encoding: Block::remove now removes all subelements of type
refs #3070
Change-Id: Ife9cb9fe9ba7e0a79d5f759c9990cbe04b0b87c3
diff --git a/src/encoding/block.cpp b/src/encoding/block.cpp
index 693bc17..77be4f2 100644
--- a/src/encoding/block.cpp
+++ b/src/encoding/block.cpp
@@ -406,7 +406,7 @@
resetWire();
auto it = std::remove_if(m_subBlocks.begin(), m_subBlocks.end(),
- [type] (const Block& subBlock) { return subBlock.type() != type; });
+ [type] (const Block& subBlock) { return subBlock.type() == type; });
m_subBlocks.resize(it - m_subBlocks.begin());
}
diff --git a/src/encoding/block.hpp b/src/encoding/block.hpp
index 9407ccf..0552755 100644
--- a/src/encoding/block.hpp
+++ b/src/encoding/block.hpp
@@ -249,6 +249,11 @@
element_const_iterator
find(uint32_t type) const;
+ /**
+ * @brief remove all subelements of \p type
+ * @param type TLV-TYPE of subelements to remove
+ * @pre parse() has been invoked
+ */
void
remove(uint32_t type);