}
public:
- NetmaskTree() noexcept : NetmaskTree(false) {
+ NetmaskTree() noexcept : d_root(new TreeNode()) {
}
- NetmaskTree(bool cleanup) noexcept : d_root(new TreeNode()), d_cleanup_tree(cleanup) {
- }
-
- NetmaskTree(const NetmaskTree& rhs): d_root(new TreeNode()), d_cleanup_tree(rhs.d_cleanup_tree) {
+ NetmaskTree(const NetmaskTree& rhs): d_root(new TreeNode()) {
// it is easier to copy the nodes than tree.
// also acts as handy compactor
for(auto const& node: rhs._nodes)
// see above.
for(auto const& node: rhs._nodes)
insert(node->first).second = node->second;
- d_cleanup_tree = rhs.d_cleanup_tree;
return *this;
}
_nodes.erase(node->node.get());
node->assigned = false;
node->node->second = value_type();
-
- if (d_cleanup_tree)
- cleanup_tree(node);
+ cleanup_tree(node);
}
}
private:
unique_ptr<TreeNode> d_root; //<! Root of our tree
std::set<node_type*> _nodes; //<! Container for actual values
- bool d_cleanup_tree; //<! Whether or not to cleanup the tree on erase
};
/** This class represents a group of supplemental Netmask classes. An IP address matchs
class NetmaskGroup
{
public:
- //! By default, initialise the tree to cleanup
- NetmaskGroup() noexcept : NetmaskGroup(true) {
- }
-
- //! This allows control over whether to cleanup or not
- NetmaskGroup(bool cleanup) noexcept : tree(cleanup) {
+ NetmaskGroup() noexcept {
}
//! If this IP address is matched by any of the classes within
class ECSIndexEntry
{
public:
- ECSIndexEntry(const DNSName& qname, uint16_t qtype): d_nmt(true), d_qname(qname), d_qtype(qtype)
+ ECSIndexEntry(const DNSName& qname, uint16_t qtype): d_nmt(), d_qname(qname), d_qtype(qtype)
{
}
BOOST_AUTO_TEST_CASE(test_removal) {
std::string prefix = "192.";
- NetmaskTree<int> nmt(true);
+ NetmaskTree<int> nmt;
BOOST_CHECK(nmt.empty());
BOOST_CHECK_EQUAL(nmt.size(), 0);