class ...
make_any_base_hook::type< O1, O2, O3 >

Derive a class from this hook in order to store objects of that class in an intrusive container.

The hook admits the following options: `tag<>`, `void_pointer<>` and `link_mode<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``any_base_hook``, then each ``any_base_hook`` needs its unique tag.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `safe_link`).

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

bool

Precondition: `link_mode` must be `safe_link`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `container::iterator_to` will return a valid iterator.

Complexity: Constant

Effects: If `link_mode` is or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `any_base_hook` &

Effects: If `link_mode` is or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`any_base_hook` & `const `any_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a container an assertion is raised.

Throws: Nothing.

class ...
make_any_member_hook::type< O1, O2, O3 >

Store this hook in a class to be inserted in an intrusive container.

The hook admits the following options: `void_pointer<>` and `link_mode<>`.

`link_mode<>` will specify the linking mode of the hook (`normal_link` or `safe_link`).

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

bool

Precondition: `link_mode` must be `safe_link`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `container::iterator_to` will return a valid iterator.

Complexity: Constant

Effects: If `link_mode` is or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `any_member_hook` &

Effects: If `link_mode` is or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`any_member_hook` & `const `any_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a container an assertion is raised.

Throws: Nothing.

This option setter specifies that any hook should behave as an `avl_set` hook

This option setter specifies that any hook should behave as a `bs_set` hook

This option setter specifies that any hook should behave as an list hook

This option setter specifies that any hook should behave as a set hook

This option setter specifies that any hook should behave as an slist hook

This option setter specifies that any hook should behave as an unordered set hook

class ...

Helper metafunction to define a ```any_base_hook`` that` yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ```any_member_hook`` that` yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template `avl_multiset` is an intrusive container, that mimics most of the interface of std::_multiset as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``avl_multiset` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `avl_multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``avl_multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &key` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``avl_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``avl_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

avl_multiset
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`avl_multiset` & ``avl_multiset` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`avl_multiset` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `avl_multiset` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`avl_multiset` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `avl_multiset` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

The class template `avl_set` is an intrusive container, that mimics most of the interface of std::set as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``avl_set` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `avl_set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``avl_set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``avl_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``avl_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

avl_set
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`avl_set` & ``avl_set` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`avl_set` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `avl_set` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`avl_set` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `avl_set` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

Helper metafunction to define a ``avl_multiset`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a `set` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
bool class ... `const `avl_set`< T, Options... > &` `const `avl_set`< T, Options... > &`
bool class ... `const `avl_set`< T, Options... > &` `const `avl_set`< T, Options... > &`
bool class ... `const `avl_set`< T, Options... > &` `const `avl_set`< T, Options... > &`
bool class ... `const `avl_set`< T, Options... > &` `const `avl_set`< T, Options... > &`
void class ... ``avl_set`< T, Options... > &` ``avl_set`< T, Options... > &`
bool class ... `const `avl_multiset`< T, Options... > &` `const `avl_multiset`< T, Options... > &`
bool class ... `const `avl_multiset`< T, Options... > &` `const `avl_multiset`< T, Options... > &`
bool class ... `const `avl_multiset`< T, Options... > &` `const `avl_multiset`< T, Options... > &`
bool class ... `const `avl_multiset`< T, Options... > &` `const `avl_multiset`< T, Options... > &`
void class ... ``avl_multiset`< T, Options... > &` ``avl_multiset`< T, Options... > &`
class ...
make_avl_set_base_hook::type< O1, O2, O3, O4 >

Derive a class from `avl_set_base_hook` in order to store objects in in an avl_set/avl_multiset. `avl_set_base_hook` holds the data necessary to maintain the avl_set/avl_multiset and provides an appropriate `value_traits` class for avl_set/avl_multiset.

The hook admits the following options: `tag<>`, `void_pointer<>`, `link_mode<>` and `optimize_size<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``list_base_hook``, then each ``list_base_hook`` needs its unique tag.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`optimize_size<>` will tell the hook to optimize the hook for size instead of speed.

void ``avl_set_base_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `avl_set_base_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`avl_set_base_hook` & `const `avl_set_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a set an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...
make_avl_set_member_hook::type< O1, O2, O3, O4 >

Put a public data member `avl_set_member_hook` in order to store objects of this class in an avl_set/avl_multiset. `avl_set_member_hook` holds the data necessary for maintaining the avl_set/avl_multiset and provides an appropriate `value_traits` class for avl_set/avl_multiset.

The hook admits the following options: `void_pointer<>`, `link_mode<>` and `optimize_size<>`.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`optimize_size<>` will tell the hook to optimize the hook for size instead of speed.

void ``avl_set_member_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `avl_set_member_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`avl_set_member_hook` & `const `avl_set_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a set an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...

Helper metafunction to define a ``avl_set_base_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``avl_set_member_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template avltree is an intrusive AVL tree container, that is used to construct intrusive `avl_set` and `avl_multiset` containers. The no-throw guarantee holds only, if the key_compare object doesn't throw.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

ValueTraits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
implementation_defined::insert_commit_data
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``avltree` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `avltree` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``avltree` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``avltree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``avltree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

bool
Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

avltree
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`avltree` & ``avltree` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`avltree` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `avltree` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`avltree` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `avltree` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

Helper metafunction to define a `avltree` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined

`avltree_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the binary search tree

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

`balance`: The type of the balance factor

Static functions:

`static node_ptr get_parent(const_node_ptr n);`

`static void set_parent(node_ptr n, node_ptr parent);`

`static node_ptr get_left(const_node_ptr n);`

`static void set_left(node_ptr n, node_ptr left);`

`static node_ptr get_right(const_node_ptr n);`

`static void set_right(node_ptr n, node_ptr right);`

`static balance get_balance(const_node_ptr n);`

`static void set_balance(node_ptr n, balance b);`

`static balance negative();`

`static balance zero();`

`static balance positive();`

NodeTraits::node
NodeTraits
NodeTraits::node_ptr
NodeTraits::const_node_ptr
NodeTraits::balance

This type is the information that will be filled by insert_unique_check

bstree_algo::insert_commit_data
node_ptr `const const_node_ptr &`

Requires: 'node' is a node of the tree or a header node.

Effects: Returns the header of the tree.

Complexity: Logarithmic.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the first node of the tree, the header if the tree is empty.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the header of the tree.

Complexity: Constant time.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: header1 and header2 must be the header nodes of two trees.

Effects: Swaps two trees. After the function header1 will contain links to the second tree and header2 will have links to the first tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr` `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees with header header1 and header2.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing and comparison is needed. Experimental function

void `node_ptr` `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree with header "header" and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. Experimental function

void `node_ptr`

Requires: node is a tree node but not the header.

Effects: Unlinks the node and rebalances the tree.

Complexity: Average complexity is constant time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: header is the header of a tree.

Effects: Unlinks the leftmost node from the tree, and updates the header link to the new leftmost node.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the tree and the tree can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the tree.

bool `const const_node_ptr &`

Requires: 'node' is a node of the tree or a node initialized by init(...) or init_node.

Effects: Returns true if the node is initialized by init() or init_node().

Complexity: Constant time.

Throws: Nothing.

std::size_t `const const_node_ptr &`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: 'node' is a node from the tree except the header.

Effects: Returns the next node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: 'node' is a node from the tree except the leftmost node.

Effects: Returns the previous node of the tree.

Complexity: Average constant time.

Throws: Nothing.

void `const node_ptr &`

Requires: 'node' must not be part of any tree.

Effects: After the function unique(node) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `node_ptr`

Requires: node must not be part of any tree.

Effects: Initializes the header to represent an empty tree. unique(header) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

node_ptr `node_ptr` `node_ptr`

Requires: header must be the header of a tree, z a node of that tree and z != header.

Effects: Erases node "z" from the tree with header "header".

Complexity: Amortized constant time.

Throws: Nothing.

bool `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2 if tree1 does not contain a node that is equivalent to z.

Returns: True if the node was trasferred, false otherwise.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `const const_node_ptr &` `node_ptr` `Cloner` `Disposer`

Requires: "cloner" must be a function object taking a node_ptr and returning a new cloned node of it. "disposer" must take a node_ptr and shouldn't throw.

Effects: First empties target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Then, duplicates the entire tree pointed by "source_header" cloning each source node with `node_ptr Cloner::operator()(const node_ptr &)` to obtain the nodes of the target tree. If "cloner" throws, the cloned target nodes are disposed using `void disposer(const node_ptr &)`.

Complexity: Linear to the number of element of the source tree plus the number of elements of tree target tree when calling this function.

Throws: If cloner functor throws. If this happens target nodes are disposed.

void `const node_ptr &` `Disposer`

Requires: "disposer" must be an object function taking a node_ptr parameter and shouldn't throw.

Effects: Empties the target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Complexity: Linear to the number of element of the source tree plus the. number of elements of tree target tree when calling this function.

Throws: Nothing.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change.

std::size_t `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the lower bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "header" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. "hint" is node from the "header"'s tree.

Effects: Inserts new_node into the tree, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case).

Complexity: Logarithmic in general, but it is amortized constant time if new_node is inserted immediately before "hint".

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "pos" must be a valid iterator or header (end) node. "pos" must be an iterator pointing to the successor to "new_node" once inserted according to the order of already inserted nodes. This function does not check "pos" and this precondition must be guaranteed by the caller.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "pos" is not the successor of the newly inserted "new_node" tree invariants might be broken.

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering no less than the greatest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is less than the greatest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering, no greater than the lowest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is greater than the lowest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

std::pair< node_ptr, bool > `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" and obtains the needed information to realize a constant-time node insertion if there is no equivalent node.

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic.

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

std::pair< node_ptr, bool > `const const_node_ptr &` `const node_ptr &` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr. "hint" is node from the "header"'s tree.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" using "hint" as a hint to where it should be inserted and obtains the needed information to realize a constant-time node insertion if there is no equivalent node. If "hint" is the upper_bound the function has constant time complexity (two comparisons in the worst case).

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic, but it is amortized constant time if new_node should be inserted immediately before "hint".

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

void `node_ptr` `node_ptr` `const insert_commit_data &`

Requires: "header" must be the header node of a tree. "commit_data" must have been obtained from a previous call to "insert_unique_check". No objects should have been inserted or erased from the set between the "insert_unique_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts new_node in the set using the information obtained from the "commit_data" that a previous "insert_check" filled.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_unique_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

bool `const const_node_ptr &`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

class ...

The class template `bs_multiset` is an intrusive container, that mimics most of the interface of std::multiset as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``bs_multiset` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `bs_multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``bs_multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``bs_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``bs_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

bs_multiset
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`bs_multiset` & ``bs_multiset` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`bs_multiset` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `bs_multiset` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`bs_multiset` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `bs_multiset` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

The class template `bs_set` is an intrusive container, that mimics most of the interface of std::set as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``bs_set` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `bs_set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``bs_set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``bs_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``bs_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

bs_set
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`bs_set` & ``bs_set` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`bs_set` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `bs_set` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`bs_set` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `bs_set` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

Helper metafunction to define a ``bs_multiset`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``bs_set`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
bool class ... `const `bs_set`< T, Options... > &` `const `bs_set`< T, Options... > &`
bool class ... `const `bs_set`< T, Options... > &` `const `bs_set`< T, Options... > &`
bool class ... `const `bs_set`< T, Options... > &` `const `bs_set`< T, Options... > &`
bool class ... `const `bs_set`< T, Options... > &` `const `bs_set`< T, Options... > &`
void class ... ``bs_set`< T, Options... > &` ``bs_set`< T, Options... > &`
bool class ... `const `bs_multiset`< T, Options... > &` `const `bs_multiset`< T, Options... > &`
bool class ... `const `bs_multiset`< T, Options... > &` `const `bs_multiset`< T, Options... > &`
bool class ... `const `bs_multiset`< T, Options... > &` `const `bs_multiset`< T, Options... > &`
bool class ... `const `bs_multiset`< T, Options... > &` `const `bs_multiset`< T, Options... > &`
void class ... ``bs_multiset`< T, Options... > &` ``bs_multiset`< T, Options... > &`
class ...
make_bs_set_base_hook::type< O1, O2, O3 >

Derive a class from `bs_set_base_hook` in order to store objects in in a bs_set/bs_multiset. `bs_set_base_hook` holds the data necessary to maintain the bs_set/bs_multiset and provides an appropriate `value_traits` class for bs_set/bs_multiset.

The hook admits the following options: `tag<>`, `void_pointer<>`, `link_mode<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``list_base_hook``, then each ``list_base_hook`` needs its unique tag.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

void ``bs_set_base_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `bs_set_base_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`bs_set_base_hook` & `const `bs_set_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a set an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...
make_bs_set_member_hook::type< O1, O2, O3 >

Put a public data member `bs_set_member_hook` in order to store objects of this class in a bs_set/bs_multiset. `bs_set_member_hook` holds the data necessary for maintaining the bs_set/bs_multiset and provides an appropriate `value_traits` class for bs_set/bs_multiset.

The hook admits the following options: `void_pointer<>`, `link_mode<>`.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

void ``bs_set_member_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `bs_set_member_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`bs_set_member_hook` & `const `bs_set_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a set an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...

Helper metafunction to define a ``bs_set_base_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``bs_set_member_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...
bstbase< ValueTraits, VoidOrKeyOfValue, VoidOrKeyComp, ConstantTimeSize, SizeType, AlgoType, HeaderHolder >

The class template bstree is an unbalanced intrusive binary search tree container. The no-throw guarantee holds only, if the key_compare object doesn't throw.

The complexity guarantees only hold if the tree is balanced, logarithmic complexity would increase to linear if the tree is totally unbalanced.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
implementation_defined
node_algorithms::insert_commit_data
const bool
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``bstree` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `bstree` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``bstree` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

void class ... ``bstree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

it !
itend
void class ... ``bstree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

it !
itend
void `ExtraChecker`

Effects: Asserts the integrity of the container with additional checks provided by the user.

Complexity: Linear time.

Note: The method might not have effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

void

Effects: Asserts the integrity of the container.

Complexity: Linear time.

Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

bool
Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

bstree
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`bstree` & ``bstree` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`bstree` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `bstree` & `const_iterator`

Precondition: end_iterator must be a valid end const_iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Constant.

`bstree` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `bstree` & `const_iterator`

Precondition: it must be a valid end const_iterator of container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

class ...

Helper metafunction to define a `bstree` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
bstree_algorithms_base< NodeTraits >

This is an implementation of a binary search tree. A node in the search tree has references to its children and its parent. This is to allow traversal of the whole tree from a given node making the implementation of iterator a pointer to a node. At the top of the tree a node is used specially. This node's parent pointer is pointing to the root of the tree. Its left pointer points to the leftmost node in the tree and the right pointer to the rightmost one. This node is used to represent the end-iterator. +---------+ header------------------------------>| | | | +----------(left)--------| |--------(right)---------+ | +---------+ | | | | | | (parent) | | | | | | | | +---------+ | root of tree ..|......................> | | | | | D | | | | | | | +----+------+----+ |

| +------+ +------+ | | | | | | | | | B | | F | | | | | | | | | +–+------+–+ +–+------+–+ |

| ++--+ +--++ ++--+ +--++ | +-->| | | | | | | |<–+ | A | | C | | E | | G | | | | | | | | | +------+ +------+ +------+ +------+

`bstree_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the binary search tree

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_parent(const_node_ptr n);`

`static void set_parent(node_ptr n, node_ptr parent);`

`static node_ptr get_left(const_node_ptr n);`

`static void set_left(node_ptr n, node_ptr left);`

`static node_ptr get_right(const_node_ptr n);`

`static void set_right(node_ptr n, node_ptr right);`

NodeTraits::node
NodeTraits
NodeTraits::node_ptr
NodeTraits::const_node_ptr
insert_commit_data_t< node_ptr >
data_for_rebalance_t< node_ptr >
node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the first node of the tree, the header if the tree is empty.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the header of the tree.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the root of the tree if any, header otherwise

Complexity: Constant time.

Throws: Nothing.

bool `const const_node_ptr &`

Requires: 'node' is a node of the tree or a node initialized by init(...) or init_node.

Effects: Returns true if the node is initialized by init() or init_node().

Complexity: Constant time.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'node' is a node of the tree or a header node.

Effects: Returns the header of the tree.

Complexity: Logarithmic.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr` `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees with header header1 and header2.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing and comparison is needed. Experimental function

void `node_ptr` `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree with header "header" and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. Experimental function

node_ptr `const node_ptr &`

Requires: 'node' is a node from the tree except the header.

Effects: Returns the next node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: 'node' is a node from the tree except the leftmost node.

Effects: Returns the previous node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node of a tree but not the header.

Effects: Returns the minimum node of the subtree starting at p.

Complexity: Logarithmic to the size of the subtree.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node of a tree but not the header.

Effects: Returns the maximum node of the subtree starting at p.

Complexity: Logarithmic to the size of the subtree.

Throws: Nothing.

void `node_ptr`

Requires: 'node' must not be part of any tree.

Effects: After the function unique(node) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

bool `const const_node_ptr &`

Effects: Returns true if node is in the same state as if called init(node)

Complexity: Constant.

Throws: Nothing.

void `node_ptr`

Requires: node must not be part of any tree.

Effects: Initializes the header to represent an empty tree. unique(header) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `const node_ptr &` `Disposer`

Requires: "disposer" must be an object function taking a node_ptr parameter and shouldn't throw.

Effects: Empties the target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Complexity: Linear to the number of element of the source tree plus the. number of elements of tree target tree when calling this function.

Throws: Nothing.

node_ptr `node_ptr`

Requires: header is the header of a tree.

Effects: Unlinks the leftmost node from the tree, and updates the header link to the new leftmost node.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the tree and the tree can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the tree.

std::size_t `const const_node_ptr &`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: header1 and header2 must be the header nodes of two trees.

Effects: Swaps two trees. After the function header1 will contain links to the second tree and header2 will have links to the first tree.

Complexity: Constant.

Throws: Nothing.

bool `const const_node_ptr &`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change.

std::size_t `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing the first element that is equivalent to "key" according to "comp" or an empty range that indicates the position where that element would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

void `node_ptr` `node_ptr` `const insert_commit_data &`

Requires: "header" must be the header node of a tree. "commit_data" must have been obtained from a previous call to "insert_unique_check". No objects should have been inserted or erased from the set between the "insert_unique_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts new_node in the set using the information obtained from the "commit_data" that a previous "insert_check" filled.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_unique_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

std::pair< node_ptr, bool > `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" and obtains the needed information to realize a constant-time node insertion if there is no equivalent node.

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic.

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

std::pair< node_ptr, bool > `const const_node_ptr &` `const node_ptr &` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr. "hint" is node from the "header"'s tree.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" using "hint" as a hint to where it should be inserted and obtains the needed information to realize a constant-time node insertion if there is no equivalent node. If "hint" is the upper_bound the function has constant time complexity (two comparisons in the worst case).

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic, but it is amortized constant time if new_node should be inserted immediately before "hint".

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "header" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. "hint" is node from the "header"'s tree.

Effects: Inserts new_node into the tree, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case).

Complexity: Logarithmic in general, but it is amortized constant time if new_node is inserted immediately before "hint".

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the lower bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "pos" must be a valid iterator or header (end) node. "pos" must be an iterator pointing to the successor to "new_node" once inserted according to the order of already inserted nodes. This function does not check "pos" and this precondition must be guaranteed by the caller.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "pos" is not the successor of the newly inserted "new_node" tree invariants might be broken.

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering no less than the greatest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is less than the greatest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering, no greater than the lowest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is greater than the lowest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

std::size_t `const_node_ptr`

Requires: 'node' can't be a header node.

Effects: Calculates the depth of a node: the depth of a node is the length (number of edges) of the path from the root to that node. (The root node is at depth 0.)

Complexity: Logarithmic to the number of nodes in the tree.

Throws: Nothing.

void `const const_node_ptr &` `node_ptr` `Cloner` `Disposer`

Requires: "cloner" must be a function object taking a node_ptr and returning a new cloned node of it. "disposer" must take a node_ptr and shouldn't throw.

Effects: First empties target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Then, duplicates the entire tree pointed by "source_header" cloning each source node with `node_ptr Cloner::operator()(const node_ptr &)` to obtain the nodes of the target tree. If "cloner" throws, the cloned target nodes are disposed using `void disposer(const node_ptr &)`.

Complexity: Linear to the number of element of the source tree plus the number of elements of tree target tree when calling this function.

Throws: If cloner functor throws. If this happens target nodes are disposed.

void `node_ptr` `node_ptr`

Requires: header must be the header of a tree, z a node of that tree and z != header.

Effects: Erases node "z" from the tree with header "header".

Complexity: Amortized constant time.

Throws: Nothing.

bool `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2 if tree1 does not contain a node that is equivalent to z.

Returns: True if the node was trasferred, false otherwise.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr`

Requires: node is a tree node but not the header.

Effects: Unlinks the node and rebalances the tree.

Complexity: Average complexity is constant time.

Throws: Nothing.

void `node_ptr`

Requires: header must be the header of a tree.

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

node_ptr `node_ptr`

Requires: old_root is a node of a tree. It shall not be null.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear.

void `const const_node_ptr &` `Checker` `typename Checker::return_type &`

Effects: Asserts the integrity of the container with additional checks provided by the user.

Requires: header must be the header of a tree.

Complexity: Linear time.

Note: The method might not have effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

bool `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr` `data_for_rebalance &`
void `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr` `data_for_rebalance &`
void `node_ptr` `node_ptr` `data_for_rebalance &`
std::size_t `const const_node_ptr &`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

bool `const node_ptr &`

Requires: p is a node of a tree.

Effects: Returns true if p is a left child.

Complexity: Constant.

Throws: Nothing.

bool `const node_ptr &`

Requires: p is a node of a tree.

Effects: Returns true if p is a right child.

Complexity: Constant.

Throws: Nothing.

void `node_ptr` `node_ptr` `insert_commit_data &`
void `node_ptr` `insert_commit_data &`
void `node_ptr` `insert_commit_data &`
void `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare` `insert_commit_data &`
void `node_ptr` `node_ptr` `NodePtrCompare` `insert_commit_data &` `std::size_t *0`
void `node_ptr` `node_ptr` `NodePtrCompare` `insert_commit_data &` `std::size_t *0`
void `node_ptr` `node_ptr` `const insert_commit_data &`
void `node_ptr` `node_ptr` `node_ptr` `const bool`
void `node_ptr` `node_ptr`
void `node_ptr` `node_ptr` `node_ptr` `node_ptr`
void `node_ptr` `node_ptr`
void `node_ptr` `node_ptr` `node_ptr` `node_ptr`
void `node_ptr` `std::size_t &`
void `node_ptr` `std::size_t`
void `node_ptr` `std::size_t`
node_ptr `const node_ptr &`

Requires: "n" must be a node inserted in a tree.

Effects: Returns a pointer to the header node of the tree.

Complexity: Logarithmic.

Throws: Nothing.

node_ptr `const const_node_ptr &` `node_ptr` `Cloner` `Disposer` `node_ptr &` `node_ptr &`
void `node_ptr` `Disposer`
node_ptr `node_ptr` `node_ptr` `const KeyType &` `KeyNodePtrCompare`
node_ptr `node_ptr` `node_ptr` `const KeyType &` `KeyNodePtrCompare`
void `const const_node_ptr &` `Checker` `typename Checker::return_type &`

`circular_list_algorithms` provides basic algorithms to manipulate nodes forming a circular doubly linked list. An empty circular list is formed by a node whose pointers point to itself.

`circular_list_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the circular list

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_previous(const_node_ptr n);`

`static void set_previous(node_ptr n, node_ptr prev);`

`static node_ptr get_next(const_node_ptr n);`

`static void set_next(node_ptr n, node_ptr next);`

std::size_t
std::size_t
node_ptr
NodeTraits::node
NodeTraits::node_ptr
NodeTraits::const_node_ptr
NodeTraits
void `node_ptr`

Effects: Constructs an non-used list element, so that inited(this_node) == true

Complexity: Constant

Throws: Nothing.

bool `const const_node_ptr &`

Effects: Returns true is "this_node" is in a non-used state as if it was initialized by the "init" function.

Complexity: Constant

Throws: Nothing.

void `node_ptr`

Effects: Constructs an empty list, making this_node the only node of the circular list: `NodeTraits::get_next(this_node) == NodeTraits::get_previous(this_node) == this_node`.

Complexity: Constant

Throws: Nothing.

bool `const const_node_ptr &`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns true is "this_node" is the only node of a circular list: `return NodeTraits::get_next(this_node) == this_node`

Complexity: Constant

Throws: Nothing.

std::size_t `const const_node_ptr &`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns the number of nodes in a circular list. If the circular list is empty, returns 1.

Complexity: Linear

Throws: Nothing.

node_ptr `node_ptr`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Unlinks the node from the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: b and e must be nodes of the same circular list or an empty range.

Effects: Unlinks the node [b, e) from the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: nxt_node must be a node of a circular list.

Effects: Links this_node before nxt_node in the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: prev_node must be a node of a circular list.

Effects: Links this_node after prev_node in the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: this_node and other_node must be nodes inserted in circular lists or be empty circular lists.

Effects: Swaps the position of the nodes: this_node is inserted in other_nodes position in the second circular list and the other_node is inserted in this_node's position in the first circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr` `node_ptr`

Requires: b and e must be nodes of the same circular list or an empty range. and p must be a node of a different circular list or may not be an iterator in Effects: Removes the nodes from [b, e) range from their circular list and inserts them before p in p's circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: i must a node of a circular list and p must be a node of a different circular list.

Effects: Removes the node i from its circular list and inserts it before p in p's circular list. If p == i or p == NodeTraits::get_next(i), this function is a null operation.

Complexity: Constant

Throws: Nothing.

void `node_ptr`

Effects: Reverses the order of elements in the list.

Throws: Nothing.

Complexity: This function is linear time.

void `node_ptr` `std::size_t`

Effects: Moves the node p n positions towards the end of the list.

Throws: Nothing.

Complexity: Linear to the number of moved positions.

void `node_ptr` `std::size_t`

Effects: Moves the node p n positions towards the beginning of the list.

Throws: Nothing.

Complexity: Linear to the number of moved positions.

std::size_t `const const_node_ptr &` `const const_node_ptr &`

Requires: f and l must be in a circular list.

Effects: Returns the number of nodes in the range [f, l).

Complexity: Linear

Throws: Nothing.

void `node_ptr` `node_ptr` `Pred` `stable_partition_info &`
void `node_ptr` `node_ptr`
void `node_ptr` `node_ptr`

`circular_slist_algorithms` provides basic algorithms to manipulate nodes forming a circular singly linked list. An empty circular list is formed by a node whose pointer to the next node points to itself.

`circular_slist_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the circular list

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_next(const_node_ptr n);`

`static void set_next(node_ptr n, node_ptr next);`

NodeTraits::node
NodeTraits::node_ptr
NodeTraits::const_node_ptr
NodeTraits
void `node_ptr`

Effects: Constructs an non-used list element, putting the next pointer to null: `NodeTraits::get_next(this_node) == node_ptr()`

Complexity: Constant

Throws: Nothing.

bool `const_node_ptr`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns true is "this_node" is the only node of a circular list: or it's a not inserted node: `return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node`

Complexity: Constant

Throws: Nothing.

bool `const_node_ptr`

Effects: Returns true is "this_node" has the same state as if it was inited using "init(node_ptr)"

Complexity: Constant

Throws: Nothing.

void `node_ptr`

Requires: prev_node must be in a circular list or be an empty circular list.

Effects: Unlinks the next node of prev_node from the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: prev_node and last_node must be in a circular list or be an empty circular list.

Effects: Unlinks the range (prev_node, last_node) from the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: prev_node must be a node of a circular list.

Effects: Links this_node after prev_node in the circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr` `node_ptr` `node_ptr`

Requires: b and e must be nodes of the same circular list or an empty range. and p must be a node of a different circular list.

Effects: Removes the nodes from (b, e] range from their circular list and inserts them after p in p's circular list.

Complexity: Constant

Throws: Nothing.

void `node_ptr`

Effects: Constructs an empty list, making this_node the only node of the circular list: `NodeTraits::get_next(this_node) == this_node`.

Complexity: Constant

Throws: Nothing.

node_ptr `const node_ptr &` `const node_ptr &`

Requires: this_node and prev_init_node must be in the same circular list.

Effects: Returns the previous node of this_node in the circular list starting. the search from prev_init_node. The first node checked for equality is NodeTraits::get_next(prev_init_node).

Complexity: Linear to the number of elements between prev_init_node and this_node.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns the previous node of this_node in the circular list.

Complexity: Linear to the number of elements in the circular list.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns the previous node of the previous node of this_node in the circular list.

Complexity: Linear to the number of elements in the circular list.

Throws: Nothing.

node_ptr `node_ptr` `const node_ptr &`

Requires: this_node and p must be in the same circular list.

Effects: Returns the previous node of the previous node of this_node in the circular list starting. the search from p. The first node checked for equality is NodeTraits::get_next((NodeTraits::get_next(p)).

Complexity: Linear to the number of elements in the circular list.

Throws: Nothing.

std::size_t `const const_node_ptr &`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns the number of nodes in a circular list. If the circular list is empty, returns 1.

Complexity: Linear

Throws: Nothing.

void `node_ptr`

Requires: this_node must be in a circular list, be an empty circular list or be inited.

Effects: Unlinks the node from the circular list.

Complexity: Linear to the number of elements in the circular list

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: nxt_node must be a node of a circular list.

Effects: Links this_node before nxt_node in the circular list.

Complexity: Linear to the number of elements in the circular list.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: this_node and other_node must be nodes inserted in circular lists or be empty circular lists.

Effects: Swaps the position of the nodes: this_node is inserted in other_nodes position in the second circular list and the other_node is inserted in this_node's position in the first circular list.

Complexity: Linear to number of elements of both lists

Throws: Nothing.

void `node_ptr`

Effects: Reverses the order of elements in the list.

Throws: Nothing.

Complexity: This function is linear to the contained elements.

node_ptr `node_ptr` `std::size_t`

Effects: Moves the node p n positions towards the end of the list.

Returns: The previous node of p after the function if there has been any movement, Null if n leads to no movement.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number moved positions.

node_ptr `node_ptr` `std::size_t`

Effects: Moves the node p n positions towards the beginning of the list.

Returns: The previous node of p after the function if there has been any movement, Null if n leads equals to no movement.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number moved positions.

link_mode_type safe_link

This value traits template is used to create value traits from user defined node traits where value_traits::value_type will derive from node_traits::node

NodeTraits
T
node_traits::node
node_traits::node_ptr
node_traits::const_node_ptr
`pointer_traits`< node_ptr >::template rebind_pointer< value_type >::type
`pointer_traits`< node_ptr >::template rebind_pointer< const value_type >::type
`boost::intrusive::pointer_traits`< pointer >::reference
`boost::intrusive::pointer_traits`< const_pointer >::reference
const link_mode_type
node_ptr `reference`
const_node_ptr `const_reference`
pointer `const node_ptr &`
const_pointer `const const_node_ptr &`
class ...
hashtable_size_traits_wrapper< hashdata_internal< ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags &(hash_bool_flags::incremental_pos|hash_bool_flags::cache_begin_pos) >, SizeType,(BoolFlags &hash_bool_flags::constant_time_size_pos) !=0 >

The class template hashtable is an intrusive hash table container, that is used to construct intrusive `unordered_set` and `unordered_multiset` containers. The no-throw guarantee holds only, if the VoidOrKeyEqual object and Hasher don't throw.

hashtable is a semi-intrusive container: each object to be stored in the container must contain a proper hook, but the container also needs additional auxiliary memory to work: hashtable needs a pointer to an array of type `bucket_type` to be passed in the constructor. This bucket array must have at least the same lifetime as the container. This makes the use of hashtable more complicated than purely intrusive containers. `bucket_type` is default-constructible, copyable and assignable

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `hash<>` and `equal<>` `bucket_traits<>`, power_2_buckets<>, cache_begin<> and incremental<>.

hashtable only provides forward iterators but it provides 4 iterator types: iterator and const_iterator to navigate through the whole container and local_iterator and const_local_iterator to navigate through the values stored in a single bucket. Local iterators are faster and smaller.

It's not recommended to use non constant-time size hashtables because several key functions, like "empty()", become non-constant time functions. Non constant_time size hashtables are mainly provided to support auto-unlink hooks.

hashtables, does not make automatic rehashings nor offers functions related to a load factor. Rehashing can be explicitly requested and the user must provide a new bucket array that will be used from that moment.

Since no automatic rehashing is done, iterators are never invalidated when inserting or erasing elements. Iterators are only invalidated when rehashing.

ValueTraits
value_traits::pointer
value_traits::const_pointer
value_traits::value_type
hash_types_base::key_type
hash_types_base::key_of_value
`pointer_traits`< pointer >::reference
`pointer_traits`< const_pointer >::reference
`pointer_traits`< pointer >::difference_type
SizeType
internal_type::key_equal
internal_type::hasher
bucket_impl< `slist` >
internal_type::bucket_ptr
slist::iterator
slist::const_iterator
internal_type::iterator
internal_type::const_iterator
internal_type::local_iterator
internal_type::const_local_iterator
value_traits::node_traits
node_traits::node
`pointer_traits`< pointer >::template rebind_pointer< node >::type
`pointer_traits`< pointer >::template rebind_pointer< const node >::type
`pointer_traits`< node_ptr >::reference
`pointer_traits`< const_node_ptr >::reference
slist::node_algorithms
unspecified
const bool
const bool
const bool
const bool
const bool
const bool
const bool
const bool
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

hasher

Effects: Returns the hasher object used by the `unordered_set`.

Complexity: Constant.

Throws: If hasher copy-constructor throws.

key_equal

Effects: Returns the key_equal object used by the `unordered_set`.

Complexity: Constant.

Throws: If key_equal copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: if constant-time size and `cache_begin` options are disabled, average constant time (worst case, with empty() == true: O(this->bucket_count()). Otherwise constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the `unordered_set`.

Complexity: Linear to elements contained in *this if `constant_time_size` is false. Constant-time otherwise.

Throws: Nothing.

void ``hashtable` &`

Requires: the hasher and the equality function unqualified swap call should not throw.

Effects: Swaps the contents of two unordered_sets. Swaps also the contained bucket array and equality and hasher functors.

Complexity: Constant.

Throws: If the swap() call for the comparison or hash functors found using ADL throw. Basic guarantee.

void `const `hashtable` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw Cloner should yield to nodes that compare equal and produce the same hash than the original node.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. The hash function and the equality predicate are copied from the source.

If `store_hash` option is true, this method does not use the hash function.

If any operation throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner or hasher throw or hash or equality predicate copying throws. Basic guarantee.

void ``hashtable` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw Cloner should yield to nodes that compare equal and produce the same hash than the original node.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. The hash function and the equality predicate are copied from the source.

If `store_hash` option is true, this method does not use the hash function.

If any operation throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner or hasher throw or hash or equality predicate copying throws. Basic guarantee.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts the value into the `unordered_set`.

Returns: An iterator to the inserted value.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Equivalent to this->insert_equal(t) for each element in [b, e).

Complexity: Average case O(N), where N is distance(b, e). Worst case O(N*this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Tries to inserts value into the `unordered_set`.

Returns: If the value is not already present inserts it and returns a pair containing the iterator to the new value and true. If there is an equivalent value returns a pair containing an iterator to the already present value and false.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Equivalent to this->insert_unique(t) for each element in [b, e).

Complexity: Average case O(N), where N is distance(b, e). Worst case O(N*this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const KeyType &` `KeyHasher` `KeyEqual` `insert_commit_data &`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the `unordered_set`, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the hash or the equality is much cheaper to construct than the value_type and this function offers the possibility to use that the part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time.

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the `unordered_set`.

After a successful rehashing insert_commit_data remains valid.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the `unordered_set`, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hasher or key_compare throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the hash or the equality is much cheaper to construct than the value_type and this function offers the possibility to use that the part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time.

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the `unordered_set`.

After a successful rehashing insert_commit_data remains valid.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the `unordered_set` between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the `unordered_set` using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

After a successful rehashing insert_commit_data remains valid.

void `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average case O(1), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased element. No destructors are called.

void `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average case O(distance(b, e)), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Erases all the elements that have the same hash and compare equal with the given key.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If hash_func or equal_func throw. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average case O(1), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average case O(distance(b, e)), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyHasher` `KeyEqual` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "equal_func". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If hash_func or equal_func throw. Basic guarantee.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

size_type `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns the number of contained elements with the given key

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal throw.

iterator `const key_type &`

Effects: Finds an iterator to the first element is equal to "value" or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

iterator `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Finds an iterator to the first element whose key is "key" according to the given hash and equality functor or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

const_iterator `const key_type &`

Effects: Finds a const_iterator to the first element whose key is "key" or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

const_iterator `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Finds an iterator to the first element whose key is "key" according to the given hasher and equality functor or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

std::pair< iterator, iterator > `const key_type &`

Effects: Returns a range containing all elements with values equivalent to value. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

std::pair< iterator, iterator > `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns a range containing all elements with equivalent keys. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(key, hash_func, equal_func)). Worst case O(this->size()).

Throws: If hash_func or the equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Returns a range containing all elements with values equivalent to value. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns a range containing all elements with equivalent keys. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(key, hash_func, equal_func)). Worst case O(this->size()).

Throws: If the hasher or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: If the internal hash function throws.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: If the internal hash function throws.

local_iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

const_local_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of buckets passed in the constructor or the last rehash function.

Complexity: Constant.

Throws: Nothing.

size_type `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns the number of elements in the nth bucket.

Complexity: Constant.

Throws: Nothing.

size_type `const key_type &`

Effects: Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed.

Complexity: Constant.

Throws: If the hash functor throws.

Note: the return value is in the range [0, this->bucket_count()).

size_type `const KeyType &` `KeyHasher`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

Effects: Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed.

Complexity: Constant.

Throws: If hash_func throws.

Note: the return value is in the range [0, this->bucket_count()).

bucket_ptr

Effects: Returns the bucket array pointer passed in the constructor or the last rehash function.

Complexity: Constant.

Throws: Nothing.

local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

void `const `bucket_traits` &`

Requires: new_bucket_traits can hold a pointer to a new bucket array or the same as the old bucket array with a different length. new_size is the length of the the array pointed by new_buckets. If new_bucket_traits.bucket_begin() == this->bucket_pointer() new_bucket_traits.bucket_count() can be bigger or smaller than this->bucket_count(). 'new_bucket_traits' copy constructor should not throw.

Effects: If `new_bucket_traits.bucket_begin() == this->bucket_pointer()` is false, unlinks values from the old bucket and inserts then in the new one according to the hash value of values.

If `new_bucket_traits.bucket_begin() == this->bucket_pointer()` is true, the implementations avoids moving values as much as possible.

Bucket traits hold by *this is assigned from new_bucket_traits. If the container is configured as incremental<>, the split bucket is set to the new bucket_count().

If `store_hash` option is true, this method does not use the hash function. If false, the implementation tries to minimize calls to the hash function (e.g. once for equivalent values if optimize_multikey<true> is true).

If rehash is successful updates the internal `bucket_traits` with new_bucket_traits.

Complexity: Average case linear in this->size(), worst case quadratic.

Throws: If the hasher functor throws. Basic guarantee.

void

Note: This function is used when keys from inserted elements are changed (e.g. a language change when key is a string) but uniqueness and hash properties are preserved so a fast full rehash recovers invariants for *this without extracting and reinserting all elements again.

Requires: Calls produced to the hash function should not alter the value uniqueness properties of already inserted elements. If hasher(key1) == hasher(key2) was true when elements were inserted, it shall be true during calls produced in the execution of this function.

key_equal is not called inside this function so it is assumed that key_equal(value1, value2) should produce the same results as before for inserted elements.

Effects: Reprocesses all values hold by *this, recalculating their hash values and redistributing them though the buckets.

If `store_hash` option is true, this method uses the hash function and updates the stored hash value.

Complexity: Average case linear in this->size(), worst case quadratic.

Throws: If the hasher functor throws. Basic guarantee.

bool `booltrue`

Requires:

Effects:

Complexity:

Throws:

Note: this method is only available if incremental<true> option is activated.

grow

bool `const `bucket_traits` &`

Effects: If new_bucket_traits.bucket_count() is not this->bucket_count()/2 or this->bucket_count()*2, or this->split_bucket() != new_bucket_traits.bucket_count() returns false and does nothing.

Otherwise, copy assigns new_bucket_traits to the internal `bucket_traits` and transfers all the objects from old buckets to the new ones.

Complexity: Linear to size().

Throws: Nothing

Note: this method is only available if incremental<true> option is activated.

size_type

Requires: incremental<> option must be set

Effects: returns the current split count

Complexity: Constant

Throws: Nothing

const `bucket_traits` &
const hasher &
hasher()
const key_equal &
key_equal()
const value_traits &
value_traits()

Requires: buckets must not be being used by any other resource.

Effects: Constructs an empty `unordered_set`, storing a reference to the bucket array and copies of the key_hasher and equal_func functors.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hash_func or equal_func throws.

Notes: buckets array must be disposed only after *this is disposed.

bool
Iterator
Iterator
const `bucket_traits` &
const hasher &
hasher()
const key_equal &
key_equal()
const value_traits &
value_traits()

Requires: buckets must not be being used by any other resource and dereferencing iterator must yield an lvalue of type value_type.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: If N is distance(b, e): Average case is O(N) (with a good hash function and with buckets_len >= N),worst case O(N^2).

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hasher or key_equal throws.

Notes: buckets array must be disposed only after *this is disposed.

hashtable
&&

Effects: Constructs a container moving resources from another container. Internal value traits, bucket traits, hasher and comparison are move constructed and nodes belonging to x are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of value traits, bucket traits, hasher or comparison throws.

`hashtable` & ``hashtable` &&`

Effects: Equivalent to swap.

Effects: Detaches all elements from this. The objects in the `unordered_set` are not deleted (i.e. no destructors are called).

Complexity: Linear to the number of elements in the `unordered_set`, if it's a safe-mode or auto-unlink value. Otherwise constant.

Throws: Nothing.

local_iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_local_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

size_type `size_type`

Effects: Returns the nearest new bucket count optimized for the container that is bigger or equal than n. This suggestion can be used to create bucket arrays with a size that will usually improve container's performance. If such value does not exist, the higher possible value is returned.

Complexity: Amortized constant time.

Throws: Nothing.

size_type `size_type`

Effects: Returns the nearest new bucket count optimized for the container that is smaller or equal than n. This suggestion can be used to create bucket arrays with a size that will usually improve container's performance. If such value does not exist, the lowest possible value is returned.

Complexity: Amortized constant time.

Throws: Nothing.

class ...

Helper metafunction to define a `hashtable` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined

This header file forward declares most Intrusive classes.

It forward declares the following containers and hooks:

- `boost::intrusive::slist` / `boost::intrusive::slist_base_hook` / `boost::intrusive::slist_member_hook`

- `boost::intrusive::list` / `boost::intrusive::list_base_hook` / `boost::intrusive::list_member_hook`

- `boost::intrusive::bstree` / `boost::intrusive::bs_set` / `boost::intrusive::bs_multiset` / `boost::intrusive::bs_set_base_hook` / `boost::intrusive::bs_set_member_hook`

- `boost::intrusive::rbtree` / `boost::intrusive::set` / `boost::intrusive::multiset` / `boost::intrusive::set_base_hook` / `boost::intrusive::set_member_hook`

- `boost::intrusive::avltree` / `boost::intrusive::avl_set` / `boost::intrusive::avl_multiset` / `boost::intrusive::avl_set_base_hook` / `boost::intrusive::avl_set_member_hook`

- `boost::intrusive::splaytree` / `boost::intrusive::splay_set` / `boost::intrusive::splay_multiset`

- `boost::intrusive::sgtree` / `boost::intrusive::sg_set` / `boost::intrusive::sg_multiset`

- `boost::intrusive::treap` / `boost::intrusive::treap_set` / `boost::intrusive::treap_multiset`

- `boost::intrusive::hashtable` / `boost::intrusive::unordered_set` / `boost::intrusive::unordered_multiset` / `boost::intrusive::unordered_set_base_hook` / `boost::intrusive::unordered_set_member_hook` /

- `boost::intrusive::any_base_hook` / `boost::intrusive::any_member_hook`

It forward declares the following container or hook options:

- `boost::intrusive::constant_time_size` / `boost::intrusive::size_type` / `boost::intrusive::compare` / `boost::intrusive::equal`

- `boost::intrusive::floating_point` / `boost::intrusive::priority` / `boost::intrusive::hash`

- `boost::intrusive::value_traits` / `boost::intrusive::member_hook` / `boost::intrusive::function_hook` / `boost::intrusive::base_hook`

- `boost::intrusive::void_pointer` / `boost::intrusive::tag` / `boost::intrusive::link_mode`

- `boost::intrusive::optimize_size` / `boost::intrusive::linear` / `boost::intrusive::cache_last`

- `boost::intrusive::bucket_traits` / `boost::intrusive::store_hash` / `boost::intrusive::optimize_multikey`

- `boost::intrusive::power_2_buckets` / `boost::intrusive::cache_begin` / `boost::intrusive::compare_hash` / `boost::intrusive::incremental`

It forward declares the following value traits utilities:

- `boost::intrusive::value_traits` / `boost::intrusive::derivation_value_traits` / `boost::intrusive::trivial_value_traits`

Finally it forward declares the following general purpose utilities:

- `boost::intrusive::pointer_plus_bits` / boost::intrusive::priority_compare.

`linear_slist_algorithms` provides basic algorithms to manipulate nodes forming a linear singly linked list.

`linear_slist_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the linear list

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_next(const_node_ptr n);`

`static void set_next(node_ptr n, node_ptr next);`

NodeTraits::node
NodeTraits::node_ptr
NodeTraits::const_node_ptr
NodeTraits
twin< node_ptr >
void `const node_ptr &`

Effects: Constructs an non-used list element, putting the next pointer to null: `NodeTraits::get_next(this_node) == node_ptr()`

Complexity: Constant

Throws: Nothing.

bool `const_node_ptr`

Requires: this_node must be in a circular list or be an empty circular list.

Effects: Returns true is "this_node" is the only node of a circular list: or it's a not inserted node: `return node_ptr() == NodeTraits::get_next(this_node) || NodeTraits::get_next(this_node) == this_node`

Complexity: Constant

Throws: Nothing.

bool `const_node_ptr`

Effects: Returns true is "this_node" has the same state as if it was inited using "init(node_ptr)"

Complexity: Constant

Throws: Nothing.

void `const node_ptr &`

Requires: prev_node must be in a circular list or be an empty circular list.

Effects: Unlinks the next node of prev_node from the circular list.

Complexity: Constant

Throws: Nothing.

void `const node_ptr &` `const node_ptr &`

Requires: prev_node and last_node must be in a circular list or be an empty circular list.

Effects: Unlinks the range (prev_node, last_node) from the linear list.

Complexity: Constant

Throws: Nothing.

void `const node_ptr &` `const node_ptr &`

Requires: prev_node must be a node of a linear list.

Effects: Links this_node after prev_node in the linear list.

Complexity: Constant

Throws: Nothing.

void `const node_ptr &` `const node_ptr &` `const node_ptr &`

Requires: b and e must be nodes of the same linear list or an empty range. and p must be a node of a different linear list.

Effects: Removes the nodes from (b, e] range from their linear list and inserts them after p in p's linear list.

Complexity: Constant

Throws: Nothing.

void `const node_ptr &`

Effects: Constructs an empty list, making this_node the only node of the circular list: `NodeTraits::get_next(this_node) == this_node`.

Complexity: Constant

Throws: Nothing.

node_ptr `const node_ptr &` `const node_ptr &`

Requires: this_node and prev_init_node must be in the same linear list.

Effects: Returns the previous node of this_node in the linear list starting. the search from prev_init_node. The first node checked for equality is NodeTraits::get_next(prev_init_node).

Complexity: Linear to the number of elements between prev_init_node and this_node.

Throws: Nothing.

std::size_t `const const_node_ptr &`

Requires: this_node must be in a linear list or be an empty linear list.

Effects: Returns the number of nodes in a linear list. If the linear list is empty, returns 1.

Complexity: Linear

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: this_node and other_node must be nodes inserted in linear lists or be empty linear lists.

Effects: Moves all the nodes previously chained after this_node after other_node and vice-versa.

Complexity: Constant

Throws: Nothing.

node_ptr `node_ptr`

Effects: Reverses the order of elements in the list.

Returns: The new first node of the list.

Throws: Nothing.

Complexity: This function is linear to the contained elements.

node_pair `node_ptr` `std::size_t`

Effects: Moves the first n nodes starting at p to the end of the list.

Returns: A pair containing the new first and last node of the list or if there has been any movement, a null pair if n leads to no movement.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number moved positions.

node_pair `node_ptr` `std::size_t`

Effects: Moves the first n nodes starting at p to the beginning of the list.

Returns: A pair containing the new first and last node of the list or if there has been any movement, a null pair if n leads to no movement.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number moved positions.

If this linking policy is specified in a `value_traits` class as the `link_mode`, containers configured with such `value_traits` won't set the hooks of the erased values to a default state. Containers also won't check that the hooks of the new values are default initialized.

If this linking policy is specified in a `value_traits` class as the `link_mode`, containers configured with such `value_traits` will set the hooks of the erased values to a default state. Containers also will check that the hooks of the new values are default initialized.

Same as "safe_link" but the user type is an auto-unlink type, so the containers with constant-time size features won't be compatible with `value_traits` configured with this policy. Containers also know that the a value can be silently erased from the container without using any function provided by the containers.

This enumeration defines the type of `value_traits` that can be defined for Boost.Intrusive containers

class ...

The class template list is an intrusive container that mimics most of the interface of std::list as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>` and `size_type<>`.

ValueTraits
value_traits::pointer
value_traits::const_pointer
`pointer_traits`< pointer >::element_type
`pointer_traits`< pointer >::reference
`pointer_traits`< const_pointer >::reference
`pointer_traits`< pointer >::difference_type
SizeType
list_iterator< value_traits, false >
list_iterator< value_traits, true >
boost::intrusive::reverse_iterator< iterator >
boost::intrusive::reverse_iterator< const_iterator >
value_traits::node_traits
node_traits::node
node_traits::node_ptr
node_traits::const_node_ptr
`circular_list_algorithms`< node_traits >
unspecified
const bool
const bool
const bool
void `reference`

Requires: value must be an lvalue.

Effects: Inserts the value in the back of the list. No copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void `reference`

Requires: value must be an lvalue.

Effects: Inserts the value in the front of the list. No copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void

Effects: Erases the last element of the list. No destructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators (but not the references) to the erased element.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the last element of the list. No destructors are called. Disposer::operator()(pointer) is called for the removed element.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators to the erased element.

void

Effects: Erases the first element of the list. No destructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators (but not the references) to the erased element.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the first element of the list. No destructors are called. Disposer::operator()(pointer) is called for the removed element.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators to the erased element.

reference

Effects: Returns a reference to the first element of the list.

Throws: Nothing.

Complexity: Constant.

const_reference

Effects: Returns a const_reference to the first element of the list.

Throws: Nothing.

Complexity: Constant.

reference

Effects: Returns a reference to the last element of the list.

Throws: Nothing.

Complexity: Constant.

const_reference

Effects: Returns a const_reference to the last element of the list.

Throws: Nothing.

Complexity: Constant.

iterator

Effects: Returns an iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

iterator

Effects: Returns an iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a constant iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed list.

Throws: Nothing.

Complexity: Constant.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.

Throws: Nothing.

Complexity: Constant.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed list.

Throws: Nothing.

Complexity: Constant.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed list.

Throws: Nothing.

Complexity: Constant.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.

Throws: Nothing.

Complexity: Constant.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed list.

Throws: Nothing.

Complexity: Constant.

size_type

Effects: Returns the number of the elements contained in the list.

Throws: Nothing.

Complexity: Linear to the number of elements contained in the list. if constant-time size option is disabled. Constant time otherwise.

Note: Does not affect the validity of iterators and references.

bool

Effects: Returns true if the list contains no elements.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void ``list` &`

Effects: Swaps the elements of x and *this.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void `size_type1`

Effects: Moves backwards all the elements, so that the first element becomes the second, the second becomes the third... the last element becomes the first one.

Throws: Nothing.

Complexity: Linear to the number of shifts.

Note: Does not affect the validity of iterators and references.

void `size_type1`

Effects: Moves forward all the elements, so that the second element becomes the first, the third becomes the second... the first element becomes the last one.

Throws: Nothing.

Complexity: Linear to the number of shifts.

Note: Does not affect the validity of iterators and references.

iterator `const_iterator`

Effects: Erases the element pointed by i of the list. No destructors are called.

Returns: the first element remaining beyond the removed element, or end() if no such element exists.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator` `const_iterator`

Requires: b and e must be valid iterators to elements in *this.

Effects: Erases the element range pointed by b and e No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the number of erased elements if it's a safe-mode or auto-unlink value, or constant-time size is enabled. Constant-time otherwise.

Note: Invalidates the iterators (but not the references) to the erased elements.

iterator `const_iterator` `const_iterator` `size_type`

Requires: b and e must be valid iterators to elements in *this. n must be distance(b, e).

Effects: Erases the element range pointed by b and e No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the number of erased elements if it's a safe-mode or auto-unlink value is enabled. Constant-time otherwise.

Note: Invalidates the iterators (but not the references) to the erased elements.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed by i of the list. No destructors are called. Disposer::operator()(pointer) is called for the removed element.

Returns: the first element remaining beyond the removed element, or end() if no such element exists.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators to the erased element.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element range pointed by b and e No destructors are called. Disposer::operator()(pointer) is called for the removed elements.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the number of elements erased.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all the elements of the container. No destructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements of the list. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements of the container. No destructors are called. Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Complexity: Linear to the number of elements of the list.

Note: Invalidates the iterators to the erased elements.

void `const `list` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws. Basic guarantee.

void ``list` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws. Basic guarantee.

iterator `const_iterator` `reference`

Requires: value must be an lvalue and p must be a valid iterator of *this.

Effects: Inserts the value before the position pointed by p.

Returns: An iterator to the inserted element.

Throws: Nothing.

Complexity: Constant time. No copy constructors are called.

Note: Does not affect the validity of iterators and references.

void `const_iterator` `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type and p must be a valid iterator of *this.

Effects: Inserts the range pointed by b and e before the position p. No copy constructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements inserted.

Note: Does not affect the validity of iterators and references.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Clears the list and inserts the range pointed by b and e. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements inserted plus linear to the elements contained in the list if it's a safe-mode or auto-unlink value. Linear to the number of elements inserted in the list otherwise.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `Disposer` `Iterator` `Iterator`

Requires: Disposer::operator()(pointer) shouldn't throw.

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Clears the list and inserts the range pointed by b and e. No destructors or copy constructors are called. Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Complexity: Linear to the number of elements inserted plus linear to the elements contained in the list.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `const_iterator` ``list` &`

Requires: p must be a valid iterator of *this.

Effects: Transfers all the elements of list x to this list, before the the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``list` &` `const_iterator`

Requires: p must be a valid iterator of *this. new_ele must point to an element contained in list x.

Effects: Transfers the value pointed by new_ele, from list x to this list, before the element pointed by p. No destructors or copy constructors are called. If p == new_ele or p == ++new_ele, this function is a null operation.

Throws: Nothing.

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``list` &` `const_iterator` `const_iterator`

Requires: p must be a valid iterator of *this. f and e must point to elements contained in list x.

Effects: Transfers the range pointed by f and e from list x to this list, before the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements transferred if constant-time size option is enabled. Constant-time otherwise.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``list` &` `const_iterator` `const_iterator` `size_type`

Requires: p must be a valid iterator of *this. f and e must point to elements contained in list x. n == distance(f, e)

Effects: Transfers the range pointed by f and e from list x to this list, before the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void

Effects: This function sorts the list *this according to operator <. The sort is stable, that is, the relative order of equivalent elements is preserved.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or operator < throws. Basic guarantee.

Notes: Iterators and references are not invalidated.

Complexity: The number of comparisons is approximately N log N, where N is the list's size.

void `Predicate`

Requires: p must be a comparison function that induces a strict weak ordering

Effects: This function sorts the list *this according to p. The sort is stable, that is, the relative order of equivalent elements is preserved.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the predicate throws. Basic guarantee.

Notes: This won't throw if list_base_hook<> or `list_member_hook` are used. Iterators and references are not invalidated.

Complexity: The number of comparisons is approximately N log N, where N is the list's size.

void ``list` &`

Effects: This function removes all of x's elements and inserts them in order into *this according to operator <. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If operator < throws. Basic guarantee.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references are not invalidated

void ``list` &` `Predicate`

Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If the predicate throws. Basic guarantee.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references are not invalidated.

void

Effects: Reverses the order of elements in the list.

Throws: Nothing.

Complexity: This function is linear time.

Note: Iterators and references are not invalidated

void `const_reference`

Effects: Removes all the elements that compare equal to value. No destructors are called.

Throws: If operator == throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `const_reference` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes all the elements that compare equal to value. Disposer::operator()(pointer) is called for every removed element.

Throws: If operator == throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `Pred`

Effects: Removes all the elements for which a specified predicate is satisfied. No destructors are called.

Throws: If pred throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() calls to the predicate.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `Pred` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes all the elements for which a specified predicate is satisfied. Disposer::operator()(pointer) is called for every removed element.

Throws: If pred throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void

Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list. No destructors are called.

Throws: If std::equal_to<value_type throws. Basic guarantee.

Complexity: Linear time (size()-1 comparisons calls to pred()).

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `BinaryPredicate`

Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. No destructors are called.

Throws: If pred throws. Basic guarantee.

Complexity: Linear time (size()-1 comparisons equality comparisons).

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list. Disposer::operator()(pointer) is called for every removed element.

Throws: If std::equal_to<value_type throws. Basic guarantee.

Complexity: Linear time (size()-1) comparisons equality comparisons.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `BinaryPredicate` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. Disposer::operator()(pointer) is called for every removed element.

Throws: If pred throws. Basic guarantee.

Complexity: Linear time (size()-1) comparisons equality comparisons.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

iterator `reference`

Requires: value must be a reference to a value inserted in a list.

Effects: This function returns a const_iterator pointing to the element

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated.

const_iterator `const_reference`

Requires: value must be a const reference to a value inserted in a list.

Effects: This function returns an iterator pointing to the element.

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated.

void

Effects: Asserts the integrity of the container.

Complexity: Linear time.

Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

Effects: constructs an empty list.

Complexity: Constant

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks).

const value_traits &

Effects: constructs an empty list.

Complexity: Constant

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks).

Iterator
Iterator
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Constructs a list equal to the range [first,last).

Complexity: Linear in distance(b, e). No copy constructors are called.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks).

list
&&

Effects: Constructs a container moving resources from another container. Internal value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of value traits throws.

`list` & ``list` &&`

Effects: Equivalent to swap

Effects: If it's not a safe-mode or an auto-unlink value_type the destructor does nothing (ie. no code is generated). Otherwise it detaches all elements from this. In this case the objects in the list are not deleted (i.e. no destructors are called), but the hooks according to the ValueTraits template parameter are set to their default value.

Throws: Nothing.

Complexity: Linear to the number of elements in the list, if it's a safe-mode or auto-unlink value . Otherwise constant.

`list` & `iterator`

Precondition: end_iterator must be a valid end iterator of list.

Effects: Returns a const reference to the list associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `list` & `const_iterator`

Precondition: end_iterator must be a valid end const_iterator of list.

Effects: Returns a const reference to the list associated to the end iterator

Throws: Nothing.

Complexity: Constant.

iterator `reference`

Requires: value must be a reference to a value inserted in a list.

Effects: This function returns a const_iterator pointing to the element

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated. This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be a const reference to a value inserted in a list.

Effects: This function returns an iterator pointing to the element.

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated. This static function is available only if the value traits is stateless.

class ...

Helper metafunction to define a `list` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...
make_list_base_hook::type< O1, O2, O3 >

Derive a class from this hook in order to store objects of that class in an list.

The hook admits the following options: `tag<>`, `void_pointer<>` and `link_mode<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``list_base_hook``, then each ``list_base_hook`` needs its unique tag.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

void ``list_base_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `list::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `list_base_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`list_base_hook` & `const `list_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in an list an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...
make_list_member_hook::type< O1, O2, O3 >

Store this hook in a class to be inserted in an list.

The hook admits the following options: `void_pointer<>` and `link_mode<>`.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

void ``list_member_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `list::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `list_member_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`list_member_hook` & `const `list_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in an list an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...

Helper metafunction to define a ```list_base_hook`` that` yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ```list_member_hook`` that` yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
typename NodeTraits::node T::*
link_mode_type safe_link

This value traits template is used to create value traits from user defined node traits where value_traits::value_type will store a node_traits::node

NodeTraits
T
node_traits::node
node_traits::node_ptr
node_traits::const_node_ptr
`pointer_traits`< node_ptr >
`pointer_traits`< node_ptr >::template rebind_pointer< T >::type
`pointer_traits`< node_ptr >::template rebind_pointer< const T >::type
value_type &
const value_type &
const link_mode_type
node_ptr `reference`
const_node_ptr `const_reference`
pointer `const node_ptr &`
const_pointer `const const_node_ptr &`

This option setter specifies that the container must use the specified base hook

This option setter specifies the bucket traits class for unordered associative containers. When this option is specified, instead of using the default bucket traits, a user defined holder will be defined

bool

This option setter specifies if the container will cache a pointer to the first non-empty bucket so that begin() is always constant-time. This is specially helpful when we can have containers with a few elements but with big bucket arrays (that is, hashtables with low load factors).

bool

If true, slist also stores a pointer to the last element of the singly linked list. This allows O(1) swap and splice_after(iterator, slist &) for circular slists and makes possible new functions like push_back(reference) and back().

This option setter specifies the strict weak ordering comparison functor for the value type

bool

This option setter specifies if the container will compare the hash value before comparing objects. This option can't be specified if store_hash<> is not true. This is specially helpful when we have containers with a high load factor. and the comparison function is much more expensive that comparing already stored hash values.

bool

This option setter specifies if the intrusive container stores its size as a member to obtain constant-time size() member.

This option setter specifies the equality functor for the value type

bool

This option setter for scapegoat containers specifies if the intrusive scapegoat container should use a non-variable alpha value that does not need floating-point operations.

If activated, the fixed alpha value is 1/sqrt(2). This option also saves some space in the container since the alpha value and some additional data does not need to be stored in the container.

If the user only needs an alpha value near 1/sqrt(2), this option also improves performance since avoids logarithm and division operations when rebalancing the tree.

This option setter specifies the function object that will be used to convert between values to be inserted in a container and the hook to be used for that purpose.

This option setter specifies the hash functor for the value type

This option setter specifies a container header holder type.
bool

This option setter specifies if the hash container will use incremental hashing. With incremental hashing the cost of hash table expansion is spread out across each hash table insertion operation, as opposed to be incurred all at once. Therefore linear hashing is well suited for interactive applications or real-time appplications where the worst-case insertion time of non-incremental hash containers (rehashing the whole bucket array) is not admisible.

This option setter specifies a function object that specifies the type of the key of an associative container and an operator to obtain it from a value type.

This function object must the define a `type` member typedef and a member with signature `type [const&] operator()(const value_type &) const` that will return the key from a value_type of an associative container

bool

This option setter specifies if the slist container should use a linear implementation instead of a circular one.

link_mode_type

This option setter specifies the link mode (normal_link, safe_link or auto_unlink)

MemberHook Parent::*

This option setter specifies the member hook the container must use.

bool

This option setter specifies if the unordered hook should offer room to store another link to another node with the same key. Storing this link will speed up lookups and insertions on `unordered_multiset` containers with a great number of elements with the same key.

bool

This option setter specifies if the hook should be optimized for size instead of for speed.

bool

This option setter specifies if the bucket array will be always power of two. This allows using masks instead of the default modulo operation to determine the bucket number from the hash value, leading to better performance. In debug mode, if power of two buckets mode is activated, the bucket length will be checked with assertions.

This option setter specifies the priority comparison functor for the value type

This option setter specifies a function object that specifies the type of the priority of a treap container and an operator to obtain it from a value type.

This function object must the define a `type` member typedef and a member with signature `type [const&] operator()(const value_type &) const` that will return the priority from a value_type of a treap container

This option setter specifies the type that the container will use to store its size.

bool

This option setter specifies if the unordered hook should offer room to store the hash value. Storing the hash in the hook will speed up rehashing processes in applications where rehashing is frequent, rehashing might throw or the value is heavy to hash.

This option setter specifies the type of the tag of a base hook. A type cannot have two base hooks of the same type, so a tag can be used to differentiate two base hooks with otherwise same type

This option setter specifies the relationship between the type to be managed by the container (the value type) and the node to be used in the node algorithms. It also specifies the linking policy.

This option setter specifies the type of a void pointer. This will instruct the hook to use this type of pointer instead of the default one

class ...

This class is a utility that takes:

- a default options class defining initial static constant and typedefs

- several options defined with BOOST_INTRUSIVE_OPTION_CONSTANT and BOOST_INTRUSIVE_OPTION_TYPE

and packs them together in a new type that defines all options as member typedefs or static constant values. Given options of form:

    BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, VoidPointer, my_pointer_type)
    BOOST_INTRUSIVE_OPTION_CONSTANT(incremental, bool, Enabled, is_incremental)

the following expression

    struct default_options
    {
      typedef long      int_type;
      static const int  int_constant = -1;
    };

    pack_options< default_options, my_pointer<void*>, incremental<true> >::type

will create a type that will contain the following typedefs/constants

    struct unspecified_type
    {
       //Default options
       typedef long      int_type;
       static const int  int_constant  = -1;

       //Packed options (will ovewrite any default option)
       typedef void*     my_pointer_type;
       static const bool is_incremental = true;
    };

If an option is specified in the default options argument and later redefined as an option, the last definition will prevail.

unspecified_type

Defines an option class of name OPTION_NAME that can be used to specify a type of type TYPE...

    struct OPTION_NAME<class TYPE>
    {  unspecified_content  };

...that after being combined with ``boost::intrusive::pack_options``, will typedef TYPE as a typedef of name TYPEDEF_NAME. Example:

    //[includes and namespaces omitted for brevity]

    //This macro will create the following class:
    //    template<class VoidPointer>
    //    struct my_pointer
    //    { unspecified_content };
    BOOST_INTRUSIVE_OPTION_TYPE(my_pointer, VoidPointer, boost::remove_pointer<VoidPointer>::type, my_pointer_type)

    struct empty_default{};

    typedef pack_options< empty_default, typename my_pointer<void*> >::type::my_pointer_type type;

    BOOST_STATIC_ASSERT(( boost::is_same<type, void>::value ));

Defines an option class of name OPTION_NAME that can be used to specify a constant of type TYPE with value VALUE...

    struct OPTION_NAME<TYPE VALUE>
    {  unspecified_content  };

...that after being combined with ``boost::intrusive::pack_options``, will contain a CONSTANT_NAME static constant of value VALUE. Example:

    //[includes and namespaces omitted for brevity]

    //This macro will create the following class:
    //    template<bool Enabled>
    //    struct incremental
    //    { unspecified_content };
    BOOST_INTRUSIVE_OPTION_CONSTANT(incremental, bool, Enabled, is_incremental)

    struct empty_default{};

    const bool is_incremental = pack_options< empty_default, incremental<true> >::type::is_incremental;

    BOOST_STATIC_ASSERT(( is_incremental == true ));

Parent * `Member *` `const Member Parent::*`

Given a pointer to a member and its corresponding pointer to data member, this function returns the pointer of the parent containing that member. Note: this function does not work with pointer to members that rely on virtual inheritance.

const Parent * `const Member *` `const Member Parent::*`

Given a const pointer to a member and its corresponding const pointer to data member, this function returns the const pointer of the parent containing that member. Note: this function does not work with pointer to members that rely on virtual inheritance.

std::size_t

This trait class is used to know if a pointer can embed extra bits of information if it's going to be used to point to objects with an alignment of "Alignment" bytes.

const std::size_t
std::size_t
void *
Alignment

This is a specialization for raw pointers. Raw pointers can embed extra bits in the lower bits if the alignment is multiple of 2pow(NumBits).

const std::size_t
std::size_t

This is class that is supposed to have static methods to embed extra bits of information in a pointer. This is a declaration and there is no default implementation, because operations to embed the bits change with every pointer type.

An implementation that detects that a pointer type whose has_pointer_plus_bits<>::value is non-zero can make use of these operations to embed the bits in the pointer.

std::size_t
T *
NumBits

This is the specialization to embed extra bits of information in a raw pointer. The extra bits are stored in the lower bits of the pointer.

T *
const uintptr_t
pointer `pointer`
void `pointer &` `pointer`
std::size_t `pointer`
void `pointer &` `std::size_t`
const V &
const bool
char `int` `typename X::template rebind< U > *`
int `any< int >` `void *`
const V &
const bool
char `int` `typename X::template rebind< U >::other *`
int `any< int >` `void *`
boost::intrusive::pointer_rebinder< Ptr, U, pointer_rebind_mode< Ptr, U >::mode >
defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
T *
U
U *
const unsigned int
const unsigned int
const unsigned int
unsigned int
Ptr
U
1u
Ptr::template rebind< U >
Ptr
U
2u
Ptr::template rebind< U >::other
template< class > class
Ptr< A >
U
0u
Ptr< U >
template< class, class... > class
class...
Ptr< A
An... >
U
0u
Ptr< U, An... >

`pointer_traits` is the implementation of C++11 std::pointer_traits class with some extensions like castings.

`pointer_traits` supplies a uniform interface to certain attributes of pointer-like types.

Note: When defining a custom family of pointers or references to be used with BI library, make sure the public static conversion functions accessed through the ``pointer_traits`` interface (`*_cast_from` and `pointer_to`) can properly convert between const and nonconst referred member types without the use of implicit constructor calls. It is suggested these conversions be implemented as function templates, where the template argument is the type of the object being converted from.

The pointer type queried by this `pointer_traits` instantiation

Ptr

Ptr::element_type if such a type exists; otherwise, T if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments ; otherwise , the specialization is ill-formed.

unspecified_type

Ptr::difference_type if such a type exists; otherwise, std::ptrdiff_t.

unspecified_type

Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is a class template instantiation of the form SomePointer<T, Args>, where Args is zero or more type arguments ; otherwise, the instantiation of rebind is ill-formed.

For portable code for C++03 and C++11,

    typename rebind_pointer<U>::type

shall be used instead of rebind to obtain a pointer to U.
unspecified

Ptr::reference if such a type exists (non-standard extension); otherwise, element_type &

unspecified_type
pointer `reference`

Remark: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise, it is element_type &.

Returns: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(reference). Non-standard extension: If such function does not exist, returns pointer(addressof(r));

Note: For non-conforming compilers only the existence of a member function called `pointer_to` is checked.

pointer `const UPtr &`

Remark: Non-standard extension.

Returns: A dereferenceable pointer to r obtained by calling the static template function Ptr::static_cast_from(UPpr/const UPpr &). If such function does not exist, returns pointer_to(static_cast<element_type&>(*uptr))

Note: For non-conforming compilers only the existence of a member function called `static_cast_from` is checked.

pointer `const UPtr &`

Remark: Non-standard extension.

Returns: A dereferenceable pointer to r obtained by calling the static template function Ptr::const_cast_from<UPtr>(UPpr/const UPpr &). If such function does not exist, returns pointer_to(const_cast<element_type&>(*uptr))

Note: For non-conforming compilers only the existence of a member function called `const_cast_from` is checked.

pointer `const UPtr &`

Remark: Non-standard extension.

Returns: A dereferenceable pointer to r obtained by calling the static template function Ptr::dynamic_cast_from<UPtr>(UPpr/const UPpr &). If such function does not exist, returns pointer_to(dynamic_cast<element_type>(&*uptr))

Note: For non-conforming compilers only the existence of a member function called `dynamic_cast_from` is checked.

T *

Specialization of `pointer_traits` for raw pointers

U *
T
T *
std::ptrdiff_t
std::size_t
T &

    U *

For portable code for C++03 and C++11,

    typename rebind_pointer<U>::type

shall be used instead of rebind to obtain a pointer to U.
U *
pointer `reference`

Returns: addressof(r)

pointer `U *`

Returns: static_cast<pointer>(uptr)

pointer `U *`

Returns: const_cast<pointer>(uptr)

pointer `U *`

Returns: dynamic_cast<pointer>(uptr)

void
T
T
bool
bool `const T &` `const T &`
void
bool `const T &` `const U &`
class ...

Helper metafunction to define a `rbtree` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template rbtree is an intrusive red-black tree container, that is used to construct intrusive set and multiset containers. The no-throw guarantee holds only, if the key_compare object doesn't throw.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

ValueTraits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
implementation_defined::insert_commit_data
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``rbtree` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `rbtree` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``rbtree` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

void ``rbtree` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``rbtree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``rbtree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

bool
Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

rbtree
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`rbtree` & ``rbtree` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`rbtree` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `rbtree` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`rbtree` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `rbtree` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

`rbtree_algorithms` provides basic algorithms to manipulate nodes forming a red-black tree. The insertion and deletion algorithms are based on those in Cormen, Leiserson, and Rivest, Introduction to Algorithms (MIT Press, 1990), except that

(1) the header node is maintained with links not only to the root but also to the leftmost node of the tree, to enable constant time begin(), and to the rightmost node of the tree, to enable linear time performance when used with the generic set algorithms (set_union, etc.);

(2) when a node being deleted has two children its successor node is relinked into its place, rather than copied, so that the only pointers invalidated are those referring to the deleted node.

`rbtree_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the binary search tree

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

`color`: The type that can store the color of a node

Static functions:

`static node_ptr get_parent(const_node_ptr n);`

`static void set_parent(node_ptr n, node_ptr parent);`

`static node_ptr get_left(const_node_ptr n);`

`static void set_left(node_ptr n, node_ptr left);`

`static node_ptr get_right(const_node_ptr n);`

`static void set_right(node_ptr n, node_ptr right);`

`static color get_color(const_node_ptr n);`

`static void set_color(node_ptr n, color c);`

`static color black();`

`static color red();`

NodeTraits
NodeTraits::node
NodeTraits::node_ptr
NodeTraits::const_node_ptr
NodeTraits::color

This type is the information that will be filled by insert_unique_check

bstree_algo::insert_commit_data
node_ptr `const const_node_ptr &`

Requires: 'node' is a node of the tree or a header node.

Effects: Returns the header of the tree.

Complexity: Logarithmic.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the first node of the tree, the header if the tree is empty.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the header of the tree.

Complexity: Constant time.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: header1 and header2 must be the header nodes of two trees.

Effects: Swaps two trees. After the function header1 will contain links to the second tree and header2 will have links to the first tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr` `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees with header header1 and header2.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing and comparison is needed. Experimental function

void `node_ptr` `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree with header "header" and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. Experimental function

void `const node_ptr &`

Requires: node is a tree node but not the header.

Effects: Unlinks the node and rebalances the tree.

Complexity: Average complexity is constant time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: header is the header of a tree.

Effects: Unlinks the leftmost node from the tree, and updates the header link to the new leftmost node.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the tree and the tree can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the tree.

bool `const const_node_ptr &`

Requires: 'node' is a node of the tree or a node initialized by init(...) or init_node.

Effects: Returns true if the node is initialized by init() or init_node().

Complexity: Constant time.

Throws: Nothing.

std::size_t `const const_node_ptr &`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: 'node' is a node from the tree except the header.

Effects: Returns the next node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `const node_ptr &`

Requires: 'node' is a node from the tree except the leftmost node.

Effects: Returns the previous node of the tree.

Complexity: Average constant time.

Throws: Nothing.

void `const node_ptr &`

Requires: 'node' must not be part of any tree.

Effects: After the function unique(node) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `node_ptr`

Requires: node must not be part of any tree.

Effects: Initializes the header to represent an empty tree. unique(header) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

node_ptr `node_ptr` `node_ptr`

Requires: header must be the header of a tree, z a node of that tree and z != header.

Effects: Erases node "z" from the tree with header "header".

Complexity: Amortized constant time.

Throws: Nothing.

bool `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2 if tree1 does not contain a node that is equivalent to z.

Returns: True if the node was trasferred, false otherwise.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `const_node_ptr` `node_ptr` `Cloner` `Disposer`

Requires: "cloner" must be a function object taking a node_ptr and returning a new cloned node of it. "disposer" must take a node_ptr and shouldn't throw.

Effects: First empties target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Then, duplicates the entire tree pointed by "source_header" cloning each source node with `node_ptr Cloner::operator()(const node_ptr &)` to obtain the nodes of the target tree. If "cloner" throws, the cloned target nodes are disposed using `void disposer(const node_ptr &)`.

Complexity: Linear to the number of element of the source tree plus the number of elements of tree target tree when calling this function.

Throws: If cloner functor throws. If this happens target nodes are disposed.

void `const node_ptr &` `Disposer`

Requires: "disposer" must be an object function taking a node_ptr parameter and shouldn't throw.

Effects: Empties the target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Complexity: Linear to the number of element of the source tree plus the. number of elements of tree target tree when calling this function.

Throws: Nothing.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const const_node_ptr &` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change.

std::size_t `const const_node_ptr &` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the lower bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "header" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. "hint" is node from the "header"'s tree.

Effects: Inserts new_node into the tree, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case).

Complexity: Logarithmic in general, but it is amortized constant time if new_node is inserted immediately before "hint".

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "pos" must be a valid iterator or header (end) node. "pos" must be an iterator pointing to the successor to "new_node" once inserted according to the order of already inserted nodes. This function does not check "pos" and this precondition must be guaranteed by the caller.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "pos" is not the successor of the newly inserted "new_node" tree invariants might be broken.

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering no less than the greatest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is less than the greatest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering, no greater than the lowest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is greater than the lowest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

std::pair< node_ptr, bool > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" and obtains the needed information to realize a constant-time node insertion if there is no equivalent node.

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic.

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

std::pair< node_ptr, bool > `const_node_ptr` `node_ptr` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr. "hint" is node from the "header"'s tree.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" using "hint" as a hint to where it should be inserted and obtains the needed information to realize a constant-time node insertion if there is no equivalent node. If "hint" is the upper_bound the function has constant time complexity (two comparisons in the worst case).

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic, but it is amortized constant time if new_node should be inserted immediately before "hint".

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

void `node_ptr` `node_ptr` `const insert_commit_data &`

Requires: "header" must be the header node of a tree. "commit_data" must have been obtained from a previous call to "insert_unique_check". No objects should have been inserted or erased from the set between the "insert_unique_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts new_node in the set using the information obtained from the "commit_data" that a previous "insert_check" filled.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_unique_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

bool `const const_node_ptr &`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

class ...

Helper metafunction to define a `multiset` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a `set` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template multiset is an intrusive container, that mimics most of the interface of std::multiset as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``multiset` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

multiset
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`multiset` & ``multiset` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`multiset` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `multiset` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`multiset` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `multiset` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

The class template set is an intrusive container, that mimics most of the interface of std::set as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``set` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

set
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`set` & ``set` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`set` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `set` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`set` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `set` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

bool class ... `const `set`< T, Options... > &` `const `set`< T, Options... > &`
bool class ... `const `set`< T, Options... > &` `const `set`< T, Options... > &`
bool class ... `const `set`< T, Options... > &` `const `set`< T, Options... > &`
bool class ... `const `set`< T, Options... > &` `const `set`< T, Options... > &`
void class ... ``set`< T, Options... > &` ``set`< T, Options... > &`
bool class ... `const `multiset`< T, Options... > &` `const `multiset`< T, Options... > &`
bool class ... `const `multiset`< T, Options... > &` `const `multiset`< T, Options... > &`
bool class ... `const `multiset`< T, Options... > &` `const `multiset`< T, Options... > &`
bool class ... `const `multiset`< T, Options... > &` `const `multiset`< T, Options... > &`
void class ... ``multiset`< T, Options... > &` ``multiset`< T, Options... > &`
class ...

Helper metafunction to define a ``set_base_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``set_member_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...
make_set_base_hook::type< O1, O2, O3, O4 >

Derive a class from `set_base_hook` in order to store objects in in a set/multiset. `set_base_hook` holds the data necessary to maintain the set/multiset and provides an appropriate `value_traits` class for set/multiset.

The hook admits the following options: `tag<>`, `void_pointer<>`, `link_mode<>` and `optimize_size<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``list_base_hook``, then each ``list_base_hook`` needs its unique tag.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`optimize_size<>` will tell the hook to optimize the hook for size instead of speed.

void ``set_base_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `set_base_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`set_base_hook` & `const `set_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a set an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...
make_set_member_hook::type< O1, O2, O3, O4 >

Put a public data member `set_member_hook` in order to store objects of this class in a set/multiset. `set_member_hook` holds the data necessary for maintaining the set/multiset and provides an appropriate `value_traits` class for set/multiset.

The hook admits the following options: `void_pointer<>`, `link_mode<>` and `optimize_size<>`.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`optimize_size<>` will tell the hook to optimize the hook for size instead of speed.

void ``set_member_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `set_member_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`set_member_hook` & `const `set_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in a set an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...

Helper metafunction to define a ``sg_multiset`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``sg_set`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template `sg_multiset` is an intrusive container, that mimics most of the interface of std::sg_multiset as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `floating_point<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``sg_multiset` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `sg_multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. Additional notes: it also copies the alpha factor from the source container.

void ``sg_multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics. Additional notes: it also copies the alpha factor from the source container.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

float

Returns: The balance factor (alpha) used in this tree

Throws: Nothing.

Complexity: Constant.

void `float`

Requires: new_alpha must be a value between 0.5 and 1.0

Effects: Establishes a new balance factor (alpha) and rebalances the tree if the new balance factor is stricter (less) than the old factor.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

void class ... ``sg_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``sg_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

sg_multiset
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`sg_multiset` & ``sg_multiset` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`sg_multiset` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `sg_multiset` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`sg_multiset` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `sg_multiset` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

The class template `sg_set` is an intrusive container, that mimics most of the interface of std::sg_set as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `floating_point<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``sg_set` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `sg_set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. Additional notes: it also copies the alpha factor from the source container.

void ``sg_set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics. Additional notes: it also copies the alpha factor from the source container.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

float

Returns: The balance factor (alpha) used in this tree

Throws: Nothing.

Complexity: Constant.

void `float`

Requires: new_alpha must be a value between 0.5 and 1.0

Effects: Establishes a new balance factor (alpha) and rebalances the tree if the new balance factor is stricter (less) than the old factor.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

void class ... ``sg_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``sg_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

sg_set
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`sg_set` & ``sg_set` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`sg_set` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `sg_set` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`sg_set` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `sg_set` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

bool class ... `const `sg_set`< T, Options... > &` `const `sg_set`< T, Options... > &`
bool class ... `const `sg_set`< T, Options... > &` `const `sg_set`< T, Options... > &`
bool class ... `const `sg_set`< T, Options... > &` `const `sg_set`< T, Options... > &`
bool class ... `const `sg_set`< T, Options... > &` `const `sg_set`< T, Options... > &`
void class ... ``sg_set`< T, Options... > &` ``sg_set`< T, Options... > &`
bool class ... `const `sg_multiset`< T, Options... > &` `const `sg_multiset`< T, Options... > &`
bool class ... `const `sg_multiset`< T, Options... > &` `const `sg_multiset`< T, Options... > &`
bool class ... `const `sg_multiset`< T, Options... > &` `const `sg_multiset`< T, Options... > &`
bool class ... `const `sg_multiset`< T, Options... > &` `const `sg_multiset`< T, Options... > &`
void class ... ``sg_multiset`< T, Options... > &` ``sg_multiset`< T, Options... > &`
class ...

Helper metafunction to define a `sgtree` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template sgtree is an intrusive scapegoat tree container, that is used to construct intrusive `sg_set` and `sg_multiset` containers. The no-throw guarantee holds only, if the value_compare object doesn't throw.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `floating_point<>`, `size_type<>` and `compare<>`.

ValueTraits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined
implementation_defined
const bool
const bool
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``sgtree` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `sgtree` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. Additional notes: it also copies the alpha factor from the source container.

void ``sgtree` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics. Additional notes: it also copies the alpha factor from the source container.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator BOOST_INTRUSIVE_I bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

void class ... ``sgtree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

it !
itend
void class ... ``sgtree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

it !
itend
size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

float

Returns: The balance factor (alpha) used in this tree

Throws: Nothing.

Complexity: Constant.

void `float`

Requires: new_alpha must be a value between 0.5 and 1.0

Effects: Establishes a new balance factor (alpha) and rebalances the tree if the new balance factor is stricter (less) than the old factor.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

bool
Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

sgtree
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`sgtree` & ``sgtree` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`sgtree` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `sgtree` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`sgtree` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `sgtree` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

`sgtree_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the binary search tree

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_parent(const_node_ptr n);`

`static void set_parent(node_ptr n, node_ptr parent);`

`static node_ptr get_left(const_node_ptr n);`

`static void set_left(node_ptr n, node_ptr left);`

`static node_ptr get_right(const_node_ptr n);`

`static void set_right(node_ptr n, node_ptr right);`

insert_commit_data

This type is the information that will be filled by insert_unique_check

std::size_t
NodeTraits::node
NodeTraits
NodeTraits::node_ptr
NodeTraits::const_node_ptr
node_ptr `const_node_ptr`

Requires: 'node' is a node of the tree or a header node.

Effects: Returns the header of the tree.

Complexity: Logarithmic.

Throws: Nothing.

node_ptr `const_node_ptr`

Requires: 'header' is the header node of a tree.

Effects: Returns the first node of the tree, the header if the tree is empty.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const_node_ptr`

Requires: 'header' is the header node of a tree.

Effects: Returns the header of the tree.

Complexity: Constant time.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: header1 and header2 must be the header nodes of two trees.

Effects: Swaps two trees. After the function header1 will contain links to the second tree and header2 will have links to the first tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr` `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees with header header1 and header2.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing and comparison is needed. Experimental function

void `node_ptr` `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree with header "header" and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. Experimental function

node_ptr `node_ptr` static void unlink(node_ptr node) BOOST_NOEXCEPT;

Requires: header is the header of a tree.

Effects: Unlinks the leftmost node from the tree, and updates the header link to the new leftmost node.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the tree and the tree can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the tree.

bool `const_node_ptr`

Requires: 'node' is a node of the tree or a node initialized by init(...) or init_node.

Effects: Returns true if the node is initialized by init() or init_node().

Complexity: Constant time.

Throws: Nothing.

std::size_t `const_node_ptr`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node from the tree except the header.

Effects: Returns the next node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node from the tree except the leftmost node.

Effects: Returns the previous node of the tree.

Complexity: Average constant time.

Throws: Nothing.

void `node_ptr`

Requires: 'node' must not be part of any tree.

Effects: After the function unique(node) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `node_ptr`

Requires: node must not be part of any tree.

Effects: Initializes the header to represent an empty tree. unique(header) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

node_ptr `node_ptr` `node_ptr` `std::size_t` `std::size_t &` `AlphaByMaxSize`

Requires: header must be the header of a tree, z a node of that tree and z != header.

Effects: Erases node "z" from the tree with header "header".

Complexity: Amortized constant time.

Throws: Nothing.

void `const_node_ptr` `node_ptr` `Cloner` `Disposer`

Requires: "cloner" must be a function object taking a node_ptr and returning a new cloned node of it. "disposer" must take a node_ptr and shouldn't throw.

Effects: First empties target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Then, duplicates the entire tree pointed by "source_header" cloning each source node with `node_ptr Cloner::operator()(const node_ptr &)` to obtain the nodes of the target tree. If "cloner" throws, the cloned target nodes are disposed using `void disposer(const node_ptr &)`.

Complexity: Linear to the number of element of the source tree plus the number of elements of tree target tree when calling this function.

Throws: If cloner functor throws. If this happens target nodes are disposed.

void `node_ptr` `Disposer`

Requires: "disposer" must be an object function taking a node_ptr parameter and shouldn't throw.

Effects: Empties the target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Complexity: Linear to the number of element of the source tree plus the. number of elements of tree target tree when calling this function.

Throws: Nothing.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change.

std::size_t `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the lower bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "header" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. "hint" is node from the "header"'s tree.

Effects: Inserts new_node into the tree, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case).

Complexity: Logarithmic in general, but it is amortized constant time if new_node is inserted immediately before "hint".

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "header" must be the header node of a tree. "pos" must be a valid iterator or header (end) node. "pos" must be an iterator pointing to the successor to "new_node" once inserted according to the order of already inserted nodes. This function does not check "pos" and this precondition must be guaranteed by the caller.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "pos" is not the successor of the newly inserted "new_node" tree invariants might be broken.

void `node_ptr` `node_ptr` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering no less than the greatest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is less than the greatest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

void `node_ptr` `node_ptr` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering, no greater than the lowest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is greater than the lowest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

std::pair< node_ptr, bool > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare` ``insert_commit_data` &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" and obtains the needed information to realize a constant-time node insertion if there is no equivalent node.

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic.

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

std::pair< node_ptr, bool > `const_node_ptr` `node_ptr` `const KeyType &` `KeyNodePtrCompare` ``insert_commit_data` &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr. "hint" is node from the "header"'s tree.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" using "hint" as a hint to where it should be inserted and obtains the needed information to realize a constant-time node insertion if there is no equivalent node. If "hint" is the upper_bound the function has constant time complexity (two comparisons in the worst case).

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic, but it is amortized constant time if new_node should be inserted immediately before "hint".

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

void `node_ptr` `node_ptr` `const `insert_commit_data` &` `std::size_t` `H_Alpha` `std::size_t &`

Requires: "header" must be the header node of a tree. "commit_data" must have been obtained from a previous call to "insert_unique_check". No objects should have been inserted or erased from the set between the "insert_unique_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts new_node in the set using the information obtained from the "commit_data" that a previous "insert_check" filled.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_unique_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

bool `node_ptr` `NodePtrCompare` `std::size_t` `std::size_t &` `node_ptr` `node_ptr` `std::size_t` `std::size_t &` `H_Alpha` `AlphaByMaxSize`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2 if tree1 does not contain a node that is equivalent to z.

Returns: True if the node was trasferred, false otherwise.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr` `NodePtrCompare` `std::size_t` `std::size_t &` `node_ptr` `node_ptr` `std::size_t` `std::size_t &` `H_Alpha` `AlphaByMaxSize`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2.

Complexity: Logarithmic.

Throws: If the comparison throws.

bool `const_node_ptr`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

class ...

Helper metafunction to define a `slist` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template slist is an intrusive container, that encapsulates a singly-linked list. You can use such a list to squeeze the last bit of performance from your application. Unfortunately, the little gains come with some huge drawbacks. A lot of member functions can't be implemented as efficiently as for standard containers. To overcome this limitation some other member functions with rather unusual semantics have to be introduced.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `linear<>` and `cache_last<>`.

The iterators of slist are forward iterators. slist provides a static function called "previous" to compute the previous iterator of a given iterator. This function has linear complexity. To improve the usability esp. with the '*_after' functions, ++end() == begin() and previous(begin()) == end() are defined. An new special function "before_begin()" is defined, which returns an iterator that points one less the beginning of the list: ++before_begin() == begin()

ValueTraits
value_traits::pointer
value_traits::const_pointer
`pointer_traits`< pointer >::element_type
`pointer_traits`< pointer >::reference
`pointer_traits`< const_pointer >::reference
`pointer_traits`< pointer >::difference_type
SizeType
slist_iterator< value_traits, false >
slist_iterator< value_traits, true >
value_traits::node_traits
node_traits::node
node_traits::node_ptr
node_traits::const_node_ptr
unspecified
unspecified
const bool
const bool
const bool
const bool
const bool
void

Effects: Erases all the elements of the container.

Throws: Nothing.

Complexity: Linear to the number of elements of the list. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements of the container Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Complexity: Linear to the number of elements of the list.

Note: Invalidates the iterators to the erased elements.

void `reference`

Requires: value must be an lvalue.

Effects: Inserts the value in the front of the list. No copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void `reference`

Requires: value must be an lvalue.

Effects: Inserts the value in the back of the list. No copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references. This function is only available is cache_last<> is true.

void

Effects: Erases the first element of the list. No destructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators (but not the references) to the erased element.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the first element of the list. Disposer::operator()(pointer) is called for the removed element.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators to the erased element.

reference

Effects: Returns a reference to the first element of the list.

Throws: Nothing.

Complexity: Constant.

const_reference

Effects: Returns a const_reference to the first element of the list.

Throws: Nothing.

Complexity: Constant.

reference

Effects: Returns a reference to the last element of the list.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references. This function is only available is cache_last<> is true.

const_reference

Effects: Returns a const_reference to the last element of the list.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references. This function is only available is cache_last<> is true.

iterator

Effects: Returns an iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the first element contained in the list.

Throws: Nothing.

Complexity: Constant.

iterator

Effects: Returns an iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns a const_iterator to the end of the list.

Throws: Nothing.

Complexity: Constant.

iterator

Effects: Returns an iterator that points to a position before the first element. Equivalent to "end()"

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns an iterator that points to a position before the first element. Equivalent to "end()"

Throws: Nothing.

Complexity: Constant.

const_iterator

Effects: Returns an iterator that points to a position before the first element. Equivalent to "end()"

Throws: Nothing.

Complexity: Constant.

iterator

Effects: Returns an iterator to the last element contained in the list.

Throws: Nothing.

Complexity: Constant.

Note: This function is present only if cached_last<> option is true.

const_iterator

Effects: Returns a const_iterator to the last element contained in the list.

Throws: Nothing.

Complexity: Constant.

Note: This function is present only if cached_last<> option is true.

const_iterator

Effects: Returns a const_iterator to the last element contained in the list.

Throws: Nothing.

Complexity: Constant.

Note: This function is present only if cached_last<> option is true.

size_type

Effects: Returns the number of the elements contained in the list.

Throws: Nothing.

Complexity: Linear to the number of elements contained in the list. if `constant_time_size` is false. Constant time otherwise.

Note: Does not affect the validity of iterators and references.

bool

Effects: Returns true if the list contains no elements.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void ``slist` &`

Effects: Swaps the elements of x and *this.

Throws: Nothing.

Complexity: Linear to the number of elements of both lists. Constant-time if linear<> and/or cache_last<> options are used.

Note: Does not affect the validity of iterators and references.

void `size_type1`

Effects: Moves backwards all the elements, so that the first element becomes the second, the second becomes the third... the last element becomes the first one.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number shifts.

Note: Iterators Does not affect the validity of iterators and references.

void `size_type1`

Effects: Moves forward all the elements, so that the second element becomes the first, the third becomes the second... the first element becomes the last one.

Throws: Nothing.

Complexity: Linear to the number of elements plus the number shifts.

Note: Does not affect the validity of iterators and references.

void `const `slist` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws.

void ``slist` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws.

iterator `const_iterator` `reference`

Requires: value must be an lvalue and prev_p must point to an element contained by the list or to end().

Effects: Inserts the value after the position pointed by prev_p. No copy constructor is called.

Returns: An iterator to the inserted element.

Throws: Nothing.

Complexity: Constant.

Note: Does not affect the validity of iterators and references.

void `const_iterator` `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type and prev_p must point to an element contained by the list or to the end node.

Effects: Inserts the [f, l) after the position prev_p.

Throws: Nothing.

Complexity: Linear to the number of elements inserted.

Note: Does not affect the validity of iterators and references.

iterator `const_iterator` `reference`

Requires: value must be an lvalue and p must point to an element contained by the list or to end().

Effects: Inserts the value before the position pointed by p. No copy constructor is called.

Throws: Nothing.

Complexity: Linear to the number of elements before p. Constant-time if cache_last<> is true and p == end().

Note: Does not affect the validity of iterators and references.

void `const_iterator` `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type and p must point to an element contained by the list or to the end node.

Effects: Inserts the pointed by b and e before the position p. No copy constructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements inserted plus linear to the elements before b. Linear to the number of elements to insert if cache_last<> option is true and p == end().

Note: Does not affect the validity of iterators and references.

iterator `const_iterator`

Effects: Erases the element after the element pointed by prev of the list. No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator` `const_iterator`

Effects: Erases the range (before_f, l) from the list. No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the number of erased elements if it's a safe-mode , auto-unlink value or constant-time size is activated. Constant time otherwise.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator` `const_iterator` `size_type`

Effects: Erases the range (before_f, l) from the list. n must be distance(before_f, l) - 1. No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: constant-time if `link_mode` is normal_link. Linear to the elements (l - before_f) otherwise.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator`

Effects: Erases the element pointed by i of the list. No destructors are called.

Returns: the first element remaining beyond the removed element, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the elements before i.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator` `const_iterator`

Requires: f and l must be valid iterator to elements in *this.

Effects: Erases the range pointed by b and e. No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the elements before l.

Note: Invalidates the iterators (but not the references) to the erased elements.

iterator `const_iterator` `const_iterator` `size_type`

Effects: Erases the range [f, l) from the list. n must be distance(f, l). No destructors are called.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: linear to the elements before f if `link_mode` is normal_link and `constant_time_size` is activated. Linear to the elements before l otherwise.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element after the element pointed by prev of the list. Disposer::operator()(pointer) is called for the removed element.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Constant.

Note: Invalidates the iterators to the erased element.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range (before_f, l) from the list. Disposer::operator()(pointer) is called for the removed elements.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the elements (l - before_f + 1).

Note: Invalidates the iterators to the erased element.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed by i of the list. No destructors are called. Disposer::operator()(pointer) is called for the removed element.

Returns: the first element remaining beyond the removed element, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the elements before i.

Note: Invalidates the iterators (but not the references) to the erased element.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: f and l must be valid iterator to elements in *this. Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed by b and e. No destructors are called. Disposer::operator()(pointer) is called for the removed elements.

Returns: the first element remaining beyond the removed elements, or end() if no such element exists.

Throws: Nothing.

Complexity: Linear to the number of erased elements plus linear to the elements before f.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Clears the list and inserts the range pointed by b and e. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements inserted plus linear to the elements contained in the list if it's a safe-mode or auto-unlink value. Linear to the number of elements inserted in the list otherwise.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `Disposer` `Iterator` `Iterator`

Requires: Disposer::operator()(pointer) shouldn't throw.

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Clears the list and inserts the range pointed by b and e. No destructors or copy constructors are called. Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Complexity: Linear to the number of elements inserted plus linear to the elements contained in the list.

Note: Invalidates the iterators (but not the references) to the erased elements.

void `const_iterator` ``slist` &` `const_iterator *0`

Requires: prev must point to an element contained by this list or to the before_begin() element

Effects: Transfers all the elements of list x to this list, after the the element pointed by prev. No destructors or copy constructors are called.

Returns: Nothing.

Throws: Nothing.

Complexity: In general, linear to the elements contained in x. Constant-time if cache_last<> option is true and also constant-time if linear<> option is true "this" is empty and "l" is not used.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

Additional note: If the optional parameter "l" is provided, it will be assigned to the last spliced element or prev if x is empty. This iterator can be used as new "prev" iterator for a new splice_after call. that will splice new values after the previously spliced values.

void `const_iterator` ``slist` &` `const_iterator`

Requires: prev must point to an element contained by this list or to the before_begin() element. prev_ele must point to an element contained in list x or must be x.before_begin().

Effects: Transfers the element after prev_ele, from list x to this list, after the element pointed by prev. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Constant.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``slist` &` `const_iterator` `const_iterator`

Requires: prev_pos must be a dereferenceable iterator in *this or be before_begin(), and before_f and before_l belong to x and ++before_f != x.end() && before_l != x.end().

Effects: Transfers the range (before_f, before_l] from list x to this list, after the element pointed by prev_pos. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the number of elements transferred if `constant_time_size` is true. Constant-time otherwise.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``slist` &` `const_iterator` `const_iterator` `size_type`

Requires: prev_pos must be a dereferenceable iterator in *this or be before_begin(), and before_f and before_l belong to x and ++before_f != x.end() && before_l != x.end() and n == distance(before_f, before_l).

Effects: Transfers the range (before_f, before_l] from list x to this list, after the element pointed by p. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Constant time.

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``slist` &` `const_iterator *0`

Requires: it is an iterator to an element in *this.

Effects: Transfers all the elements of list x to this list, before the the element pointed by it. No destructors or copy constructors are called.

Returns: Nothing.

Throws: Nothing.

Complexity: Linear to the elements contained in x plus linear to the elements before it. Linear to the elements before it if cache_last<> option is true. Constant-time if cache_last<> option is true and it == end().

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

Additional note: If the optional parameter "l" is provided, it will be assigned to the last spliced element or prev if x is empty. This iterator can be used as new "prev" iterator for a new splice_after call. that will splice new values after the previously spliced values.

void `const_iterator` ``slist` &` `const_iterator`

Requires: it p must be a valid iterator of *this. elem must point to an element contained in list x.

Effects: Transfers the element elem, from list x to this list, before the element pointed by pos. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the elements before pos and before elem. Linear to the elements before elem if cache_last<> option is true and pos == end().

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``slist` &` `const_iterator` `const_iterator`

Requires: pos must be a dereferenceable iterator in *this and f and f belong to x and f and f a valid range on x.

Effects: Transfers the range [f, l) from list x to this list, before the element pointed by pos. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the sum of elements before pos, f, and l plus linear to the number of elements transferred if `constant_time_size` is true. Linear to the sum of elements before f, and l plus linear to the number of elements transferred if `constant_time_size` is true if cache_last<> is true and pos == end()

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `const_iterator` ``slist` &` `const_iterator` `const_iterator` `size_type`

Requires: pos must be a dereferenceable iterator in *this and f and l belong to x and f and l a valid range on x. n == distance(f, l).

Effects: Transfers the range [f, l) from list x to this list, before the element pointed by pos. No destructors or copy constructors are called.

Throws: Nothing.

Complexity: Linear to the sum of elements before pos, f, and l. Linear to the sum of elements before f and l if cache_last<> is true and pos == end().

Note: Iterators of values obtained from list x now point to elements of this list. Iterators of this list and all the references are not invalidated.

void `Predicate`

Effects: This function sorts the list *this according to operator<. The sort is stable, that is, the relative order of equivalent elements is preserved.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the predicate throws. Basic guarantee.

Complexity: The number of comparisons is approximately N log N, where N is the list's size.

Note: Iterators and references are not invalidated

void

Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or operator< throws. Basic guarantee.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references are not invalidated.

void ``slist` &` `Predicate` `const_iterator *0`

Requires: p must be a comparison function that induces a strict weak ordering and both *this and x must be sorted according to that ordering The lists x and *this must be distinct.

Effects: This function removes all of x's elements and inserts them in order into *this. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Returns: Nothing.

Throws: If the predicate throws. Basic guarantee.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references are not invalidated.

Additional note: If optional "l" argument is passed, it is assigned to an iterator to the last transferred value or end() is x is empty.

void ``slist` &`

Effects: This function removes all of x's elements and inserts them in order into *this according to operator<. The merge is stable; that is, if an element from *this is equivalent to one from x, then the element from *this will precede the one from x.

Throws: if operator< throws. Basic guarantee.

Complexity: This function is linear time: it performs at most size() + x.size() - 1 comparisons.

Note: Iterators and references are not invalidated

void

Effects: Reverses the order of elements in the list.

Throws: Nothing.

Complexity: This function is linear to the contained elements.

Note: Iterators and references are not invalidated

void `const_reference`

Effects: Removes all the elements that compare equal to value. No destructors are called.

Throws: If operator== throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid. This function is linear time: it performs exactly size() comparisons for equality.

void `const_reference` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes all the elements that compare equal to value. Disposer::operator()(pointer) is called for every removed element.

Throws: If operator== throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `Pred`

Effects: Removes all the elements for which a specified predicate is satisfied. No destructors are called.

Throws: If pred throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() calls to the predicate.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `Pred` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes all the elements for which a specified predicate is satisfied. Disposer::operator()(pointer) is called for every removed element.

Throws: If pred throws. Basic guarantee.

Complexity: Linear time. It performs exactly size() comparisons for equality.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void

Effects: Removes adjacent duplicate elements or adjacent elements that are equal from the list. No destructors are called.

Throws: If operator== throws. Basic guarantee.

Complexity: Linear time (size()-1) comparisons calls to pred()).

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `BinaryPredicate`

Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. No destructors are called.

Throws: If the predicate throws. Basic guarantee.

Complexity: Linear time (size()-1) comparisons equality comparisons.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. Disposer::operator()(pointer) is called for every removed element.

Throws: If operator== throws. Basic guarantee.

Complexity: Linear time (size()-1) comparisons equality comparisons.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

void `BinaryPredicate` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Removes adjacent duplicate elements or adjacent elements that satisfy some binary predicate from the list. Disposer::operator()(pointer) is called for every removed element.

Throws: If the predicate throws. Basic guarantee.

Complexity: Linear time (size()-1) comparisons equality comparisons.

Note: The relative order of elements that are not removed is unchanged, and iterators to elements that are not removed remain valid.

iterator `reference`

Requires: value must be a reference to a value inserted in a list.

Effects: This function returns a const_iterator pointing to the element

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated.

const_iterator `const_reference`

Requires: value must be a const reference to a value inserted in a list.

Effects: This function returns an iterator pointing to the element.

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated.

iterator `iterator`

Returns: The iterator to the element before i in the list. Returns the end-iterator, if either i is the begin-iterator or the list is empty.

Throws: Nothing.

Complexity: Linear to the number of elements before i. Constant if cache_last<> is true and i == end().

const_iterator `const_iterator`

Returns: The const_iterator to the element before i in the list. Returns the end-const_iterator, if either i is the begin-const_iterator or the list is empty.

Throws: Nothing.

Complexity: Linear to the number of elements before i. Constant if cache_last<> is true and i == end().

iterator `const_iterator` `iterator`

Returns: The iterator to the element before i in the list, starting the search on element after prev_from. Returns the end-iterator, if either i is the begin-iterator or the list is empty.

Throws: Nothing.

Complexity: Linear to the number of elements before i. Constant if cache_last<> is true and i == end().

const_iterator `const_iterator` `const_iterator`

Returns: The const_iterator to the element before i in the list, starting the search on element after prev_from. Returns the end-const_iterator, if either i is the begin-const_iterator or the list is empty.

Throws: Nothing.

Complexity: Linear to the number of elements before i. Constant if cache_last<> is true and i == end().

void

Effects: Asserts the integrity of the container.

Complexity: Linear time.

Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

Effects: constructs an empty list.

Complexity: Constant

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks).

const value_traits &

Effects: constructs an empty list.

Complexity: Constant

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks).

Iterator
Iterator
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Constructs a list equal to [b ,e).

Complexity: Linear in distance(b, e). No copy constructors are called.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks).

slist
&&

Effects: Constructs a container moving resources from another container. Internal value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of value traits throws.

`slist` & ``slist` &&`

Effects: Equivalent to swap

Effects: If it's a safe-mode or auto-unlink value, the destructor does nothing (ie. no code is generated). Otherwise it detaches all elements from this. In this case the objects in the list are not deleted (i.e. no destructors are called), but the hooks according to the `value_traits` template parameter are set to their default value.

Complexity: Linear to the number of elements in the list, if it's a safe-mode or auto-unlink value. Otherwise constant.

`slist` & `iterator`

Precondition: end_iterator must be a valid end iterator of slist.

Effects: Returns a const reference to the slist associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `slist` & `const_iterator`

Precondition: end_iterator must be a valid end const_iterator of slist.

Effects: Returns a const reference to the slist associated to the end iterator

Throws: Nothing.

Complexity: Constant.

iterator `reference`

Requires: value must be a reference to a value inserted in a list.

Effects: This function returns a const_iterator pointing to the element

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated. This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be a const reference to a value inserted in a list.

Effects: This function returns an iterator pointing to the element.

Throws: Nothing.

Complexity: Constant time.

Note: Iterators and references are not invalidated. This static function is available only if the value traits is stateless.

void `node_ptr` ``slist` &` `node_ptr` `node_ptr`
void `node_ptr` `node_ptr` `node_ptr`
void `unspecified`
void `unspecified`
void `size_type` `unspecified`
void `size_type` `unspecified`
void `size_type` `unspecified`
void `size_type` `unspecified`
void ``slist` *` ``slist` *`
void `node_ptr` `node_ptr` `unspecified`
void `node_ptr` `node_ptr` `unspecified`
`slist` & `const const_iterator &`
class ...

Helper metafunction to define a ``slist_base_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``slist_member_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...
make_slist_base_hook::type< O1, O2, O3 >

Derive a class from `slist_base_hook` in order to store objects in in an list. `slist_base_hook` holds the data necessary to maintain the list and provides an appropriate `value_traits` class for list.

The hook admits the following options: `tag<>`, `void_pointer<>` and `link_mode<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``list_base_hook``, then each ``list_base_hook`` needs its unique tag.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

void ``slist_base_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `slist::iterator_to` will return a valid iterator.

Throws: Nothing.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `slist_base_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`slist_base_hook` & `const `slist_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in an slist an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...
make_slist_member_hook::type< O1, O2, O3 >

Put a public data member `slist_member_hook` in order to store objects of this class in an list. `slist_member_hook` holds the data necessary for maintaining the list and provides an appropriate `value_traits` class for list.

The hook admits the following options: `void_pointer<>` and `link_mode<>`.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

void ``slist_member_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `slist::iterator_to` will return a valid iterator.

Note: If this member is called when the value is inserted in a slist with the option linear<true>, this function will return "false" for the last element, as it is not linked to anything (the next element is null), so use with care.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `slist_member_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`slist_member_hook` & `const `slist_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in an slist an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...

Helper metafunction to define a ``splay_multiset`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``splay_set`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template `splay_multiset` is an intrusive container, that mimics most of the interface of std::multiset as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``splay_multiset` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `splay_multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. Additional notes: it also copies the alpha factor from the source container.

void ``splay_multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

std::pair< iterator, iterator > `const_reference` `const_reference` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const_reference` `const_reference` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void `iterator`

Requires: i must be a valid iterator of *this.

Effects: Rearranges the container so that the element pointed by i is placed as the root of the tree, improving future searches of this value.

Complexity: Amortized logarithmic.

Throws: Nothing.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Rearranges the container so that if *this stores an element with a key equivalent to value the element is placed as the root of the tree. If the element is not present returns the last node compared with the key. If the tree is empty, end() is returned.

Complexity: Amortized logarithmic.

Returns: An iterator to the new root of the tree, end() if the tree is empty.

Throws: If the comparison functor throws.

iterator `const key_type &`

Effects: Rearranges the container so that if *this stores an element with a key equivalent to value the element is placed as the root of the tree.

Complexity: Amortized logarithmic.

Returns: An iterator to the new root of the tree, end() if the tree is empty.

Throws: If the predicate throws.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

void class ... ``splay_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``splay_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

splay_multiset
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`splay_multiset` & ``splay_multiset` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`splay_multiset` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `splay_multiset` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`splay_multiset` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `splay_multiset` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

The class template `splay_set` is an intrusive container, that mimics most of the interface of std::set as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``splay_set` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `splay_set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. Additional notes: it also copies the alpha factor from the source container.

void ``splay_set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void `iterator`

Requires: i must be a valid iterator of *this.

Effects: Rearranges the container so that the element pointed by i is placed as the root of the tree, improving future searches of this value.

Complexity: Amortized logarithmic.

Throws: Nothing.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Rearranges the container so that if *this stores an element with a key equivalent to value the element is placed as the root of the tree. If the element is not present returns the last node compared with the key. If the tree is empty, end() is returned.

Complexity: Amortized logarithmic.

Returns: An iterator to the new root of the tree, end() if the tree is empty.

Throws: If the comparison functor throws.

iterator `const key_type &`

Effects: Rearranges the container so that if *this stores an element with a key equivalent to value the element is placed as the root of the tree.

Complexity: Amortized logarithmic.

Returns: An iterator to the new root of the tree, end() if the tree is empty.

Throws: If the predicate throws.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

void class ... ``splay_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``splay_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

splay_set
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`splay_set` & ``splay_set` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`splay_set` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `splay_set` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`splay_set` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `splay_set` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

bool class ... `const `splay_set`< T, Options... > &` `const `splay_set`< T, Options... > &`
bool class ... `const `splay_set`< T, Options... > &` `const `splay_set`< T, Options... > &`
bool class ... `const `splay_set`< T, Options... > &` `const `splay_set`< T, Options... > &`
bool class ... `const `splay_set`< T, Options... > &` `const `splay_set`< T, Options... > &`
void class ... ``splay_set`< T, Options... > &` ``splay_set`< T, Options... > &`
bool class ... `const `splay_multiset`< T, Options... > &` `const `splay_multiset`< T, Options... > &`
bool class ... `const `splay_multiset`< T, Options... > &` `const `splay_multiset`< T, Options... > &`
bool class ... `const `splay_multiset`< T, Options... > &` `const `splay_multiset`< T, Options... > &`
bool class ... `const `splay_multiset`< T, Options... > &` `const `splay_multiset`< T, Options... > &`
void class ... ``splay_multiset`< T, Options... > &` ``splay_multiset`< T, Options... > &`
class ...

Helper metafunction to define a `splaytree` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

The class template splaytree is an intrusive splay tree container that is used to construct intrusive `splay_set` and `splay_multiset` containers. The no-throw guarantee holds only, if the key_compare object doesn't throw.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>` and `compare<>`.

ValueTraits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
implementation_defined::insert_commit_data
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``splaytree` &`

Effects: Swaps the contents of two containers.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `splaytree` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee. Additional notes: it also copies the alpha factor from the source container.

void ``splaytree` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

Note: This version can modify the source container, useful to implement move semantics.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare ordering function throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const_iterator` `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. The difference is that comp compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp ordering function throws. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the container using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by value_comp().

Throws: If the comparison functor call throws.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: Nothing.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk) and nk the key_type of a value_type inserted into `*this`.

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "value"

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws. Additional note: const function, no splaying is performed

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: non-const function, splaying is performed for the first element of the equal range of "key"

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws. Additional note: const function, no splaying is performed

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``splaytree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``splaytree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void `iterator`

Requires: i must be a valid iterator of *this.

Effects: Rearranges the container so that the element pointed by i is placed as the root of the tree, improving future searches of this value.

Complexity: Amortized logarithmic.

Throws: Nothing.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Rearranges the container so that if *this stores an element with a key equivalent to value the element is placed as the root of the tree. If the element is not present returns the last node compared with the key. If the tree is empty, end() is returned.

Complexity: Amortized logarithmic.

Returns: An iterator to the new root of the tree, end() if the tree is empty.

Throws: If the comparison functor throws.

iterator `const key_type &`

Effects: Rearranges the container so that if *this stores an element with a key equivalent to value the element is placed as the root of the tree.

Complexity: Amortized logarithmic.

Returns: An iterator to the new root of the tree, end() if the tree is empty.

Throws: If the predicate throws.

void

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

iterator `iterator`

Requires: old_root is a node of a tree.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear to the elements in the subtree.

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

const key_compare &
const value_traits &
value_traits()

Effects: Constructs an empty container with given comparison and traits.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the key_compare object throws. Basic guarantee.

bool
Iterator
Iterator
const key_compare &
key_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare object throws. Basic guarantee.

splaytree
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`splaytree` & ``splaytree` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`splaytree` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `splaytree` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`splaytree` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `splaytree` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

A splay tree is an implementation of a binary search tree. The tree is self balancing using the splay algorithm as described in

"Self-Adjusting Binary Search Trees by Daniel Dominic Sleator and Robert Endre Tarjan AT&T Bell Laboratories, Murray Hill, NJ Journal of the ACM, Vol 32, no 3, July 1985, pp 652-686

`splaytree_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the binary search tree

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_parent(const_node_ptr n);`

`static void set_parent(node_ptr n, node_ptr parent);`

`static node_ptr get_left(const_node_ptr n);`

`static void set_left(node_ptr n, node_ptr left);`

`static node_ptr get_right(const_node_ptr n);`

`static void set_right(node_ptr n, node_ptr right);`

NodeTraits::node
NodeTraits
NodeTraits::node_ptr
NodeTraits::const_node_ptr

This type is the information that will be filled by insert_unique_check

bstree_algo::insert_commit_data
node_ptr `const const_node_ptr &`

Requires: 'node' is a node of the tree or a header node.

Effects: Returns the header of the tree.

Complexity: Logarithmic.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the first node of the tree, the header if the tree is empty.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const const_node_ptr &`

Requires: 'header' is the header node of a tree.

Effects: Returns the header of the tree.

Complexity: Constant time.

Throws: Nothing.

void `const node_ptr &` `const node_ptr &`

Requires: header1 and header2 must be the header nodes of two trees.

Effects: Swaps two trees. After the function header1 will contain links to the second tree and header2 will have links to the first tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr` `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees with header header1 and header2.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing and comparison is needed. Experimental function

void `node_ptr` `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree with header "header" and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. Experimental function

void `node_ptr`

Requires: node is a tree node but not the header.

Effects: Unlinks the node and rebalances the tree.

Complexity: Average complexity is constant time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: header is the header of a tree.

Effects: Unlinks the leftmost node from the tree, and updates the header link to the new leftmost node.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the tree and the tree can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the tree.

bool `const_node_ptr`

Requires: 'node' is a node of the tree or a node initialized by init(...) or init_node.

Effects: Returns true if the node is initialized by init() or init_node().

Complexity: Constant time.

Throws: Nothing.

std::size_t `const_node_ptr`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node from the tree except the header.

Effects: Returns the next node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node from the tree except the leftmost node.

Effects: Returns the previous node of the tree.

Complexity: Average constant time.

Throws: Nothing.

void `node_ptr`

Requires: 'node' must not be part of any tree.

Effects: After the function unique(node) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `node_ptr`

Requires: node must not be part of any tree.

Effects: Initializes the header to represent an empty tree. unique(header) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `node_ptr` `node_ptr`

Requires: header must be the header of a tree, z a node of that tree and z != header.

Effects: Erases node "z" from the tree with header "header".

Complexity: Amortized constant time.

Throws: Nothing. Additional notes: the previous node of z is splayed to speed up range deletions.

bool `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2 if tree1 does not contain a node that is equivalent to z.

Returns: True if the node was trasferred, false otherwise.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr` `NodePtrCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `const_node_ptr` `node_ptr` `Cloner` `Disposer`

Requires: "cloner" must be a function object taking a node_ptr and returning a new cloned node of it. "disposer" must take a node_ptr and shouldn't throw.

Effects: First empties target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Then, duplicates the entire tree pointed by "source_header" cloning each source node with `node_ptr Cloner::operator()(const node_ptr &)` to obtain the nodes of the target tree. If "cloner" throws, the cloned target nodes are disposed using `void disposer(const node_ptr &)`.

Complexity: Linear to the number of element of the source tree plus the number of elements of tree target tree when calling this function.

Throws: If cloner functor throws. If this happens target nodes are disposed.

void `node_ptr` `Disposer`

Requires: "disposer" must be an object function taking a node_ptr parameter and shouldn't throw.

Effects: Empties the target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Complexity: Linear to the number of element of the source tree plus the. number of elements of tree target tree when calling this function.

Throws: Nothing.

std::size_t `node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws. Additional notes: an element with key `key` is splayed.

std::size_t `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws. Additional note: no splaying is performed

node_ptr `node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional notes: the first node of the range is splayed.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional note: no splaying is performed

node_ptr `node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional notes: the first node of the range is splayed.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional note: no splaying is performed

node_ptr `node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional notes: the found node of the lower bound is splayed.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional note: no splaying is performed

std::pair< node_ptr, node_ptr > `node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional notes: the first node of the range is splayed.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional note: no splaying is performed

std::pair< node_ptr, node_ptr > `node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing the first element that is equivalent to "key" according to "comp" or an empty range that indicates the position where that element would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional notes: the first node of the range is splayed.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing the first element that is equivalent to "key" according to "comp" or an empty range that indicates the position where that element would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws. Additional note: no splaying is performed

std::pair< node_ptr, node_ptr > `node_ptr` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change. Additional notes: the first node of the range is splayed.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change. Additional note: no splaying is performed

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws. Additional note: the inserted node is splayed

node_ptr `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the lower bound according to "comp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws. Additional note: the inserted node is splayed

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare`

Requires: "header" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. "hint" is node from the "header"'s tree.

Effects: Inserts new_node into the tree, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case).

Complexity: Logarithmic in general, but it is amortized constant time if new_node is inserted immediately before "hint".

Throws: If "comp" throws. Additional note: the inserted node is splayed

node_ptr `node_ptr` `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "pos" must be a valid iterator or header (end) node. "pos" must be an iterator pointing to the successor to "new_node" once inserted according to the order of already inserted nodes. This function does not check "pos" and this precondition must be guaranteed by the caller.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "pos" is not the successor of the newly inserted "new_node" tree invariants might be broken. Additional note: the inserted node is splayed

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering no less than the greatest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is less than the greatest inserted key tree invariants are broken. This function is slightly faster than using "insert_before". Additional note: the inserted node is splayed

void `node_ptr` `node_ptr`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering, no greater than the lowest inserted key.

Effects: Inserts new_node into the tree before "pos".

Complexity: Constant-time.

Throws: Nothing.

Note: If "new_node" is greater than the lowest inserted key tree invariants are broken. This function is slightly faster than using "insert_before". Additional note: the inserted node is splayed

std::pair< node_ptr, bool > `node_ptr` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" and obtains the needed information to realize a constant-time node insertion if there is no equivalent node.

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic.

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set. Additional note: nodes with the given key are splayed

std::pair< node_ptr, bool > `node_ptr` `node_ptr` `const KeyType &` `KeyNodePtrCompare` `insert_commit_data &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr. "hint" is node from the "header"'s tree.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" using "hint" as a hint to where it should be inserted and obtains the needed information to realize a constant-time node insertion if there is no equivalent node. If "hint" is the upper_bound the function has constant time complexity (two comparisons in the worst case).

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic, but it is amortized constant time if new_node should be inserted immediately before "hint".

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set. Additional note: nodes with the given key are splayed

void `node_ptr` `node_ptr` `const insert_commit_data &`

Requires: "header" must be the header node of a tree. "commit_data" must have been obtained from a previous call to "insert_unique_check". No objects should have been inserted or erased from the set between the "insert_unique_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts new_node in the set using the information obtained from the "commit_data" that a previous "insert_check" filled.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_unique_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

bool `const_node_ptr`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr`

Requires: header must be the header of a tree.

Effects: Rebalances the tree.

Throws: Nothing.

Complexity: Linear.

node_ptr `node_ptr`

Requires: old_root is a node of a tree. It shall not be null.

Effects: Rebalances the subtree rooted at old_root.

Returns: The new root of the subtree.

Throws: Nothing.

Complexity: Linear.

void `node_ptr` `node_ptr`
node_ptr `node_ptr` `const KeyType &` `KeyNodePtrCompare` `bool *0`
class ...

Helper metafunction to define a `treap` that yields to the same type when the same options (either explicitly or implicitly) are used.

`pack_options`< treap_defaults, O1, O2, O3, O4, O5, O6, O7 >::`type`
unspecified
`treap`< value_traits, typename packed_options::key_of_value, typename packed_options::compare, typename packed_options::priority_of_value, typename packed_options::priority, typename packed_options::size_type, packed_options::constant_time_size, typename packed_options::header_holder_type >
`implementation_defined`
class ...

The class template treap is an intrusive treap container that is used to construct intrusive set and multiset containers. The no-throw guarantee holds only, if the key_compare object and priority_compare object don't throw.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `compare<>`, `priority<>` and `priority_of_value<>`

ValueTraits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined
implementation_defined
implementation_defined
implementation_defined
unspecified
node_algorithms::insert_commit_data
const bool
const bool
const bool
unspecified `PrioPrioComp`
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the highest priority object of the treap.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the highest priority object of the treap..

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the highest priority object of the treap..

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the highest priority objec of the reversed treap.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

priority_compare

Effects: Returns the priority_compare object used by the container.

Complexity: Constant.

Throws: If priority_compare copy-constructor throws.

void ``treap` &`

Effects: Swaps the contents of two treaps.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `treap` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``treap` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by key_comp().

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by key_comp().

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `const priority_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comparison or predicate functions throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const key_type &` `const priority_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comparison or predicate functions throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator BOOST_INTRUSIVE_I bool > `const KeyType &` `KeyTypeKeyCompare` `const PrioType &` `PrioValuePrioCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. prio_value_pcomp must be a comparison function that induces the same strict weak ordering as priority_compare. The difference is that prio_value_pcomp and comp compare an arbitrary key/priority with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comp or prio_value_pcomp ordering functions throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `const PrioType &` `PrioValuePrioCompare` `insert_commit_data &`

Requires: comp must be a comparison function that induces the same strict weak ordering as key_compare. prio_value_pcomp must be a comparison function that induces the same strict weak ordering as priority_compare. The difference is that prio_value_pcomp and comp compare an arbitrary key/priority with the contained values.

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comp or prio_value_pcomp ordering functions throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the `avl_set` using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the internal priority_compare function throws. Equivalent guarantee to while(beg != end) erase(beg++);

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the priority_compare function throws then weak guarantee and heap invariants are broken. The safest thing would be to clear or destroy the container.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the priority_compare function throws then weak guarantee and heap invariants are broken. The safest thing would be to clear or destroy the container.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

void class ... ``sgtree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

it !
itend
void class ... ``sgtree`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Extracts each element in source and insert it into a using the comparison object of *this.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

it !
itend
void `ExtraChecker`

Effects: Asserts the integrity of the container with additional checks provided by the user.

Complexity: Linear time.

Note: The method might not have effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

void

Effects: Asserts the integrity of the container.

Complexity: Linear time.

Note: The method has no effect when asserts are turned off (e.g., with NDEBUG). Experimental function, interface might change in future versions.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.

const key_compare &
const priority_compare &
priority_compare()
const value_traits &
value_traits()

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.

bool
Iterator
Iterator
const key_compare &
key_compare()
const priority_compare &
priority_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare/priority_compare objects throw. Basic guarantee.

treap
&&

Effects: Constructs a container moving resources from another container. Internal comparison object and value traits are move constructed and nodes belonging to x (except the node representing the "end") are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of the comparison objet throws.

`treap` & ``treap` &&`

Effects: Equivalent to swap

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`treap` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `treap` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`treap` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `treap` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

`treap_algorithms` provides basic algorithms to manipulate nodes forming a treap.

(1) the header node is maintained with links not only to the root but also to the leftmost node of the tree, to enable constant time begin(), and to the rightmost node of the tree, to enable linear time performance when used with the generic set algorithms (set_union, etc.);

(2) when a node being deleted has two children its successor node is relinked into its place, rather than copied, so that the only pointers invalidated are those referring to the deleted node.

`treap_algorithms` is configured with a NodeTraits class, which encapsulates the information about the node to be manipulated. NodeTraits must support the following interface:

Typedefs:

`node`: The type of the node that forms the treap

`node_ptr`: A pointer to a node

`const_node_ptr`: A pointer to a const node

Static functions:

`static node_ptr get_parent(const_node_ptr n);`

`static void set_parent(node_ptr n, node_ptr parent);`

`static node_ptr get_left(const_node_ptr n);`

`static void set_left(node_ptr n, node_ptr left);`

`static node_ptr get_right(const_node_ptr n);`

`static void set_right(node_ptr n, node_ptr right);`

This type is the information that will be filled by insert_unique_check

NodeTraits
NodeTraits::node
NodeTraits::node_ptr
NodeTraits::const_node_ptr
node_ptr `const_node_ptr`

Requires: 'node' is a node of the tree or a header node.

Effects: Returns the header of the tree.

Complexity: Logarithmic.

Throws: Nothing.

node_ptr `const_node_ptr`

Requires: 'header' is the header node of a tree.

Effects: Returns the first node of the tree, the header if the tree is empty.

Complexity: Constant time.

Throws: Nothing.

node_ptr `const_node_ptr`

Requires: 'header' is the header node of a tree.

Effects: Returns the header of the tree.

Complexity: Constant time.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: header1 and header2 must be the header nodes of two trees.

Effects: Swaps two trees. After the function header1 will contain links to the second tree and header2 will have links to the first tree.

Complexity: Constant.

Throws: Nothing.

void `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr` `node_ptr` `node_ptr`

Requires: node1 and node2 can't be header nodes of two trees with header header1 and header2.

Effects: Swaps two nodes. After the function node1 will be inserted in the position node2 before the function. node2 will be inserted in the position node1 had before the function.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if node1 and node2 are not equivalent according to the ordering rules.

Experimental function

void `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Logarithmic.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing and comparison is needed. Experimental function

void `node_ptr` `node_ptr` `node_ptr`

Requires: node_to_be_replaced must be inserted in a tree with header "header" and new_node must not be inserted in a tree.

Effects: Replaces node_to_be_replaced in its position in the tree with new_node. The tree does not need to be rebalanced

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if new_node is not equivalent to node_to_be_replaced according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed. Experimental function

void `node_ptr` `NodePtrPriorityCompare`

Requires: node is a tree node but not the header.

Effects: Unlinks the node and rebalances the tree.

Complexity: Average complexity is constant time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: header is the header of a tree.

Effects: Unlinks the leftmost node from the tree, and updates the header link to the new leftmost node.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the tree and the tree can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the tree.

bool `const_node_ptr`

Requires: 'node' is a node of the tree or a node initialized by init(...) or init_node.

Effects: Returns true if the node is initialized by init() or init_node().

Complexity: Constant time.

Throws: Nothing.

std::size_t `const_node_ptr`

Requires: node is a node of the tree but it's not the header.

Effects: Returns the number of nodes of the subtree.

Complexity: Linear time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node from the tree except the header.

Effects: Returns the next node of the tree.

Complexity: Average constant time.

Throws: Nothing.

node_ptr `node_ptr`

Requires: 'node' is a node from the tree except the leftmost node.

Effects: Returns the previous node of the tree.

Complexity: Average constant time.

Throws: Nothing.

void `node_ptr`

Requires: 'node' must not be part of any tree.

Effects: After the function unique(node) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

void `node_ptr`

Requires: node must not be part of any tree.

Effects: Initializes the header to represent an empty tree. unique(header) == true.

Complexity: Constant.

Throws: Nothing.

Nodes: If node is inserted in a tree, this function corrupts the tree.

node_ptr `node_ptr` `node_ptr` `NodePtrPriorityCompare`

Requires: header must be the header of a tree, z a node of that tree and z != header.

Effects: Erases node "z" from the tree with header "header".

Complexity: Amortized constant time.

Throws: Nothing.

void `const_node_ptr` `node_ptr` `Cloner` `Disposer`

Requires: "cloner" must be a function object taking a node_ptr and returning a new cloned node of it. "disposer" must take a node_ptr and shouldn't throw.

Effects: First empties target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Then, duplicates the entire tree pointed by "source_header" cloning each source node with `node_ptr Cloner::operator()(const node_ptr &)` to obtain the nodes of the target tree. If "cloner" throws, the cloned target nodes are disposed using `void disposer(const node_ptr &)`.

Complexity: Linear to the number of element of the source tree plus the number of elements of tree target tree when calling this function.

Throws: If cloner functor throws. If this happens target nodes are disposed.

void `node_ptr` `Disposer`

Requires: "disposer" must be an object function taking a node_ptr parameter and shouldn't throw.

Effects: Empties the target tree calling `void disposer::operator()(const node_ptr &)` for every node of the tree except the header.

Complexity: Linear to the number of element of the source tree plus the. number of elements of tree target tree when calling this function.

Throws: Nothing.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is not less than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is greater than "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns a node_ptr to the first element that is equivalent to "key" according to "comp" or "header" if that element does not exist.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns an a pair of node_ptr delimiting a range containing all elements that are equivalent to "key" according to "comp" or an empty range that indicates the position where those elements would be if there are no equivalent elements.

Complexity: Logarithmic.

Throws: If "comp" throws.

std::pair< node_ptr, node_ptr > `const_node_ptr` `const KeyType &` `const KeyType &` `KeyNodePtrCompare` `bool` `bool`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs. 'lower_key' must not be greater than 'upper_key' according to 'comp'. If 'lower_key' == 'upper_key', ('left_closed' || 'right_closed') must be true.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If "comp" throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change.

std::size_t `const_node_ptr` `const KeyType &` `KeyNodePtrCompare`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. KeyNodePtrCompare can compare KeyType with tree's node_ptrs.

Effects: Returns the number of elements with a key equivalent to "key" according to "comp".

Complexity: Logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare` `NodePtrPriorityCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. NodePtrPriorityCompare is a priority function object that induces a strict weak ordering compatible with the one used to create the the tree. NodePtrPriorityCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp" and rotates the tree according to "pcomp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throw or "pcomp" throw.

node_ptr `node_ptr` `node_ptr` `NodePtrCompare` `NodePtrPriorityCompare`

Requires: "h" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. NodePtrPriorityCompare is a priority function object that induces a strict weak ordering compatible with the one used to create the the tree. NodePtrPriorityCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before the upper bound according to "comp" and rotates the tree according to "pcomp".

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If "comp" throws.

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrCompare` `NodePtrPriorityCompare`

Requires: "header" must be the header node of a tree. NodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares two node_ptrs. "hint" is node from the "header"'s tree. NodePtrPriorityCompare is a priority function object that induces a strict weak ordering compatible with the one used to create the the tree. NodePtrPriorityCompare compares two node_ptrs.

Effects: Inserts new_node into the tree, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case). Rotates the tree according to "pcomp".

Complexity: Logarithmic in general, but it is amortized constant time if new_node is inserted immediately before "hint".

Throws: If "comp" throw or "pcomp" throw.

node_ptr `node_ptr` `node_ptr` `node_ptr` `NodePtrPriorityCompare`

Requires: "header" must be the header node of a tree. "pos" must be a valid node of the tree (including header end) node. "pos" must be a node pointing to the successor to "new_node" once inserted according to the order of already inserted nodes. This function does not check "pos" and this precondition must be guaranteed by the caller. NodePtrPriorityCompare is a priority function object that induces a strict weak ordering compatible with the one used to create the the tree. NodePtrPriorityCompare compares two node_ptrs.

Effects: Inserts new_node into the tree before "pos" and rotates the tree according to "pcomp".

Complexity: Constant-time.

Throws: If "pcomp" throws, strong guarantee.

Note: If "pos" is not the successor of the newly inserted "new_node" tree invariants might be broken.

void `node_ptr` `node_ptr` `NodePtrPriorityCompare`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering no less than the greatest inserted key. NodePtrPriorityCompare is a priority function object that induces a strict weak ordering compatible with the one used to create the the tree. NodePtrPriorityCompare compares two node_ptrs.

Effects: Inserts x into the tree in the last position and rotates the tree according to "pcomp".

Complexity: Constant-time.

Throws: If "pcomp" throws, strong guarantee.

Note: If "new_node" is less than the greatest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

void `node_ptr` `node_ptr` `NodePtrPriorityCompare`

Requires: "header" must be the header node of a tree. "new_node" must be, according to the used ordering, no greater than the lowest inserted key. NodePtrPriorityCompare is a priority function object that induces a strict weak ordering compatible with the one used to create the the tree. NodePtrPriorityCompare compares two node_ptrs.

Effects: Inserts x into the tree in the first position and rotates the tree according to "pcomp".

Complexity: Constant-time.

Throws: If "pcomp" throws, strong guarantee.

Note: If "new_node" is greater than the lowest inserted key tree invariants are broken. This function is slightly faster than using "insert_before".

std::pair< node_ptr, bool > `const_node_ptr` `const KeyType &` `KeyNodePtrCompare` `const PrioType &` `PrioNodePtrPrioCompare` ``insert_commit_data` &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" and obtains the needed information to realize a constant-time node insertion if there is no equivalent node.

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic.

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

std::pair< node_ptr, bool > `const_node_ptr` `node_ptr` `const KeyType &` `KeyNodePtrCompare` `const PrioType &` `PrioNodePtrPrioCompare` ``insert_commit_data` &`

Requires: "header" must be the header node of a tree. KeyNodePtrCompare is a function object that induces a strict weak ordering compatible with the strict weak ordering used to create the the tree. NodePtrCompare compares KeyType with a node_ptr. "hint" is node from the "header"'s tree.

Effects: Checks if there is an equivalent node to "key" in the tree according to "comp" using "hint" as a hint to where it should be inserted and obtains the needed information to realize a constant-time node insertion if there is no equivalent node. If "hint" is the upper_bound the function has constant time complexity (two comparisons in the worst case).

Returns: If there is an equivalent value returns a pair containing a node_ptr to the already present node and false. If there is not equivalent key can be inserted returns true in the returned pair's boolean and fills "commit_data" that is meant to be used with the "insert_commit" function to achieve a constant-time insertion function.

Complexity: Average complexity is at most logarithmic, but it is amortized constant time if new_node should be inserted immediately before "hint".

Throws: If "comp" throws.

Notes: This function is used to improve performance when constructing a node is expensive and the user does not want to have two equivalent nodes in the tree: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the node and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the node and use "insert_commit" to insert the node in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_unique_commit" only if no more objects are inserted or erased from the set.

void `node_ptr` `node_ptr` `const `insert_commit_data` &`

Requires: "header" must be the header node of a tree. "commit_data" must have been obtained from a previous call to "insert_unique_check". No objects should have been inserted or erased from the set between the "insert_unique_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts new_node in the set using the information obtained from the "commit_data" that a previous "insert_check" filled.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_unique_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

bool `node_ptr` `NodePtrCompare` `PrioNodePtrPrioCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2 if tree1 does not contain a node that is equivalent to z.

Returns: True if the node was trasferred, false otherwise.

Complexity: Logarithmic.

Throws: If the comparison throws.

void `node_ptr` `NodePtrCompare` `PrioNodePtrPrioCompare` `node_ptr` `node_ptr`

Requires: header1 and header2 must be the headers of trees tree1 and tree2 respectively, z a non-header node of tree1. NodePtrCompare is the comparison function of tree1..

Effects: Transfers node "z" from tree1 to tree2.

Complexity: Logarithmic.

Throws: If the comparison throws.

bool `const_node_ptr`

Requires: p is a node of a tree.

Effects: Returns true if p is the header of the tree.

Complexity: Constant.

Throws: Nothing.

class ...

Helper metafunction to define a ``treap_multiset`` that yields to the same type when the same options (either explicitly or implicitly) are used.

`pack_options`< treap_defaults, O1, O2, O3, O4, O5, O6, O7 >::`type`
unspecified
`treap_multiset`< value_traits, typename packed_options::key_of_value, typename packed_options::compare, typename packed_options::priority_of_value, typename packed_options::priority, typename packed_options::size_type, packed_options::constant_time_size, typename packed_options::header_holder_type >
`implementation_defined`
class ...

Helper metafunction to define a ``treap_set`` that yields to the same type when the same options (either explicitly or implicitly) are used.

`pack_options`< treap_defaults, O1, O2, O3, O4, O5, O6, O7 >::`type`
unspecified
`treap_set`< value_traits, typename packed_options::key_of_value, typename packed_options::compare, typename packed_options::priority_of_value, typename packed_options::priority, typename packed_options::size_type, packed_options::constant_time_size, typename packed_options::header_holder_type >
`implementation_defined`
class ...

The class template `treap_multiset` is an intrusive container, that mimics most of the interface of std::treap_multiset as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `compare<>`, `priority<>` and `priority_of_value<>`

implementation_defined::value_type
implementation_defined::value_traits
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::priority_type
implementation_defined::priority_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``treap_multiset` &`

Effects: Swaps the contents of two treaps.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `treap_multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``treap_multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

iterator

Effects: Returns an iterator pointing to the highest priority object of the treap.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the highest priority object of the treap..

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the highest priority object of the treap..

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the highest priority objec of the reversed treap.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

priority_compare

Effects: Returns a const_reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container before the upper bound.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator.

Effects: Inserts x into the container, using "hint" as a hint to where it will be inserted. If "hint" is the upper_bound the insertion takes constant time (two comparisons in the worst case)

Complexity: Logarithmic in general, but it is amortized constant time if t is inserted immediately before hint.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Inserts a each element of a range into the container before the upper bound of the key of each element.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by key_comp().

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the internal priority_compare function throws. Equivalent guarantee to while(beg != end) erase(beg++);

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the priority_compare function throws then weak guarantee and heap invariants are broken. The safest thing would be to clear or destroy the container.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the priority_compare function throws then weak guarantee and heap invariants are broken. The safest thing would be to clear or destroy the container.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``treap_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``treap_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.

const key_compare &
const priority_compare &
priority_compare()
const value_traits &
value_traits()

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const priority_compare &
priority_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare/priority_compare objects throw. Basic guarantee.

treap_multiset
&&

Effects: to-do

`treap_multiset` & ``treap_multiset` &&`

Effects: to-do

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`treap_multiset` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `treap_multiset` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`treap_multiset` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `treap_multiset` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

class ...

The class template `treap_set` is an intrusive container, that mimics most of the interface of std::set as described in the C++ standard.

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `compare<>`, `priority<>` and `priority_of_value<>`

implementation_defined::value_type
implementation_defined::value_traits
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::value_compare
implementation_defined::key_compare
implementation_defined::priority_type
implementation_defined::priority_compare
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::reverse_iterator
implementation_defined::const_reverse_iterator
implementation_defined::insert_commit_data
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
const bool
iterator

Effects: Returns an iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the beginning of the reversed container.

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the end of the reversed container.

Complexity: Constant.

Throws: Nothing.

iterator

Effects: Returns a iterator pointing to the root node of the container or end() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the root node of the container or cend() if not present.

Complexity: Constant.

Throws: Nothing.

key_compare

Effects: Returns the key_compare object used by the container.

Complexity: Constant.

Throws: If key_compare copy-constructor throws.

value_compare

Effects: Returns the value_compare object used by the container.

Complexity: Constant.

Throws: If value_compare copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the container.

Complexity: Linear to elements contained in *this if constant-time size option is disabled. Constant time otherwise.

Throws: Nothing.

void ``treap_set` &`

Effects: Swaps the contents of two treaps.

Complexity: Constant.

Throws: If the comparison functor's swap call throws.

void `const `treap_set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

void ``treap_set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw. Cloner should yield to nodes equivalent to the original nodes.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. Copies the predicate from the source container.

If cloner throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner throws or predicate copy assignment throws. Basic guarantee.

iterator

Effects: Returns an iterator pointing to the highest priority object of the treap.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the highest priority object of the treap..

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the highest priority object of the treap..

Complexity: Constant.

Throws: Nothing.

reverse_iterator

Effects: Returns a reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the highest priority objec of the reversed treap.

Complexity: Constant.

Throws: Nothing.

const_reverse_iterator

Effects: Returns a const_reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

priority_compare

Effects: Returns a const_reverse_iterator pointing to the highest priority object of the reversed treap.

Complexity: Constant.

Throws: Nothing.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Inserts value into the container if the value is not already present.

Complexity: Average complexity for insert element is at most logarithmic.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, and "hint" must be a valid iterator

Effects: Tries to insert x into the container, using "hint" as a hint to where it will be inserted.

Complexity: Logarithmic in general, but it is amortized constant time (two comparisons in the worst case) if t is inserted immediately before hint.

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `const priority_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average complexity is at most logarithmic.

Throws: If the comparison or predicate functions throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This gives a total logarithmic complexity to the insertion: check(O(log(N)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const_iterator` `const key_type &` `const priority_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the container, using a user provided key instead of the value itself, using "hint" as a hint to where it will be inserted.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Logarithmic in general, but it's amortized constant time if t is inserted immediately before hint.

Throws: If the comparison or predicate functions throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the constructing that is used to impose the order is much cheaper to construct than the value_type and this function offers the possibility to use that key to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time. This can give a total constant-time complexity to the insertion: check(O(1)) + commit(O(1)).

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the container.

std::pair< iterator, bool > `const KeyType &` `KeyTypeKeyCompare` `const PrioType &` `PrioValuePrioCompare` `insert_commit_data &`
std::pair< iterator, bool > `const_iterator` `const KeyType &` `KeyTypeKeyCompare` `const PrioType &` `PrioValuePrioCompare` `insert_commit_data &`
void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Tries to insert each element of a range into the container.

Complexity: Insert range is in general O(N * log(N)), where N is the size of the range. However, it is linear in N if the range is already sorted by key_comp().

Throws: If the internal key_compare or priority_compare functions throw. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the container between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the `avl_set` using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

iterator `const_iterator` `reference`

Requires: value must be an lvalue, "pos" must be a valid iterator (or end) and must be the succesor of value once inserted according to the predicate

Effects: Inserts x into the container before "pos".

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if "pos" is not the successor of "value" container ordering invariant will be broken. This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no less than the greatest inserted key

Effects: Inserts x into the container in the last position.

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if value is less than the greatest inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

void `reference`

Requires: value must be an lvalue, and it must be no greater than the minimum inserted key

Effects: Inserts x into the container in the first position.

Complexity: Constant time.

Throws: If the internal priority_compare function throws. Strong guarantee.

Note: This function does not check preconditions so if value is greater than the minimum inserted key container ordering invariant will be broken. This function is slightly more efficient than using "insert_before". This is a low-level function to be used only for performance reasons by advanced users.

iterator `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average complexity for erase element is constant time.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare`

Effects: Erases all the elements with the given key. according to the comparison functor "comp".

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the internal priority_compare function throws. Equivalent guarantee to while(beg != end) erase(beg++);

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

iterator `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average complexity for erase element is constant time.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators to the erased elements.

iterator `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average complexity for erase range is at most O(log(size() + N)), where N is the number of elements in the range.

Throws: if the internal priority_compare function throws. Strong guarantee.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the priority_compare function throws then weak guarantee and heap invariants are broken. The safest thing would be to clear or destroy the container.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyTypeKeyCompare` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "comp". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: O(log(size() + N).

Throws: if the priority_compare function throws then weak guarantee and heap invariants are broken. The safest thing would be to clear or destroy the container.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Effects: Erases all of the elements calling disposer(p) for each node to be erased. Complexity: Average complexity for is at most O(log(size() + N)), where N is the number of elements in the container.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. Calls N times to disposer functor.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given value.

Throws: If `key_compare` throws.

size_type `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Returns the number of contained elements with the given key

Complexity: Logarithmic to the number of elements contained plus lineal to number of objects with the given key.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Effects: Returns an iterator to the first element whose key is not less than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Returns an iterator to the first element whose key is greater than k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Returns an iterator to the first element whose key is greater than k according to comp or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

const_iterator `const key_type &`

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

const_iterator `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), and nk the key_type of a value_type inserted into `*this`.

Effects: Finds an iterator to the first element whose key is k or end() if that element does not exist.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< iterator, iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `key_compare` throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyTypeKeyCompare`

Requires: key is a value such that `*this` is partitioned with respect to comp(nk, key) and !comp(key, nk), with comp(nk, key) implying !comp(key, nk), with nk the key_type of a value_type inserted into `*this`.

Effects: Finds a range containing all elements whose key is k or an empty range that indicates the position where those elements would be if they there is no elements with key k.

Complexity: Logarithmic.

Throws: If `comp` throws.

std::pair< iterator, iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< iterator, iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const key_type &` `const key_type &` `bool` `bool`

Requires: `upper_key` shall not precede `lower_key` according to key_compare. [key_comp()(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!key_comp()(upper_key, lower_key) && !key_comp()(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key) if left_closed, upper_bound(lower_key) otherwise

second = upper_bound(upper_key) if right_closed, lower_bound(upper_key) otherwise

Complexity: Logarithmic.

Throws: If `key_compare` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_value and upper_value.

Note: Experimental function, the interface might change in future releases.

std::pair< const_iterator, const_iterator > `const KeyType &` `const KeyType &` `KeyTypeKeyCompare` `bool` `bool`

Requires: `lower_key` is a value such that `*this` is partitioned with respect to comp(nk, lower_key) if left_closed is true, with respect to !comp(lower_key, nk) otherwise.

`upper_key` is a value such that `*this` is partitioned with respect to !comp(upper_key, nk) if right_closed is true, with respect to comp(nk, upper_key) otherwise.

`upper_key` shall not precede `lower_key` according to comp [comp(upper_key, lower_key) shall be false]

If `lower_key` is equivalent to `upper_key` [!comp(upper_key, lower_key) && !comp(lower_key, upper_key)] then ('left_closed' || 'right_closed') must be false.

Effects: Returns an a pair with the following criteria:

first = lower_bound(lower_key, comp) if left_closed, upper_bound(lower_key, comp) otherwise

second = upper_bound(upper_key, comp) if right_closed, lower_bound(upper_key, comp) otherwise

Complexity: Logarithmic.

Throws: If `comp` throws.

Note: This function can be more efficient than calling upper_bound and lower_bound for lower_key and upper_key.

Note: Experimental function, the interface might change in future releases.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

pointer

Effects: Unlinks the leftmost node from the container.

Complexity: Average complexity is constant time.

Throws: Nothing.

Notes: This function breaks the container and the container can only be used for more unlink_leftmost_without_rebalance calls. This function is normally used to achieve a step by step controlled destruction of the container.

void `iterator` `reference`

Requires: replace_this must be a valid iterator of *this and with_this must not be inserted in any container.

Effects: Replaces replace_this in its position in the container with with_this. The container does not need to be rebalanced.

Complexity: Constant.

Throws: Nothing.

Note: This function will break container ordering invariants if with_this is not equivalent to *replace_this according to the ordering rules. This function is faster than erasing and inserting the node, since no rebalancing or comparison is needed.

void `reference`

Effects: removes "value" from the container.

Throws: Nothing.

Complexity: Logarithmic time.

Note: This static function is only usable with non-constant time size containers that have stateless comparison functors.

If the user calls this function with a constant time size container or stateful comparison functor a compilation error will be issued.

void class ... ``treap_set`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

void class ... ``treap_multiset`< T, Options2... > &`

Requires: "source" container's Options can only can differ in the comparison function from *this.

Effects: Attempts to extract each element in source and insert it into a using the comparison object of *this. If there is an element in a with key equivalent to the key of an element from source, then that element is not extracted from source.

Postcondition: Pointers and references to the transferred elements of source refer to those same elements but as members of *this. Iterators referring to the transferred elements will continue to refer to their elements, but they now behave as iterators into *this, not into source.

Throws: Nothing unless the comparison object throws.

Complexity: N log(a.size() + N) (N has the value source.size())

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.

const key_compare &
const priority_compare &
priority_compare()
const value_traits &
value_traits()

Effects: Constructs an empty container.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor of the value_compare/priority_compare objects throw. Basic guarantee.

Iterator
Iterator
const key_compare &
key_compare()
const priority_compare &
priority_compare()
const value_traits &
value_traits()

Requires: Dereferencing iterator must yield an lvalue of type value_type. cmp must be a comparison function that induces a strict weak ordering.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: Linear in N if [b, e) is already sorted using comp and otherwise N * log N, where N is the distance between first and last.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor/operator() of the key_compare/priority_compare objects throw. Basic guarantee.

treap_set
&&

Effects: to-do

`treap_set` & ``treap_set` &&`

Effects: to-do

Effects: Detaches all elements from this. The objects in the set are not deleted (i.e. no destructors are called), but the nodes according to the `value_traits` template parameter are reinitialized and thus can be reused.

Complexity: Linear to elements contained in *this.

Throws: Nothing.

`treap_set` & `iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

const `treap_set` & `const_iterator`

Precondition: end_iterator must be a valid end iterator of the container.

Effects: Returns a const reference to the container associated to the end iterator

Throws: Nothing.

Complexity: Constant.

`treap_set` & `iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

const `treap_set` & `const_iterator`

Precondition: it must be a valid iterator of the container.

Effects: Returns a const reference to the container associated to the iterator

Throws: Nothing.

Complexity: Logarithmic.

iterator `reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a set of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator i belonging to the set that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

void `reference`

Requires: value shall not be in a container.

Effects: init_node puts the hook of a value in a well-known default state.

Throws: Nothing.

Complexity: Constant time.

Note: This function puts the hook in the well-known default state used by auto_unlink and safe hooks.

link_mode_type safe_link

This value traits template is used to create value traits from user defined node traits where value_traits::value_type and node_traits::node should be equal

NodeTraits
node_traits::node_ptr
node_traits::const_node_ptr
node_traits::node
node_ptr
const_node_ptr
const link_mode_type
node_ptr `value_type &`
const_node_ptr `const value_type &`
const pointer & `const node_ptr &`
const const_pointer & `const const_node_ptr &`
class ...

Helper metafunction to define an ``unordered_multiset`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define an ``unordered_set`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...
boost::intrusive::hashtable< ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags >

The class template `unordered_multiset` is an intrusive container, that mimics most of the interface of std::tr1::unordered_multiset as described in the C++ TR1.

`unordered_multiset` is a semi-intrusive container: each object to be stored in the container must contain a proper hook, but the container also needs additional auxiliary memory to work: `unordered_multiset` needs a pointer to an array of type `bucket_type` to be passed in the constructor. This bucket array must have at least the same lifetime as the container. This makes the use of `unordered_multiset` more complicated than purely intrusive containers. `bucket_type` is default-constructible, copyable and assignable

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `hash<>` and `equal<>` `bucket_traits<>`, `power_2_buckets<>` and `cache_begin<>`.

`unordered_multiset` only provides forward iterators but it provides 4 iterator types: iterator and const_iterator to navigate through the whole container and local_iterator and const_local_iterator to navigate through the values stored in a single bucket. Local iterators are faster and smaller.

It's not recommended to use non constant-time size unordered_multisets because several key functions, like "empty()", become non-constant time functions. Non constant-time size unordered_multisets are mainly provided to support auto-unlink hooks.

`unordered_multiset`, unlike std::unordered_set, does not make automatic rehashings nor offers functions related to a load factor. Rehashing can be explicitly requested and the user must provide a new bucket array that will be used from that moment.

Since no automatic rehashing is done, iterators are never invalidated when inserting or erasing elements. Iterators are only invalidated when rehasing.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::value_traits
implementation_defined::bucket_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::key_equal
implementation_defined::hasher
implementation_defined::bucket_type
implementation_defined::bucket_ptr
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::insert_commit_data
implementation_defined::local_iterator
implementation_defined::const_local_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
iterator

Effects: Returns an iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

hasher

Effects: Returns the hasher object used by the `unordered_set`.

Complexity: Constant.

Throws: If hasher copy-constructor throws.

key_equal

Effects: Returns the key_equal object used by the `unordered_set`.

Complexity: Constant.

Throws: If key_equal copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: if constant-time size and `cache_begin` options are disabled, average constant time (worst case, with empty() == true: O(this->bucket_count()). Otherwise constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the `unordered_set`.

Complexity: Linear to elements contained in *this if `constant_time_size` is false. Constant-time otherwise.

Throws: Nothing.

void ``unordered_multiset` &`

Requires: buckets must not be being used by any other resource.

Effects: Constructs an empty `unordered_set`, storing a reference to the bucket array and copies of the key_hasher and equal_func functors.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hash_func or equal_func throws.

Notes: buckets array must be disposed only after *this is disposed.

void `const `unordered_multiset` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw Cloner should yield to nodes that compare equal and produce the same hash than the original node.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. The hash function and the equality predicate are copied from the source.

If `store_hash` option is true, this method does not use the hash function.

If any operation throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner or hasher throw or hash or equality predicate copying throws. Basic guarantee.

void ``unordered_multiset` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw Cloner should yield to nodes that compare equal and produce the same hash than the original node.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. The hash function and the equality predicate are copied from the source.

If `store_hash` option is true, this method does not use the hash function.

If any operation throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner or hasher throw or hash or equality predicate copying throws. Basic guarantee.

iterator `reference`

Requires: value must be an lvalue

Effects: Inserts the value into the `unordered_set`.

Returns: An iterator to the inserted value.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Equivalent to this->insert_equal(t) for each element in [b, e).

Complexity: Average case O(N), where N is distance(b, e). Worst case O(N*this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average case O(1), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased element. No destructors are called.

void `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average case O(distance(b, e)), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Erases all the elements that have the same hash and compare equal with the given key.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If hash_func or equal_func throw. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average case O(1), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average case O(distance(b, e)), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyHasher` `KeyEqual` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "equal_func". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If hash_func or equal_func throw. Basic guarantee.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

size_type `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns the number of contained elements with the given key

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal throw.

iterator `const key_type &`

Effects: Finds an iterator to the first element is equal to "value" or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

iterator `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Finds an iterator to the first element whose key is "key" according to the given hash and equality functor or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

const_iterator `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

const_iterator `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Finds an iterator to the first element whose key is "key" according to the given hasher and equality functor or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

std::pair< iterator, iterator > `const key_type &`

Effects: Returns a range containing all elements with values equivalent to value. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

std::pair< iterator, iterator > `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns a range containing all elements with equivalent keys. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(key, hash_func, equal_func)). Worst case O(this->size()).

Throws: If hash_func or the equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Returns a range containing all elements with values equivalent to value. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns a range containing all elements with equivalent keys. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(key, hash_func, equal_func)). Worst case O(this->size()).

Throws: If the hasher or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: If the internal hash function throws.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: If the internal hash function throws.

local_iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

const_local_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of buckets passed in the constructor or the last rehash function.

Complexity: Constant.

Throws: Nothing.

size_type `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns the number of elements in the nth bucket.

Complexity: Constant.

Throws: Nothing.

size_type `const key_type &`

Effects: Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed.

Complexity: Constant.

Throws: If the hash functor throws.

Note: the return value is in the range [0, this->bucket_count()).

size_type `const KeyType &` `KeyHasher`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

Effects: Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed.

Complexity: Constant.

Throws: If hash_func throws.

Note: the return value is in the range [0, this->bucket_count()).

bucket_ptr

Effects: Returns the bucket array pointer passed in the constructor or the last rehash function.

Complexity: Constant.

Throws: Nothing.

local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

void `const bucket_traits &`

Requires: new_bucket_traits can hold a pointer to a new bucket array or the same as the old bucket array with a different length. new_size is the length of the the array pointed by new_buckets. If new_bucket_traits.bucket_begin() == this->bucket_pointer() new_bucket_traits.bucket_count() can be bigger or smaller than this->bucket_count(). 'new_bucket_traits' copy constructor should not throw.

Effects: If `new_bucket_traits.bucket_begin() == this->bucket_pointer()` is false, unlinks values from the old bucket and inserts then in the new one according to the hash value of values.

If `new_bucket_traits.bucket_begin() == this->bucket_pointer()` is true, the implementations avoids moving values as much as possible.

Bucket traits hold by *this is assigned from new_bucket_traits. If the container is configured as incremental<>, the split bucket is set to the new bucket_count().

If `store_hash` option is true, this method does not use the hash function. If false, the implementation tries to minimize calls to the hash function (e.g. once for equivalent values if optimize_multikey<true> is true).

If rehash is successful updates the internal `bucket_traits` with new_bucket_traits.

Complexity: Average case linear in this->size(), worst case quadratic.

Throws: If the hasher functor throws. Basic guarantee.

void

Note: This function is used when keys from inserted elements are changed (e.g. a language change when key is a string) but uniqueness and hash properties are preserved so a fast full rehash recovers invariants for *this without extracting and reinserting all elements again.

Requires: Calls produced to the hash function should not alter the value uniqueness properties of already inserted elements. If hasher(key1) == hasher(key2) was true when elements were inserted, it shall be true during calls produced in the execution of this function.

key_equal is not called inside this function so it is assumed that key_equal(value1, value2) should produce the same results as before for inserted elements.

Effects: Reprocesses all values hold by *this, recalculating their hash values and redistributing them though the buckets.

If `store_hash` option is true, this method uses the hash function and updates the stored hash value.

Complexity: Average case linear in this->size(), worst case quadratic.

Throws: If the hasher functor throws. Basic guarantee.

bool `booltrue`

Requires:

Effects:

Complexity:

Throws:

Note: this method is only available if incremental<true> option is activated.

bool `const bucket_traits &`

Effects: If new_bucket_traits.bucket_count() is not this->bucket_count()/2 or this->bucket_count()*2, or this->split_bucket() != new_bucket_traits.bucket_count() returns false and does nothing.

Otherwise, copy assigns new_bucket_traits to the internal `bucket_traits` and transfers all the objects from old buckets to the new ones.

Complexity: Linear to size().

Throws: Nothing

Note: this method is only available if incremental<true> option is activated.

size_type

Requires: incremental<> option must be set

Effects: returns the current split count

Complexity: Constant

Throws: Nothing

const bucket_traits &
const hasher &
hasher()
const key_equal &
key_equal()
const value_traits &
value_traits()

Requires: buckets must not be being used by any other resource.

Effects: Constructs an empty `unordered_set`, storing a reference to the bucket array and copies of the key_hasher and equal_func functors.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hash_func or equal_func throws.

Notes: buckets array must be disposed only after *this is disposed.

Iterator
Iterator
const bucket_traits &
const hasher &
hasher()
const key_equal &
key_equal()
const value_traits &
value_traits()

Requires: buckets must not be being used by any other resource and dereferencing iterator must yield an lvalue of type value_type.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: If N is distance(b, e): Average case is O(N) (with a good hash function and with buckets_len >= N),worst case O(N^2).

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hasher or key_equal throws.

Notes: buckets array must be disposed only after *this is disposed.

unordered_multiset
&&

Effects: to-do

`unordered_multiset` & ``unordered_multiset` &&`

Effects: to-do

Effects: Detaches all elements from this. The objects in the `unordered_set` are not deleted (i.e. no destructors are called).

Complexity: Linear to the number of elements in the `unordered_set`, if it's a safe-mode or auto-unlink value. Otherwise constant.

Throws: Nothing.

local_iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_local_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

size_type `size_type`

Effects: Returns the nearest new bucket count optimized for the container that is bigger or equal than n. This suggestion can be used to create bucket arrays with a size that will usually improve container's performance. If such value does not exist, the higher possible value is returned.

Complexity: Amortized constant time.

Throws: Nothing.

size_type `size_type`

Effects: Returns the nearest new bucket count optimized for the container that is smaller or equal than n. This suggestion can be used to create bucket arrays with a size that will usually improve container's performance. If such value does not exist, the lowest possible value is returned.

Complexity: Amortized constant time.

Throws: Nothing.

class ...
boost::intrusive::hashtable< ValueTraits, VoidOrKeyOfValue, VoidOrKeyHash, VoidOrKeyEqual, BucketTraits, SizeType, BoolFlags|hash_bool_flags::unique_keys_pos >

The class template `unordered_set` is an intrusive container, that mimics most of the interface of std::tr1::unordered_set as described in the C++ TR1.

`unordered_set` is a semi-intrusive container: each object to be stored in the container must contain a proper hook, but the container also needs additional auxiliary memory to work: `unordered_set` needs a pointer to an array of type `bucket_type` to be passed in the constructor. This bucket array must have at least the same lifetime as the container. This makes the use of `unordered_set` more complicated than purely intrusive containers. `bucket_type` is default-constructible, copyable and assignable

The template parameter `T` is the type to be managed by the container. The user can specify additional options and if no options are provided default options are used.

The container supports the following options: `base_hook<>/member_hook<>/value_traits<>`, `constant_time_size<>`, `size_type<>`, `hash<>` and `equal<>` `bucket_traits<>`, `power_2_buckets<>` and `cache_begin<>`.

`unordered_set` only provides forward iterators but it provides 4 iterator types: iterator and const_iterator to navigate through the whole container and local_iterator and const_local_iterator to navigate through the values stored in a single bucket. Local iterators are faster and smaller.

It's not recommended to use non constant-time size unordered_sets because several key functions, like "empty()", become non-constant time functions. Non constant-time size unordered_sets are mainly provided to support auto-unlink hooks.

`unordered_set`, unlike std::unordered_set, does not make automatic rehashings nor offers functions related to a load factor. Rehashing can be explicitly requested and the user must provide a new bucket array that will be used from that moment.

Since no automatic rehashing is done, iterators are never invalidated when inserting or erasing elements. Iterators are only invalidated when rehasing.

implementation_defined::value_type
implementation_defined::key_type
implementation_defined::key_of_value
implementation_defined::value_traits
implementation_defined::bucket_traits
implementation_defined::pointer
implementation_defined::const_pointer
implementation_defined::reference
implementation_defined::const_reference
implementation_defined::difference_type
implementation_defined::size_type
implementation_defined::key_equal
implementation_defined::hasher
implementation_defined::bucket_type
implementation_defined::bucket_ptr
implementation_defined::iterator
implementation_defined::const_iterator
implementation_defined::insert_commit_data
implementation_defined::local_iterator
implementation_defined::const_local_iterator
implementation_defined::node_traits
implementation_defined::node
implementation_defined::node_ptr
implementation_defined::const_node_ptr
implementation_defined::node_algorithms
iterator

Effects: Returns an iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the beginning of the `unordered_set`.

Complexity: Amortized constant time. Worst case (empty `unordered_set`): O(this->bucket_count())

Throws: Nothing.

iterator

Effects: Returns an iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

const_iterator

Effects: Returns a const_iterator pointing to the end of the `unordered_set`.

Complexity: Constant.

Throws: Nothing.

hasher

Effects: Returns the hasher object used by the `unordered_set`.

Complexity: Constant.

Throws: If hasher copy-constructor throws.

key_equal

Effects: Returns the key_equal object used by the `unordered_set`.

Complexity: Constant.

Throws: If key_equal copy-constructor throws.

bool

Effects: Returns true if the container is empty.

Complexity: if constant-time size and `cache_begin` options are disabled, average constant time (worst case, with empty() == true: O(this->bucket_count()). Otherwise constant.

Throws: Nothing.

size_type

Effects: Returns the number of elements stored in the `unordered_set`.

Complexity: Linear to elements contained in *this if `constant_time_size` is false. Constant-time otherwise.

Throws: Nothing.

void ``unordered_set` &`

Requires: buckets must not be being used by any other resource.

Effects: Constructs an empty `unordered_set`, storing a reference to the bucket array and copies of the key_hasher and equal_func functors.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hash_func or equal_func throws.

Notes: buckets array must be disposed only after *this is disposed.

void `const `unordered_set` &` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw Cloner should yield to nodes that compare equal and produce the same hash than the original node.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(const_reference ) and inserts them on *this. The hash function and the equality predicate are copied from the source.

If `store_hash` option is true, this method does not use the hash function.

If any operation throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner or hasher throw or hash or equality predicate copying throws. Basic guarantee.

void ``unordered_set` &&` `Cloner` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw Cloner should yield to nodes that compare equal and produce the same hash than the original node.

Effects: Erases all the elements from *this calling Disposer::operator()(pointer), clones all the elements from src calling Cloner::operator()(reference) and inserts them on *this. The hash function and the equality predicate are copied from the source.

If `store_hash` option is true, this method does not use the hash function.

If any operation throws, all cloned elements are unlinked and disposed calling Disposer::operator()(pointer).

Complexity: Linear to erased plus inserted elements.

Throws: If cloner or hasher throw or hash or equality predicate copying throws. Basic guarantee.

std::pair< iterator, bool > `reference`

Requires: value must be an lvalue

Effects: Tries to inserts value into the `unordered_set`.

Returns: If the value is not already present inserts it and returns a pair containing the iterator to the new value and true. If there is an equivalent value returns a pair containing an iterator to the already present value and false.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Strong guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

void `Iterator` `Iterator`

Requires: Dereferencing iterator must yield an lvalue of type value_type.

Effects: Equivalent to this->insert_unique(t) for each element in [b, e).

Complexity: Average case O(N), where N is distance(b, e). Worst case O(N*this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Does not affect the validity of iterators and references. No copy-constructors are called.

std::pair< iterator, bool > `const key_type &` `insert_commit_data &`

Effects: Checks if a value can be inserted in the `unordered_set`, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hasher or key_compare throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the hash or the equality is much cheaper to construct than the value_type and this function offers the possibility to use that the part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time.

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the `unordered_set`.

After a successful rehashing insert_commit_data remains valid.

std::pair< iterator, bool > `const KeyType &` `KeyHasher` `KeyEqual` `insert_commit_data &`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Checks if a value can be inserted in the `unordered_set`, using a user provided key instead of the value itself.

Returns: If there is an equivalent value returns a pair containing an iterator to the already present value and false. If the value can be inserted returns true in the returned pair boolean and fills "commit_data" that is meant to be used with the "insert_commit" function.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw. Strong guarantee.

Notes: This function is used to improve performance when constructing a value_type is expensive: if there is an equivalent value the constructed object must be discarded. Many times, the part of the node that is used to impose the hash or the equality is much cheaper to construct than the value_type and this function offers the possibility to use that the part to check if the insertion will be successful.

If the check is successful, the user can construct the value_type and use "insert_commit" to insert the object in constant-time.

"commit_data" remains valid for a subsequent "insert_commit" only if no more objects are inserted or erased from the `unordered_set`.

After a successful rehashing insert_commit_data remains valid.

iterator `reference` `const insert_commit_data &`

Requires: value must be an lvalue of type value_type. commit_data must have been obtained from a previous call to "insert_check". No objects should have been inserted or erased from the `unordered_set` between the "insert_check" that filled "commit_data" and the call to "insert_commit".

Effects: Inserts the value in the `unordered_set` using the information obtained from the "commit_data" that a previous "insert_check" filled.

Returns: An iterator to the newly inserted object.

Complexity: Constant time.

Throws: Nothing.

Notes: This function has only sense if a "insert_check" has been previously executed to fill "commit_data". No value should be inserted or erased between the "insert_check" and "insert_commit" calls.

After a successful rehashing insert_commit_data remains valid.

void `const_iterator`

Effects: Erases the element pointed to by i.

Complexity: Average case O(1), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased element. No destructors are called.

void `const_iterator` `const_iterator`

Effects: Erases the range pointed to by b end e.

Complexity: Average case O(distance(b, e)), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Erases all the elements with the given value.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Erases all the elements that have the same hash and compare equal with the given key.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If hash_func or equal_func throw. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the element pointed to by i. Disposer::operator()(pointer) is called for the removed element.

Complexity: Average case O(1), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

void `const_iterator` `const_iterator` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases the range pointed to by b end e. Disposer::operator()(pointer) is called for the removed elements.

Complexity: Average case O(distance(b, e)), worst case O(this->size()).

Throws: Nothing.

Note: Invalidates the iterators to the erased elements.

size_type `const key_type &` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given value. Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws. Basic guarantee.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const KeyType &` `KeyHasher` `KeyEqual` `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all the elements with the given key. according to the comparison functor "equal_func". Disposer::operator()(pointer) is called for the removed elements.

Returns: The number of erased elements.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If hash_func or equal_func throw. Basic guarantee.

Note: Invalidates the iterators to the erased elements.

void

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. if it's a safe-mode or auto-unlink value_type. Constant time otherwise.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

void `Disposer`

Requires: Disposer::operator()(pointer) shouldn't throw.

Effects: Erases all of the elements.

Complexity: Linear to the number of elements on the container. Disposer::operator()(pointer) is called for the removed elements.

Throws: Nothing.

Note: Invalidates the iterators (but not the references) to the erased elements. No destructors are called.

size_type `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

size_type `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns the number of contained elements with the given key

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal throw.

iterator `const key_type &`

Effects: Finds an iterator to the first element is equal to "value" or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

iterator `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Finds an iterator to the first element whose key is "key" according to the given hash and equality functor or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

const_iterator `const key_type &`

Effects: Returns the number of contained elements with the given value

Complexity: Average case O(1), worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

const_iterator `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Finds an iterator to the first element whose key is "key" according to the given hasher and equality functor or end() if that element does not exist.

Complexity: Average case O(1), worst case O(this->size()).

Throws: If hash_func or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

std::pair< iterator, iterator > `const key_type &`

Effects: Returns a range containing all elements with values equivalent to value. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

std::pair< iterator, iterator > `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns a range containing all elements with equivalent keys. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(key, hash_func, equal_func)). Worst case O(this->size()).

Throws: If hash_func or the equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

std::pair< const_iterator, const_iterator > `const key_type &`

Effects: Returns a range containing all elements with values equivalent to value. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(value)). Worst case O(this->size()).

Throws: If the internal hasher or the equality functor throws.

std::pair< const_iterator, const_iterator > `const KeyType &` `KeyHasher` `KeyEqual`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

"equal_func" must be a equality function that induces the same equality as key_equal. The difference is that "equal_func" compares an arbitrary key with the contained values.

Effects: Returns a range containing all elements with equivalent keys. Returns std::make_pair(this->end(), this->end()) if no such elements exist.

Complexity: Average case O(this->count(key, hash_func, equal_func)). Worst case O(this->size()).

Throws: If the hasher or equal_func throw.

Note: This function is used when constructing a value_type is expensive and the value_type can be compared with a cheaper key type. Usually this key is part of the value_type.

iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: If the internal hash function throws.

const_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid const_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: If the internal hash function throws.

local_iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

const_local_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

size_type

Effects: Returns the number of buckets passed in the constructor or the last rehash function.

Complexity: Constant.

Throws: Nothing.

size_type `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns the number of elements in the nth bucket.

Complexity: Constant.

Throws: Nothing.

size_type `const key_type &`

Effects: Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed.

Complexity: Constant.

Throws: If the hash functor throws.

Note: the return value is in the range [0, this->bucket_count()).

size_type `const KeyType &` `KeyHasher`

Requires: "hash_func" must be a hash function that induces the same hash values as the stored hasher. The difference is that "hash_func" hashes the given key instead of the value_type.

Effects: Returns the index of the bucket in which elements with keys equivalent to k would be found, if any such element existed.

Complexity: Constant.

Throws: If hash_func throws.

Note: the return value is in the range [0, this->bucket_count()).

bucket_ptr

Effects: Returns the bucket array pointer passed in the constructor or the last rehash function.

Complexity: Constant.

Throws: Nothing.

local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the beginning of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

const_local_iterator `size_type`

Requires: n is in the range [0, this->bucket_count()).

Effects: Returns a const_local_iterator pointing to the end of the sequence stored in the bucket n.

Complexity: Constant.

Throws: Nothing.

Note: [this->begin(n), this->end(n)) is a valid range containing all of the elements in the nth bucket.

void `const bucket_traits &`

Requires: new_bucket_traits can hold a pointer to a new bucket array or the same as the old bucket array with a different length. new_size is the length of the the array pointed by new_buckets. If new_bucket_traits.bucket_begin() == this->bucket_pointer() new_bucket_traits.bucket_count() can be bigger or smaller than this->bucket_count(). 'new_bucket_traits' copy constructor should not throw.

Effects: If `new_bucket_traits.bucket_begin() == this->bucket_pointer()` is false, unlinks values from the old bucket and inserts then in the new one according to the hash value of values.

If `new_bucket_traits.bucket_begin() == this->bucket_pointer()` is true, the implementations avoids moving values as much as possible.

Bucket traits hold by *this is assigned from new_bucket_traits. If the container is configured as incremental<>, the split bucket is set to the new bucket_count().

If `store_hash` option is true, this method does not use the hash function. If false, the implementation tries to minimize calls to the hash function (e.g. once for equivalent values if optimize_multikey<true> is true).

If rehash is successful updates the internal `bucket_traits` with new_bucket_traits.

Complexity: Average case linear in this->size(), worst case quadratic.

Throws: If the hasher functor throws. Basic guarantee.

void

Note: This function is used when keys from inserted elements are changed (e.g. a language change when key is a string) but uniqueness and hash properties are preserved so a fast full rehash recovers invariants for *this without extracting and reinserting all elements again.

Requires: Calls produced to the hash function should not alter the value uniqueness properties of already inserted elements. If hasher(key1) == hasher(key2) was true when elements were inserted, it shall be true during calls produced in the execution of this function.

key_equal is not called inside this function so it is assumed that key_equal(value1, value2) should produce the same results as before for inserted elements.

Effects: Reprocesses all values hold by *this, recalculating their hash values and redistributing them though the buckets.

If `store_hash` option is true, this method uses the hash function and updates the stored hash value.

Complexity: Average case linear in this->size(), worst case quadratic.

Throws: If the hasher functor throws. Basic guarantee.

bool `booltrue`

Requires:

Effects:

Complexity:

Throws:

Note: this method is only available if incremental<true> option is activated.

bool `const bucket_traits &`

Effects: If new_bucket_traits.bucket_count() is not this->bucket_count()/2 or this->bucket_count()*2, or this->split_bucket() != new_bucket_traits.bucket_count() returns false and does nothing.

Otherwise, copy assigns new_bucket_traits to the internal `bucket_traits` and transfers all the objects from old buckets to the new ones.

Complexity: Linear to size().

Throws: Nothing

Note: this method is only available if incremental<true> option is activated.

size_type

Requires: incremental<> option must be set

Effects: returns the current split count

Complexity: Constant

Throws: Nothing

const bucket_traits &
const hasher &
hasher()
const key_equal &
key_equal()
const value_traits &
value_traits()

Requires: buckets must not be being used by any other resource.

Effects: Constructs an empty `unordered_set`, storing a reference to the bucket array and copies of the key_hasher and equal_func functors.

Complexity: Constant.

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hash_func or equal_func throws.

Notes: buckets array must be disposed only after *this is disposed.

Iterator
Iterator
const bucket_traits &
const hasher &
hasher()
const key_equal &
key_equal()
const value_traits &
value_traits()

Requires: buckets must not be being used by any other resource and dereferencing iterator must yield an lvalue of type value_type.

Effects: Constructs an empty container and inserts elements from [b, e).

Complexity: If N is distance(b, e): Average case is O(N) (with a good hash function and with buckets_len >= N),worst case O(N^2).

Throws: If value_traits::node_traits::node constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the copy constructor or invocation of hasher or key_equal throws.

Notes: buckets array must be disposed only after *this is disposed.

unordered_set
&&

Effects: Constructs a container moving resources from another container. Internal value traits, bucket traits, hasher and comparison are move constructed and nodes belonging to x are linked to *this.

Complexity: Constant.

Throws: If value_traits::node_traits::node's move constructor throws (this does not happen with predefined Boost.Intrusive hooks) or the move constructor of value traits, bucket traits, hasher or comparison throws.

`unordered_set` & ``unordered_set` &&`

Effects: Equivalent to swap.

Effects: Detaches all elements from this. The objects in the `unordered_set` are not deleted (i.e. no destructors are called).

Complexity: Linear to the number of elements in the `unordered_set`, if it's a safe-mode or auto-unlink value. Otherwise constant.

Throws: Nothing.

local_iterator `reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

const_local_iterator `const_reference`

Requires: value must be an lvalue and shall be in a `unordered_set` of appropriate type. Otherwise the behavior is undefined.

Effects: Returns: a valid local_iterator belonging to the `unordered_set` that points to the value

Complexity: Constant.

Throws: Nothing.

Note: This static function is available only if the value traits is stateless.

size_type `size_type`

Effects: Returns the nearest new bucket count optimized for the container that is bigger or equal than n. This suggestion can be used to create bucket arrays with a size that will usually improve container's performance. If such value does not exist, the higher possible value is returned.

Complexity: Amortized constant time.

Throws: Nothing.

size_type `size_type`

Effects: Returns the nearest new bucket count optimized for the container that is smaller or equal than n. This suggestion can be used to create bucket arrays with a size that will usually improve container's performance. If such value does not exist, the lowest possible value is returned.

Complexity: Amortized constant time.

Throws: Nothing.

class ...

Helper metafunction to define a ``unordered_set_base_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...

Helper metafunction to define a ``unordered_set_member_hook`` that yields to the same type when the same options (either explicitly or implicitly) are used.

implementation_defined
class ...
make_unordered_set_base_hook::type< O1, O2, O3, O4 >

Derive a class from `unordered_set_base_hook` in order to store objects in in an unordered_set/unordered_multi_set. `unordered_set_base_hook` holds the data necessary to maintain the unordered_set/unordered_multi_set and provides an appropriate `value_traits` class for unordered_set/unordered_multi_set.

The hook admits the following options: `tag<>`, `void_pointer<>`, `link_mode<>`, `store_hash<>` and `optimize_multikey<>`.

`tag<>` defines a tag to identify the node. The same tag value can be used in different classes, but if a class is derived from more than one ``list_base_hook``, then each ``list_base_hook`` needs its unique tag.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`store_hash<>` will tell the hook to store the hash of the value to speed up rehashings.

`optimize_multikey<>` will tell the hook to store a link to form a group with other value with the same value to speed up searches and insertions in unordered_multisets with a great number of with equivalent keys.

void ``unordered_set_base_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `unordered_set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `unordered_set_base_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`unordered_set_base_hook` & `const `unordered_set_base_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in an `unordered_set` an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.

class ...
make_unordered_set_member_hook::type< O1, O2, O3, O4 >

Put a public data member `unordered_set_member_hook` in order to store objects of this class in an unordered_set/unordered_multi_set. `unordered_set_member_hook` holds the data necessary for maintaining the unordered_set/unordered_multi_set and provides an appropriate `value_traits` class for unordered_set/unordered_multi_set.

The hook admits the following options: `void_pointer<>`, `link_mode<>` and `store_hash<>`.

`void_pointer<>` is the pointer type that will be used internally in the hook and the container configured to use this hook.

`link_mode<>` will specify the linking mode of the hook (`normal_link`, `auto_unlink` or `safe_link`).

`store_hash<>` will tell the hook to store the hash of the value to speed up rehashings.

void ``unordered_set_member_hook` &`

Effects: Swapping two nodes swaps the position of the elements related to those nodes in one or two containers. That is, if the node this is part of the element e1, the node x is part of the element e2 and both elements are included in the containers s1 and s2, then after the swap-operation e1 is in s2 at the position of e2 and e2 is in s1 at the position of e1. If one element is not in a container, then after the swap-operation the other element is not in a container. Iterators to e1 and e2 related to those nodes are invalidated.

Complexity: Constant

Throws: Nothing.

bool

Precondition: `link_mode` must be `safe_link` or `auto_unlink`.

Returns: true, if the node belongs to a container, false otherwise. This function can be used to test whether `unordered_set::iterator_to` will return a valid iterator.

Complexity: Constant

void

Effects: Removes the node if it's inserted in a container. This function is only allowed if `link_mode` is `auto_unlink`.

Throws: Nothing.

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state.

Throws: Nothing.

const `unordered_set_member_hook` &

Effects: If `link_mode` is `auto_unlink` or `safe_link` initializes the node to an unlinked state. The argument is ignored.

Throws: Nothing.

Rationale: Providing a copy-constructor makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

`unordered_set_member_hook` & `const `unordered_set_member_hook` &`

Effects: Empty function. The argument is ignored.

Throws: Nothing.

Rationale: Providing an assignment operator makes classes using the hook STL-compliant without forcing the user to do some additional work. `swap` can be used to emulate move-semantics.

Effects: If `link_mode` is `normal_link`, the destructor does nothing (ie. no code is generated). If `link_mode` is `safe_link` and the object is stored in an `unordered_set` an assertion is raised. If `link_mode` is `auto_unlink` and `is_linked()` is true, the node is unlinked.

Throws: Nothing.