Container that stores sequences concatenated internally. More...
#include <bio/ranges/container/concatenated_sequences.hpp>
Public Types | |
Member types | |
using | value_type = decltype(std::declval< std::decay_t< underlying_container_type > & >()|views::slice(0, 1)) |
A views::slice that represents "one element", typically a std::span. | |
using | reference = value_type |
A proxy of type views::slice that represents the range on the concatenated vector. | |
using | const_reference = decltype(std::as_const(data_values)|views::slice(0, 1)) |
An immutable proxy of type views::slice that represents the range on the concatenated vector. | |
using | iterator = detail::random_access_iterator< concatenated_sequences > |
The iterator type of this container (a random access iterator). | |
using | const_iterator = detail::random_access_iterator< concatenated_sequences const > |
The const iterator type of this container (a random access iterator). | |
using | difference_type = std::ranges::range_difference_t< data_delimiters_type > |
A signed integer type (usually std::ptrdiff_t) | |
using | size_type = std::ranges::range_size_t< data_delimiters_type > |
An unsigned integer type (usually std::size_t) | |
Public Member Functions | |
Constructors, destructor and assignment | |
concatenated_sequences ()=default | |
Default constructors. | |
constexpr | concatenated_sequences (concatenated_sequences const &)=default |
Default constructors. | |
constexpr | concatenated_sequences (concatenated_sequences &&) noexcept=default |
Default constructors. | |
constexpr concatenated_sequences & | operator= (concatenated_sequences const &)=default |
Default constructors. | |
constexpr concatenated_sequences & | operator= (concatenated_sequences &&) noexcept=default |
Default constructors. | |
~concatenated_sequences ()=default | |
Default constructors. | |
template<meta::different_from< concatenated_sequences > rng_of_rng_type> requires (std::ranges::input_range<rng_of_rng_type> && range_value_t_is_compatible_with_value_type<rng_of_rng_type>) | |
concatenated_sequences (rng_of_rng_type &&rng_of_rng) | |
Construct/assign from a different range. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
concatenated_sequences (size_type const count, rng_type &&value) | |
Construct/assign with count times value . | |
template<std::forward_iterator begin_iterator_type, typename end_iterator_type > requires (std::sized_sentinel_for<end_iterator_type, begin_iterator_type> && iter_value_t_is_compatible_with_value_type<begin_iterator_type>) | |
concatenated_sequences (begin_iterator_type begin_it, end_iterator_type end_it) | |
Construct/assign from pair of iterators. | |
template<std::ranges::forward_range value_type_t = value_type> requires is_compatible_with_value_type<value_type_t> | |
concatenated_sequences (std::initializer_list< value_type_t > ilist) | |
Construct/assign from std::initializer_list . | |
template<std::ranges::forward_range value_type_t> requires is_compatible_with_value_type<value_type_t> | |
concatenated_sequences & | operator= (std::initializer_list< value_type_t > ilist) |
Construct/assign from std::initializer_list . | |
template<std::ranges::input_range rng_of_rng_type> requires range_value_t_is_compatible_with_value_type<rng_of_rng_type> | |
void | assign (rng_of_rng_type &&rng_of_rng) |
Construct/assign from a different range. | |
template<std::ranges::forward_range rng_type> requires (is_compatible_with_value_type<rng_type>) | |
void | assign (size_type const count, rng_type &&value) |
Construct/assign with count times value . | |
template<std::forward_iterator begin_iterator_type, typename end_iterator_type > requires (iter_value_t_is_compatible_with_value_type<begin_iterator_type> && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>) | |
void | assign (begin_iterator_type begin_it, end_iterator_type end_it) |
Construct/assign from pair of iterators. | |
template<std::ranges::forward_range rng_type = value_type> requires is_compatible_with_value_type<rng_type> | |
void | assign (std::initializer_list< rng_type > ilist) |
Construct/assign from std::initializer_list . | |
Iterators | |
iterator | begin () noexcept |
Returns an iterator to the first element of the container. | |
const_iterator | begin () const noexcept |
Returns an iterator to the first element of the container. | |
const_iterator | cbegin () const noexcept |
Returns an iterator to the first element of the container. | |
iterator | end () noexcept |
Returns an iterator to the element following the last element of the container. | |
const_iterator | end () const noexcept |
Returns an iterator to the element following the last element of the container. | |
const_iterator | cend () const noexcept |
Returns an iterator to the element following the last element of the container. | |
Element access | |
reference | at (size_type const i) |
Return the i-th element as a view. | |
const_reference | at (size_type const i) const |
Return the i-th element as a view. | |
reference | operator[] (size_type const i) |
Return the i-th element as a view. | |
const_reference | operator[] (size_type const i) const |
Return the i-th element as a view. | |
reference | front () |
Return the first element as a view. Calling front on an empty container is undefined. | |
const_reference | front () const |
Return the first element as a view. Calling front on an empty container is undefined. | |
reference | back () |
Return the last element as a view. | |
const_reference | back () const |
Return the last element as a view. | |
reference | concat () |
Return the concatenation of all members. | |
const_reference | concat () const |
Return the concatenation of all members. | |
std::pair< decltype(data_values) &, decltype(data_delimiters) & > | raw_data () |
Provides direct, unsafe access to underlying data structures. | |
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > | raw_data () const |
Provides direct, unsafe access to underlying data structures. | |
Capacity | |
bool | empty () const noexcept |
Checks whether the container is empty. | |
size_type | size () const noexcept |
Returns the number of elements in the container, i.e. std::distance(begin(), end()). | |
size_type | max_size () const noexcept |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container. | |
size_type | capacity () const noexcept |
Returns the number of elements that the container has currently allocated space for. | |
void | reserve (size_type const new_cap) |
Increase the capacity to a value that's greater or equal to new_cap. | |
void | shrink_to_fit () |
Requests the removal of unused capacity. | |
Capacity (concat) | |
size_type | concat_size () const noexcept |
Returns the cumulative size of all elements in the container. | |
size_type | concat_capacity () const noexcept |
Returns the concatenated size the container has currently allocated space for. | |
void | concat_reserve (size_type const new_cap) |
Increase the concat_capacity() to a value that's greater or equal to new_cap. | |
Modifiers | |
void | clear () noexcept |
Removes all elements from the container. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
iterator | insert (const_iterator pos, rng_type &&value) |
Inserts value before position in the container. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
iterator | insert (const_iterator pos, size_type const count, rng_type &&value) |
Inserts count copies of value before position in the container. | |
template<std::forward_iterator begin_iterator_type, typename end_iterator_type > requires (iter_value_t_is_compatible_with_value_type<begin_iterator_type> && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>) | |
iterator | insert (const_iterator pos, begin_iterator_type first, end_iterator_type last) |
Inserts elements from range [first, last) before position in the container. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
iterator | insert (const_iterator pos, std::initializer_list< rng_type > const &ilist) |
Inserts elements from initializer list before position in the container. | |
iterator | erase (const_iterator first, const_iterator last) |
Removes specified elements from the container. | |
iterator | erase (const_iterator pos) |
Removes specified elements from the container. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
void | push_back (rng_type &&value) |
Appends the given element value to the end of the container. | |
void | push_back () |
Appends an empty element to the end of the container. | |
void | push_back_inner (std::ranges::range_value_t< underlying_container_type > const value) |
Appends the given element-of-element value to the end of the underlying container. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
void | append_inner (rng_type &&value) |
Appends the given elements to the end of the underlying container (increases size of last element by n). | |
void | pop_back () |
Removes the last element of the container. | |
void | resize (size_type const count) |
Resizes the container to contain count elements. | |
template<std::ranges::forward_range rng_type> requires is_compatible_with_value_type<rng_type> | |
void | resize (size_type const count, rng_type &&value) |
Resizes the container to contain count elements. | |
constexpr void | swap (concatenated_sequences &rhs) noexcept |
Swap contents with another instance. | |
constexpr void | swap (concatenated_sequences &&rhs) noexcept |
Swap contents with another instance. | |
Comparison operators | |
constexpr bool | operator== (concatenated_sequences const &rhs) const noexcept |
Checks whether *this is equal to rhs . | |
constexpr bool | operator< (concatenated_sequences const &rhs) const noexcept |
Checks whether *this is less than rhs . | |
constexpr bool | operator> (concatenated_sequences const &rhs) const noexcept |
Checks whether *this is greater than rhs . | |
constexpr bool | operator<= (concatenated_sequences const &rhs) const noexcept |
Checks whether *this is less than or equal to rhs . | |
constexpr bool | operator>= (concatenated_sequences const &rhs) const noexcept |
Checks whether *this is greater than or equal to rhs . | |
Container that stores sequences concatenated internally.
underlying_container_type | Type of the underlying container. Must satisfy bio::reservible_container. |
data_delimiters_type | A container that stores the begin/end positions in the underlying_container_type. Must satifsy bio::reservible_container and have underlying_container_type's size_type as value_type. |
This class may be used whenever you would usually use std::vector<std::vector<some_alphabet>>
or std::vector<std::string>
, i.e. whenever you have a collection of sequences. It is the spiritual successor of the StringSet<TString, Owner<ConcatDirect>>
from SeqAn2.
It saves all of the member sequences inside one concatenated sequence internally. If you access an element, you instead get a view on the internal sequence. This has the following advantages:
Note that the "value type" of bio::concatenated_sequences<T>
is not T
. It is a view –– typically a std::span or a std::string_view. This view becomes invalid when the container is destroyed or any operation is performed on the container that invalidates its iterators, e.g. push_back().
The disadvantages are:
Whenever a strong exception guarantee is given for this class, it presumes that std::is_nothrow_move_constructible<typename underlying_container_type::value_type>
otherwise only basic exception safety can be assumed.
This container provides no thread-safety beyond the promise given also by the STL that all calls to const
member function are safe from multiple threads (as long as no thread calls a non-const
member function at the same time).
|
inline |
Construct/assign from a different range.
rng_of_rng_type | The type of range to be inserted; must satisfy range_value_t_is_compatible_with_value_type. |
rng_of_rng | The sequences to construct/assign from. |
Linear in the cumulative size of rng_of_rng
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Construct/assign with count
times value
.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
count | Number of elements. |
value | The initial value to be assigned. |
In .
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Construct/assign from pair of iterators.
begin_iterator_type | Must satisfy std::forward_iterator and must satisfy iter_value_t_is_compatible_with_value_type. |
end_iterator_type | Must satisfy std::sized_sentinel_for. |
begin_it | begin of range to construct/assign from. |
end_it | end of range to construct/assign from. |
Linear in the cumulative size of the ranges between begin_it
and end_it
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Construct/assign from std::initializer_list
.
value_type_t | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
ilist | an std::initializer_list of value_type_t . |
Linear in the cumulative size of the ranges in ilist
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Appends the given elements to the end of the underlying container (increases size of last element by n).
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
value | The value to append. |
This conceptionally performs an insert()
on the back()
of this container, i.e. the last inner container grows by value.size().
If the new concat_size() is greater than concat_capacity(), all iterators and references (including the past-the-end iterator) are invalidated. Otherwise, only the past-the-end iterator is invalidated.
Amortised linear in the size of value. Wort-case linear in concat_size().
Basic exception guarantee, i.e. guaranteed not to leak. However, the container may contain invalid data after an exception is thrown.
|
inline |
Construct/assign from pair of iterators.
begin_iterator_type | Must satisfy std::forward_iterator and satisfy iter_value_t_is_compatible_with_value_type. |
end_iterator_type | Must satisfy std::sized_sentinel_for. |
begin_it | begin of range to construct/assign from. |
end_it | end of range to construct/assign from. |
Linear in the cumulative size of the ranges between begin_it
and end_it
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Construct/assign from a different range.
rng_of_rng_type | The type of range to be inserted; must satisfy range_value_t_is_compatible_with_value_type. |
rng_of_rng | The sequences to construct/assign from. |
Linear in the cumulative size of rng_of_rng
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Construct/assign with count
times value
.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
count | Number of elements. |
value | The initial value to be assigned. |
In .
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Construct/assign from std::initializer_list
.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
ilist | an std::initializer_list of rng_type . |
Linear in the cumulative size of the elements in ilist
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Return the i-th element as a view.
i | The element to retrieve. |
std::out_of_range | If you access an element behind the last. |
Constant.
Strong exception guarantee (never modifies data)..
|
inline |
Return the i-th element as a view.
i | The element to retrieve. |
std::out_of_range | If you access an element behind the last. |
Constant.
Strong exception guarantee (never modifies data)..
|
inline |
Return the last element as a view.
Calling back on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
Strong exception guarantee (never modifies data)..
|
inline |
Return the last element as a view.
Calling back on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
Strong exception guarantee (never modifies data)..
|
inlinenoexcept |
Returns an iterator to the first element of the container.
If the container is empty, the returned iterator will be equal to end().
Constant.
No-throw guarantee.
|
inlinenoexcept |
Returns an iterator to the first element of the container.
If the container is empty, the returned iterator will be equal to end().
Constant.
No-throw guarantee.
|
inlinenoexcept |
Returns the number of elements that the container has currently allocated space for.
This does not operate on underlying concat container, see concat_capacity().
Constant.
No-throw guarantee.
|
inlinenoexcept |
Returns an iterator to the first element of the container.
If the container is empty, the returned iterator will be equal to end().
Constant.
No-throw guarantee.
|
inlinenoexcept |
Returns an iterator to the element following the last element of the container.
This element acts as a placeholder; attempting to dereference it results in undefined behaviour.
Constant.
No-throw guarantee.
|
inlinenoexcept |
Removes all elements from the container.
Constant.
No-throw guarantee.
|
inline |
Return the concatenation of all members.
This is a safe way of accessing the internal concatenated representation, i.e. you cannot do operations that would invalidate this container (like insert or resize), but you can write to the individual positions.
Constant.
Strong exception guarantee (never modifies data).
|
inline |
Return the concatenation of all members.
This is a safe way of accessing the internal concatenated representation, i.e. you cannot do operations that would invalidate this container (like insert or resize), but you can write to the individual positions.
Constant.
Strong exception guarantee (never modifies data).
|
inlinenoexcept |
Returns the concatenated size the container has currently allocated space for.
Constant.
No-throw guarantee.
|
inline |
Increase the concat_capacity() to a value that's greater or equal to new_cap.
new_cap | The new capacity. |
std::length_error | If new_cap > max_size(). |
std::exception | Any exception thrown by Allocator::allocate() (typically std::bad_alloc ). |
Increase the capacity of the underlying concatenated sequence to a value that's greater or equal to new_cap. If new_cap is greater than the current concat_capacity(), new storage is allocated, otherwise the method does nothing. If new_cap is greater than concat_capacity(), all iterators, including the past-the-end iterator, and all references to the elements are invalidated. Otherwise, no iterators or references are invalidated.
At most linear in the concat_size() of the container.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inlinenoexcept |
Returns the cumulative size of all elements in the container.
Constant.
No-throw guarantee.
|
inlinenoexcept |
Checks whether the container is empty.
true
if the container is empty, false
otherwise.Constant.
No-throw guarantee.
|
inlinenoexcept |
Returns an iterator to the element following the last element of the container.
This element acts as a placeholder; attempting to dereference it results in undefined behaviour.
Constant.
No-throw guarantee.
|
inlinenoexcept |
Returns an iterator to the element following the last element of the container.
This element acts as a placeholder; attempting to dereference it results in undefined behaviour.
Constant.
No-throw guarantee.
|
inline |
Removes specified elements from the container.
first | Begin of range to erase. |
last | Behind the end of range to erase. |
first==last
.Invalidates iterators and references at or after the point of the erase, including the end() iterator.
The iterator first does not need to be dereferenceable if first==last: erasing an empty range is a no-op.
Linear in concat_size().
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inline |
Removes specified elements from the container.
pos | Remove the element at pos. |
first==last
.Invalidates iterators and references at or after the point of the erase, including the end() iterator.
The iterator pos must be valid and dereferenceable. Thus the end() iterator (which is valid, but is not dereferencable) cannot be used as a value for pos.
Linear in concat_size().
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inline |
Return the first element as a view. Calling front on an empty container is undefined.
Calling front on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
Strong exception guarantee (never modifies data).
|
inline |
Return the first element as a view. Calling front on an empty container is undefined.
Calling front on an empty container is undefined. In debug mode an assertion checks the size of the container.
Constant.
Strong exception guarantee (never modifies data).
|
inline |
Inserts elements from range [first, last)
before position in the container.
begin_iterator_type | Must satisfy std::forward_iterator and iter_value_t_is_compatible_with_value_type. |
end_iterator_type | Must satisfy std::sized_sentinel_for. |
pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
first | Begin of range to insert. |
last | Behind the end of range to insert. |
first==last
.The behaviour is undefined if first and last are iterators into *this
.
Causes reallocation if the new size() is greater than the old capacity(). If the new size() is greater than capacity(), all iterators and references are invalidated. Otherwise, only the iterators and references before the insertion point remain valid. The past-the-end iterator is also invalidated.
Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>
.
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inline |
Inserts value before position in the container.
rng_type | The type of range to be inserted; must satisfy std::ranges::forward_range and have the same value_type as value_type (i.e. value_type 's value_type !). |
pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
value | Element value to insert. |
Causes reallocation if the new size() is greater than the old capacity(). If the new size() is greater than capacity(), all iterators and references are invalidated. Otherwise, only the iterators and references before the insertion point remain valid. The past-the-end iterator is also invalidated.
Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>
.
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inline |
Inserts count copies of value before position in the container.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
count | Number of copies. |
value | Element value to insert. |
count==0
.Causes reallocation if the new size() is greater than the old capacity(). If the new size() is greater than capacity(), all iterators and references are invalidated. Otherwise, only the iterators and references before the insertion point remain valid. The past-the-end iterator is also invalidated.
Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>
.
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inline |
Inserts elements from initializer list before position in the container.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
pos | Iterator before which the content will be inserted. pos may be the end() iterator. |
ilist | Initializer list with values to insert. |
ilist
is empty.Causes reallocation if the new size() is greater than the old capacity(). If the new size() is greater than capacity(), all iterators and references are invalidated. Otherwise, only the iterators and references before the insertion point remain valid. The past-the-end iterator is also invalidated.
Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>
.
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inlinenoexcept |
Returns the maximum number of elements the container is able to hold due to system or library implementation limitations, i.e. std::distance(begin(), end()) for the largest container.
This value typically reflects the theoretical limit on the size of the container. At runtime, the size of the container may be limited to a value smaller than max_size() by the amount of RAM available.
Constant.
No-throw guarantee.
|
inline |
Construct/assign from std::initializer_list
.
value_type_t | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
ilist | an std::initializer_list of value_type_t . |
Linear in the cumulative size of the elements in ilist
.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Return the i-th element as a view.
i | The element to retrieve. |
Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.
Constant.
Strong exception guarantee (never modifies data)..
|
inline |
Return the i-th element as a view.
i | The element to retrieve. |
Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.
Constant.
Strong exception guarantee (never modifies data)..
|
inline |
Removes the last element of the container.
Calling pop_back on an empty container is undefined. In debug mode an assertion will be thrown.
No iterators or references except for back() and end() are invalidated.
Constant.
No exception is thrown in release mode.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Appends an empty element to the end of the container.
This conceptionally adds an empty element to the container, i.e. the "outer container" grows by 1 and the new back() will be empty.
No iterators are invalidated.
Amortised constant. Wort-case linear in size().
Basic exception guarantee, i.e. guaranteed not to leak. However, the container may contain invalid data after an exception is thrown.
|
inline |
Appends the given element value to the end of the container.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
value | The value to append. |
This conceptionally adds another element to the container with the specified content, i.e. the "outer container" grows by 1.
If the new concat_size() is greater than concat_capacity(), all iterators and references (including the past-the-end iterator) are invalidated. Otherwise, only the past-the-end iterator is invalidated.
Amortised linear in the size of value. Wort-case linear in concat_size().
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
|
inline |
Appends the given element-of-element value to the end of the underlying container.
value | The value to append. |
This conceptionally performs a push_back()
on the back()
of this container, i.e. that last inner container grows by 1.
If the new concat_size() is greater than concat_capacity(), all iterators and references (including the past-the-end iterator) are invalidated. Otherwise, only the past-the-end iterator is invalidated.
Amortised constant. Wort-case linear in concat_size().
Basic exception guarantee, i.e. guaranteed not to leak. However, the container may contain invalid data after an exception is thrown.
|
inline |
Provides direct, unsafe access to underlying data structures.
The exact representation of the data is implementation defined. Do not rely on it for API stability.
|
inline |
Provides direct, unsafe access to underlying data structures.
The exact representation of the data is implementation defined. Do not rely on it for API stability.
|
inline |
Increase the capacity to a value that's greater or equal to new_cap.
new_cap | The new capacity. |
std::length_error | If new_cap > max_size(). |
std::exception | Any exception thrown by Allocator::allocate() (typically std::bad_alloc ). |
Increase the capacity of the vector to a value that's greater or equal to new_cap. If new_cap is greater than the current capacity(), new storage is allocated, otherwise the method does nothing. If new_cap is greater than capacity(), all iterators, including the past-the-end iterator, and all references to the elements are invalidated. Otherwise, no iterators or references are invalidated.
This does not operate on underlying concat container, see concat_reserve().
At most linear in the size() of the container.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inline |
Resizes the container to contain count elements.
count | The new size. |
std::length_error | If count > max_size(). |
std::exception | Any exception thrown by Allocator::allocate() (typically std::bad_alloc ). |
Increase the size() of the vector to count.
If the current capacity() is smaller than count, new storage is allocated and all iterators, including the past-the-end iterator, and all references to the elements are invalidated. Otherwise only the past-the-end iterator is invalidated.
If the current size is greater than count, the container is reduced to its first count elements. Capacity is never reduced when resizing to smaller size because that would invalidate all iterators, rather than only the ones that would be invalidated by the equivalent sequence of pop_back() calls.
At most linear in the size() of the container.
Only new size: Strong exception guarantee (no data is modified in case an exception is thrown). [only new size]
New default value: Basic exception guarantee, i.e. guaranteed not to leak, but container my contain bogus data after exceptions is thrown.
|
inline |
Resizes the container to contain count elements.
rng_type | The type of range to be inserted; must satisfy is_compatible_with_value_type. |
value | Instead of appending empty containers, append copies of value. |
count | The new size. |
std::length_error | If count > max_size(). |
std::exception | Any exception thrown by Allocator::allocate() (typically std::bad_alloc ). |
Increase the size() of the vector to count.
If the current capacity() is smaller than count, new storage is allocated and all iterators, including the past-the-end iterator, and all references to the elements are invalidated. Otherwise only the past-the-end iterator is invalidated.
If the current size is greater than count, the container is reduced to its first count elements. Capacity is never reduced when resizing to smaller size because that would invalidate all iterators, rather than only the ones that would be invalidated by the equivalent sequence of pop_back() calls.
At most linear in the size() of the container.
Only new size: Strong exception guarantee (no data is modified in case an exception is thrown). [only new size]
New default value: Basic exception guarantee, i.e. guaranteed not to leak, but container my contain bogus data after exceptions is thrown.
|
inline |
Requests the removal of unused capacity.
It is a non-binding request to reduce capacity() to size() and concat_capacity() to concat_size(). It depends on the implementation if the request is fulfilled. If reallocation occurs, all iterators, including the past the end iterator, and all references to the elements are invalidated. If no reallocation takes place, no iterators or references are invalidated.
This effects both underlying data structures.
At most linear in the size() of the container.
Strong exception guarantee (no data is modified in case an exception is thrown).
|
inlinenoexcept |
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Swap contents with another instance.
rhs | The other instance to swap with. |
Constant.
No-throw guarantee.
|
inlineconstexprnoexcept |
Swap contents with another instance.
rhs | The other instance to swap with. |
Constant.
No-throw guarantee.