SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
concatenated_sequences.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2024 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2024 Knut Reinert & MPI für molekulare Genetik
3// SPDX-License-Identifier: BSD-3-Clause
4
10#pragma once
11
12#include <iterator>
13#include <ranges>
14#include <type_traits>
15#include <vector>
16
21
22#if SEQAN3_WITH_CEREAL
23# include <cereal/types/vector.hpp>
24#endif
25
26namespace seqan3
27{
28
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>>
86{
87protected:
92 data_delimiters_type data_delimiters{0};
93
94public:
96
105 using value_type = decltype(std::declval<std::decay_t<underlying_container_type> &>() | views::slice(0, 1));
106
113
120 decltype(std::declval<std::decay_t<underlying_container_type> const &>() | views::slice(0, 1));
121
127 using iterator = detail::random_access_iterator<concatenated_sequences>;
128
134 using const_iterator = detail::random_access_iterator<concatenated_sequences const>;
135
141 using difference_type = std::ranges::range_difference_t<data_delimiters_type>;
142
148 using size_type = std::ranges::range_size_t<data_delimiters_type>;
150
151protected:
158 // unfortunately we cannot specialise the variable template so we have to add an auxiliary here
159 template <std::ranges::range t>
160 static constexpr bool is_compatible_with_value_type_aux(std::type_identity<t>)
161 {
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>>;
164 }
165
166 static constexpr bool is_compatible_with_value_type_aux(...)
167 {
168 return false;
169 }
171
177 // we explicitly check same-ness, because these types may not be fully resolved, yet
178 template <std::ranges::range t>
179 static constexpr bool is_compatible_with_value_type = is_compatible_with_value_type_aux(std::type_identity<t>{});
180
186 // cannot use the concept, because this class is not yet fully defined
187 template <typename t>
188 requires is_compatible_with_value_type<std::iter_reference_t<t>>
189 static constexpr bool iter_value_t_is_compatible_with_value_type = true;
190
196 // cannot use the concept, because this class is not yet fully defined
197 template <std::ranges::range t>
198 requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
201
202public:
209 constexpr concatenated_sequences(concatenated_sequences const &) = default;
218
234 template <std::ranges::input_range rng_of_rng_type>
235 concatenated_sequences(rng_of_rng_type && rng_of_rng)
236 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
237 {
238 if constexpr (std::ranges::sized_range<rng_of_rng_type>)
239 data_delimiters.reserve(std::ranges::size(rng_of_rng) + 1);
240
241 for (auto && val : rng_of_rng)
242 {
243 data_values.insert(data_values.end(), val.begin(), val.end());
244 data_delimiters.push_back(data_delimiters.back() + val.size());
245 }
246 }
247
263 template <std::ranges::forward_range rng_type>
264 concatenated_sequences(size_type const count, rng_type && value)
265 requires is_compatible_with_value_type<rng_type>
266 {
267 // TODO SEQAN_UNLIKELY
268 if (count == 0)
269 return;
270
271 insert(cend(), count, std::forward<rng_type>(value));
272 }
273
291 template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
292 concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
293 requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
294 && iter_value_t_is_compatible_with_value_type<begin_iterator_type>
295 {
296 insert(cend(), begin_it, end_it);
297 }
298
313 template <std::ranges::forward_range value_type_t = value_type>
314 requires is_compatible_with_value_type<value_type_t>
319
334 template <std::ranges::forward_range value_type_t>
336 requires is_compatible_with_value_type<value_type_t>
337 {
338 assign(std::begin(ilist), std::end(ilist));
339 return *this;
340 }
341
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>
360 {
361 concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
362 swap(rhs);
363 }
364
380 template <std::ranges::forward_range rng_type>
381 void assign(size_type const count, rng_type && value)
382 requires (is_compatible_with_value_type<rng_type>)
383 {
384 concatenated_sequences rhs{count, value};
385 swap(rhs);
386 }
387
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>
409 {
410 concatenated_sequences rhs{begin_it, end_it};
411 swap(rhs);
412 }
413
428 template <std::ranges::forward_range rng_type = value_type>
430 requires is_compatible_with_value_type<rng_type>
431 {
432 assign(std::begin(ilist), std::end(ilist));
433 }
434
436
455 iterator begin() noexcept
456 {
457 return iterator{*this};
458 }
459
461 const_iterator begin() const noexcept
462 {
463 return const_iterator{*this};
464 }
465
467 const_iterator cbegin() const noexcept
468 {
469 return const_iterator{*this};
470 }
471
487 iterator end() noexcept
488 {
489 return iterator{*this, size()};
490 }
491
493 const_iterator end() const noexcept
494 {
495 return const_iterator{*this, size()};
496 }
497
499 const_iterator cend() const noexcept
500 {
501 return const_iterator{*this, size()};
502 }
504
524 {
525 //TODO add SEQAN_UNLIKELY
526 if (i >= size())
527 throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
528 return (*this)[i];
529 }
530
533 {
534 //TODO add SEQAN_UNLIKELY
535 if (i >= size())
536 throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
537 return (*this)[i];
538 }
539
557 {
558 assert(i < size());
559 return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
560 }
561
564 {
565 assert(i < size());
566 return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
567 }
568
584 {
585 assert(size() > 0);
586 return (*this)[0];
587 }
588
591 {
592 assert(size() > 0);
593 return (*this)[0];
594 }
595
611 {
612 assert(size() > 0);
613 return (*this)[size() - 1];
614 }
615
618 {
619 assert(size() > 0);
620 return (*this)[size() - 1];
621 }
622
640 {
641 return data_values | views::slice(static_cast<size_type>(0), concat_size());
642 }
643
646 {
647 return data_values | views::slice(static_cast<size_type>(0), concat_size());
648 }
649
657 std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
658 {
659 return {data_values, data_delimiters};
660 }
661
663 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
664 {
665 return {data_values, data_delimiters};
666 }
667
669
686 bool empty() const noexcept
687 {
688 return size() == 0;
689 }
690
704 size_type size() const noexcept
705 {
706 return data_delimiters.size() - 1;
707 }
708
725 size_type max_size() const noexcept
726 {
727 return data_delimiters.max_size() - 1;
728 }
729
747 size_type capacity() const noexcept
748 {
749 return data_delimiters.capacity();
750 }
751
774 void reserve(size_type const new_cap)
775 {
776 data_delimiters.reserve(new_cap + 1);
777 }
778
799 {
800 data_values.shrink_to_fit();
801 data_delimiters.shrink_to_fit();
802 }
804
821 size_type concat_size() const noexcept
822 {
823 return data_values.size();
824 }
825
839 size_type concat_capacity() const noexcept
840 {
841 return data_values.capacity();
842 }
843
864 void concat_reserve(size_type const new_cap)
865 {
866 data_values.reserve(new_cap);
867 }
869
885 void clear() noexcept
886 {
887 data_values.clear();
888 data_delimiters.clear();
889 data_delimiters.push_back(0);
890 }
891
918 template <std::ranges::forward_range rng_type>
919 iterator insert(const_iterator pos, rng_type && value)
920 requires is_compatible_with_value_type<rng_type>
921 {
922 return insert(pos, 1, std::forward<rng_type>(value));
923 }
924 // no specialisation for temporaries, since we have to copy anyway
925
952 template <std::ranges::forward_range rng_type>
953 iterator insert(const_iterator pos, size_type const count, rng_type && value)
954 requires is_compatible_with_value_type<rng_type>
955 {
956 auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
957 // TODO SEQAN_UNLIKELY
958 if (count == 0)
959 return begin() + pos_as_num;
960
961 /* TODO implement views::flat_repeat_n that is like
962 * views::repeat_n(value, count) | std::views::join | ranges::views::bounded;
963 * but preserves random access and size.
964 *
965 * then do
966 * auto concatenated = ranges::views::flat_repeat_n(value, count);
967 * insert(pos, concatenated.cbegin(), concatenated.cend())
968 */
969
970 size_type value_len = 0;
971 if constexpr (std::ranges::sized_range<rng_type>)
972 value_len = std::ranges::size(value);
973 else
974 value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
975
976 data_values.reserve(data_values.size() + count * value_len);
977 auto placeholder =
978 views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len) | std::views::common;
979 // insert placeholder so the tail is moved once:
980 data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
981 std::ranges::begin(placeholder),
982 std::ranges::end(placeholder));
983
984 // assign the actual values to the placeholder:
985 size_t i = data_delimiters[pos_as_num];
986 for (size_t j = 0; j < count; ++j)
987 for (auto && v : value)
988 data_values[i++] = v;
989
990 data_delimiters.reserve(data_values.size() + count);
991 data_delimiters.insert(data_delimiters.begin() + pos_as_num, count, *(data_delimiters.begin() + pos_as_num));
992
993 // adapt delimiters of inserted
994 for (size_type i = 0; i < count; ++i)
995 data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
996
997 // adapt delimiters after that
998 // TODO parallel execution policy or vectorization?
999 std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
1000 data_delimiters.end(),
1001 [full_len = value_len * count](auto & d)
1002 {
1003 d += full_len;
1004 });
1005
1006 return begin() + pos_as_num;
1007 }
1008
1035 template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1036 iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1037 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
1038 && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1039 {
1040 auto const pos_as_num = std::distance(cbegin(), pos);
1041 // TODO SEQAN_UNLIKELY
1042 if (last - first == 0)
1043 return begin() + pos_as_num;
1044
1045 auto const ilist =
1046 std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1047 last,
1048 std::ranges::distance(first, last));
1049
1050 data_delimiters.reserve(data_values.size() + ilist.size());
1051 data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1052 ilist.size(),
1053 *(data_delimiters.begin() + pos_as_num));
1054
1055 // adapt delimiters of inserted region
1056 size_type full_len = 0;
1057 for (size_type i = 0; i < ilist.size(); ++i, ++first)
1058 {
1059 full_len += std::ranges::distance(*first);
1060 data_delimiters[pos_as_num + 1 + i] += full_len;
1061 }
1062
1063 // adapt values of inserted region
1064 auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len) | std::views::common;
1065 // insert placeholder so the tail is moved only once:
1066 data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1067 std::ranges::begin(placeholder),
1068 std::ranges::end(placeholder));
1069
1070 // assign the actual values to the placeholder:
1071 size_t i = data_delimiters[pos_as_num];
1072 for (auto && v0 : ilist)
1073 for (auto && v1 : v0)
1074 data_values[i++] = v1;
1075
1076 // adapt delimiters behind inserted region
1077 // TODO parallel execution policy or vectorization?
1078 std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1079 data_delimiters.end(),
1080 [full_len](auto & d)
1081 {
1082 d += full_len;
1083 });
1084
1085 return begin() + pos_as_num;
1086 }
1087
1109 template <std::ranges::forward_range rng_type>
1111 requires is_compatible_with_value_type<rng_type>
1112 {
1113 return insert(pos, ilist.begin(), ilist.end());
1114 }
1115
1137 {
1138 auto const dist = std::distance(cbegin(), last);
1139 // TODO SEQAN_UNLIKELY
1140 if (last - first == 0)
1141 return begin() + dist;
1142
1143 auto const distf = std::distance(cbegin(), first);
1144
1145 // we need to scan once over the input
1146 size_type sum_size{0};
1147 for (; first != last; ++first)
1148 sum_size += std::ranges::size(*first);
1149
1150 data_values.erase(data_values.begin() + data_delimiters[distf], data_values.begin() + data_delimiters[dist]);
1151
1152 data_delimiters.erase(data_delimiters.begin() + distf + 1, data_delimiters.begin() + dist + 1);
1153
1154 // adapt delimiters after that
1155 // TODO parallel execution policy or vectorization?
1156 std::for_each(data_delimiters.begin() + distf + 1,
1157 data_delimiters.end(),
1158 [sum_size](auto & d)
1159 {
1160 d -= sum_size;
1161 });
1162 return begin() + dist;
1163 }
1164
1186 {
1187 return erase(pos, pos + 1);
1188 }
1189
1211 template <std::ranges::forward_range rng_type>
1212 void push_back(rng_type && value)
1213 requires is_compatible_with_value_type<rng_type>
1214 {
1215 data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1216 data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
1217 }
1218
1238 {
1239 data_delimiters.push_back(data_delimiters.back());
1240 }
1241
1262 void last_push_back(std::ranges::range_value_t<underlying_container_type> const value)
1263 {
1264 data_values.push_back(value);
1265 ++data_delimiters.back();
1266 }
1267
1289 template <std::ranges::forward_range rng_type>
1290 void last_append(rng_type && value)
1291 requires is_compatible_with_value_type<rng_type>
1292 {
1293 data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1294 data_delimiters.back() += std::ranges::size(value);
1295 }
1296
1316 {
1317 assert(size() > 0);
1318 auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1319 data_values.resize(data_values.size() - back_length);
1320 data_delimiters.pop_back();
1321 }
1322
1351 void resize(size_type const count)
1352 {
1353 assert(count < max_size());
1354 data_delimiters.resize(count + 1, data_delimiters.back());
1355 data_values.resize(data_delimiters.back());
1356 }
1357
1363 template <std::ranges::forward_range rng_type>
1364 void resize(size_type const count, rng_type && value)
1365 requires is_compatible_with_value_type<rng_type>
1366 {
1367 assert(count < max_size());
1368 assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
1369
1370 if (count < size())
1371 resize(count);
1372 else if (count > size())
1373 insert(cend(), count - size(), std::forward<rng_type>(value));
1374 }
1375
1389 constexpr void swap(concatenated_sequences & rhs) noexcept
1390 {
1391 std::swap(data_values, rhs.data_values);
1392 std::swap(data_delimiters, rhs.data_delimiters);
1393 }
1394
1396 constexpr void swap(concatenated_sequences && rhs) noexcept
1397 {
1398 std::swap(data_values, rhs.data_values);
1399 std::swap(data_delimiters, rhs.data_delimiters);
1400 }
1402
1411 constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
1412 {
1413 return raw_data() == rhs.raw_data();
1414 }
1415
1420 constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
1421 {
1422 return raw_data() != rhs.raw_data();
1423 }
1424
1429 constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1430 {
1431 return raw_data() < rhs.raw_data();
1432 }
1433
1438 constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1439 {
1440 return raw_data() > rhs.raw_data();
1441 }
1442
1447 constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1448 {
1449 return raw_data() <= rhs.raw_data();
1450 }
1451
1456 constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1457 {
1458 return raw_data() >= rhs.raw_data();
1459 }
1461
1469 template <cereal_archive archive_t>
1470 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1471 {
1472 archive(data_values, data_delimiters);
1473 }
1475};
1476
1477} // namespace seqan3
T begin(T... args)
Adaptions of concepts from the Cereal library.
Container that stores sequences concatenated internally.
Definition concatenated_sequences.hpp:86
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
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:747
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:774
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:1262
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:1290
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:590
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
const_reference back() const
Return the last element as a view.
Definition concatenated_sequences.hpp:617
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:639
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition concatenated_sequences.hpp:1438
bool empty() const noexcept
Checks whether the container is empty.
Definition concatenated_sequences.hpp:686
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:1389
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:885
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:1315
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:583
reference back()
Return the last element as a view.
Definition concatenated_sequences.hpp:610
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition concatenated_sequences.hpp:839
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:461
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:657
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:1036
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:953
void shrink_to_fit()
Requests the removal of unused capacity.
Definition concatenated_sequences.hpp:798
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:919
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:1411
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:1364
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:381
detail::random_access_iterator< concatenated_sequences > iterator
The iterator type of this container (a random access iterator).
Definition concatenated_sequences.hpp:127
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:725
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:704
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition concatenated_sequences.hpp:1212
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition concatenated_sequences.hpp:1420
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:864
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:1237
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:189
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1185
void resize(size_type const count)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1351
const_reference concat() const
Return the concatenation of all members.
Definition concatenated_sequences.hpp:645
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:1456
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition concatenated_sequences.hpp:563
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition concatenated_sequences.hpp:821
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1396
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:663
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:1429
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:1110
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:1136
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:1447
T distance(T... args)
T end(T... args)
T for_each(T... args)
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition slice.hpp:175
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.
T swap(T... args)
Adaptations of concepts from the standard library.
Hide me