SeqAn3 3.3.0
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
concatenated_sequences.hpp
Go to the documentation of this file.
1// -----------------------------------------------------------------------------------------------------
2// Copyright (c) 2006-2023, Knut Reinert & Freie Universität Berlin
3// Copyright (c) 2016-2023, Knut Reinert & MPI für molekulare Genetik
4// This file may be used, modified and/or redistributed under the terms of the 3-clause BSD-License
5// shipped with this file and also available at: https://github.com/seqan/seqan3/blob/master/LICENSE.md
6// -----------------------------------------------------------------------------------------------------
7
13#pragma once
14
15#include <iterator>
16#include <ranges>
17#include <type_traits>
18#include <vector>
19
24
25#if SEQAN3_WITH_CEREAL
26# include <cereal/types/vector.hpp>
27#endif
28
29namespace seqan3
30{
31
82template <typename underlying_container_type,
86 && std::is_same_v<std::ranges::range_size_t<underlying_container_type>,
87 std::ranges::range_value_t<data_delimiters_type>>
89{
90protected:
95 data_delimiters_type data_delimiters{0};
96
97public:
99
108 using value_type = decltype(std::declval<std::decay_t<underlying_container_type> &>() | views::slice(0, 1));
109
116
123 decltype(std::declval<std::decay_t<underlying_container_type> const &>() | views::slice(0, 1));
124
130 using iterator = detail::random_access_iterator<concatenated_sequences>;
131
137 using const_iterator = detail::random_access_iterator<concatenated_sequences const>;
138
144 using difference_type = std::ranges::range_difference_t<data_delimiters_type>;
145
151 using size_type = std::ranges::range_size_t<data_delimiters_type>;
153
154protected:
161 // unfortunately we cannot specialise the variable template so we have to add an auxiliary here
162 template <std::ranges::range t>
163 static constexpr bool is_compatible_with_value_type_aux(std::type_identity<t>)
164 {
165 return range_dimension_v<t> == range_dimension_v<value_type>
166 && std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
167 }
168
169 static constexpr bool is_compatible_with_value_type_aux(...)
170 {
171 return false;
172 }
174
180 // we explicitly check same-ness, because these types may not be fully resolved, yet
181 template <std::ranges::range t>
182 static constexpr bool is_compatible_with_value_type = is_compatible_with_value_type_aux(std::type_identity<t>{});
183
189 // cannot use the concept, because this class is not yet fully defined
190 template <typename t>
191 requires is_compatible_with_value_type<std::iter_reference_t<t>>
192 static constexpr bool iter_value_t_is_compatible_with_value_type = true;
193
199 // cannot use the concept, because this class is not yet fully defined
200 template <std::ranges::range t>
201 requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
204
205public:
212 constexpr concatenated_sequences(concatenated_sequences const &) = default;
221
237 template <std::ranges::input_range rng_of_rng_type>
238 concatenated_sequences(rng_of_rng_type && rng_of_rng)
239 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
240 {
241 if constexpr (std::ranges::sized_range<rng_of_rng_type>)
242 data_delimiters.reserve(std::ranges::size(rng_of_rng) + 1);
243
244 for (auto && val : rng_of_rng)
245 {
246 data_values.insert(data_values.end(), val.begin(), val.end());
247 data_delimiters.push_back(data_delimiters.back() + val.size());
248 }
249 }
250
266 template <std::ranges::forward_range rng_type>
267 concatenated_sequences(size_type const count, rng_type && value)
268 requires is_compatible_with_value_type<rng_type>
269 {
270 // TODO SEQAN_UNLIKELY
271 if (count == 0)
272 return;
273
274 insert(cend(), count, std::forward<rng_type>(value));
275 }
276
294 template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
295 concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
296 requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
297 && iter_value_t_is_compatible_with_value_type<begin_iterator_type>
298 {
299 insert(cend(), begin_it, end_it);
300 }
301
316 template <std::ranges::forward_range value_type_t = value_type>
317 requires is_compatible_with_value_type<value_type_t>
322
337 template <std::ranges::forward_range value_type_t>
339 requires is_compatible_with_value_type<value_type_t>
340 {
341 assign(std::begin(ilist), std::end(ilist));
342 return *this;
343 }
344
360 template <std::ranges::input_range rng_of_rng_type>
361 void assign(rng_of_rng_type && rng_of_rng)
362 requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
363 {
364 concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
365 swap(rhs);
366 }
367
383 template <std::ranges::forward_range rng_type>
384 void assign(size_type const count, rng_type && value)
385 requires (is_compatible_with_value_type<rng_type>)
386 {
387 concatenated_sequences rhs{count, value};
388 swap(rhs);
389 }
390
408 template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
409 void assign(begin_iterator_type begin_it, end_iterator_type end_it)
410 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
411 && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
412 {
413 concatenated_sequences rhs{begin_it, end_it};
414 swap(rhs);
415 }
416
431 template <std::ranges::forward_range rng_type = value_type>
433 requires is_compatible_with_value_type<rng_type>
434 {
435 assign(std::begin(ilist), std::end(ilist));
436 }
437
439
458 iterator begin() noexcept
459 {
460 return iterator{*this};
461 }
462
464 const_iterator begin() const noexcept
465 {
466 return const_iterator{*this};
467 }
468
470 const_iterator cbegin() const noexcept
471 {
472 return const_iterator{*this};
473 }
474
490 iterator end() noexcept
491 {
492 return iterator{*this, size()};
493 }
494
496 const_iterator end() const noexcept
497 {
498 return const_iterator{*this, size()};
499 }
500
502 const_iterator cend() const noexcept
503 {
504 return const_iterator{*this, size()};
505 }
507
527 {
528 //TODO add SEQAN_UNLIKELY
529 if (i >= size())
530 throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
531 return (*this)[i];
532 }
533
536 {
537 //TODO add SEQAN_UNLIKELY
538 if (i >= size())
539 throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
540 return (*this)[i];
541 }
542
560 {
561 assert(i < size());
562 return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
563 }
564
567 {
568 assert(i < size());
569 return data_values | views::slice(data_delimiters[i], data_delimiters[i + 1]);
570 }
571
587 {
588 assert(size() > 0);
589 return (*this)[0];
590 }
591
594 {
595 assert(size() > 0);
596 return (*this)[0];
597 }
598
614 {
615 assert(size() > 0);
616 return (*this)[size() - 1];
617 }
618
621 {
622 assert(size() > 0);
623 return (*this)[size() - 1];
624 }
625
643 {
644 return data_values | views::slice(static_cast<size_type>(0), concat_size());
645 }
646
649 {
650 return data_values | views::slice(static_cast<size_type>(0), concat_size());
651 }
652
660 std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
661 {
662 return {data_values, data_delimiters};
663 }
664
666 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
667 {
668 return {data_values, data_delimiters};
669 }
670
672
689 bool empty() const noexcept
690 {
691 return size() == 0;
692 }
693
707 size_type size() const noexcept
708 {
709 return data_delimiters.size() - 1;
710 }
711
728 size_type max_size() const noexcept
729 {
730 return data_delimiters.max_size() - 1;
731 }
732
750 size_type capacity() const noexcept
751 {
752 return data_delimiters.capacity();
753 }
754
777 void reserve(size_type const new_cap)
778 {
779 data_delimiters.reserve(new_cap + 1);
780 }
781
802 {
803 data_values.shrink_to_fit();
804 data_delimiters.shrink_to_fit();
805 }
807
824 size_type concat_size() const noexcept
825 {
826 return data_values.size();
827 }
828
842 size_type concat_capacity() const noexcept
843 {
844 return data_values.capacity();
845 }
846
867 void concat_reserve(size_type const new_cap)
868 {
869 data_values.reserve(new_cap);
870 }
872
888 void clear() noexcept
889 {
890 data_values.clear();
891 data_delimiters.clear();
892 data_delimiters.push_back(0);
893 }
894
921 template <std::ranges::forward_range rng_type>
922 iterator insert(const_iterator pos, rng_type && value)
923 requires is_compatible_with_value_type<rng_type>
924 {
925 return insert(pos, 1, std::forward<rng_type>(value));
926 }
927 // no specialisation for temporaries, since we have to copy anyway
928
955 template <std::ranges::forward_range rng_type>
956 iterator insert(const_iterator pos, size_type const count, rng_type && value)
957 requires is_compatible_with_value_type<rng_type>
958 {
959 auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
960 // TODO SEQAN_UNLIKELY
961 if (count == 0)
962 return begin() + pos_as_num;
963
964 /* TODO implement views::flat_repeat_n that is like
965 * views::repeat_n(value, count) | std::views::join | ranges::views::bounded;
966 * but preserves random access and size.
967 *
968 * then do
969 * auto concatenated = ranges::views::flat_repeat_n(value, count);
970 * insert(pos, concatenated.cbegin(), concatenated.cend())
971 */
972
973 size_type value_len = 0;
974 if constexpr (std::ranges::sized_range<rng_type>)
975 value_len = std::ranges::size(value);
976 else
977 value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
978
979 data_values.reserve(data_values.size() + count * value_len);
980 auto placeholder =
981 views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len) | std::views::common;
982 // insert placeholder so the tail is moved once:
983#if SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
984# pragma GCC diagnostic push
985# pragma GCC diagnostic ignored "-Wstringop-overread"
986# pragma GCC diagnostic ignored "-Wstringop-overflow"
987#endif // SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
988 data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
989 std::ranges::begin(placeholder),
990 std::ranges::end(placeholder));
991#if SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
992# pragma GCC diagnostic pop
993#endif // SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
994
995 // assign the actual values to the placeholder:
996 size_t i = data_delimiters[pos_as_num];
997 for (size_t j = 0; j < count; ++j)
998 for (auto && v : value)
999 data_values[i++] = v;
1000
1001 data_delimiters.reserve(data_values.size() + count);
1002 data_delimiters.insert(data_delimiters.begin() + pos_as_num, count, *(data_delimiters.begin() + pos_as_num));
1003
1004 // adapt delimiters of inserted
1005 for (size_type i = 0; i < count; ++i)
1006 data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
1007
1008 // adapt delimiters after that
1009 // TODO parallel execution policy or vectorization?
1010 std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
1011 data_delimiters.end(),
1012 [full_len = value_len * count](auto & d)
1013 {
1014 d += full_len;
1015 });
1016
1017 return begin() + pos_as_num;
1018 }
1019
1046 template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1047 iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1048 requires iter_value_t_is_compatible_with_value_type<begin_iterator_type>
1049 && std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1050 {
1051 auto const pos_as_num = std::distance(cbegin(), pos);
1052 // TODO SEQAN_UNLIKELY
1053 if (last - first == 0)
1054 return begin() + pos_as_num;
1055
1056 auto const ilist =
1057 std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1058 last,
1059 std::ranges::distance(first, last));
1060
1061 data_delimiters.reserve(data_values.size() + ilist.size());
1062 data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1063 ilist.size(),
1064 *(data_delimiters.begin() + pos_as_num));
1065
1066 // adapt delimiters of inserted region
1067 size_type full_len = 0;
1068 for (size_type i = 0; i < ilist.size(); ++i, ++first)
1069 {
1070 full_len += std::ranges::distance(*first);
1071 data_delimiters[pos_as_num + 1 + i] += full_len;
1072 }
1073
1074 // adapt values of inserted region
1075 auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len) | std::views::common;
1076 // insert placeholder so the tail is moved only once:
1077 data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1078 std::ranges::begin(placeholder),
1079 std::ranges::end(placeholder));
1080
1081 // assign the actual values to the placeholder:
1082 size_t i = data_delimiters[pos_as_num];
1083 for (auto && v0 : ilist)
1084 for (auto && v1 : v0)
1085 data_values[i++] = v1;
1086
1087 // adapt delimiters behind inserted region
1088 // TODO parallel execution policy or vectorization?
1089 std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1090 data_delimiters.end(),
1091 [full_len](auto & d)
1092 {
1093 d += full_len;
1094 });
1095
1096 return begin() + pos_as_num;
1097 }
1098
1120 template <std::ranges::forward_range rng_type>
1122 requires is_compatible_with_value_type<rng_type>
1123 {
1124 return insert(pos, ilist.begin(), ilist.end());
1125 }
1126
1148 {
1149 auto const dist = std::distance(cbegin(), last);
1150 // TODO SEQAN_UNLIKELY
1151 if (last - first == 0)
1152 return begin() + dist;
1153
1154 auto const distf = std::distance(cbegin(), first);
1155
1156 // we need to scan once over the input
1157 size_type sum_size{0};
1158 for (; first != last; ++first)
1159 sum_size += std::ranges::size(*first);
1160
1161 data_values.erase(data_values.begin() + data_delimiters[distf], data_values.begin() + data_delimiters[dist]);
1162
1163 data_delimiters.erase(data_delimiters.begin() + distf + 1, data_delimiters.begin() + dist + 1);
1164
1165 // adapt delimiters after that
1166 // TODO parallel execution policy or vectorization?
1167 std::for_each(data_delimiters.begin() + distf + 1,
1168 data_delimiters.end(),
1169 [sum_size](auto & d)
1170 {
1171 d -= sum_size;
1172 });
1173 return begin() + dist;
1174 }
1175
1197 {
1198 return erase(pos, pos + 1);
1199 }
1200
1222 template <std::ranges::forward_range rng_type>
1223 void push_back(rng_type && value)
1224 requires is_compatible_with_value_type<rng_type>
1225 {
1226 data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1227 data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
1228 }
1229
1249 {
1250 data_delimiters.push_back(data_delimiters.back());
1251 }
1252
1273 void last_push_back(std::ranges::range_value_t<underlying_container_type> const value)
1274 {
1275 data_values.push_back(value);
1276 ++data_delimiters.back();
1277 }
1278
1300 template <std::ranges::forward_range rng_type>
1301 void last_append(rng_type && value)
1302 requires is_compatible_with_value_type<rng_type>
1303 {
1304 data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1305 data_delimiters.back() += std::ranges::size(value);
1306 }
1307
1327 {
1328 assert(size() > 0);
1329 auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1330 data_values.resize(data_values.size() - back_length);
1331 data_delimiters.pop_back();
1332 }
1333
1362 void resize(size_type const count)
1363 {
1364 assert(count < max_size());
1365 data_delimiters.resize(count + 1, data_delimiters.back());
1366 data_values.resize(data_delimiters.back());
1367 }
1368
1374 template <std::ranges::forward_range rng_type>
1375 void resize(size_type const count, rng_type && value)
1376 requires is_compatible_with_value_type<rng_type>
1377 {
1378 assert(count < max_size());
1379 assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
1380
1381 if (count < size())
1382 resize(count);
1383 else if (count > size())
1384 insert(cend(), count - size(), std::forward<rng_type>(value));
1385 }
1386
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 }
1405
1407 constexpr void swap(concatenated_sequences && rhs) noexcept
1408 {
1409 std::swap(data_values, rhs.data_values);
1410 std::swap(data_delimiters, rhs.data_delimiters);
1411 }
1413
1422 constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
1423 {
1424 return raw_data() == rhs.raw_data();
1425 }
1426
1431 constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
1432 {
1433 return raw_data() != rhs.raw_data();
1434 }
1435
1440 constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1441 {
1442 return raw_data() < rhs.raw_data();
1443 }
1444
1449 constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1450 {
1451 return raw_data() > rhs.raw_data();
1452 }
1453
1458 constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1459 {
1460 return raw_data() <= rhs.raw_data();
1461 }
1462
1467 constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1468 {
1469 return raw_data() >= rhs.raw_data();
1470 }
1472
1480 template <cereal_archive archive_t>
1481 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1482 {
1483 archive(data_values, data_delimiters);
1484 }
1486};
1487
1488} // namespace seqan3
T begin(T... args)
Adaptions of concepts from the Cereal library.
Container that stores sequences concatenated internally.
Definition concatenated_sequences.hpp:89
detail::random_access_iterator< concatenated_sequences const > const_iterator
The const iterator type of this container (a random access iterator).
Definition concatenated_sequences.hpp:137
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:238
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition concatenated_sequences.hpp:750
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:777
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:1273
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:1301
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:593
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
const_reference back() const
Return the last element as a view.
Definition concatenated_sequences.hpp:620
reference at(size_type const i)
Return the i-th element as a view.
Definition concatenated_sequences.hpp:526
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:470
reference concat()
Return the concatenation of all members.
Definition concatenated_sequences.hpp:642
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition concatenated_sequences.hpp:1449
bool empty() const noexcept
Checks whether the container is empty.
Definition concatenated_sequences.hpp:689
reference operator[](size_type const i)
Return the i-th element as a view.
Definition concatenated_sequences.hpp:559
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:338
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1400
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:490
void clear() noexcept
Removes all elements from the container.
Definition concatenated_sequences.hpp:888
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:458
~concatenated_sequences()=default
Default constructors.
void pop_back()
Removes the last element of the container.
Definition concatenated_sequences.hpp:1326
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition concatenated_sequences.hpp:586
reference back()
Return the last element as a view.
Definition concatenated_sequences.hpp:613
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition concatenated_sequences.hpp:842
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition concatenated_sequences.hpp:464
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:123
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition concatenated_sequences.hpp:660
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:496
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:1047
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:956
void shrink_to_fit()
Requests the removal of unused capacity.
Definition concatenated_sequences.hpp:801
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:922
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:318
constexpr bool operator==(concatenated_sequences const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition concatenated_sequences.hpp:1422
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition concatenated_sequences.hpp:502
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1375
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:384
detail::random_access_iterator< concatenated_sequences > iterator
The iterator type of this container (a random access iterator).
Definition concatenated_sequences.hpp:130
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:728
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:182
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition concatenated_sequences.hpp:432
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition concatenated_sequences.hpp:707
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition concatenated_sequences.hpp:1223
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition concatenated_sequences.hpp:1431
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:867
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition concatenated_sequences.hpp:361
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:202
void push_back()
Appends an empty element to the end of the container.
Definition concatenated_sequences.hpp:1248
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition concatenated_sequences.hpp:192
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1196
void resize(size_type const count)
Resizes the container to contain count elements.
Definition concatenated_sequences.hpp:1362
const_reference concat() const
Return the concatenation of all members.
Definition concatenated_sequences.hpp:648
value_type reference
A views::slice that represents "one element", typically a std::span.
Definition concatenated_sequences.hpp:115
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition concatenated_sequences.hpp:1467
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition concatenated_sequences.hpp:566
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition concatenated_sequences.hpp:824
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition concatenated_sequences.hpp:1407
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition concatenated_sequences.hpp:267
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition concatenated_sequences.hpp:409
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:666
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:108
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition concatenated_sequences.hpp:1440
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition concatenated_sequences.hpp:151
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition concatenated_sequences.hpp:295
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:1121
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:535
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition concatenated_sequences.hpp:1147
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition concatenated_sequences.hpp:144
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition concatenated_sequences.hpp:1458
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:178
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition repeat_n.hpp:91
A more refined container concept than seqan3::random_access_container.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:29
Provides seqan3::views::repeat_n.
Provides seqan3::views::slice.
T swap(T... args)
Adaptations of concepts from the standard library.