17 #include <type_traits>
28 #if SEQAN3_WITH_CEREAL
29 #include <cereal/types/vector.hpp>
47 template <
typename value_type,
bool const_>
50 decltype(std::declval<value_type const &>() | views::as_const | views::slice(0,1)),
51 decltype(std::declval<value_type &>() | views::slice(0,1))>
57 decltype(std::declval<value_type &>() |
views::slice(0,1))>;
70 std::ranges::copy(*
this, std::ranges::begin(ret));
126 template <
typename inner_type,
131 std::is_same_v<std::ranges::range_size_t<inner_type>, std::ranges::range_value_t<data_delimiters_type>>
195 using size_type = std::ranges::range_size_t<data_delimiters_type>;
200 using allocator_type = void;
211 template <std::ranges::range t>
214 return range_dimension_v<t> == range_dimension_v<value_type> &&
215 std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
218 static constexpr
bool is_compatible_with_value_type_aux(...)
230 template <std::ranges::range t>
239 template <
typename t>
241 requires is_compatible_with_value_type<std::iter_reference_t<t>>
251 template <std::ranges::range t>
253 requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
290 template <std::ranges::input_range rng_of_rng_type>
293 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
296 if constexpr (std::ranges::sized_range<rng_of_rng_type>)
299 for (
auto && val : rng_of_rng)
321 template <std::ranges::forward_range rng_type>
324 requires is_compatible_with_value_type<rng_type>
351 template <std::forward_iterator begin_iterator_type,
typename end_iterator_type>
354 requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type> &&
355 iter_value_t_is_compatible_with_value_type<begin_iterator_type>
375 template <std::ranges::forward_range value_type_t = value_type>
377 requires is_compatible_with_value_type<value_type_t>
398 template <std::ranges::forward_range value_type_t>
401 requires is_compatible_with_value_type<value_type_t>
423 template <std::ranges::input_range rng_of_rng_type>
424 void assign(rng_of_rng_type && rng_of_rng)
426 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
448 template <std::ranges::forward_range rng_type>
451 requires (is_compatible_with_value_type<rng_type>)
475 template <std::forward_iterator begin_iterator_type,
typename end_iterator_type>
476 void assign(begin_iterator_type begin_it, end_iterator_type end_it)
478 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
479 std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
500 template <std::ranges::forward_range rng_type = value_type>
503 requires is_compatible_with_value_type<rng_type>
601 throw std::out_of_range{
"Trying to access element behind the last in concatenated_sequences."};
610 throw std::out_of_range{
"Trying to access element behind the last in concatenated_sequences."};
687 return (*
this)[
size()-1];
694 return (*
this)[
size()-1];
1007 template <std::ranges::forward_range rng_type>
1010 requires is_compatible_with_value_type<rng_type>
1013 return insert(pos, 1, std::forward<rng_type>(value));
1043 template <std::ranges::forward_range rng_type>
1046 requires is_compatible_with_value_type<rng_type>
1052 return begin() + pos_as_num;
1064 if constexpr (std::ranges::sized_range<rng_type>)
1067 value_len =
std::distance(std::ranges::begin(value), std::ranges::end(value));
1071 | std::views::common;
1074 std::ranges::begin(placeholder),
1075 std::ranges::end(placeholder));
1079 for (
size_t j = 0; j <
count; ++j)
1080 for (
auto && v : value)
1096 [full_len = value_len *
count] (
auto & d) { d += full_len; });
1098 return begin() + pos_as_num;
1127 template <std::forward_iterator begin_iterator_type,
typename end_iterator_type>
1130 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
1131 std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1136 if (last - first == 0)
1137 return begin() + pos_as_num;
1140 std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1142 std::ranges::distance(first, last));
1152 for (
size_type i = 0; i < ilist.size(); ++i, ++first)
1154 full_len += std::ranges::distance(*first);
1159 auto placeholder =
views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len)
1160 | std::views::common;
1163 std::ranges::begin(placeholder),
1164 std::ranges::end(placeholder));
1168 for (
auto && v0 : ilist)
1169 for (
auto && v1 : v0)
1177 [full_len] (
auto & d) { d += full_len; });
1179 return begin() + pos_as_num;
1203 template <std::ranges::forward_range rng_type>
1206 requires is_compatible_with_value_type<rng_type>
1209 return insert(pos, ilist.begin(), ilist.end());
1236 if (last - first == 0)
1237 return begin() + dist;
1243 for (; first != last; ++first)
1256 [sum_size] (
auto & d) { d -= sum_size; });
1257 return begin() + dist;
1282 return erase(pos, pos + 1);
1303 template <std::ranges::forward_range rng_type>
1306 requires is_compatible_with_value_type<rng_type>
1379 template <std::ranges::forward_range rng_type>
1382 requires is_compatible_with_value_type<rng_type>
1431 return raw_data() == rhs.raw_data();
1440 return raw_data() != rhs.raw_data();
1449 return raw_data() < rhs.raw_data();
1458 return raw_data() > rhs.raw_data();
1467 return raw_data() <= rhs.raw_data();
1476 return raw_data() >= rhs.raw_data();
1487 template <cereal_archive archive_t>
Provides seqan3::views::as_const.
Adaptions of concepts from the Cereal library.
Container that stores sequences concatenated internally.
Definition: concatenated_sequences.hpp:134
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:731
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1232
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:812
void shrink_to_fit()
Requests the removal of unused capacity.
Definition: concatenated_sequences.hpp:885
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition: concatenated_sequences.hpp:908
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:322
constexpr concatenated_sequences & operator=(concatenated_sequences const &)=default
Default constructors.
data_delimiters_type data_delimiters
Where the delimiters are stored; begins with 0, has size of size() + 1.
Definition: concatenated_sequences.hpp:140
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:424
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition: concatenated_sequences.hpp:1447
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition: concatenated_sequences.hpp:791
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition: concatenated_sequences.hpp:926
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:476
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:561
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
iterator insert(const_iterator pos, rng_type &&value)
Inserts value before position in the container.
Definition: concatenated_sequences.hpp:1008
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:379
std::decay_t< inner_type > data_values
Where the concatenation is stored.
Definition: concatenated_sequences.hpp:138
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1280
const_reference concat() const
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:719
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:657
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition: concatenated_sequences.hpp:1474
constexpr concatenated_sequences(concatenated_sequences const &)=default
Default constructors.
constexpr bool operator==(concatenated_sequences const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition: concatenated_sequences.hpp:1429
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition: concatenated_sequences.hpp:243
reference at(size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:597
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:664
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1407
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1414
concatenated_sequences()=default
Default constructors.
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:637
void resize(size_type const count)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1367
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:737
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition: concatenated_sequences.hpp:255
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:567
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition: concatenated_sequences.hpp:1304
bool empty() const noexcept
Checks whether the container is empty.
Definition: concatenated_sequences.hpp:773
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition: concatenated_sequences.hpp:1438
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:535
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:529
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition: concatenated_sequences.hpp:195
const_reference back() const
Return the last element as a view.
Definition: concatenated_sequences.hpp:691
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:352
~concatenated_sequences()=default
Default constructors.
reference back()
Return the last element as a view.
Definition: concatenated_sequences.hpp:684
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:449
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition: concatenated_sequences.hpp:1456
void clear() noexcept
Removes all elements from the container.
Definition: concatenated_sequences.hpp:974
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:573
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition: concatenated_sequences.hpp:834
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > data() const
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:751
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:1204
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:541
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition: concatenated_sequences.hpp:188
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:1128
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:606
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1380
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:399
std::pair< decltype(data_values) &, decltype(data_delimiters) & > data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:744
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:1044
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:951
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:231
void pop_back()
Removes the last element of the container.
Definition: concatenated_sequences.hpp:1331
reference concat()
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:713
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:291
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:861
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:501
constexpr concatenated_sequences & operator=(concatenated_sequences &&)=default
Default constructors.
reference operator[](size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:630
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition: concatenated_sequences.hpp:1465
A generic random access iterator that delegates most operations to the range.
Definition: random_access_iterator.hpp:310
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:168
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:150
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition: slice.hpp:191
auto const as_const
A view that provides only const & to elements of the underlying range.
Definition: as_const.hpp:88
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition: repeat_n.hpp:95
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:70
A more refined container concept than seqan3::random_access_container.
Provides C++20 additions to the <iterator> header.
Provides seqan3::views::join.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
Provides the seqan3::detail::random_access_iterator class.
Adaptations of concepts from the standard library.
Adaptations of concepts from the Ranges TS.
Provides seqan3::views::slice.
The reference type of seqan3::concatenated_sequences.
Definition: concatenated_sequences.hpp:52
concatenated_sequences_reference_proxy(base_t &&rhs)
Construct from base type.
Definition: concatenated_sequences.hpp:63
This is helper structure to deprecate seqan3::value_type and will be removed before SeqAn 3....
Definition: pre.hpp:33
Provides seqan3::views::repeat_n.