SeqAn3  3.0.2
The Modern C++ library for sequence analysis.
seqan3::concatenated_sequences< inner_type, data_delimiters_type > Class Template Reference

Container that stores sequences concatenated internally. More...

#include <seqan3/range/container/concatenated_sequences.hpp>

+ Inheritance diagram for seqan3::concatenated_sequences< inner_type, data_delimiters_type >:

Public Types

Member types
using value_type = std::decay_t< inner_type >
 == inner_type.
 
using reference = detail::concatenated_sequences_reference_proxy< value_type, false >
 A proxy of type views::slice that represents the range on the concatenated vector.
 
using const_reference = detail::concatenated_sequences_reference_proxy< value_type, true >
 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 = difference_type_t< data_delimiters_type >
 A signed integer type (usually std::ptrdiff_t)
 
using size_type = size_type_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 &&)=default
 Default constructors.
 
constexpr concatenated_sequencesoperator= (concatenated_sequences const &)=default
 Default constructors.
 
constexpr concatenated_sequencesoperator= (concatenated_sequences &&)=default
 Default constructors.
 
 ~concatenated_sequences ()=default
 Default constructors.
 
template<std::ranges::input_range rng_of_rng_type>
 concatenated_sequences (rng_of_rng_type &&rng_of_rng)
 Construct/assign from a different range. More...
 
template<std::ranges::forward_range rng_type>
 concatenated_sequences (size_type const count, rng_type &&value)
 Construct/assign with count times value. More...
 
template<std::forward_iterator 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. More...
 
template<std::ranges::forward_range rng_type = value_type>
 concatenated_sequences (std::initializer_list< rng_type > ilist)
 Construct/assign from std::initializer_list. More...
 
template<std::ranges::forward_range rng_type>
concatenated_sequencesoperator= (std::initializer_list< rng_type > ilist)
 Construct/assign from std::initializer_list. More...
 
template<std::ranges::input_range rng_of_rng_type>
void assign (rng_of_rng_type &&rng_of_rng)
 Construct/assign from a different range. More...
 
template<typename rng_type >
void assign (size_type const count, rng_type &&value)
 Construct/assign with count times value. More...
 
template<std::forward_iterator 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. More...
 
template<std::ranges::forward_range rng_type = value_type>
void assign (std::initializer_list< rng_type > ilist)
 Construct/assign from std::initializer_list. More...
 
Iterators
iterator begin () noexcept
 Returns an iterator to the first element of the container. More...
 
const_iterator begin () const noexcept
 Returns an iterator to the first element of the container. More...
 
const_iterator cbegin () const noexcept
 Returns an iterator to the first element of the container. More...
 
iterator end () noexcept
 Returns an iterator to the element following the last element of the container. More...
 
const_iterator end () const noexcept
 Returns an iterator to the element following the last element of the container. More...
 
const_iterator cend () const noexcept
 Returns an iterator to the element following the last element of the container. More...
 
Element access
reference at (size_type const i)
 Return the i-th element as a view. More...
 
const_reference at (size_type const i) const
 Return the i-th element as a view. More...
 
reference operator[] (size_type const i)
 Return the i-th element as a view. More...
 
const_reference operator[] (size_type const i) const
 Return the i-th element as a view. More...
 
reference front ()
 Return the first element as a view. Calling front on an empty container is undefined. More...
 
const_reference front () const
 Return the first element as a view. Calling front on an empty container is undefined. More...
 
reference back ()
 Return the last element as a view. More...
 
const_reference back () const
 Return the last element as a view. More...
 
reference concat ()
 Return the concatenation of all members. More...
 
const_reference concat () const
 Return the concatenation of all members. More...
 
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data ()
 Provides direct, unsafe access to underlying data structures. More...
 
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > raw_data () const
 Provides direct, unsafe access to underlying data structures. More...
 
std::pair< decltype(data_values) &, decltype(data_delimiters) & > data ()
 Provides direct, unsafe access to underlying data structures. More...
 
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > data () const
 Provides direct, unsafe access to underlying data structures. More...
 
Capacity
bool empty () const noexcept
 Checks whether the container is empty. More...
 
size_type size () const noexcept
 Returns the number of elements in the container, i.e. std::distance(begin(), end()). More...
 
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. More...
 
size_type capacity () const noexcept
 Returns the number of elements that the container has currently allocated space for. More...
 
void reserve (size_type const new_cap)
 Increase the capacity to a value that's greater or equal to new_cap. More...
 
void shrink_to_fit ()
 Requests the removal of unused capacity. More...
 
Capacity (concat)
size_type concat_size () const noexcept
 Returns the cumulative size of all elements in the container. More...
 
size_type concat_capacity () const noexcept
 Returns the concatenated size the container has currently allocated space for. More...
 
void concat_reserve (size_type const new_cap)
 Increase the concat_capacity() to a value that's greater or equal to new_cap. More...
 
Modifiers
void clear () noexcept
 Removes all elements from the container. More...
 
template<std::ranges::forward_range rng_type>
iterator insert (const_iterator pos, rng_type &&value) requires is_compatible_value< rng_type >
 Inserts value before position in the container. More...
 
template<std::ranges::forward_range rng_type>
iterator insert (const_iterator pos, size_type const count, rng_type &&value) requires is_compatible_value< rng_type >
 Inserts count copies of value before position in the container. More...
 
template<std::forward_iterator 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. More...
 
template<std::ranges::forward_range rng_type>
iterator insert (const_iterator pos, std::initializer_list< rng_type > const &ilist) requires is_compatible_value< rng_type >
 Inserts elements from initializer list before position in the container. More...
 
iterator erase (const_iterator first, const_iterator last)
 Removes specified elements from the container. More...
 
iterator erase (const_iterator pos)
 Removes specified elements from the container. More...
 
template<std::ranges::forward_range rng_type>
void push_back (rng_type &&value) requires is_compatible_value< rng_type >
 Appends the given element value to the end of the container. More...
 
void pop_back ()
 Removes the last element of the container. More...
 
void resize (size_type const count)
 Resizes the container to contain count elements. More...
 
template<std::ranges::forward_range rng_type>
void resize (size_type const count, rng_type &&value) requires is_compatible_value< rng_type >
 Resizes the container to contain count elements. More...
 
constexpr void swap (concatenated_sequences &rhs) noexcept
 Swap contents with another instance. More...
 
constexpr void swap (concatenated_sequences &&rhs) noexcept
 Swap contents with another instance. More...
 
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 not 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.
 

Static Protected Attributes

template<typename t >
static constexpr bool is_compatible_this
 Whether a type satisfies seqan3::compatible with this class.
 
Compatibility

Static constexpr variables that emulate/encapsulate seqan3::compatible (which doesn't work for types during their definition).

template<typename t >
static constexpr bool is_compatible_value
 Whether a type satisfies seqan3::compatible with this class's value_type or reference type.
 

Detailed Description

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
class seqan3::concatenated_sequences< inner_type, data_delimiters_type >

Container that stores sequences concatenated internally.

Template Parameters
inner_typeThe type of sequences that will be stored. Must satisfy seqan3::reservible_container.
data_delimiters_typeA container that stores the begin/end positions in the inner_type. Must be seqan3::reservible_container and have inner_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 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 raw_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.

Example

#include <vector>
int main()
{
using seqan3::operator""_dna4;
seqan3::concatenated_sequences<seqan3::dna4_vector> concat1{"ACGT"_dna4, "GAGGA"_dna4};
seqan3::debug_stream << concat1[0] << '\n'; // "ACGT"
std::vector<seqan3::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][1] = 'T'_dna4; // and this works for concatenated_sequences
seqan3::debug_stream << concat1[0] << '\n'; // "ATTA"
// if you know that you will be adding ten vectors of length ten:
std::vector<seqan3::dna4> vector_of_length10{"ACGTACGTAC"_dna4};
concat1.reserve(10);
concat1.concat_reserve(10 * vector_of_length10.size());
while (concat1.size() < 10)
{
// ...
concat1.push_back(vector_of_length10);
}
}

Exceptions

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.

Thread safety

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).

Constructor & Destructor Documentation

◆ concatenated_sequences() [1/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::input_range rng_of_rng_type>
seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concatenated_sequences ( rng_of_rng_type &&  rng_of_rng)
inline

Construct/assign from a different range.

Template Parameters
rng_of_rng_typeThe type of range to be inserted; must satisfy is_compatible_this.
Parameters
rng_of_rngThe sequences to construct/assign from.

Complexity

Linear in the cumulative size of rng_of_rng.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ concatenated_sequences() [2/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concatenated_sequences ( size_type const  count,
rng_type &&  value 
)
inline

Construct/assign with count times value.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
countNumber of elements.
valueThe initial value to be assigned.

Complexity

In $O(count*value)$.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ concatenated_sequences() [3/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::forward_iterator begin_iterator_type, typename end_iterator_type >
seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concatenated_sequences ( begin_iterator_type  begin_it,
end_iterator_type  end_it 
)
inline

Construct/assign from pair of iterators.

Template Parameters
begin_iterator_typeMust satisfy std::forward_iterator and must satisfy is_compatible_value.
end_iterator_typeMust satisfy std::sized_sentinel_for.
Parameters
begin_itbegin of range to construct/assign from.
end_itend of range to construct/assign from.

Complexity

Linear in the cumulative size of the ranges between begin_it and end_it.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ concatenated_sequences() [4/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type = value_type>
seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concatenated_sequences ( std::initializer_list< rng_type >  ilist)
inline

Construct/assign from std::initializer_list.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
ilistan std::initializer_list of rng_type.

Complexity

Linear in the cumulative size of the ranges in ilist.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

Member Function Documentation

◆ assign() [1/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::input_range rng_of_rng_type>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::assign ( rng_of_rng_type &&  rng_of_rng)
inline

Construct/assign from a different range.

Template Parameters
rng_of_rng_typeThe type of range to be inserted; must satisfy is_compatible_this.
Parameters
rng_of_rngThe sequences to construct/assign from.

Complexity

Linear in the cumulative size of rng_of_rng.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ assign() [2/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<typename rng_type >
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::assign ( size_type const  count,
rng_type &&  value 
)
inline

Construct/assign with count times value.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
countNumber of elements.
valueThe initial value to be assigned.

Complexity

In $O(count*value)$.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ assign() [3/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::forward_iterator begin_iterator_type, typename end_iterator_type >
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::assign ( begin_iterator_type  begin_it,
end_iterator_type  end_it 
)
inline

Construct/assign from pair of iterators.

Template Parameters
begin_iterator_typeMust satisfy std::forward_iterator and satisfy is_compatible_value.
end_iterator_typeMust satisfy std::sized_sentinel_for.
Parameters
begin_itbegin of range to construct/assign from.
end_itend of range to construct/assign from.

Complexity

Linear in the cumulative size of the ranges between begin_it and end_it.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ assign() [4/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type = value_type>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::assign ( std::initializer_list< rng_type >  ilist)
inline

Construct/assign from std::initializer_list.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
ilistan std::initializer_list of rng_type.

Complexity

Linear in the cumulative size of the elements in ilist.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ at() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::at ( size_type const  i)
inline

Return the i-th element as a view.

Parameters
iThe element to retrieve.
Exceptions
std::out_of_rangeIf you access an element behind the last.
Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data)..

◆ at() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::at ( size_type const  i) const
inline

Return the i-th element as a view.

Parameters
iThe element to retrieve.
Exceptions
std::out_of_rangeIf you access an element behind the last.
Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data)..

◆ back() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::back ( )
inline

Return the last element as a view.

Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Calling back on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data)..

◆ back() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::back ( ) const
inline

Return the last element as a view.

Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Calling back on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data)..

◆ begin() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::begin ( )
inlinenoexcept

Returns an iterator to the first element of the container.

Returns
Iterator to the first element.

If the container is empty, the returned iterator will be equal to end().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ begin() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::begin ( ) const
inlinenoexcept

Returns an iterator to the first element of the container.

Returns
Iterator to the first element.

If the container is empty, the returned iterator will be equal to end().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ capacity()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
size_type seqan3::concatenated_sequences< inner_type, data_delimiters_type >::capacity ( ) const
inlinenoexcept

Returns the number of elements that the container has currently allocated space for.

Returns
The capacity of the currently allocated storage.
Attention

This does not operate on underlying concat container, see concat_capacity().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ cbegin()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::cbegin ( ) const
inlinenoexcept

Returns an iterator to the first element of the container.

Returns
Iterator to the first element.

If the container is empty, the returned iterator will be equal to end().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ cend()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::cend ( ) const
inlinenoexcept

Returns an iterator to the element following the last element of the container.

Returns
Iterator to the first element.

This element acts as a placeholder; attempting to dereference it results in undefined behaviour.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ clear()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::clear ( )
inlinenoexcept

Removes all elements from the container.

Returns
The number of elements in the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ concat() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concat ( )
inline

Return the concatenation of all members.

Returns
A ranges::view proxy on the concatenation of underlying sequences.

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.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data).

◆ concat() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concat ( ) const
inline

Return the concatenation of all members.

Returns
A ranges::view proxy on the concatenation of underlying sequences.

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.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data).

◆ concat_capacity()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
size_type seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concat_capacity ( ) const
inlinenoexcept

Returns the concatenated size the container has currently allocated space for.

Returns
The capacity of the currently allocated storage.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ concat_reserve()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concat_reserve ( size_type const  new_cap)
inline

Increase the concat_capacity() to a value that's greater or equal to new_cap.

Parameters
new_capThe new capacity.
Exceptions
std::length_errorIf new_cap > max_size().
std::exceptionAny 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.

Complexity

At most linear in the concat_size() of the container.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ concat_size()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
size_type seqan3::concatenated_sequences< inner_type, data_delimiters_type >::concat_size ( ) const
inlinenoexcept

Returns the cumulative size of all elements in the container.

Returns
The cumulative size of elements in the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ data() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
std::pair<decltype(data_values) &, decltype(data_delimiters) &> seqan3::concatenated_sequences< inner_type, data_delimiters_type >::data ( )
inline

Provides direct, unsafe access to underlying data structures.

Returns
An std::pair of the concatenated sequences and the delimiter string.
Warning
This documentation item is not guaranteed to exist in future SeqAn3 releases. Do not rely on the interface in your applications.

The exact representation of the data is implementation defined. Do not rely on it for API stability.

Deprecated:
Use raw_data() instead.

◆ data() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> seqan3::concatenated_sequences< inner_type, data_delimiters_type >::data ( ) const
inline

Provides direct, unsafe access to underlying data structures.

Returns
An std::pair of the concatenated sequences and the delimiter string.
Warning
This documentation item is not guaranteed to exist in future SeqAn3 releases. Do not rely on the interface in your applications.

The exact representation of the data is implementation defined. Do not rely on it for API stability.

Deprecated:
Use raw_data() instead.

◆ empty()

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
bool seqan3::concatenated_sequences< inner_type, data_delimiters_type >::empty ( ) const
inlinenoexcept

Checks whether the container is empty.

Returns
true if the container is empty, false otherwise.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ end() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::end ( )
inlinenoexcept

Returns an iterator to the element following the last element of the container.

Returns
Iterator to the first element.

This element acts as a placeholder; attempting to dereference it results in undefined behaviour.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ end() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::end ( ) const
inlinenoexcept

Returns an iterator to the element following the last element of the container.

Returns
Iterator to the first element.

This element acts as a placeholder; attempting to dereference it results in undefined behaviour.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ erase() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::erase ( const_iterator  first,
const_iterator  last 
)
inline

Removes specified elements from the container.

Parameters
firstBegin of range to erase.
lastBehind the end of range to erase.
Returns
Iterator pointing to the first element inserted, or pos if 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.

Complexity

Linear in concat_size().

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

◆ erase() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::erase ( const_iterator  pos)
inline

Removes specified elements from the container.

Parameters
posRemove the element at pos.
Returns
Iterator pointing to the first element inserted, or pos if 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.

Complexity

Linear in concat_size().

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

◆ front() [1/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::front ( )
inline

Return the first element as a view. Calling front on an empty container is undefined.

Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Calling front on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data).

◆ front() [2/2]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::front ( ) const
inline

Return the first element as a view. Calling front on an empty container is undefined.

Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Calling front on an empty container is undefined. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data).

◆ insert() [1/4]

template<typename inner_type , typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::insert ( const_iterator  pos,
rng_type &&  value 
)
inline

Inserts value before position in the container.

Template Parameters
rng_typeThe 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!).
Parameters
posIterator before which the content will be inserted. pos may be the end() iterator.
valueElement value to insert.
Returns
Iterator pointing to the inserted value.

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.

Complexity

Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>.

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

Example

int main()
{
using seqan3::operator""_dna4;
foobar.insert(foobar.end(), "ACGT"_dna4);
seqan3::debug_stream << foobar[0] << '\n'; // "ACGT"
}

◆ insert() [2/4]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::insert ( const_iterator  pos,
size_type const  count,
rng_type &&  value 
)
inline

Inserts count copies of value before position in the container.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_this.
Parameters
posIterator before which the content will be inserted. pos may be the end() iterator.
countNumber of copies.
valueElement value to insert.
Returns
Iterator pointing to the first element inserted, or pos if 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.

Complexity

Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>.

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

Example

int main()
{
using seqan3::operator""_dna4;
foobar.insert(foobar.end(), 2, "ACGT"_dna4);
seqan3::debug_stream << foobar[0] << '\n'; // "ACGT"
seqan3::debug_stream << foobar[1] << '\n'; // "ACGT"
}

◆ insert() [3/4]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::forward_iterator begin_iterator_type, typename end_iterator_type >
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::insert ( const_iterator  pos,
begin_iterator_type  first,
end_iterator_type  last 
)
inline

Inserts elements from range [first, last) before position in the container.

Template Parameters
begin_iterator_typeMust satisfy std::forward_iterator and is_compatible_value.
end_iterator_typeMust satisfy std::sized_sentinel_for.
Parameters
posIterator before which the content will be inserted. pos may be the end() iterator.
firstBegin of range to insert.
lastBehind the end of range to insert.
Returns
Iterator pointing to the first element inserted, or pos if 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.

Complexity

Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>.

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

◆ insert() [4/4]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
iterator seqan3::concatenated_sequences< inner_type, data_delimiters_type >::insert ( const_iterator  pos,
std::initializer_list< rng_type > const &  ilist 
)
inline

Inserts elements from initializer list before position in the container.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
posIterator before which the content will be inserted. pos may be the end() iterator.
ilistInitializer list with values to insert.
Returns
Iterator pointing to the first element inserted, or pos if 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.

Complexity

Worst-case linear in concat_size(). This is a drawback over e.g. std::vector<std::vector<alphabet>>.

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

◆ max_size()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
size_type seqan3::concatenated_sequences< inner_type, data_delimiters_type >::max_size ( ) const
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.

Returns
The number of elements in the 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.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ operator=()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
concatenated_sequences& seqan3::concatenated_sequences< inner_type, data_delimiters_type >::operator= ( std::initializer_list< rng_type >  ilist)
inline

Construct/assign from std::initializer_list.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
ilistan std::initializer_list of rng_type.

Complexity

Linear in the cumulative size of the elements in ilist.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ operator[]() [1/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::operator[] ( size_type const  i)
inline

Return the i-th element as a view.

Parameters
iThe element to retrieve.
Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data)..

◆ operator[]() [2/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
const_reference seqan3::concatenated_sequences< inner_type, data_delimiters_type >::operator[] ( size_type const  i) const
inline

Return the i-th element as a view.

Parameters
iThe element to retrieve.
Returns
A ranges::view on the underlying concatenated sequences that acts as a proxy for the element.

Accessing an element behind the last causes undefined behaviour. In debug mode an assertion checks the size of the container.

Complexity

Constant.

Exceptions

Strong exception guarantee (never modifies data)..

◆ pop_back()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::pop_back ( )
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.

Complexity

Constant.

Exceptions

No exception is thrown in release mode.

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ push_back()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::push_back ( rng_type &&  value)
inline

Appends the given element value to the end of the container.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
valueThe value to append.

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.

Complexity

Amortised linear in the size of value. Wort-case linear in concat_size().

Exceptions

Basic exception guarantee, i.e. guaranteed not to leak, but container my contain invalid data after exceptions is thrown.

◆ raw_data() [1/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
std::pair<decltype(data_values) &, decltype(data_delimiters) &> seqan3::concatenated_sequences< inner_type, data_delimiters_type >::raw_data ( )
inline

Provides direct, unsafe access to underlying data structures.

Returns
An std::pair of the concatenated sequences and the delimiter string.
Warning
This documentation item is not guaranteed to exist in future SeqAn3 releases. Do not rely on the interface in your applications.

The exact representation of the data is implementation defined. Do not rely on it for API stability.

◆ raw_data() [2/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> seqan3::concatenated_sequences< inner_type, data_delimiters_type >::raw_data ( ) const
inline

Provides direct, unsafe access to underlying data structures.

Returns
An std::pair of the concatenated sequences and the delimiter string.
Warning
This documentation item is not guaranteed to exist in future SeqAn3 releases. Do not rely on the interface in your applications.

The exact representation of the data is implementation defined. Do not rely on it for API stability.

◆ reserve()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::reserve ( size_type const  new_cap)
inline

Increase the capacity to a value that's greater or equal to new_cap.

Parameters
new_capThe new capacity.
Exceptions
std::length_errorIf new_cap > max_size().
std::exceptionAny 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.

Attention

This does not operate on underlying concat container, see concat_reserve().

Complexity

At most linear in the size() of the container.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ resize() [1/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::resize ( size_type const  count)
inline

Resizes the container to contain count elements.

Parameters
countThe new size.
Exceptions
std::length_errorIf count > max_size().
std::exceptionAny 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.

Complexity

At most linear in the size() of the container.

Exceptions

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.

◆ resize() [2/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
template<std::ranges::forward_range rng_type>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::resize ( size_type const  count,
rng_type &&  value 
)
inline

Resizes the container to contain count elements.

Template Parameters
rng_typeThe type of range to be inserted; must satisfy is_compatible_value.
Parameters
valueInstead of appending empty containers, append copies of value.
countThe new size.
Exceptions
std::length_errorIf count > max_size().
std::exceptionAny 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.

Complexity

At most linear in the size() of the container.

Exceptions

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.

◆ shrink_to_fit()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::shrink_to_fit ( )
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.

Attention

This effects both underlying data structures.

Complexity

At most linear in the size() of the container.

Exceptions

Strong exception guarantee (no data is modified in case an exception is thrown).

◆ size()

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
size_type seqan3::concatenated_sequences< inner_type, data_delimiters_type >::size ( ) const
inlinenoexcept

Returns the number of elements in the container, i.e. std::distance(begin(), end()).

Returns
The number of elements in the container.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ swap() [1/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
constexpr void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::swap ( concatenated_sequences< inner_type, data_delimiters_type > &  rhs)
inlinenoexcept

Swap contents with another instance.

Parameters
rhsThe other instance to swap with.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ swap() [2/2]

template<typename inner_type, typename data_delimiters_type = std::vector<typename inner_type::size_type>>
constexpr void seqan3::concatenated_sequences< inner_type, data_delimiters_type >::swap ( concatenated_sequences< inner_type, data_delimiters_type > &&  rhs)
inlinenoexcept

Swap contents with another instance.

Parameters
rhsThe other instance to swap with.

Complexity

Constant.

Exceptions

No-throw guarantee.


The documentation for this class was generated from the following file: