• Jonathan Hamilton's avatar
    Fix some Node::operator[] regressions from 0.5.1 · b426faff
    Jonathan Hamilton authored
    "const Node Node::operator[](const Key& key) const" changed from
    returning new empty node if the key was missing in 0.5.1 to returning
    a shared 'zombie' node in 0.5.2 to resolve a memory leak.
    
    (Specifically 1025f76d was where this
    was introduced)
    
    This caused some regressions where this 'zombie' object threw exceptions
    in some functions where the 'empty' object would not.
    
    This change fixes the Node::as(fallback) method (to return the
    'fallback' instead of throwing an exception) and the
    Node::begin()/Node::end() methods to return default-constructed
    iterators (so begin() == end() in such cases) instead of another
    exception.
    b426faff
node_test.cpp 10.5 KB