Container¶
Meta-header for the container submodule .
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
Provides seqan3::concatenated_sequences.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
seqan3¶ The main SeqAn3 namespace.
Helpers for seqan3::semi_alphabet_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::semi_alphabet_concept.
Helpers for seqan3::alphabet_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::alphabet_concept.
Helpers for seqan3::nucleotide_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::nucleotide_concept.
Alphabet aliases
Other names (typedefs) for seqan3::nucl16
Range concepts
Adapted from the Ranges TS.
Container concepts
Container concepts as defined by the standard library (or very close).
Container-of-container concepts
Shortcuts for multi-dimensional container concepts.
- template <typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
-
class
concatenated_sequences¶ - #include <range/container/concatenated_sequences.hpp>
Container that stores sequences concatenated internally.
This class may be used whenever you would usually use
std::vector<std::vector<some_alphabet>>orstd::vector<std::string>, i.e. whenever you have a collection of sequences. It is the spiritual successor of theStringSet<TString, Owner<ConcatDirect>>from SeqAn2.- Template Parameters
inner_type: The type of sequences that will be stored. Must satisfy seqan3::reservable_sequence_concept.data_delimiters_type: A container that stores the begin/end positions in the inner_type. Must be seqan3::reservable_sequence_concept and have inner_type’s size_type as value_type.
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 string as a proxy. This has the following advantages:
- Better cache locality when parsing the sequences linearly (and often also on random access).
- Constant time access to the concatenation of the sequences via concat().
- This access is also writable so that certain transformations can be done globally, instead of element-wise.
- Also direct access to the delimiters via data() [this is used by some algorithms].
The disadvantages are:
- Slower inserts and erases because the entire concatenation might have to be copied.
- No emplace operations.
- Modifying elements is limited to operations on elements of that element, i.e. you can change a character, but you can’t assign a new member sequence to an existing position.
concatenated_sequences<dna4_vector> concat1{"ACGT"_dna4, "GAGGA"_dna4}; std::cout << concat1[0] << '\n'; // "[A,C,G,T]" std::vector<dna4_vector> concat2{"ACTA"_dna4, "AGGA"_dna4}; concat1 = concat2; // you can assign from other ranges concat2[0] = "ATTA"_dna4; // this works for vector of vector //concat1[0] = "ATTA"_dna4; // but not on concatenated_sequences concat1[0][1] = dna4::T; // this, however, does std::cout << concat1[0] << '\n'; // "[A,T,T,A]" // if you know that you will be adding a thousand vectors of length thousand: concat1.reserve(1'000); concat1.concat_reserve(1'000 * 1'000); while (...) { // ... concat1.push_back(vector_of_length1000); }
- Example
Whenever a strong exception guarantee is given for this class, it presumes that
std::is_nothrow_move_constructible<typename inner_type::value_type>otherwise only basic exception safety can be assumed.- Exceptions
This container provides no thread-safety beyond the promise given also by the STL that all calls to
constmember function are safe from multiple threads (as long as no thread calls a non-constmember function at the same time).- Thread safety
Member types
-
template<>
usingvalue_type= std::decay_t<inner_type>¶ == inner_type.
-
using
seqan3::concatenated_sequences< inner_type, data_delimiters_type >::reference = decltype(data_values | ranges::view::slice(0, 1)) A proxy of type ranges::view::slice that represents the range on the concatenated vector.
-
using
seqan3::concatenated_sequences< inner_type, data_delimiters_type >::const_reference = decltype(std::as_const(data_values) | ranges::view::slice(0, 1) | ranges::view::const_) An immutable proxy of type ranges::view::slice that represents the range on the concatenated vector.
-
template<>
usingiterator= detail::random_access_iterator<concatenated_sequences>¶ The iterator type of this container (a random access iterator).
-
template<>
usingconst_iterator= detail::random_access_iterator<concatenated_sequences const>¶ The const iterator type of this container (a random access iterator).
-
template<>
usingdifference_type= ranges::difference_type_t<data_delimiters_type>¶ A signed integer type (usually std::ptrdiff_t)
-
template<>
usingsize_type= ranges::size_type_t<data_delimiters_type>¶ An unsigned integer type (usually std::size_t)
Constructors, destructor and assignment
-
concatenated_sequences()¶ Default constructors.
-
constexpr
concatenated_sequences(concatenated_sequences const&)¶ Default constructors.
-
constexpr
concatenated_sequences(concatenated_sequences&&)¶ Default constructors.
-
constexpr concatenated_sequences &
operator=(concatenated_sequences const&)¶ Default constructors.
-
constexpr concatenated_sequences &
operator=(concatenated_sequences&&)¶ Default constructors.
-
~concatenated_sequences()¶ Default constructors.
- template <typename rng_of_rng_type>
-
concatenated_sequences(rng_of_rng_type &&rng_of_rng)¶ Construct/assign from a different range.
Linear in the cumulative size of
rng_of_rng.- Complexity
- Template Parameters
rng_of_rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withconcatenated_sequences.
- Parameters
rng_of_rng: The sequences to construct/assign from.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename rng_type>
-
concatenated_sequences(size_type const count, rng_type &&value)¶ Construct/assign with
counttimesvalue.In
.- Complexity
- Template Parameters
rng_type: The type of range to be inserted;rng_typeandvalue_typemust satisfy seqan3::compatible_concept.
- Parameters
count: Number of elements.value: The initial value to be assigned.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename begin_iterator_type, typename end_iterator_type>
-
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)¶ Construct/assign from pair of iterators.
Linear in the cumulative size of the ranges between
begin_itandend_it.- Complexity
- Template Parameters
begin_iterator_type: Must satisfy seqan3::forward_iterator_concept and satisfy seqan3::compatible_concept withvalue_type.end_iterator_type: Must satisfy seqan3::sized_sentinel_concept.
- Parameters
begin_it: begin of range to construct/assign from.end_it: end of range to construct/assign from.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename rng_type = value_type>
-
concatenated_sequences(std::initializer_list<rng_type> ilist)¶ Construct/assign from
std::initializer_list.Linear in the cumulative size of the ranges in
ilist.- Complexity
- Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withvalue_type.
- Parameters
ilist: anstd::initializer_listofrng_type.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename rng_type>
-
concatenated_sequences &
operator=(std::initializer_list<rng_type> ilist)¶ Construct/assign from
std::initializer_list.Linear in the cumulative size of the elements in
ilist.- Complexity
- Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withvalue_type.
- Parameters
ilist: anstd::initializer_listofrng_type.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename rng_of_rng_type>
-
void
assign(rng_of_rng_type &&rng_of_rng)¶ Construct/assign from a different range.
Linear in the cumulative size of
rng_of_rng.- Complexity
- Template Parameters
rng_of_rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withconcatenated_sequences.
- Parameters
rng_of_rng: The sequences to construct/assign from.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename rng_type>
-
void
assign(size_type const count, rng_type &&value)¶ Construct/assign with
counttimesvalue.In
.- Complexity
- Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withvalue_type.
- Parameters
count: Number of elements.value: The initial value to be assigned.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename begin_iterator_type, typename end_iterator_type>
-
void
assign(begin_iterator_type begin_it, end_iterator_type end_it)¶ Construct/assign from pair of iterators.
Linear in the cumulative size of the ranges between
begin_itandend_it.- Complexity
- Template Parameters
begin_iterator_type: Must satisfy seqan3::forward_iterator_concept and satisfy seqan3::compatible_concept withvalue_type.end_iterator_type: Must satisfy seqan3::sized_sentinel_concept.
- Parameters
begin_it: begin of range to construct/assign from.end_it: end of range to construct/assign from.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
- template <typename rng_type = value_type>
-
void
assign(std::initializer_list<rng_type> ilist)¶ Construct/assign from
std::initializer_list.Linear in the cumulative size of the elements in
ilist.- Complexity
- Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withvalue_type.
- Parameters
ilist: anstd::initializer_listofrng_type.
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
Iterators
-
iterator
begin()¶ Returns an iterator to the first element of the container.
If the container is empty, the returned iterator will be equal to end().
- Return
- Iterator to the first element.
Constant.
- Complexity
No-throw guarantee.
- Exceptions
-
const_iterator
begin() const¶ Returns an iterator to the first element of the container.
If the container is empty, the returned iterator will be equal to end().
- Return
- Iterator to the first element.
Constant.
- Complexity
No-throw guarantee.
- Exceptions
-
const_iterator
cbegin() const¶ Returns an iterator to the first element of the container.
If the container is empty, the returned iterator will be equal to end().
- Return
- Iterator to the first element.
Constant.
- Complexity
No-throw guarantee.
- Exceptions
-
iterator
end()¶ 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.
- Return
- Iterator to the first element.
Constant.
- Complexity
No-throw guarantee.
- Exceptions
-
const_iterator
end() const¶ 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.
- Return
- Iterator to the first element.
Constant.
- Complexity
No-throw guarantee.
- Exceptions
-
const_iterator
cend() const¶ 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.
- Return
- Iterator to the first element.
Constant.
- Complexity
No-throw guarantee.
- Exceptions
Element access
-
reference
at(size_type const i)¶ Return the i-th element as a view.
Constant.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
- Parameters
i: The element to retrieve.
- Exceptions
std::out_of_range: If you access an element behind the last.
Strong exception guarantee (never modifies data)..
- Exceptions
-
const_reference
at(size_type const i) const¶ Return the i-th element as a view.
Constant.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
- Parameters
i: The element to retrieve.
- Exceptions
std::out_of_range: If you access an element behind the last.
Strong exception guarantee (never modifies data)..
- Exceptions
-
reference
operator[](size_type const i)¶ Return the i-th element as a view.
Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container. Constant.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
- Parameters
i: The element to retrieve.
Strong exception guarantee (never modifies data)..
- Exceptions
-
const_reference
operator[](size_type const i) const¶ Return the i-th element as a view.
Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container. Constant.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
- Parameters
i: The element to retrieve.
Strong exception guarantee (never modifies data)..
- Exceptions
-
reference
front()¶ 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.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
Strong exception guarantee (never modifies data).
- Exceptions
-
const_reference
front() const¶ 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.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
Strong exception guarantee (never modifies data).
- Exceptions
-
reference
back()¶ 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.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
Strong exception guarantee (never modifies data)..
- Exceptions
-
const_reference
back() const¶ 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.
- Return
- A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.
- Complexity
Strong exception guarantee (never modifies data)..
- Exceptions
-
reference
concat()¶ 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.
- Return
- A ranges::view proxy on the concatenation of underlying sequences.
Constant.
- Complexity
Strong exception guarantee (never modifies data).
- Exceptions
-
const_reference
concat() const¶ 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.
- Return
- A ranges::view proxy on the concatenation of underlying sequences.
Constant.
- Complexity
Strong exception guarantee (never modifies data).
- Exceptions
-
std::pair<decltype(data_values) &, decltype(data_delimiters) &>
data()¶ Provides direct, unsafe access to underlying data structures.
This exact representation of the data is implementation defined. Do not rely on it for API stability.
- Return
- An std::pair of the concatenated sequences and the delimiter string.
-
std::pair<decltype(data_values) const &, decltype(data_delimiters) const &>
data() const¶ Provides direct, unsafe access to underlying data structures.
This exact representation of the data is implementation defined. Do not rely on it for API stability.
- Return
- An std::pair of the concatenated sequences and the delimiter string.
Capacity
-
bool
empty() const¶ Checks whether the container is empty.
Constant.
- Return
trueif the container is empty,falseotherwise.- Complexity
No-throw guarantee.
- Exceptions
-
size_type
size() const¶ Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Constant.
- Return
- The number of elements in the container.
- Complexity
No-throw guarantee.
- Exceptions
-
size_type
max_size() const¶ 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.
- Return
- The number of elements in the container.
- Complexity
No-throw guarantee.
- Exceptions
-
size_type
capacity() const¶ Returns the number of elements that the container has currently allocated space for.
This does not operate on underlying concat container, see concat_capacity().
- Return
- The capacity of the currently allocated storage.
- Attention
Constant.
- Complexity
No-throw guarantee.
- Exceptions
-
void
reserve(size_type const new_cap)¶ Increase the capacity to a value that’s greater or equal to new_cap.
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.
- Parameters
new_cap: The new capacity.
- Exceptions
std::length_error: If new_cap > max_size().std::exception: Any exception thrown byAllocator::allocate()(typicallystd::bad_alloc).
This does not operate on underlying concat container, see concat_reserve().
- Attention
At most linear in the size() of the container.
- Complexity
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
-
void
shrink_to_fit()¶ 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.
- Attention
At most linear in the size() of the container.
- Complexity
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
Capacity (concat)
-
size_type
concat_size() const¶ Returns the cumulative size of all elements in the container.
Constant.
- Return
- The cumulative size of elements in the container.
- Complexity
No-throw guarantee.
- Exceptions
-
size_type
concat_capacity() const¶ Returns the concatenated size the container has currently allocated space for.
Constant.
- Return
- The capacity of the currently allocated storage.
- Complexity
No-throw guarantee.
- Exceptions
-
void
concat_reserve(size_type const new_cap)¶ Increase the concat_capacity() to a value that’s greater or equal to new_cap.
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.
- Parameters
new_cap: The new capacity.
- Exceptions
std::length_error: If new_cap > max_size().std::exception: Any exception thrown byAllocator::allocate()(typicallystd::bad_alloc).
At most linear in the concat_size() of the container.
- Complexity
Strong exception guarantee (no data is modified in case an exception is thrown).
- Exceptions
Modifiers
-
void
clear()¶ Removes all elements from the container.
Constant.
- Return
- The number of elements in the container.
- Complexity
No-throw guarantee.
- Exceptions
- template <typename rng_type>
-
iterator
insert(const_iterator pos, rng_type &&value)¶ Inserts value before position in the container.
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.
- Return
- Iterator pointing to the inserted value.
- Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::forward_range_concept and have the samevalue_typeasvalue_type(i.e.value_type‘svalue_type!).
- Parameters
pos: Iterator before which the content will be inserted.posmay be the end() iterator.value: Element value to insert.
Worst-case linear in concat_size(). This is a drawback over e.g.
std::vector<std::vector<alphabet>>.- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
concatenated_sequences<dna4_vector> foobar; foobar.insert(foobar.end(), "ACGT"_dna4); std::cout << foobar[0] << '\n'; // [A, C, G, T]
- Example
- template <typename rng_type>
-
iterator
insert(const_iterator pos, size_type const count, rng_type &&value)¶ Inserts count copies of value before position in the container.
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.
- Return
- Iterator pointing to the first element inserted, or pos if
count==0. - Template Parameters
rng_type: The type of range to be inserted;rng_typeandvalue_typemust satisfy seqan3::compatible_concept.
- Parameters
pos: Iterator before which the content will be inserted.posmay be the end() iterator.count: Number of copies.value: Element value to insert.
Worst-case linear in concat_size(). This is a drawback over e.g.
std::vector<std::vector<alphabet>>.- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
concatenated_sequences<dna4_vector> foobar; foobar.insert(foobar.end(), 2, "ACGT"_dna4); std::cout << foobar[0] << '\n'; // [A, C, G, T] std::cout << foobar[1] << '\n'; // [A, C, G, T]
- Example
- template <typename begin_iterator_type, typename end_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.The behaviour is undefined if first and last are iterators into
*this.- Return
- Iterator pointing to the first element inserted, or pos if
first==last. - Template Parameters
begin_iterator_type: Must satisfy seqan3::forward_iterator_concept and satisfy seqan3::compatible_concept withvalue_type.end_iterator_type: Must satisfy seqan3::sized_sentinel_concept.
- Parameters
pos: Iterator before which the content will be inserted.posmay be the end() iterator.first: Begin of range to insert.last: Behind the end of range 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>>.- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
- template <typename rng_type>
-
iterator
insert(const_iterator pos, std::initializer_list<rng_type> const &ilist)¶ Inserts elements from initializer list before position in the container.
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.
- Return
- Iterator pointing to the first element inserted, or pos if
ilistis empty. - Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withvalue_type.
- Parameters
pos: Iterator before which the content will be inserted.posmay be the end() iterator.ilist: Initializer list with values to insert.
Worst-case linear in concat_size(). This is a drawback over e.g.
std::vector<std::vector<alphabet>>.- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
-
iterator
erase(const_iterator first, const_iterator last)¶ Removes specified elements from the container.
Invalidates iterators and references at or after the point of the erase, including the end() iterator.
- Return
- Iterator pointing to the first element inserted, or pos if
first==last. - Parameters
first: Begin of range to erase.last: Behind the end of range to erase.
The iterator first does not need to be dereferenceable if first==last: erasing an empty range is a no-op.
Linear in concat_size().
- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
-
iterator
erase(const_iterator pos)¶ Removes specified elements from the container.
Invalidates iterators and references at or after the point of the erase, including the end() iterator.
- Return
- Iterator pointing to the first element inserted, or pos if
first==last. - Parameters
pos: Remove the element at pos.
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().
- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
- template <typename rng_type>
-
void
push_back(rng_type &&value)¶ Appends the given element value to the end of the container.
If the new size() is greater than capacity() then all iterators and references (including the past-the-end iterator) are invalidated. Otherwise only the past-the-end iterator is invalidated.
- Template Parameters
rng_type: The type of range to be inserted; must satisfy seqan3::compatible_concept withvalue_type.
- Parameters
value: The value to append.
Amortised linear in the size of value. Wort-case linear in concat_size().
- Complexity
Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.
- Exceptions
-
void
pop_back()¶ 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.
- Complexity
No exception is thrown in release mode.
- Exceptions
Strong exception guarantee (no data is modified in case an exception is thrown).
-
void
resize(size_type const count)¶ Resizes the container to contain count elements.
Increase the size() of the vector to count.
- Parameters
count: The new size.
- Exceptions
std::length_error: If count > max_size().std::exception: Any exception thrown byAllocator::allocate()(typicallystd::bad_alloc).
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.
- Complexity
Only new size: Strong exception guarantee (no data is modified in case an exception is thrown). [only new size]
- Exceptions
New default value: Basic exception guarantee, i.e. guaranteed not to leak, but container my contain bogus data after exceptions is thrown.
- template <typename rng_type>
-
void
resize(size_type const count, rng_type &&value)¶ Resizes the container to contain count elements.
Increase the size() of the vector to count.
- Template Parameters
rng_type: The type of range to be inserted;rng_typeandvalue_typemust satisfy seqan3::compatible_concept.
- Parameters
value: Instead of appending empty containers, append copies of value.count: The new size.
- Exceptions
std::length_error: If count > max_size().std::exception: Any exception thrown byAllocator::allocate()(typicallystd::bad_alloc).
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.
- Complexity
Only new size: Strong exception guarantee (no data is modified in case an exception is thrown). [only new size]
- Exceptions
New default value: Basic exception guarantee, i.e. guaranteed not to leak, but container my contain bogus data after exceptions is thrown.
-
constexpr void
swap(concatenated_sequences &rhs)¶ Swap contents with another instance.
Constant.
- Complexity
- Parameters
rhs: The other instance to swap with.
No-throw guarantee.
- Exceptions
-
constexpr void
swap(concatenated_sequences &&rhs)¶ Swap contents with another instance.
Constant.
- Complexity
- Parameters
rhs: The other instance to swap with.
No-throw guarantee.
- Exceptions
Comparison operators
-
constexpr bool
operator==(concatenated_sequences const &rhs) const¶
-
constexpr bool
operator!=(concatenated_sequences const &rhs) const¶
-
constexpr bool
operator<(concatenated_sequences const &rhs) const¶
-
constexpr bool
operator>(concatenated_sequences const &rhs) const¶
-
constexpr bool
operator<=(concatenated_sequences const &rhs) const¶
-
constexpr bool
operator>=(concatenated_sequences const &rhs) const¶
Adaptations of concepts from the standard library.
- Author
- Hannes Hauswedell <hannes.hauswedell AT fu-berlin.de>
-
namespace
seqan3¶ The main SeqAn3 namespace.
Helpers for seqan3::semi_alphabet_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::semi_alphabet_concept.
Helpers for seqan3::alphabet_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::alphabet_concept.
Helpers for seqan3::nucleotide_concept
These functions and metafunctions expose member variables and types so that they satisfy seqan3::nucleotide_concept.
Alphabet aliases
Other names (typedefs) for seqan3::nucl16
Range concepts
Adapted from the Ranges TS.
Container concepts
Container concepts as defined by the standard library (or very close).
-
concept bool seqan3::container_concept The (most general) container concept as defined by the standard library.
The container concept is modelled exactly as in the STL.
- Attention
- Other than one might expect,
std::forward_listdoes not satisfy this concept (because it does not provide.size()).
-
concept bool seqan3::sequence_concept A more refined container concept than seqan3::container_concept.
Includes constraints on constructors,
assign(),.insert(),.erase(),.push_back(),.pop_back,.clear(),.size(),front()and.back()member functions with corresponding signatures. Models the subset of the STL SequenceContainerConcept that is supported bystd::list,std::vector,std::deque,std::basic_string.- Attention
std::arrayandstd::forward_listdo not satisfy this concept.
-
concept bool seqan3::random_access_sequence_concept= requires (type val) { requires sequence_concept<type>; { val[0] } -> typename type::reference; { val.at(0) } -> typename type::reference; { val.resize(0) } -> void; { val.resize(0, typename type::value_type{}) } -> void; } A more refined container concept than seqan3::sequence_concept.
Adds requirements for
.at(),.resize()and the subscript operator[]. Models the subset of the STL SequenceContainerConcept that is supported bystd::vector,std::dequeandstd::basic_string.- Attention
std::array,std::forward_listandstd::listdo not satisfy this concept.
-
concept bool seqan3::reservable_sequence_concept= requires (type val) { requires random_access_sequence_concept<type>; { val.capacity() } -> typename type::size_type; { val.reserve(0) } -> void; { val.shrink_to_fit() } -> void; } A more refined container concept than seqan3::random_access_sequence_concept.
Adds requirements for
.reserve(). Satisfied bystd::vectorandstd::basic_string.- Attention
std::array,std::forward_list,std::listandstd::dequedo not satisfy this concept.
Container-of-container concepts
Shortcuts for multi-dimensional container concepts.
-
concept bool seqan3::container_of_container_concept= requires (type val) { requires container_concept<type>; requires container_concept<typename type::value_type>; } A multi-dimensional seqan3::container_concept.
Requires that both the type and it’s
value_typefulfill seqan3::container_concept.
-
concept bool seqan3::sequence_of_sequence_concept= requires (type val) { requires sequence_concept<type>; requires sequence_concept<typename type::value_type>; } A multi-dimensional seqan3::sequence_concept.
Requires that both the type and it’s
value_typefulfill seqan3::sequence_concept.
-
concept bool seqan3::ra_sequence_of_ra_sequence_concept= requires (type val) { requires random_access_sequence_concept<type>; requires random_access_sequence_concept<typename type::value_type>; } A multi-dimensional seqan3::random_access_sequence_concept.
Requires that both the type and it’s
value_typefulfill seqan3::random_access_sequence_concept.
-