Loading...
Searching...
No Matches
concatenated_sequences.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <iterator>
#include <ranges>
#include <type_traits>
#include <vector>
#include <seqan3/core/concept/cereal.hpp>
#include <seqan3/utility/container/concept.hpp>
#include <seqan3/utility/views/repeat_n.hpp>
#include <seqan3/utility/views/slice.hpp>
#if SEQAN3_HAS_CEREAL
# include <cereal/types/vector.hpp>
#endif // SEQAN3_HAS_CEREAL
namespace seqan3
{
template <typename underlying_container_type,
typename data_delimiters_type = std::vector<typename underlying_container_type::size_type>>
requires reservible_container<std::remove_reference_t<underlying_container_type>>
&& reservible_container<std::remove_reference_t<data_delimiters_type>>
&& std::is_same_v<std::ranges::range_size_t<underlying_container_type>,
std::ranges::range_value_t<data_delimiters_type>>
class concatenated_sequences
{
protected:
std::decay_t<underlying_container_type> data_values;
data_delimiters_type data_delimiters{0};
public:
using value_type = decltype(std::declval<std::decay_t<underlying_container_type> &>() | views::slice(0, 1));
using reference = value_type;
using const_reference =
decltype(std::declval<std::decay_t<underlying_container_type> const &>() | views::slice(0, 1));
using iterator = detail::random_access_iterator<concatenated_sequences>;
using const_iterator = detail::random_access_iterator<concatenated_sequences const>;
using difference_type = std::ranges::range_difference_t<data_delimiters_type>;
using size_type = std::ranges::range_size_t<data_delimiters_type>;
protected:
// unfortunately we cannot specialise the variable template so we have to add an auxiliary here
template <std::ranges::range t>
static constexpr bool is_compatible_with_value_type_aux(std::type_identity<t>)
{
return range_dimension_v<t> == range_dimension_v<value_type>
&& std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
}
static constexpr bool is_compatible_with_value_type_aux(...)
{
return false;
}
// we explicitly check same-ness, because these types may not be fully resolved, yet
template <std::ranges::range t>
static constexpr bool is_compatible_with_value_type = is_compatible_with_value_type_aux(std::type_identity<t>{});
// cannot use the concept, because this class is not yet fully defined
template <typename t>
requires is_compatible_with_value_type<std::iter_reference_t<t>>
static constexpr bool iter_value_t_is_compatible_with_value_type = true;
// cannot use the concept, because this class is not yet fully defined
template <std::ranges::range t>
requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
static constexpr bool range_value_t_is_compatible_with_value_type = true;
public:
concatenated_sequences() = default;
constexpr concatenated_sequences(concatenated_sequences const &) = default;
constexpr concatenated_sequences(concatenated_sequences &&) = default;
constexpr concatenated_sequences & operator=(concatenated_sequences const &) = default;
constexpr concatenated_sequences & operator=(concatenated_sequences &&) = default;
~concatenated_sequences() = default;
template <std::ranges::input_range rng_of_rng_type>
concatenated_sequences(rng_of_rng_type && rng_of_rng)
requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
{
if constexpr (std::ranges::sized_range<rng_of_rng_type>)
data_delimiters.reserve(std::ranges::size(rng_of_rng) + 1);
for (auto && val : rng_of_rng)
{
data_values.insert(data_values.end(), val.begin(), val.end());
data_delimiters.push_back(data_delimiters.back() + val.size());
}
}
template <std::ranges::forward_range rng_type>
concatenated_sequences(size_type const count, rng_type && value)
requires is_compatible_with_value_type<rng_type>
{
// TODO SEQAN_UNLIKELY
if (count == 0)
return;
insert(cend(), count, std::forward<rng_type>(value));
}
template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
&& iter_value_t_is_compatible_with_value_type<begin_iterator_type>
{
insert(cend(), begin_it, end_it);
}
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)
{
assign(std::begin(ilist), std::end(ilist));
}
template <std::ranges::forward_range value_type_t>
concatenated_sequences & operator=(std::initializer_list<value_type_t> ilist)
requires is_compatible_with_value_type<value_type_t>
{
assign(std::begin(ilist), std::end(ilist));
return *this;
}
template <std::ranges::input_range rng_of_rng_type>
void assign(rng_of_rng_type && rng_of_rng)
requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
{
concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
swap(rhs);
}
template <std::ranges::forward_range rng_type>
void assign(size_type const count, rng_type && value)
requires (is_compatible_with_value_type<rng_type>)
{
concatenated_sequences rhs{count, value};
swap(rhs);
}
template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
&& std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
{
concatenated_sequences rhs{begin_it, end_it};
swap(rhs);
}
template <std::ranges::forward_range rng_type = value_type>
void assign(std::initializer_list<rng_type> ilist)
requires is_compatible_with_value_type<rng_type>
{
assign(std::begin(ilist), std::end(ilist));
}
iterator begin() noexcept
{
return iterator{*this};
}
const_iterator begin() const noexcept
{
return const_iterator{*this};
}
const_iterator cbegin() const noexcept
{
return const_iterator{*this};
}
iterator end() noexcept
{
return iterator{*this, size()};
}
const_iterator end() const noexcept
{
return const_iterator{*this, size()};
}
const_iterator cend() const noexcept
{
return const_iterator{*this, size()};
}
reference at(size_type const i)
{
//TODO add SEQAN_UNLIKELY
if (i >= size())
throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
return (*this)[i];
}
const_reference at(size_type const i) const
{
//TODO add SEQAN_UNLIKELY
if (i >= size())
throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
return (*this)[i];
}
reference operator[](size_type const i)
{
assert(i < size());
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(-Warray-bounds)
return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
}
const_reference operator[](size_type const i) const
{
assert(i < size());
return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
}
reference front()
{
assert(size() > 0);
return (*this)[0];
}
const_reference front() const
{
assert(size() > 0);
return (*this)[0];
}
reference back()
{
assert(size() > 0);
return (*this)[size() - 1];
}
const_reference back() const
{
assert(size() > 0);
return (*this)[size() - 1];
}
reference concat()
{
return data_values | views::slice(static_cast<size_type>(0), concat_size());
}
const_reference concat() const
{
return data_values | views::slice(static_cast<size_type>(0), concat_size());
}
std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
{
return {data_values, data_delimiters};
}
std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
{
return {data_values, data_delimiters};
}
bool empty() const noexcept
{
return size() == 0;
}
size_type size() const noexcept
{
return data_delimiters.size() - 1;
}
size_type max_size() const noexcept
{
return data_delimiters.max_size() - 1;
}
size_type capacity() const noexcept
{
return data_delimiters.capacity();
}
void reserve(size_type const new_cap)
{
data_delimiters.reserve(new_cap + 1);
}
void shrink_to_fit()
{
data_values.shrink_to_fit();
data_delimiters.shrink_to_fit();
}
size_type concat_size() const noexcept
{
return data_values.size();
}
size_type concat_capacity() const noexcept
{
return data_values.capacity();
}
void concat_reserve(size_type const new_cap)
{
data_values.reserve(new_cap);
}
void clear() noexcept
{
data_values.clear();
data_delimiters.clear();
data_delimiters.push_back(0);
}
template <std::ranges::forward_range rng_type>
iterator insert(const_iterator pos, rng_type && value)
requires is_compatible_with_value_type<rng_type>
{
return insert(pos, 1, std::forward<rng_type>(value));
}
// no specialisation for temporaries, since we have to copy anyway
template <std::ranges::forward_range rng_type>
iterator insert(const_iterator pos, size_type const count, rng_type && value)
requires is_compatible_with_value_type<rng_type>
{
auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
// TODO SEQAN_UNLIKELY
if (count == 0)
return begin() + pos_as_num;
/* TODO implement views::flat_repeat_n that is like
* views::repeat_n(value, count) | std::views::join | ranges::views::bounded;
* but preserves random access and size.
*
* then do
* auto concatenated = ranges::views::flat_repeat_n(value, count);
* insert(pos, concatenated.cbegin(), concatenated.cend())
*/
size_type value_len = 0;
if constexpr (std::ranges::sized_range<rng_type>)
value_len = std::ranges::size(value);
else
value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
data_values.reserve(data_values.size() + count * value_len);
auto placeholder =
views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len) | std::views::common;
// insert placeholder so the tail is moved once:
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(-Wstringop-overread, -Wstringop-overflow)
data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
std::ranges::begin(placeholder),
std::ranges::end(placeholder));
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
// assign the actual values to the placeholder:
size_t i = data_delimiters[pos_as_num];
for (size_t j = 0; j < count; ++j)
for (auto && v : value)
data_values[i++] = v;
data_delimiters.reserve(data_values.size() + count);
data_delimiters.insert(data_delimiters.begin() + pos_as_num, count, *(data_delimiters.begin() + pos_as_num));
// adapt delimiters of inserted
for (size_type i = 0; i < count; ++i)
data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
// adapt delimiters after that
// TODO parallel execution policy or vectorization?
std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
data_delimiters.end(),
[full_len = value_len * count](auto & d)
{
d += full_len;
});
return begin() + pos_as_num;
}
template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
&& std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
{
auto const pos_as_num = std::distance(cbegin(), pos);
// TODO SEQAN_UNLIKELY
if (last - first == 0)
return begin() + pos_as_num;
auto const ilist =
std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
last,
std::ranges::distance(first, last));
data_delimiters.reserve(data_values.size() + ilist.size());
data_delimiters.insert(data_delimiters.begin() + pos_as_num,
ilist.size(),
*(data_delimiters.begin() + pos_as_num));
// adapt delimiters of inserted region
size_type full_len = 0;
for (size_type i = 0; i < ilist.size(); ++i, ++first)
{
full_len += std::ranges::distance(*first);
data_delimiters[pos_as_num + 1 + i] += full_len;
}
// adapt values of inserted region
auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len) | std::views::common;
// insert placeholder so the tail is moved only once:
data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
std::ranges::begin(placeholder),
std::ranges::end(placeholder));
// assign the actual values to the placeholder:
size_t i = data_delimiters[pos_as_num];
for (auto && v0 : ilist)
for (auto && v1 : v0)
data_values[i++] = v1;
// adapt delimiters behind inserted region
// TODO parallel execution policy or vectorization?
std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
data_delimiters.end(),
[full_len](auto & d)
{
d += full_len;
});
return begin() + pos_as_num;
}
template <std::ranges::forward_range rng_type>
iterator insert(const_iterator pos, std::initializer_list<rng_type> const & ilist)
requires is_compatible_with_value_type<rng_type>
{
return insert(pos, ilist.begin(), ilist.end());
}
iterator erase(const_iterator first, const_iterator last)
{
auto const dist = std::distance(cbegin(), last);
// TODO SEQAN_UNLIKELY
if (last - first == 0)
return begin() + dist;
auto const distf = std::distance(cbegin(), first);
// we need to scan once over the input
size_type sum_size{0};
for (; first != last; ++first)
sum_size += std::ranges::size(*first);
data_values.erase(data_values.begin() + data_delimiters[distf], data_values.begin() + data_delimiters[dist]);
data_delimiters.erase(data_delimiters.begin() + distf + 1, data_delimiters.begin() + dist + 1);
// adapt delimiters after that
// TODO parallel execution policy or vectorization?
std::for_each(data_delimiters.begin() + distf + 1,
data_delimiters.end(),
[sum_size](auto & d)
{
d -= sum_size;
});
return begin() + dist;
}
iterator erase(const_iterator pos)
{
return erase(pos, pos + 1);
}
template <std::ranges::forward_range rng_type>
void push_back(rng_type && value)
requires is_compatible_with_value_type<rng_type>
{
data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
}
void push_back()
{
data_delimiters.push_back(data_delimiters.back());
}
void last_push_back(std::ranges::range_value_t<underlying_container_type> const value)
{
data_values.push_back(value);
++data_delimiters.back();
}
template <std::ranges::forward_range rng_type>
void last_append(rng_type && value)
requires is_compatible_with_value_type<rng_type>
{
data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
data_delimiters.back() += std::ranges::size(value);
}
void pop_back()
{
assert(size() > 0);
auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
data_values.resize(data_values.size() - back_length);
data_delimiters.pop_back();
}
void resize(size_type const count)
{
assert(count < max_size());
data_delimiters.resize(count + 1, data_delimiters.back());
data_values.resize(data_delimiters.back());
}
template <std::ranges::forward_range rng_type>
void resize(size_type const count, rng_type && value)
requires is_compatible_with_value_type<rng_type>
{
assert(count < max_size());
assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
if (count < size())
resize(count);
else if (count > size())
insert(cend(), count - size(), std::forward<rng_type>(value));
}
constexpr void swap(concatenated_sequences & rhs) noexcept
{
std::swap(data_values, rhs.data_values);
std::swap(data_delimiters, rhs.data_delimiters);
}
constexpr void swap(concatenated_sequences && rhs) noexcept
{
std::swap(data_values, rhs.data_values);
std::swap(data_delimiters, rhs.data_delimiters);
}
constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
{
return raw_data() == rhs.raw_data();
}
constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
{
return raw_data() != rhs.raw_data();
}
constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
{
return raw_data() < rhs.raw_data();
}
constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
{
return raw_data() > rhs.raw_data();
}
constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
{
return raw_data() <= rhs.raw_data();
}
constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
{
return raw_data() >= rhs.raw_data();
}
template <cereal_archive archive_t>
void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
{
archive(data_values, data_delimiters);
}
};
} // namespace seqan3
std::begin
T begin(T... args)
cereal.hpp
Adaptions of concepts from the Cereal library.
seqan3::concatenated_sequences::const_iterator
detail::random_access_iterator< concatenated_sequences const > const_iterator
The const iterator type of this container (a random access iterator).
Definition concatenated_sequences.hpp:134
seqan3::concatenated_sequences::operator=
constexpr concatenated_sequences & operator=(concatenated_sequences const &)=default
Default constructors.
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition concatenated_sequences.hpp:235
seqan3::concatenated_sequences::capacity
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition concatenated_sequences.hpp:749
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences()=default
Default constructors.
seqan3::concatenated_sequences::reserve
void reserve(size_type const new_cap)
Increase the capacity to a value that's greater or equal to new_cap.
Definition concatenated_sequences.hpp:776
seqan3::concatenated_sequences::last_push_back
void last_push_back(std::ranges::range_value_t< underlying_container_type > const value)
Appends the given element-of-element value to the end of the underlying container.
Definition concatenated_sequences.hpp:1266
seqan3::concatenated_sequences::last_append
void last_append(rng_type &&value)
Appends the given elements to the end of the underlying container (increases size of last element by ...
Definition concatenated_sequences.hpp:1294
seqan3::concatenated_sequences::front
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:592
seqan3::concatenated_sequences::concatenated_sequences
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
seqan3::concatenated_sequences::back
const_reference back() const
Return the last element as a view.
Definition concatenated_sequences.hpp:619
seqan3::concatenated_sequences::at
reference at(size_type const i)
Return the i-th element as a view.
Definition concatenated_sequences.hpp:523
seqan3::concatenated_sequences::cbegin
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:467
seqan3::concatenated_sequences::concat
reference concat()
Return the concatenation of all members.
Definition concatenated_sequences.hpp:641
seqan3::concatenated_sequences::operator>
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition concatenated_sequences.hpp:1442
seqan3::concatenated_sequences::empty
bool empty() const noexcept
Checks whether the container is empty.
Definition concatenated_sequences.hpp:688
seqan3::concatenated_sequences::operator[]
reference operator[](size_type const i)
Return the i-th element as a view.
Definition concatenated_sequences.hpp:556
seqan3::concatenated_sequences::operator=
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:335
seqan3::concatenated_sequences::swap
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1393
seqan3::concatenated_sequences::end
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:487
seqan3::concatenated_sequences::clear
void clear() noexcept
Removes all elements from the container.
Definition concatenated_sequences.hpp:887
seqan3::concatenated_sequences::begin
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:455
seqan3::concatenated_sequences::~concatenated_sequences
~concatenated_sequences()=default
Default constructors.
seqan3::concatenated_sequences::pop_back
void pop_back()
Removes the last element of the container.
Definition concatenated_sequences.hpp:1319
seqan3::concatenated_sequences::front
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:585
seqan3::concatenated_sequences::back
reference back()
Return the last element as a view.
Definition concatenated_sequences.hpp:612
seqan3::concatenated_sequences::concat_capacity
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition concatenated_sequences.hpp:841
seqan3::concatenated_sequences::begin
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:461
seqan3::concatenated_sequences::raw_data
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition concatenated_sequences.hpp:659
seqan3::concatenated_sequences::end
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:493
seqan3::concatenated_sequences::insert
iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
Inserts elements from range [first, last) before position in the container.
Definition concatenated_sequences.hpp:1040
seqan3::concatenated_sequences::insert
iterator insert(const_iterator pos, size_type const count, rng_type &&value)
Inserts count copies of value before position in the container.
Definition concatenated_sequences.hpp:955
seqan3::concatenated_sequences::shrink_to_fit
void shrink_to_fit()
Requests the removal of unused capacity.
Definition concatenated_sequences.hpp:800
seqan3::concatenated_sequences::concatenated_sequences
constexpr concatenated_sequences(concatenated_sequences const &)=default
Default constructors.
seqan3::concatenated_sequences::insert
iterator insert(const_iterator pos, rng_type &&value)
Inserts value before position in the container.
Definition concatenated_sequences.hpp:921
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:315
seqan3::concatenated_sequences::operator==
constexpr bool operator==(concatenated_sequences const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition concatenated_sequences.hpp:1415
seqan3::concatenated_sequences::cend
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:499
seqan3::concatenated_sequences::resize
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1368
seqan3::concatenated_sequences::assign
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:381
seqan3::concatenated_sequences::iterator
detail::random_access_iterator< concatenated_sequences > iterator
The iterator type of this container (a random access iterator).
Definition concatenated_sequences.hpp:127
seqan3::concatenated_sequences::max_size
size_type max_size() const noexcept
Returns the maximum number of elements the container is able to hold due to system or library impleme...
Definition concatenated_sequences.hpp:727
seqan3::concatenated_sequences::is_compatible_with_value_type
static constexpr bool is_compatible_with_value_type
Whether a type is compatible with this class's value_type or reference type.
Definition concatenated_sequences.hpp:179
seqan3::concatenated_sequences::const_reference
decltype(std::declval< std::decay_t< underlying_container_type > const & >()|views::slice(0, 1)) const_reference
An immutable views::slice that represents "one element", typically a std::span or std::string_view.
Definition concatenated_sequences.hpp:119
seqan3::concatenated_sequences::assign
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:429
seqan3::concatenated_sequences::size
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition concatenated_sequences.hpp:706
seqan3::concatenated_sequences::push_back
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition concatenated_sequences.hpp:1216
seqan3::concatenated_sequences::operator!=
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition concatenated_sequences.hpp:1424
seqan3::concatenated_sequences::concat_reserve
void concat_reserve(size_type const new_cap)
Increase the concat_capacity() to a value that's greater or equal to new_cap.
Definition concatenated_sequences.hpp:866
seqan3::concatenated_sequences::assign
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition concatenated_sequences.hpp:358
seqan3::concatenated_sequences::range_value_t_is_compatible_with_value_type
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:199
seqan3::concatenated_sequences::push_back
void push_back()
Appends an empty element to the end of the container.
Definition concatenated_sequences.hpp:1241
seqan3::concatenated_sequences::iter_value_t_is_compatible_with_value_type
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:189
seqan3::concatenated_sequences::erase
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1189
seqan3::concatenated_sequences::resize
void resize(size_type const count)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1355
seqan3::concatenated_sequences::concat
const_reference concat() const
Return the concatenation of all members.
Definition concatenated_sequences.hpp:647
seqan3::concatenated_sequences::reference
value_type reference
A views::slice that represents "one element", typically a std::span.
Definition concatenated_sequences.hpp:112
seqan3::concatenated_sequences::operator>=
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition concatenated_sequences.hpp:1460
seqan3::concatenated_sequences::operator[]
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition concatenated_sequences.hpp:565
seqan3::concatenated_sequences::concat_size
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition concatenated_sequences.hpp:823
seqan3::concatenated_sequences::swap
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1400
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:264
seqan3::concatenated_sequences::assign
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition concatenated_sequences.hpp:406
seqan3::concatenated_sequences::raw_data
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > raw_data() const
Provides direct, unsafe access to underlying data structures.
Definition concatenated_sequences.hpp:665
seqan3::concatenated_sequences::value_type
decltype(std::declval< std::decay_t< underlying_container_type > & >()|views::slice(0, 1)) value_type
A views::slice that represents "one element", typically a std::span.
Definition concatenated_sequences.hpp:105
seqan3::concatenated_sequences::operator<
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition concatenated_sequences.hpp:1433
seqan3::concatenated_sequences::size_type
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t).
Definition concatenated_sequences.hpp:148
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition concatenated_sequences.hpp:292
seqan3::concatenated_sequences::insert
iterator insert(const_iterator pos, std::initializer_list< rng_type > const &ilist)
Inserts elements from initializer list before position in the container.
Definition concatenated_sequences.hpp:1114
seqan3::concatenated_sequences::operator=
constexpr concatenated_sequences & operator=(concatenated_sequences &&)=default
Default constructors.
seqan3::concatenated_sequences::at
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition concatenated_sequences.hpp:532
seqan3::concatenated_sequences::erase
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1140
seqan3::concatenated_sequences::difference_type
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t).
Definition concatenated_sequences.hpp:141
seqan3::concatenated_sequences::operator<=
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition concatenated_sequences.hpp:1451
std::decay_t
std::declval
T declval(T... args)
std::distance
T distance(T... args)
std::end
T end(T... args)
std::for_each
T for_each(T... args)
std::forward
T forward(T... args)
seqan3::range_dimension_v
constexpr size_t range_dimension_v
Returns the number of times you can call seqan3::value_type_t recursively on t (type trait).
Definition core/range/type_traits.hpp:112
seqan3::views::slice
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition slice.hpp:137
seqan3::views::repeat_n
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition repeat_n.hpp:88
std::initializer_list
std::is_same_v
T is_same_v
iterator
seqan3
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
std::out_of_range
std::pair
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START
#define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(...)
Denotes the start of a block where diagnostics are ignored.
Definition platform.hpp:268
SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
#define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
Denotes the end of a block where diagnostics are ignored.
Definition platform.hpp:277
repeat_n.hpp
Provides seqan3::views::repeat_n.
slice.hpp
Provides seqan3::views::slice.
std::swap
T swap(T... args)
type_traits
concept.hpp
Adaptations of concepts from the standard library.
vector
Hide me