std::set<Key,Compare,Allocator>::extract (3) - Linux Manuals
std::set<Key,Compare,Allocator>::extract: std::set<Key,Compare,Allocator>::extract
Command to display std::set<Key,Compare,Allocator>::extract
manual in Linux: $ man 3 std::set<Key,Compare,Allocator>::extract
NAME
std::set<Key,Compare,Allocator>::extract - std::set<Key,Compare,Allocator>::extract
Synopsis
node_type extract( const_iterator position ); (1) (since C++17)
node_type extract( const key_type& x ); (2) (since C++17)
1) Unlinks the node that contains the element pointed to by position and returns a node_handle that owns it
2) If the container has an element with key equivalent to x, unlinks the node that contains that element from the container and returns a node_handle that owns it. Otherwise, returns an empty node handle.
In either case, no elements are copied or moved, only the internal pointers of the container nodes are repointed (rebalancing may occur, as with erase())
Extracting a node invalidates the iterators to the extracted element. Pointers and references to the extracted element remain valid, but cannot be used while element is owned by a node handle: they become usable if the element is inserted into a container.
Parameters
position - a valid iterator into this container
x - a key to identify the node to be extracted
Return value
A node_handle that owns the extracted element, or empty node handle in case the element is not found in overload (2)
Complexity
1) amortized constant
2) log(a.size())
Notes
extract is the only way to take a move-only object out of a set
set<move_only_type> s;
s.emplace(...);
move_only_type mot = move(s.extract(s.begin()).value());
Example
This section is incomplete
Reason: no example
See also
merge splices nodes from another container
(public member function)
(C++17)
inserts elements
or nodes
insert (since C++17)
(public member function)
erases elements
erase (public member function)
Pages related to std::set<Key,Compare,Allocator>::extract
- std::set<Key,Compare,Allocator>::emplace (3) - std::set<Key,Compare,Allocator>::emplace
- std::set<Key,Compare,Allocator>::emplace_hint (3) - std::set<Key,Compare,Allocator>::emplace_hint
- std::set<Key,Compare,Allocator>::empty (3) - std::set<Key,Compare,Allocator>::empty
- std::set<Key,Compare,Allocator>::end,std::set<Key,Compare,Allocator>::cend (3) - std::set<Key,Compare,Allocator>::end,std::set<Key,Compare,Allocator>::cend
- std::set<Key,Compare,Allocator>::equal_range (3) - std::set<Key,Compare,Allocator>::equal_range
- std::set<Key,Compare,Allocator>::erase (3) - std::set<Key,Compare,Allocator>::erase
- std::set<Key,Compare,Allocator>::begin,std::set<Key,Compare,Allocator>::cbegin (3) - std::set<Key,Compare,Allocator>::begin,std::set<Key,Compare,Allocator>::cbegin
- std::set<Key,Compare,Allocator>::clear (3) - std::set<Key,Compare,Allocator>::clear
- std::set<Key,Compare,Allocator>::contains (3) - std::set<Key,Compare,Allocator>::contains
- std::set<Key,Compare,Allocator>::count (3) - std::set<Key,Compare,Allocator>::count
- std::set<Key,Compare,Allocator>::find (3) - std::set<Key,Compare,Allocator>::find
- std::set<Key,Compare,Allocator>::get_allocator (3) - std::set<Key,Compare,Allocator>::get_allocator
- std::set<Key,Compare,Allocator>::insert (3) - std::set<Key,Compare,Allocator>::insert
- std::set<Key,Compare,Allocator>::key_comp (3) - std::set<Key,Compare,Allocator>::key_comp
- std::set<Key,Compare,Allocator>::lower_bound (3) - std::set<Key,Compare,Allocator>::lower_bound
- std::set<Key,Compare,Allocator>::max_size (3) - std::set<Key,Compare,Allocator>::max_size
- std::set<Key,Compare,Allocator>::merge (3) - std::set<Key,Compare,Allocator>::merge
- std::set<Key,Compare,Allocator>::operator= (3) - std::set<Key,Compare,Allocator>::operator=
- std::set<Key,Compare,Allocator>::rbegin,std::set<Key,Compare,Allocator>::crbegin (3) - std::set<Key,Compare,Allocator>::rbegin,std::set<Key,Compare,Allocator>::crbegin
- std::set<Key,Compare,Allocator>::rend,std::set<Key,Compare,Allocator>::crend (3) - std::set<Key,Compare,Allocator>::rend,std::set<Key,Compare,Allocator>::crend
- std::set<Key,Compare,Allocator>::set (3) - std::set<Key,Compare,Allocator>::set
- std::set<Key,Compare,Allocator>::size (3) - std::set<Key,Compare,Allocator>::size
- std::set<Key,Compare,Allocator>::swap (3) - std::set<Key,Compare,Allocator>::swap
- std::set<Key,Compare,Allocator>::upper_bound (3) - std::set<Key,Compare,Allocator>::upper_bound
- std::set<Key,Compare,Allocator>::value_comp (3) - std::set<Key,Compare,Allocator>::value_comp
- std::set<Key,Compare,Allocator>::~set (3) - std::set<Key,Compare,Allocator>::~set
- std::set (3) - std::set