Remove CompoundItem.
Refactor to remove CompoundItem. It was a way to share some common
code between Array and Map, and later Semantic, but the
representations of those classes need to diverge so it adds no value.
Test: cppbor_test_external
Change-Id: I986e90c1d212f6d81debe4b2f650ba68f065a6ed
diff --git a/src/cppbor_parse.cpp b/src/cppbor_parse.cpp
index 357b9ee..488f8c7 100644
--- a/src/cppbor_parse.cpp
+++ b/src/cppbor_parse.cpp
@@ -280,10 +280,7 @@
// Starting a new compound data item, i.e. a new parent. Save it on the parent stack.
// It's safe to save a raw pointer because the unique_ptr is guaranteed to stay in
// existence until the corresponding itemEnd() call.
-#if __has_feature(cxx_rtti)
- assert(dynamic_cast<CompoundItem*>(item.get()));
-#endif
- mParentStack.push(static_cast<CompoundItem*>(item.get()));
+ mParentStack.push(item.get());
return this;
} else {
appendToLastParent(std::move(item));
@@ -336,7 +333,7 @@
}
std::unique_ptr<Item> mTheItem;
- std::stack<CompoundItem*> mParentStack;
+ std::stack<Item*> mParentStack;
const uint8_t* mPosition = nullptr;
std::string mErrorMessage;
};