|
| | Bag ()=default |
| | Construct an empty container.
|
| |
| iterator | begin () |
| |
| iterator | end () |
| |
| const_iterator | begin () const |
| |
| const_iterator | end () const |
| |
| std::size_t | size () const |
| | Number of elements in the container.
|
| |
| bool | empty () const |
| | Is the container empty?
|
| |
| std::size_t | capacity () const |
| | Capacity of the container.
|
| |
| std::size_t | max_size () const |
| | Maximum number of elements the container can hold.
|
| |
| void | reserve (std::size_t new_capacity) |
| | Reserve storage.
|
| |
| void | resize (std::size_t new_size) |
| | Resize container.
|
| |
| void | clear () |
| | Remove all elements form container.
|
| |
| T & | insert (T const &v) |
| | Insert an element into the container.
|
| |
| T & | insert (T &&v) |
| | This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
| |
| iterator | erase (iterator it) |
| | Remove element from the list.
|
| |
template<class T>
class Utils::Bag< T >
Bag of elements.
A bag is a container in which the elements do not have a fixed order. It can be considered an unordered variant of vector, and implements the Container named requirement specified in C++11.
Elements in the container do not have a stable position and removing elements can change the order of the other elements. The looser contract (compared to a vector) allows removing any element in the container in constant time.
- Template Parameters
-
| T | Element type, needs to be Swappable. |
Definition at line 49 of file Bag.hpp.
Insert an element into the container.
If before the call size() >= capacity(), this may reallocate, in which case all iterators into the container are invalidated. Otherwise only the end iterator is invalidated.
- Parameters
-
- Returns
- Reference to the added element.
Definition at line 147 of file Bag.hpp.
Referenced by RegularDecomposition::resort().