SeqAn3 3.4.0-rc.4
The Modern C++ library for sequence analysis.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
concatenated_sequences.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
2// SPDX-FileCopyrightText: 2016-2025 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_HAS_CEREAL
23# include <cereal/types/vector.hpp>
24#endif // SEQAN3_HAS_CEREAL
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());
560 return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
562 }
563
566 {
567 assert(i < size());
568 return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
569 }
570
586 {
587 assert(size() > 0);
588 return (*this)[0];
589 }
590
593 {
594 assert(size() > 0);
595 return (*this)[0];
596 }
597
613 {
614 assert(size() > 0);
615 return (*this)[size() - 1];
616 }
617
620 {
621 assert(size() > 0);
622 return (*this)[size() - 1];
623 }
624
642 {
643 return data_values | views::slice(static_cast<size_type>(0), concat_size());
644 }
645
648 {
649 return data_values | views::slice(static_cast<size_type>(0), concat_size());
650 }
651
659 std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
660 {
661 return {data_values, data_delimiters};
662 }
663
665 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
666 {
667 return {data_values, data_delimiters};
668 }
669
671
688 bool empty() const noexcept
689 {
690 return size() == 0;
691 }
692
706 size_type size() const noexcept
707 {
708 return data_delimiters.size() - 1;
709 }
710
727 size_type max_size() const noexcept
728 {
729 return data_delimiters.max_size() - 1;
730 }
731
749 size_type capacity() const noexcept
750 {
751 return data_delimiters.capacity();
752 }
753
776 void reserve(size_type const new_cap)
777 {
778 data_delimiters.reserve(new_cap + 1);
779 }
780
801 {
802 data_values.shrink_to_fit();
803 data_delimiters.shrink_to_fit();
804 }
806
823 size_type concat_size() const noexcept
824 {
825 return data_values.size();
826 }
827
841 size_type concat_capacity() const noexcept
842 {
843 return data_values.capacity();
844 }
845
866 void concat_reserve(size_type const new_cap)
867 {
868 data_values.reserve(new_cap);
869 }
871
887 void clear() noexcept
888 {
889 data_values.clear();
890 data_delimiters.clear();
891 data_delimiters.push_back(0);
892 }
893
920 template <std::ranges::forward_range rng_type>
921 iterator insert(const_iterator pos, rng_type && value)
922 requires is_compatible_with_value_type<rng_type>
923 {
924 return insert(pos, 1, std::forward<rng_type>(value));
925 }
926 // no specialisation for temporaries, since we have to copy anyway
927
954 template <std::ranges::forward_range rng_type>
955 iterator insert(const_iterator pos, size_type const count, rng_type && value)
956 requires is_compatible_with_value_type<rng_type>
957 {
958 auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
959 // TODO SEQAN_UNLIKELY
960 if (count == 0)
961 return begin() + pos_as_num;
962
963 /* TODO implement views::flat_repeat_n that is like
964 * views::repeat_n(value, count) | std::views::join | ranges::views::bounded;
965 * but preserves random access and size.
966 *
967 * then do
968 * auto concatenated = ranges::views::flat_repeat_n(value, count);
969 * insert(pos, concatenated.cbegin(), concatenated.cend())
970 */
971
972 size_type value_len = 0;
973 if constexpr (std::ranges::sized_range<rng_type>)
974 value_len = std::ranges::size(value);
975 else
976 value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
977
978 data_values.reserve(data_values.size() + count * value_len);
979 auto placeholder =
980 views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len) | std::views::common;
981 // insert placeholder so the tail is moved once:
982 SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(-Wstringop-overread, -Wstringop-overflow)
983 data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
984 std::ranges::begin(placeholder),
985 std::ranges::end(placeholder));
987
988 // assign the actual values to the placeholder:
989 size_t i = data_delimiters[pos_as_num];
990 for (size_t j = 0; j < count; ++j)
991 for (auto && v : value)
992 data_values[i++] = v;
993
994 data_delimiters.reserve(data_values.size() + count);
995 data_delimiters.insert(data_delimiters.begin() + pos_as_num, count, *(data_delimiters.begin() + pos_as_num));
996
997 // adapt delimiters of inserted
998 for (size_type i = 0; i < count; ++i)
999 data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
1000
1001 // adapt delimiters after that
1002 // TODO parallel execution policy or vectorization?
1003 std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
1004 data_delimiters.end(),
1005 [full_len = value_len * count](auto & d)
1006 {
1007 d += full_len;
1008 });
1009
1010 return begin() + pos_as_num;
1011 }
1012
1039 template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1040 iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1041 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
1042 && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1043 {
1044 auto const pos_as_num = std::distance(cbegin(), pos);
1045 // TODO SEQAN_UNLIKELY
1046 if (last - first == 0)
1047 return begin() + pos_as_num;
1048
1049 auto const ilist =
1050 std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1051 last,
1052 std::ranges::distance(first, last));
1053
1054 data_delimiters.reserve(data_values.size() + ilist.size());
1055 data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1056 ilist.size(),
1057 *(data_delimiters.begin() + pos_as_num));
1058
1059 // adapt delimiters of inserted region
1060 size_type full_len = 0;
1061 for (size_type i = 0; i < ilist.size(); ++i, ++first)
1062 {
1063 full_len += std::ranges::distance(*first);
1064 data_delimiters[pos_as_num + 1 + i] += full_len;
1065 }
1066
1067 // adapt values of inserted region
1068 auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len) | std::views::common;
1069 // insert placeholder so the tail is moved only once:
1070 data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1071 std::ranges::begin(placeholder),
1072 std::ranges::end(placeholder));
1073
1074 // assign the actual values to the placeholder:
1075 size_t i = data_delimiters[pos_as_num];
1076 for (auto && v0 : ilist)
1077 for (auto && v1 : v0)
1078 data_values[i++] = v1;
1079
1080 // adapt delimiters behind inserted region
1081 // TODO parallel execution policy or vectorization?
1082 std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1083 data_delimiters.end(),
1084 [full_len](auto & d)
1085 {
1086 d += full_len;
1087 });
1088
1089 return begin() + pos_as_num;
1090 }
1091
1113 template <std::ranges::forward_range rng_type>
1115 requires is_compatible_with_value_type<rng_type>
1116 {
1117 return insert(pos, ilist.begin(), ilist.end());
1118 }
1119
1141 {
1142 auto const dist = std::distance(cbegin(), last);
1143 // TODO SEQAN_UNLIKELY
1144 if (last - first == 0)
1145 return begin() + dist;
1146
1147 auto const distf = std::distance(cbegin(), first);
1148
1149 // we need to scan once over the input
1150 size_type sum_size{0};
1151 for (; first != last; ++first)
1152 sum_size += std::ranges::size(*first);
1153
1154 data_values.erase(data_values.begin() + data_delimiters[distf], data_values.begin() + data_delimiters[dist]);
1155
1156 data_delimiters.erase(data_delimiters.begin() + distf + 1, data_delimiters.begin() + dist + 1);
1157
1158 // adapt delimiters after that
1159 // TODO parallel execution policy or vectorization?
1160 std::for_each(data_delimiters.begin() + distf + 1,
1161 data_delimiters.end(),
1162 [sum_size](auto & d)
1163 {
1164 d -= sum_size;
1165 });
1166 return begin() + dist;
1167 }
1168
1190 {
1191 return erase(pos, pos + 1);
1192 }
1193
1215 template <std::ranges::forward_range rng_type>
1216 void push_back(rng_type && value)
1217 requires is_compatible_with_value_type<rng_type>
1218 {
1219 data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1220 data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
1221 }
1222
1242 {
1243 data_delimiters.push_back(data_delimiters.back());
1244 }
1245
1266 void last_push_back(std::ranges::range_value_t<underlying_container_type> const value)
1267 {
1268 data_values.push_back(value);
1269 ++data_delimiters.back();
1270 }
1271
1293 template <std::ranges::forward_range rng_type>
1294 void last_append(rng_type && value)
1295 requires is_compatible_with_value_type<rng_type>
1296 {
1297 data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1298 data_delimiters.back() += std::ranges::size(value);
1299 }
1300
1320 {
1321 assert(size() > 0);
1322 auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1323 data_values.resize(data_values.size() - back_length);
1324 data_delimiters.pop_back();
1325 }
1326
1355 void resize(size_type const count)
1356 {
1357 assert(count < max_size());
1358 data_delimiters.resize(count + 1, data_delimiters.back());
1359 data_values.resize(data_delimiters.back());
1360 }
1361
1367 template <std::ranges::forward_range rng_type>
1368 void resize(size_type const count, rng_type && value)
1369 requires is_compatible_with_value_type<rng_type>
1370 {
1371 assert(count < max_size());
1372 assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
1373
1374 if (count < size())
1375 resize(count);
1376 else if (count > size())
1377 insert(cend(), count - size(), std::forward<rng_type>(value));
1378 }
1379
1393 constexpr void swap(concatenated_sequences & rhs) noexcept
1394 {
1395 std::swap(data_values, rhs.data_values);
1396 std::swap(data_delimiters, rhs.data_delimiters);
1397 }
1398
1400 constexpr void swap(concatenated_sequences && rhs) noexcept
1401 {
1402 std::swap(data_values, rhs.data_values);
1403 std::swap(data_delimiters, rhs.data_delimiters);
1404 }
1406
1415 constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
1416 {
1417 return raw_data() == rhs.raw_data();
1418 }
1419
1424 constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
1425 {
1426 return raw_data() != rhs.raw_data();
1427 }
1428
1433 constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1434 {
1435 return raw_data() < rhs.raw_data();
1436 }
1437
1442 constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1443 {
1444 return raw_data() > rhs.raw_data();
1445 }
1446
1451 constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1452 {
1453 return raw_data() <= rhs.raw_data();
1454 }
1455
1460 constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1461 {
1462 return raw_data() >= rhs.raw_data();
1463 }
1465
1473 template <cereal_archive archive_t>
1474 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1475 {
1476 archive(data_values, data_delimiters);
1477 }
1479};
1480
1481} // 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: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
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
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: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
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
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: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
#define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_START(...)
Denotes the start of a block where diagnostics are ignored.
Definition platform.hpp:268
#define SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY_STOP
Denotes the end of a block where diagnostics are ignored.
Definition platform.hpp:277
Provides seqan3::views::repeat_n.
Provides seqan3::views::slice.
T swap(T... args)
Adaptations of concepts from the standard library.
Hide me