PMDK C++ bindings
1.12.1-rc1
This is the C++ bindings documentation for PMDK's libpmemobj.
|
Radix tree is an associative, ordered container. More...
#include <libpmemobj++/experimental/radix_tree.hpp>
Classes | |
struct | leaf |
This is the structure which 'holds' key/value pair. More... | |
struct | node |
This is internal node. More... | |
struct | radix_tree_iterator |
Radix tree iterator supports multipass and bidirectional iteration. More... | |
Public Member Functions | |
radix_tree () | |
Default radix tree constructor. More... | |
template<class InputIt > | |
radix_tree (InputIt first, InputIt last) | |
Constructs the container with the contents of the range [first, last). More... | |
radix_tree (const radix_tree &m) | |
Copy constructor. More... | |
radix_tree (radix_tree &&m) | |
Move constructor. More... | |
radix_tree (std::initializer_list< value_type > il) | |
Constructs the container with the contents of the initializer list init. More... | |
radix_tree & | operator= (const radix_tree &m) |
Copy assignment operator. More... | |
radix_tree & | operator= (radix_tree &&m) |
Move assignment operator. More... | |
radix_tree & | operator= (std::initializer_list< value_type > ilist) |
Replaces the contents with those identified by initializer list ilist transactionally. More... | |
~radix_tree () | |
Destructor. | |
std::pair< iterator, bool > | insert (const value_type &v) |
Inserts element if the tree doesn't already contain an element with an equivalent key. More... | |
std::pair< iterator, bool > | insert (value_type &&v) |
Inserts element using move semantic if the tree doesn't already contain an element with an equivalent key. More... | |
template<class InputIterator > | |
void | insert (InputIterator first, InputIterator last) |
Inserts elements from range [first, last). More... | |
void | insert (std::initializer_list< value_type > il) |
Inserts elements from initializer list il. More... | |
template<typename K , typename BV = BytesView, class... Args> | |
auto | try_emplace (K &&k, Args &&... args) -> typename std::enable_if< detail::has_is_transparent< BV >::value &&!std::is_same< typename std::remove_const< typename std::remove_reference< K >::type >::type, key_type >::value, std::pair< iterator, bool >>::type |
If a key equivalent to k already exists in the container, does nothing. More... | |
iterator | erase (const_iterator pos) |
Removes the element at pos from the container. More... | |
iterator | erase (const_iterator first, const_iterator last) |
Removes the elements in the range [first; last), which must be a valid range in *this. More... | |
size_type | erase (const key_type &k) |
Removes the element (if one exists) with the key equivalent to key. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value && !std::is_same<K, iterator>::value && !std::is_same<K, const_iterator>::value, K>::type> | |
size_type | erase (const K &k) |
Removes the element (if one exists) with the key equivalent to key. More... | |
void | clear () |
Erases all elements from the container transactionally. More... | |
size_type | count (const key_type &k) const |
Returns the number of elements with key that compares equivalent to the specified argument. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
size_type | count (const K &k) const |
Returns the number of elements with key that compares equivalent to the specified argument. More... | |
iterator | find (const key_type &k) |
Finds an element with key equivalent to key. More... | |
const_iterator | find (const key_type &k) const |
Finds an element with key equivalent to key. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
iterator | find (const K &k) |
Finds an element with key equivalent to key. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
const_iterator | find (const K &k) const |
Finds an element with key equivalent to key. More... | |
iterator | lower_bound (const key_type &k) |
Returns an iterator pointing to the first element that is not less than (i.e. More... | |
const_iterator | lower_bound (const key_type &k) const |
Returns an iterator pointing to the first element that is not less than (i.e. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
iterator | lower_bound (const K &k) |
Returns an iterator pointing to the first element that is not less than (i.e. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
const_iterator | lower_bound (const K &k) const |
Returns an iterator pointing to the first element that is not less than (i.e. More... | |
iterator | upper_bound (const key_type &k) |
Returns an iterator pointing to the first element that is greater than key. More... | |
const_iterator | upper_bound (const key_type &k) const |
Returns an iterator pointing to the first element that is greater than key. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
iterator | upper_bound (const K &k) |
Returns an iterator pointing to the first element that is greater than key. More... | |
template<typename K , typename = typename std::enable_if< detail::has_is_transparent<BytesView>::value, K>::type> | |
const_iterator | upper_bound (const K &k) const |
Returns an iterator pointing to the first element that is greater than key. More... | |
iterator | begin () |
Returns an iterator to the first element of the container. More... | |
iterator | end () |
Returns an iterator to the element following the last element of the map. More... | |
const_iterator | cbegin () const |
Returns a const iterator to the first element of the container. More... | |
const_iterator | cend () const |
Returns a const iterator to the element following the last element of the map. More... | |
const_iterator | begin () const |
Returns a const iterator to the first element of the container. More... | |
const_iterator | end () const |
Returns a const iterator to the element following the last element of the map. More... | |
reverse_iterator | rbegin () |
Returns a reverse iterator to the beginning. More... | |
reverse_iterator | rend () |
Returns a reverse iterator to the end. More... | |
const_reverse_iterator | crbegin () const |
Returns a const, reverse iterator to the beginning. More... | |
const_reverse_iterator | crend () const |
Returns a const, reverse iterator to the end. More... | |
bool | empty () const noexcept |
Checks whether the container is empty. More... | |
size_type | max_size () const noexcept |
uint64_t | size () const noexcept |
void | swap (radix_tree &rhs) |
Member swap. More... | |
template<class... Args> | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | try_emplace (const key_type &k, Args &&... args) |
If a key equivalent to k already exists in the container, does nothing. More... | |
template<class... Args> | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | emplace (Args &&... args) |
Inserts a new element into the container constructed in-place with the given args if there is no element with the key in the container. More... | |
template<typename P , typename > | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | insert (P &&p) |
Inserts element if the tree doesn't already contain an element with an equivalent key. More... | |
template<class... Args> | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | try_emplace (key_type &&k, Args &&... args) |
If a key equivalent to k already exists in the container, does nothing. More... | |
template<typename M > | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | insert_or_assign (const key_type &k, M &&obj) |
If a key equivalent to k already exists in the container, assigns std::forward<M>(obj) to the mapped_type corresponding to the key k. More... | |
template<typename M > | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | insert_or_assign (key_type &&k, M &&obj) |
If a key equivalent to k already exists in the container, assigns std::forward<M>(obj) to the mapped_type corresponding to the key k. More... | |
template<typename M , typename K , typename > | |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > | insert_or_assign (K &&k, M &&obj) |
If a key equivalent to k already exists in the container, assigns std::forward<M>(obj) to the mapped_type corresponding to the key k. More... | |
Private Member Functions | |
void | check_pmem () |
Private helper function. More... | |
void | check_tx_stage_work () |
Private helper function. More... | |
Friends | |
template<typename K , typename V , typename BV > | |
std::ostream & | operator<< (std::ostream &os, const radix_tree< K, V, BV > &tree) |
Prints tree in DOT format. More... | |
Radix tree is an associative, ordered container.
Its API is similar to the API of std::map.
Unlike std::map radix tree does not use comparison (std::less or equivalent) to locate elements. Instead, keys are mapped to a sequence of bytes using user-provided BytesView type. The key's bytes uniquely define the position of an element. In some way, it is similar to a hash table (BytesView can be treated as a hash function) but with sorted elements.
The elements' ordering is defined based on the BytesView mapping. The byte sequences are compared using a function equivalent to std::string::compare.
BytesView should accept a pointer to the key type in a constructor and provide operator[] (should return a byte at the specified position in the byte representation of value) and size (should return size of value in bytes) method. The declaration should be as following:
By default, implementation for pmem::obj::basic_inline_string<CharT, Traits> and unsigned integral types is provided. Note that integral types are assumed to be in little-endian.
Iterators and references are stable (are not invalidated by inserts or erases of other elements nor by assigning to the value) for all value types except basic_inline_string<CharT, Traits>.
In case of basic_inline_string<CharT, Traits>, iterators and references are not invalidated by other inserts or erases, but might be invalidated by assigning new value to the element. Using find(K).assign_val("new_value") may invalidate other iterators and references to the element with key K.
swap() invalidates all references and iterators.
An example of custom BytesView implementation:
pmem::obj::experimental::radix_tree< Key, Value, BytesView >::radix_tree |
Default radix tree constructor.
Constructs an empty container.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
pmem::obj::experimental::radix_tree< Key, Value, BytesView >::radix_tree | ( | InputIt | first, |
InputIt | last | ||
) |
Constructs the container with the contents of the range [first, last).
If multiple elements in the range have keys that compare equivalent, the first element is inserted.
[in] | first | first iterator of inserted range. |
[in] | last | last iterator of inserted range. |
InputIt must meet the requirements of LegacyInputIterator.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
pmem::transaction_alloc_error | when allocating memory for inserted elements in transaction failed. |
rethrows | element constructor exception. |
pmem::obj::experimental::radix_tree< Key, Value, BytesView >::radix_tree | ( | const radix_tree< Key, Value, BytesView > & | m | ) |
Copy constructor.
Constructs the container with the copy of the contents of other.
[in] | m | reference to the radix_tree to be copied. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory in transaction failed. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
rethrows | element constructor exception. |
pmem::obj::experimental::radix_tree< Key, Value, BytesView >::radix_tree | ( | radix_tree< Key, Value, BytesView > && | m | ) |
Move constructor.
Constructs the container with the contents of other using move semantics. After the move, other is guaranteed to be empty().
[in] | m | rvalue reference to the radix_tree to be moved from. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
pmem::obj::experimental::radix_tree< Key, Value, BytesView >::radix_tree | ( | std::initializer_list< value_type > | il | ) |
Constructs the container with the contents of the initializer list init.
[in] | il | initializer list with content to be constructed. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_alloc_error | when allocating memory in transaction failed. |
pmem::transaction_scope_error | if constructor wasn't called in transaction. |
rethrows | element constructor exception. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::begin |
Returns an iterator to the first element of the container.
If the map is empty, the returned iterator will be equal to end().
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::begin |
Returns a const iterator to the first element of the container.
If the map is empty, the returned iterator will be equal to end().
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::cbegin |
Returns a const iterator to the first element of the container.
If the map is empty, the returned iterator will be equal to end().
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::cend |
Returns a const iterator to the element following the last element of the map.
This element acts as a placeholder; attempting to access it results in undefined behavior.
|
private |
Private helper function.
Checks if radix tree resides on pmem and throws an exception if not.
pool_error | if radix tree doesn't reside on pmem. |
|
private |
Private helper function.
Checks if current transaction stage is equal to TX_STAGE_WORK and throws an exception otherwise.
pmem::transaction_scope_error | if current transaction stage is not equal to TX_STAGE_WORK. |
void pmem::obj::experimental::radix_tree< Key, Value, BytesView >::clear |
Erases all elements from the container transactionally.
pmem::transaction_error | when snapshotting failed. |
radix_tree< Key, Value, BytesView >::size_type pmem::obj::experimental::radix_tree< Key, Value, BytesView >::count | ( | const K & | k | ) | const |
Returns the number of elements with key that compares equivalent to the specified argument.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value of the element to count. |
radix_tree< Key, Value, BytesView >::size_type pmem::obj::experimental::radix_tree< Key, Value, BytesView >::count | ( | const key_type & | k | ) | const |
Returns the number of elements with key that compares equivalent to the specified argument.
[in] | k | key value of the element to count. |
radix_tree< Key, Value, BytesView >::const_reverse_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::crbegin |
Returns a const, reverse iterator to the beginning.
radix_tree< Key, Value, BytesView >::const_reverse_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::crend |
Returns a const, reverse iterator to the end.
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::emplace | ( | Args &&... | args | ) |
Inserts a new element into the container constructed in-place with the given args if there is no element with the key in the container.
Careful use of emplace allows the new element to be constructed while avoiding unnecessary copy or move operations. The constructor of the new element (i.e. std::pair<const Key, T>) is called with exactly the same arguments as supplied to emplace, forwarded via std::forward<Args>(args).... The element may be constructed even if there already is an element with the key in the container, in which case the newly constructed element will be destroyed immediately.
No iterators or references are invalidated.
[in] | args | arguments to forward to the constructor of the element |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
|
noexcept |
Checks whether the container is empty.
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::end |
Returns an iterator to the element following the last element of the map.
This element acts as a placeholder; attempting to access it results in undefined behavior.
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::end |
Returns a const iterator to the element following the last element of the map.
This element acts as a placeholder; attempting to access it results in undefined behavior.
radix_tree< Key, Value, BytesView >::size_type pmem::obj::experimental::radix_tree< Key, Value, BytesView >::erase | ( | const K & | k | ) |
Removes the element (if one exists) with the key equivalent to key.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value of the elements to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
radix_tree< Key, Value, BytesView >::size_type pmem::obj::experimental::radix_tree< Key, Value, BytesView >::erase | ( | const key_type & | k | ) |
Removes the element (if one exists) with the key equivalent to key.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | k | key value of the elements to remove. |
pmem::transaction_error | when snapshotting failed. |
rethrows | destructor exception. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::erase | ( | const_iterator | first, |
const_iterator | last | ||
) |
Removes the elements in the range [first; last), which must be a valid range in *this.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | first | first iterator in the range of elements to remove. |
[in] | last | last iterator in the range of elements to remove. |
pmem::transaction_error | when snapshotting failed. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::erase | ( | const_iterator | pos | ) |
Removes the element at pos from the container.
References and iterators to the erased elements are invalidated. Other references and iterators are not affected.
[in] | pos | iterator to the element to remove. |
pmem::transaction_error | when snapshotting failed. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::find | ( | const K & | k | ) |
Finds an element with key equivalent to key.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value of the element to search for. |
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::find | ( | const K & | k | ) | const |
Finds an element with key equivalent to key.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value of the element to search for. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::find | ( | const key_type & | k | ) |
Finds an element with key equivalent to key.
[in] | k | key value of the element to search for. |
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::find | ( | const key_type & | k | ) | const |
Finds an element with key equivalent to key.
[in] | k | key value of the element to search for. |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert | ( | const value_type & | v | ) |
Inserts element if the tree doesn't already contain an element with an equivalent key.
[in] | v | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
void pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert | ( | InputIterator | first, |
InputIterator | last | ||
) |
Inserts elements from range [first, last).
[in] | first | first iterator of inserted range. |
[in] | last | last iterator of inserted range. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert | ( | P && | p | ) |
Inserts element if the tree doesn't already contain an element with an equivalent key.
This overload is equivalent to emplace(std::forward<P>(value)) and only participates in overload resolution if std::is_constructible<value_type, P&&>::value == true.
[in] | p | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
void pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert | ( | std::initializer_list< value_type > | il | ) |
Inserts elements from initializer list il.
[in] | il | initializer list to insert the values from. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
std::pair< typename radix_tree< Key, Value, BytesView >::iterator, bool > pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert | ( | value_type && | v | ) |
Inserts element using move semantic if the tree doesn't already contain an element with an equivalent key.
[in] | v | element value to insert. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert_or_assign | ( | const key_type & | k, |
M && | obj | ||
) |
If a key equivalent to k already exists in the container, assigns std::forward<M>(obj) to the mapped_type corresponding to the key k.
If the key does not exist, inserts the new value as if by insert, constructing it from value_type(k, std::forward<M>(obj)).
[in] | k | the key used both to look up and to insert if not found. |
[in] | obj | the value to insert or assign. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert_or_assign | ( | K && | k, |
M && | obj | ||
) |
If a key equivalent to k already exists in the container, assigns std::forward<M>(obj) to the mapped_type corresponding to the key k.
If the key does not exist, inserts the new value as if by insert, constructing it from value_type(std::forward<K>(k), std::forward<M>(obj)).
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | the key used both to look up and to insert if not found. |
[in] | obj | the value to insert or assign. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::insert_or_assign | ( | key_type && | k, |
M && | obj | ||
) |
If a key equivalent to k already exists in the container, assigns std::forward<M>(obj) to the mapped_type corresponding to the key k.
If the key does not exist, inserts the new value as if by insert, constructing it from value_type(std::move(k), std::forward<M>(obj))
[in] | k | the key used both to look up and to insert if not found |
[in] | obj | the value to insert or assign |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::lower_bound | ( | const K & | k | ) |
Returns an iterator pointing to the first element that is not less than (i.e.
greater or equal to) key.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value to compare the elements to. |
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::lower_bound | ( | const K & | k | ) | const |
Returns an iterator pointing to the first element that is not less than (i.e.
greater or equal to) key.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value to compare the elements to. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::lower_bound | ( | const key_type & | k | ) |
Returns an iterator pointing to the first element that is not less than (i.e.
greater or equal to) key.
[in] | k | key value to compare the elements to. |
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::lower_bound | ( | const key_type & | k | ) | const |
Returns an iterator pointing to the first element that is not less than (i.e.
greater or equal to) key.
[in] | k | key value to compare the elements to. |
|
noexcept |
radix_tree< Key, Value, BytesView > & pmem::obj::experimental::radix_tree< Key, Value, BytesView >::operator= | ( | const radix_tree< Key, Value, BytesView > & | other | ) |
Copy assignment operator.
Replaces the contents with a copy of the contents of other transactionally.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor's exception. |
radix_tree< Key, Value, BytesView > & pmem::obj::experimental::radix_tree< Key, Value, BytesView >::operator= | ( | radix_tree< Key, Value, BytesView > && | other | ) |
Move assignment operator.
Replaces the contents with those of other using move semantics (i.e. the data in other is moved from other into this container) transactionally. Other is in a valid but empty state afterwards.
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_error | when snapshotting failed. |
radix_tree< Key, Value, BytesView > & pmem::obj::experimental::radix_tree< Key, Value, BytesView >::operator= | ( | std::initializer_list< value_type > | ilist | ) |
Replaces the contents with those identified by initializer list ilist transactionally.
[in] | ilist | initializer list to use as data source. |
pmem::pool_error | if an object is not in persistent memory. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
radix_tree< Key, Value, BytesView >::reverse_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::rbegin |
Returns a reverse iterator to the beginning.
radix_tree< Key, Value, BytesView >::reverse_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::rend |
Returns a reverse iterator to the end.
|
noexcept |
void pmem::obj::experimental::radix_tree< Key, Value, BytesView >::swap | ( | radix_tree< Key, Value, BytesView > & | rhs | ) |
Member swap.
Exchanges *this with
rhs |
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::try_emplace | ( | const key_type & | k, |
Args &&... | args | ||
) |
If a key equivalent to k already exists in the container, does nothing.
Otherwise, behaves like emplace except that the element is constructed as value_type(std::piecewise_construct, std::forward_as_tuple(k), std::forward_as_tuple(std::forward<Args>(args)...))
Unlike insert or emplace, this method do not move from rvalue arguments if the insertion does not happen, which makes it easy to manipulate maps whose values are move-only types. In addition, try_emplace treats the key and the arguments to the mapped_type separately, unlike emplace, which requires the arguments to construct a value_type (that is, a std::pair).
No iterators or references are invalidated.
[in] | k | the key used both to look up and to insert if not found. |
[in] | args | arguments to forward to the constructor of the element. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
auto pmem::obj::experimental::radix_tree< Key, Value, BytesView >::try_emplace | ( | K && | k, |
Args &&... | args | ||
) | -> typename std::enable_if< detail::has_is_transparent<BV>::value && !std::is_same<typename std::remove_const< typename std::remove_reference< K>::type>::type, key_type>::value, std::pair<iterator, bool>>::type |
If a key equivalent to k already exists in the container, does nothing.
Otherwise, behaves like emplace except that the element is constructed as value_type(std::piecewise_construct, std::forward_as_tuple(std::forward<K>(k)), std::forward_as_tuple(std::forward<Args>(args)...)).
Unlike insert or emplace, this method do not move from rvalue arguments if the insertion does not happen, which makes it easy to manipulate maps whose values are move-only types. In addition, try_emplace treats the key and the arguments to the mapped_type separately, unlike emplace, which requires the arguments to construct a value_type (that is, a std::pair).
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | the key used both to look up and to insert if not found. |
[in] | args | arguments to forward to the constructor of the element. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
std::pair<typename radix_tree<Key, Value, BytesView>::iterator, bool> pmem::obj::experimental::radix_tree< Key, Value, BytesView >::try_emplace | ( | key_type && | k, |
Args &&... | args | ||
) |
If a key equivalent to k already exists in the container, does nothing.
Otherwise, behaves like emplace except that the element is constructed as value_type(std::piecewise_construct, std::forward_as_tuple(std::move(k)), std::forward_as_tuple(std::forward<Args>(args)...)).
Unlike insert or emplace, this method do not move from rvalue arguments if the insertion does not happen, which makes it easy to manipulate maps whose values are move-only types. In addition, try_emplace treats the key and the arguments to the mapped_type separately, unlike emplace, which requires the arguments to construct a value_type (that is, a std::pair).
[in] | k | the key used both to look up and to insert if not found. |
[in] | args | arguments to forward to the constructor of the element. |
pmem::transaction_error | when snapshotting failed. |
pmem::transaction_alloc_error | when allocating new memory failed. |
rethrows | constructor exception. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::upper_bound | ( | const K & | k | ) |
Returns an iterator pointing to the first element that is greater than key.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value to compare the elements to. |
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::upper_bound | ( | const K & | k | ) | const |
Returns an iterator pointing to the first element that is greater than key.
This overload only participates in overload resolution if BytesView struct has a type member named is_transparent.
[in] | k | key value to compare the elements to. |
radix_tree< Key, Value, BytesView >::iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::upper_bound | ( | const key_type & | k | ) |
Returns an iterator pointing to the first element that is greater than key.
[in] | k | key value to compare the elements to. |
radix_tree< Key, Value, BytesView >::const_iterator pmem::obj::experimental::radix_tree< Key, Value, BytesView >::upper_bound | ( | const key_type & | k | ) | const |
Returns an iterator pointing to the first element that is greater than key.
[in] | k | key value to compare the elements to. |
|
friend |
Prints tree in DOT format.
Used for debugging.