The following methods in the hierarchical container object are equivalent to instantiating the appropriate lock object, and performing the requested action.
bool flag=h->insert([] { return valueRef::create(); }, key, [] (valueRef &&existing) { return false; });
This is equivalent to creating a new write lock, positioned at the
container's root node, then invoking its
insert
() method to install a new value for
the specified key.
hierclass::base::readlock lock=h->search(key);
This is equivalent to creating a new reader lock, positioned at the
container's root node, then invoking its
to_child
() method with the second value
set to true
, positioning the reader lock
to the given key, or its closest parent, with a value. Or the root
node, if the specified key does not have a value, and none of its
parent keys have a value.
bool flag=h->erase(key); bool flag=h->prune(key); bool flag=h->prune_if(key, [] (valueRef &&value, const key &name) { return true; });
This is equivalent to creating a new writer lock, positioned at the container's root node, then invoking the lock's corresponding method.