Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
|
Implementation of set mimicking the iterface of the standard library set. The inner representation is using sorted vector of unique value. More...
#include <managed_linear_set.hpp>
Public Types | |
typedef T | value_type |
The type of values in the set. More... | |
typedef ext::vector< T, Alloc >::const_iterator | iterator |
The type of iterator over values in the set. It is the same as the underling vector's const iterator. More... | |
typedef ext::vector< T, Alloc >::const_iterator | const_iterator |
The type of const iterator over values in the set. It is the same as the underling vector's const iterator. More... | |
typedef ext::vector< T, Alloc >::const_reverse_iterator | reverse_iterator |
The type of reverse iterator over values in the set. It is the same as the underling vector's const reverse iterator. More... | |
typedef ext::vector< T, Alloc >::const_reverse_iterator | const_reverse_iterator |
The type of const reverse iterator over values in the set. It is the same as the underling vector's const reverse iterator. More... | |
Public Member Functions | |
void | addInsertCallback (const std::function< void(const T &) > &callback) |
void | addRemoveCallback (const std::function< void(const T &) > &callback) |
managed_linear_set (const Compare &comp=Compare(), const Alloc &alloc=Alloc()) | |
Default constructor of the empty set. More... | |
managed_linear_set (const Alloc &alloc) | |
Constructor of the empty set with specified allocator. More... | |
template<class InputIterator > | |
managed_linear_set (InputIterator first, InputIterator last, const Compare &comp=Compare(), const Alloc &alloc=Alloc()) | |
Set constructor from a range of values. More... | |
template<class Iterator > | |
managed_linear_set (const ext::iterator_range< Iterator > &range) | |
managed_linear_set (const managed_linear_set &x) | |
Copy constructor. More... | |
managed_linear_set (const managed_linear_set &x, const Alloc &alloc) | |
Copy constructor including allocator specification. More... | |
managed_linear_set (managed_linear_set &&x) | |
Move constructor. More... | |
managed_linear_set (managed_linear_set &&x, const Alloc &alloc) | |
Move constructor including allocator specification. More... | |
managed_linear_set (std::initializer_list< T > il, const Compare &comp=Compare(), const Alloc &alloc=Alloc()) | |
Set constructor from initializer list. More... | |
~managed_linear_set () | |
The destructor of the linear set. More... | |
iterator | begin () &noexcept |
Getter of an iterator to the begining of range of values in the container. More... | |
const_iterator | begin () const &noexcept |
Getter of a const iterator to the begining of range of values in the container. More... | |
auto | begin () &&noexcept |
Getter of a move iterator to the begining of range of values in the container. More... | |
const_iterator | cbegin () const noexcept |
Getter of a const iterator to the begining of range of values in the container. More... | |
iterator | end () &noexcept |
Getter of an iterator to the end of range of values in the container. More... | |
const_iterator | end () const &noexcept |
Getter of a const iterator to the end of range of values in the container. More... | |
auto | end () &&noexcept |
Getter of a move iterator to the end of range of values in the container. More... | |
const_iterator | cend () const noexcept |
Getter of a const iterator to the end of range of values in the container. More... | |
auto | range () & |
Make range of non-const begin to end iterators. More... | |
auto | range () const & |
Make range of non-const begin to end iterators. More... | |
auto | range () && |
Make range of move begin to end iterators. More... | |
void | clear () noexcept |
Removes all values from the conainer,. More... | |
size_t | count (const T &value) const |
Computes the number of values in the container. More... | |
const_reverse_iterator | crbegin () const noexcept |
Getter of a const revese iterator to the begining of reverse range of values in the container. More... | |
const_reverse_iterator | crend () const noexcept |
Getter of a const revese iterator to the end of reverse range of values in the container. More... | |
template<class... Args> | |
std::pair< iterator, bool > | emplace (Args &&... args) |
Emplace a value to the container. Internaly the method uses insert since the place to put the value requires call to comparator and that needs the value. More... | |
template<class... Args> | |
iterator | emplace_hint (const_iterator position, Args &&... args) |
Emplace a value to the container with provided position as a hint. Internaly the method uses insert since the place to put the value requires call to comparator and that needs the value. More... | |
bool | empty () const noexcept |
Tests whether the container is empty. More... | |
std::pair< const_iterator, const_iterator > | equal_range (const T &val) const |
Returns a range of values equal to the val . The range is specified by const iterators. More... | |
std::pair< iterator, iterator > | equal_range (const T &val) |
Returns a range of values equal to the val . The range is specified by iterators. More... | |
iterator | erase (const_iterator position) |
Removes value from the container based on the position given by iterator. More... | |
size_t | erase (const T &val) |
Removes value from the container. More... | |
iterator | erase (const_iterator first, const_iterator last) |
Removes values in the specified range. The range is specified by pair of iterators. More... | |
const_iterator | find (const T &val) const |
Function to binary search for given value. More... | |
iterator | find (const T &val) |
Function to binary search for given value. More... | |
Alloc | get_allocator () const noexcept |
Getter of the allocator. More... | |
std::pair< iterator, bool > | insert (const T &val) |
Inserts a new value to the container. More... | |
std::pair< iterator, bool > | insert (T &&val) |
Inserts a new value to the container. More... | |
iterator | insert (const_iterator position, const T &val) |
Inserts a new value to the container. The method accepts a position hint where to place the new value. More... | |
iterator | insert (const_iterator position, T &&val) |
Inserts a new value to the container. The method accepts a position hint where to place the new value. More... | |
template<class InputIterator > | |
void | insert (InputIterator first, InputIterator last) |
Insert values from a range speified by pair of iterators. More... | |
void | insert (std::initializer_list< T > il) |
Insert values from a range speified by initializer list. More... | |
Compare | key_comp () const |
Getter of the key comparator instance. More... | |
iterator | lower_bound (const T &val) |
Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val. More... | |
const_iterator | lower_bound (const T &val) const |
Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val. More... | |
size_t | max_size () const noexcept |
Returns the maximal number of values possible to store inside the container. More... | |
managed_linear_set & | operator= (const managed_linear_set &data) |
Copy operator of assignmet. More... | |
managed_linear_set & | operator= (managed_linear_set &&data) |
Move operator of assignmet. More... | |
managed_linear_set & | operator= (std::initializer_list< T > il) |
Asignment from the initializer list. More... | |
reverse_iterator | rbegin () noexcept |
Getter of a reverse iterator to the begining of range of values in the container. More... | |
const_reverse_iterator | rbegin () const noexcept |
Getter of a const reverse iterator to the begining of range of values in the container. More... | |
reverse_iterator | rend () noexcept |
Getter of a reverse iterator to the end of range of values in the container. More... | |
const_reverse_iterator | rend () const noexcept |
Getter of a const reverse iterator to the end of range of values in the container. More... | |
size_t | size () const noexcept |
Getter of the number of values inside the container. More... | |
void | swap (managed_linear_set &data) |
Swaps two instances of linear set. More... | |
iterator | upper_bound (const T &val) |
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val. More... | |
const_iterator | upper_bound (const T &val) const |
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val. More... | |
Compare | value_comp () const |
Getter of the value comparator instance. Actually the value_type is the same as key_type so this is an alias to key_comp method. More... | |
auto | operator<=> (const managed_linear_set< T, Compare, Alloc > &other) const =default |
Compares two set instances by less relation. More... | |
Implementation of set mimicking the iterface of the standard library set. The inner representation is using sorted vector of unique value.
T | the type of stored values |
Compare | the less comparator used to determinine order between elements - defaults to std::less < T > |
Alloc | the allocator of elements - defaults to std::allocator < T > |
typedef ext::vector<T,Alloc>::const_iterator ext::managed_linear_set< T, Compare, Alloc >::const_iterator |
The type of const iterator over values in the set. It is the same as the underling vector's const iterator.
typedef ext::vector<T,Alloc>::const_reverse_iterator ext::managed_linear_set< T, Compare, Alloc >::const_reverse_iterator |
The type of const reverse iterator over values in the set. It is the same as the underling vector's const reverse iterator.
typedef ext::vector<T,Alloc>::const_iterator ext::managed_linear_set< T, Compare, Alloc >::iterator |
The type of iterator over values in the set. It is the same as the underling vector's const iterator.
typedef ext::vector<T,Alloc>::const_reverse_iterator ext::managed_linear_set< T, Compare, Alloc >::reverse_iterator |
The type of reverse iterator over values in the set. It is the same as the underling vector's const reverse iterator.
typedef T ext::managed_linear_set< T, Compare, Alloc >::value_type |
The type of values in the set.
|
inlineexplicit |
Default constructor of the empty set.
comp | the instance of custom comparator or defaultly constructed comparator based on the comparator type |
alloc | the instance of custom allocator or defaultly constructed allocator based on the comparator type |
|
inlineexplicit |
Constructor of the empty set with specified allocator.
alloc | the instance of custom allocator |
|
inline |
Set constructor from a range of values.
first | the begining of the range of values |
last | the end of the range of values |
comp | the instance of custom comparator or defaultly constructed comparator based on the comparator type |
alloc | the instance of custom allocator or defaultly constructed allocator based on the comparator type |
|
inline |
Constructor from range of values.
Iterator | the type of range iterator |
range | the source range |
|
inline |
Copy constructor.
x | the other linear set instance |
|
inline |
Copy constructor including allocator specification.
x | the other linear set instance |
alloc | the new allocator instance |
|
inline |
Move constructor.
x | the other linear set instance |
|
inline |
Move constructor including allocator specification.
x | the other linear set instance |
alloc | the new allocator instance |
|
inline |
Set constructor from initializer list.
il | the source of values represented by initializer list |
comp | the instance of custom comparator or defaultly constructed comparator based on the comparator type |
alloc | the instance of custom allocator or defaultly constructed allocator based on the comparator type |
|
inline |
The destructor of the linear set.
|
inline |
|
inline |
|
inlinenoexcept |
Getter of a move iterator to the begining of range of values in the container.
|
inlinenoexcept |
Getter of an iterator to the begining of range of values in the container.
|
inlinenoexcept |
Getter of a const iterator to the begining of range of values in the container.
|
inlinenoexcept |
Getter of a const iterator to the begining of range of values in the container.
|
inlinenoexcept |
Getter of a const iterator to the end of range of values in the container.
|
inlinenoexcept |
Removes all values from the conainer,.
|
inline |
Computes the number of values in the container.
|
inlinenoexcept |
Getter of a const revese iterator to the begining of reverse range of values in the container.
|
inlinenoexcept |
Getter of a const revese iterator to the end of reverse range of values in the container.
|
inline |
Emplace a value to the container. Internaly the method uses insert since the place to put the value requires call to comparator and that needs the value.
Args | ... types of arguments of constructor of T |
args | ... actual parameters pased to constructor of T |
|
inline |
Emplace a value to the container with provided position as a hint. Internaly the method uses insert since the place to put the value requires call to comparator and that needs the value.
Args | ... types of arguments of constructor of T |
position | the position hint where to place the new value |
args | ... actual parameters pased to constructor of T |
|
inlinenoexcept |
Tests whether the container is empty.
|
inlinenoexcept |
Getter of a move iterator to the end of range of values in the container.
|
inlinenoexcept |
Getter of an iterator to the end of range of values in the container.
|
inlinenoexcept |
Getter of a const iterator to the end of range of values in the container.
|
inline |
Returns a range of values equal to the val
. The range is specified by iterators.
val | the queried value |
|
inline |
Returns a range of values equal to the val
. The range is specified by const iterators.
val | the queried value |
|
inline |
Removes value from the container.
val | the value to remove. |
|
inline |
Removes values in the specified range. The range is specified by pair of iterators.
first | the begining of removed range of values |
last | the end of removed range of values |
|
inline |
Removes value from the container based on the position given by iterator.
position | the iterator pointing to the value to remove. |
|
inline |
Function to binary search for given value.
val | the value to search for |
|
inline |
Function to binary search for given value.
val | the value to search for |
|
inlinenoexcept |
Getter of the allocator.
|
inline |
Inserts a new value to the container.
val | the value to insert |
|
inline |
Inserts a new value to the container. The method accepts a position hint where to place the new value.
position | the hint where to insert |
val | the value to insert |
|
inline |
Inserts a new value to the container. The method accepts a position hint where to place the new value.
position | the hint where to insert |
val | the value to insert |
|
inline |
Insert values from a range speified by pair of iterators.
first | the begining of removed range of values |
last | the end of removed range of values |
|
inline |
Insert values from a range speified by initializer list.
il | the source of values represented by initializer list |
|
inline |
Inserts a new value to the container.
val | the value to insert |
|
inline |
Getter of the key comparator instance.
|
inline |
Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.
val | the border value |
|
inline |
Returns an iterator pointing to the first element in the range [first,last) which does not compare less than val.
val | the border value |
|
inlinenoexcept |
Returns the maximal number of values possible to store inside the container.
|
default |
Compares two set instances by less relation.
other | the second instance to compare |
|
inline |
Copy operator of assignmet.
x | the other instance |
|
inline |
Move operator of assignmet.
x | the other instance |
|
inline |
Asignment from the initializer list.
il | the source initializer list |
|
inline |
Make range of non-const begin to end iterators.
|
inline |
Make range of move begin to end iterators.
|
inline |
Make range of non-const begin to end iterators.
|
inlinenoexcept |
Getter of a const reverse iterator to the begining of range of values in the container.
|
inlinenoexcept |
Getter of a reverse iterator to the begining of range of values in the container.
|
inlinenoexcept |
Getter of a const reverse iterator to the end of range of values in the container.
|
inlinenoexcept |
Getter of a reverse iterator to the end of range of values in the container.
|
inlinenoexcept |
Getter of the number of values inside the container.
|
inline |
Swaps two instances of linear set.
x | the other instance to swap with |
|
inline |
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val.
val | the border value |
|
inline |
Returns an iterator pointing to the first element in the range [first,last) which compares greater than val.
val | the border value |
|
inline |
Getter of the value comparator instance. Actually the value_type is the same as key_type so this is an alias to key_comp method.