23# include <cereal/types/vector.hpp>
79template <
typename underlying_container_type,
83 && std::is_same_v<std::ranges::range_size_t<underlying_container_type>,
84 std::ranges::range_value_t<data_delimiters_type>>
120 decltype(std::declval<std::decay_t<underlying_container_type>
const &>() |
views::slice(0, 1));
148 using size_type = std::ranges::range_size_t<data_delimiters_type>;
159 template <std::ranges::range t>
162 return range_dimension_v<t> == range_dimension_v<value_type>
163 && std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
166 static constexpr bool is_compatible_with_value_type_aux(...)
178 template <std::ranges::range t>
187 template <
typename t>
188 requires is_compatible_with_value_type<std::iter_reference_t<t>>
197 template <std::ranges::range t>
198 requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
234 template <std::ranges::input_range rng_of_rng_type>
236 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
238 if constexpr (std::ranges::sized_range<rng_of_rng_type>)
241 for (
auto && val : rng_of_rng)
263 template <std::ranges::forward_range rng_type>
265 requires is_compatible_with_value_type<rng_type>
271 insert(
cend(), count, std::forward<rng_type>(value));
291 template <std::forward_iterator begin_iterator_type,
typename end_iterator_type>
293 requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
294 && iter_value_t_is_compatible_with_value_type<begin_iterator_type>
313 template <std::ranges::forward_range value_type_t = value_type>
314 requires is_compatible_with_value_type<value_type_t>
334 template <std::ranges::forward_range value_type_t>
336 requires is_compatible_with_value_type<value_type_t>
357 template <std::ranges::input_range rng_of_rng_type>
358 void assign(rng_of_rng_type && rng_of_rng)
359 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
358 void assign(rng_of_rng_type && rng_of_rng) {
…}
380 template <std::ranges::forward_range rng_type>
382 requires (is_compatible_with_value_type<rng_type>)
405 template <std::forward_iterator begin_iterator_type,
typename end_iterator_type>
406 void assign(begin_iterator_type begin_it, end_iterator_type end_it)
407 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
408 && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
406 void assign(begin_iterator_type begin_it, end_iterator_type end_it) {
…}
428 template <std::ranges::forward_range rng_type = value_type>
430 requires is_compatible_with_value_type<rng_type>
527 throw std::out_of_range{
"Trying to access element behind the last in concatenated_sequences."};
536 throw std::out_of_range{
"Trying to access element behind the last in concatenated_sequences."};
615 return (*
this)[
size() - 1];
622 return (*
this)[
size() - 1];
920 template <std::ranges::forward_range rng_type>
922 requires is_compatible_with_value_type<rng_type>
924 return insert(pos, 1, std::forward<rng_type>(value));
954 template <std::ranges::forward_range rng_type>
956 requires is_compatible_with_value_type<rng_type>
961 return begin() + pos_as_num;
973 if constexpr (std::ranges::sized_range<rng_type>)
974 value_len = std::ranges::size(value);
980 views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len) | std::views::common;
985 std::ranges::end(placeholder));
990 for (
size_t j = 0; j < count; ++j)
991 for (
auto && v : value)
1005 [full_len = value_len * count](
auto & d)
1010 return begin() + pos_as_num;
1039 template <std::forward_iterator begin_iterator_type,
typename end_iterator_type>
1041 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
1042 && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1046 if (last - first == 0)
1047 return begin() + pos_as_num;
1050 std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1052 std::ranges::distance(first, last));
1061 for (
size_type i = 0; i < ilist.size(); ++i, ++first)
1063 full_len += std::ranges::distance(*first);
1068 auto placeholder =
views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len) | std::views::common;
1072 std::ranges::end(placeholder));
1076 for (
auto && v0 : ilist)
1077 for (
auto && v1 : v0)
1084 [full_len](
auto & d)
1089 return begin() + pos_as_num;
1113 template <std::ranges::forward_range rng_type>
1115 requires is_compatible_with_value_type<rng_type>
1117 return insert(pos, ilist.begin(), ilist.end());
1144 if (last - first == 0)
1145 return begin() + dist;
1151 for (; first != last; ++first)
1152 sum_size += std::ranges::size(*first);
1162 [sum_size](
auto & d)
1166 return begin() + dist;
1191 return erase(pos, pos + 1);
1215 template <std::ranges::forward_range rng_type>
1217 requires is_compatible_with_value_type<rng_type>
1266 void last_push_back(std::ranges::range_value_t<underlying_container_type>
const value)
1266 void last_push_back(std::ranges::range_value_t<underlying_container_type>
const value) {
…}
1293 template <std::ranges::forward_range rng_type>
1295 requires is_compatible_with_value_type<rng_type>
1367 template <std::ranges::forward_range rng_type>
1369 requires is_compatible_with_value_type<rng_type>
1376 else if (count >
size())
1417 return raw_data() == rhs.raw_data();
1426 return raw_data() != rhs.raw_data();
1435 return raw_data() < rhs.raw_data();
1444 return raw_data() > rhs.raw_data();
1453 return raw_data() <= rhs.raw_data();
1462 return raw_data() >= rhs.raw_data();
1473 template <cereal_archive archive_t>
Adaptions of concepts from the Cereal library.
Container that stores sequences concatenated internally.
Definition concatenated_sequences.hpp:86
constexpr concatenated_sequences & operator=(concatenated_sequences const &)=default
Default constructors.
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition concatenated_sequences.hpp:235
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition concatenated_sequences.hpp:749
concatenated_sequences()=default
Default constructors.
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
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
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
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:592
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
const_reference back() const
Return the last element as a view.
Definition concatenated_sequences.hpp:619
reference at(size_type const i)
Return the i-th element as a view.
Definition concatenated_sequences.hpp:523
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:467
reference concat()
Return the concatenation of all members.
Definition concatenated_sequences.hpp:641
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition concatenated_sequences.hpp:1442
bool empty() const noexcept
Checks whether the container is empty.
Definition concatenated_sequences.hpp:688
reference operator[](size_type const i)
Return the i-th element as a view.
Definition concatenated_sequences.hpp:556
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:335
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1393
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:487
void clear() noexcept
Removes all elements from the container.
Definition concatenated_sequences.hpp:887
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:455
~concatenated_sequences()=default
Default constructors.
void pop_back()
Removes the last element of the container.
Definition concatenated_sequences.hpp:1319
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:585
reference back()
Return the last element as a view.
Definition concatenated_sequences.hpp:612
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition concatenated_sequences.hpp:841
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:461
data_delimiters_type data_delimiters
Where the delimiters are stored; begins with 0, has size of size() + 1.
Definition concatenated_sequences.hpp:92
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:120
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition concatenated_sequences.hpp:659
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:493
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
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
void shrink_to_fit()
Requests the removal of unused capacity.
Definition concatenated_sequences.hpp:800
constexpr concatenated_sequences(concatenated_sequences const &)=default
Default constructors.
iterator insert(const_iterator pos, rng_type &&value)
Inserts value before position in the container.
Definition concatenated_sequences.hpp:921
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:315
constexpr bool operator==(concatenated_sequences const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition concatenated_sequences.hpp:1415
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:499
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1368
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:381
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
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
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:429
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition concatenated_sequences.hpp:706
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition concatenated_sequences.hpp:1216
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition concatenated_sequences.hpp:1424
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
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition concatenated_sequences.hpp:358
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:199
void push_back()
Appends an empty element to the end of the container.
Definition concatenated_sequences.hpp:1241
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:189
std::decay_t< underlying_container_type > data_values
Where the concatenation is stored.
Definition concatenated_sequences.hpp:90
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1189
void resize(size_type const count)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1355
const_reference concat() const
Return the concatenation of all members.
Definition concatenated_sequences.hpp:647
value_type reference
A views::slice that represents "one element", typically a std::span.
Definition concatenated_sequences.hpp:112
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition concatenated_sequences.hpp:1460
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition concatenated_sequences.hpp:565
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition concatenated_sequences.hpp:823
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1400
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:264
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition concatenated_sequences.hpp:406
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
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
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition concatenated_sequences.hpp:1433
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition concatenated_sequences.hpp:148
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition concatenated_sequences.hpp:292
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
constexpr concatenated_sequences & operator=(concatenated_sequences &&)=default
Default constructors.
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition concatenated_sequences.hpp:532
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1140
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition concatenated_sequences.hpp:141
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition concatenated_sequences.hpp:1451
A generic random access iterator that delegates most operations to the range.
Definition random_access_iterator.hpp:288
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition slice.hpp:137
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition repeat_n.hpp:88
A more refined container concept than seqan3::random_access_container.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
Provides seqan3::views::repeat_n.
Provides seqan3::views::slice.
Adaptations of concepts from the standard library.