SeqAn3  3.0.3
The Modern C++ library for sequence analysis.
concatenated_sequences.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2021, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2021, 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 <seqan3/std/iterator>
16 #include <seqan3/std/ranges>
17 #include <type_traits>
18 #include <vector>
19 
24 
25 #if SEQAN3_WITH_CEREAL
26 #include <cereal/types/vector.hpp>
27 #endif
28 
29 namespace seqan3::detail
30 {
31 
33 struct as_const_fn
34 {
36  template <typename t>
37  t operator()(t const && arg) const
38  {
39  return std::move(arg);
40  }
41 
43  template <typename t>
44  t const & operator()(t const & arg) const
45  {
46  return arg;
47  }
48 };
49 
89 inline constexpr auto as_const = std::views::transform(seqan3::detail::as_const_fn{});
90 
103 template <typename value_type, bool const_>
104 struct concatenated_sequences_reference_proxy :
105  public std::conditional_t<const_,
106  decltype(std::declval<value_type const &>() | detail::as_const | views::slice(0,1)),
107  decltype(std::declval<value_type &>() | views::slice(0,1))>
108 {
110  using base_t =
111  std::conditional_t<const_,
112  decltype(std::declval<value_type const &>() | detail::as_const | views::slice(0,1)),
113  decltype(std::declval<value_type &>() | views::slice(0,1))>;
114 
116  using base_t::base_t;
117 
119  concatenated_sequences_reference_proxy(base_t && rhs) : base_t{std::move(rhs)} {}
120 
122  operator value_type() const
123  {
124  value_type ret;
125  ret.resize(std::ranges::size(*this));
126  std::ranges::copy(*this, std::ranges::begin(ret));
127  return ret;
128  }
129 };
130 
131 } // namespace seqan3::detail
132 
133 namespace seqan3
134 {
135 
182 template <typename inner_type,
183  typename data_delimiters_type = std::vector<typename inner_type::size_type>>
187  std::is_same_v<std::ranges::range_size_t<inner_type>, std::ranges::range_value_t<data_delimiters_type>>
190 {
191 protected:
194  std::decay_t<inner_type> data_values;
196  data_delimiters_type data_delimiters{0};
197 
198 public:
200 
210 
216  using reference = detail::concatenated_sequences_reference_proxy<value_type, false>;
217 
223  using const_reference = detail::concatenated_sequences_reference_proxy<value_type, true>;
224 
230  using iterator = detail::random_access_iterator<concatenated_sequences>;
231 
237  using const_iterator = detail::random_access_iterator<concatenated_sequences const>;
238 
244  using difference_type = std::ranges::range_difference_t<data_delimiters_type>;
245 
251  using size_type = std::ranges::range_size_t<data_delimiters_type>;
253 
255  // this signals to range-v3 that something is a container :|
256  using allocator_type = void;
258 
259 protected:
266  // unfortunately we cannot specialise the variable template so we have to add an auxiliary here
267  template <std::ranges::range t>
268  static constexpr bool is_compatible_with_value_type_aux(std::type_identity<t>)
269  {
270  return range_dimension_v<t> == range_dimension_v<value_type> &&
271  std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
272  }
273 
274  static constexpr bool is_compatible_with_value_type_aux(...)
275  {
276  return false;
277  }
279 
285  // we explicitly check same-ness, because these types may not be fully resolved, yet
286  template <std::ranges::range t>
287  static constexpr bool is_compatible_with_value_type = is_compatible_with_value_type_aux(std::type_identity<t>{});
288 
294  // cannot use the concept, because this class is not yet fully defined
295  template <typename t>
297  requires is_compatible_with_value_type<std::iter_reference_t<t>>
299  static constexpr bool iter_value_t_is_compatible_with_value_type = true;
300 
306  // cannot use the concept, because this class is not yet fully defined
307  template <std::ranges::range t>
309  requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
311  static constexpr bool range_value_t_is_compatible_with_value_type = true;
313 
314 public:
321  constexpr concatenated_sequences(concatenated_sequences const &) = default;
330 
346  template <std::ranges::input_range rng_of_rng_type>
347  concatenated_sequences(rng_of_rng_type && rng_of_rng)
349  requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
351  {
352  if constexpr (std::ranges::sized_range<rng_of_rng_type>)
353  data_delimiters.reserve(std::ranges::size(rng_of_rng) + 1);
354 
355  for (auto && val : rng_of_rng)
356  {
357  data_values.insert(data_values.end(), val.begin(), val.end());
358  data_delimiters.push_back(data_delimiters.back() + val.size());
359  }
360  }
361 
377  template <std::ranges::forward_range rng_type>
378  concatenated_sequences(size_type const count, rng_type && value)
380  requires is_compatible_with_value_type<rng_type>
382  {
383  // TODO SEQAN_UNLIKELY
384  if (count == 0)
385  return;
386 
387  insert(cend(), count, std::forward<rng_type>(value));
388  }
389 
407  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
408  concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
410  requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type> &&
411  iter_value_t_is_compatible_with_value_type<begin_iterator_type>
413  {
414  insert(cend(), begin_it, end_it);
415  }
416 
431  template <std::ranges::forward_range value_type_t = value_type>
433  requires is_compatible_with_value_type<value_type_t>
436  {
437  assign(std::begin(ilist), std::end(ilist));
438  }
439 
454  template <std::ranges::forward_range value_type_t>
457  requires is_compatible_with_value_type<value_type_t>
459  {
460  assign(std::begin(ilist), std::end(ilist));
461  return *this;
462  }
463 
479  template <std::ranges::input_range rng_of_rng_type>
480  void assign(rng_of_rng_type && rng_of_rng)
482  requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
484  {
485  concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
486  swap(rhs);
487  }
488 
504  template <std::ranges::forward_range rng_type>
505  void assign(size_type const count, rng_type && value)
507  requires (is_compatible_with_value_type<rng_type>)
509  {
510  concatenated_sequences rhs{count, value};
511  swap(rhs);
512  }
513 
531  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
532  void assign(begin_iterator_type begin_it, end_iterator_type end_it)
534  requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
535  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
537  {
538  concatenated_sequences rhs{begin_it, end_it};
539  swap(rhs);
540  }
541 
556  template <std::ranges::forward_range rng_type = value_type>
559  requires is_compatible_with_value_type<rng_type>
561  {
562  assign(std::begin(ilist), std::end(ilist));
563  }
564 
566 
585  iterator begin() noexcept
586  {
587  return iterator{*this};
588  }
589 
591  const_iterator begin() const noexcept
592  {
593  return const_iterator{*this};
594  }
595 
597  const_iterator cbegin() const noexcept
598  {
599  return const_iterator{*this};
600  }
601 
617  iterator end() noexcept
618  {
619  return iterator{*this, size()};
620  }
621 
623  const_iterator end() const noexcept
624  {
625  return const_iterator{*this, size()};
626  }
627 
629  const_iterator cend() const noexcept
630  {
631  return const_iterator{*this, size()};
632  }
634 
654  {
655  //TODO add SEQAN_UNLIKELY
656  if (i >= size())
657  throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
658  return (*this)[i];
659  }
660 
662  const_reference at(size_type const i) const
663  {
664  //TODO add SEQAN_UNLIKELY
665  if (i >= size())
666  throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
667  return (*this)[i];
668  }
669 
687  {
688  assert(i < size());
689  return data_values | views::slice(data_delimiters[i], data_delimiters[i+1]);
690  }
691 
694  {
695  assert(i < size());
696  return data_values | detail::as_const | views::slice(data_delimiters[i], data_delimiters[i+1]);
697  }
698 
714  {
715  assert(size() > 0);
716  return (*this)[0];
717  }
718 
721  {
722  assert(size() > 0);
723  return (*this)[0];
724  }
725 
741  {
742  assert(size() > 0);
743  return (*this)[size()-1];
744  }
745 
748  {
749  assert(size() > 0);
750  return (*this)[size()-1];
751  }
752 
770  {
771  return data_values | views::slice(static_cast<size_type>(0), concat_size());
772  }
773 
776  {
777  return data_values | detail::as_const | views::slice(static_cast<size_type>(0), concat_size());
778  }
779 
787  std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
788  {
789  return {data_values, data_delimiters};
790  }
791 
793  std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
794  {
795  return {std::as_const(data_values), std::as_const(data_delimiters)};
796  }
797 
798 #ifdef SEQAN3_DEPRECATED_310
801  SEQAN3_DEPRECATED_310 std::pair<decltype(data_values) &, decltype(data_delimiters) &> data()
802  {
803  return raw_data();
804  }
805 
808  SEQAN3_DEPRECATED_310 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> data() const
809  {
810  return raw_data();
811  }
812 #endif // SEQAN3_DEPRECATED_310
814 
831  bool empty() const noexcept
832  {
833  return size() == 0;
834  }
835 
849  size_type size() const noexcept
850  {
851  return data_delimiters.size() - 1;
852  }
853 
870  size_type max_size() const noexcept
871  {
872  return data_delimiters.max_size() - 1;
873  }
874 
892  size_type capacity() const noexcept
893  {
894  return data_delimiters.capacity();
895  }
896 
919  void reserve(size_type const new_cap)
920  {
921  data_delimiters.reserve(new_cap + 1);
922  }
923 
944  {
945  data_values.shrink_to_fit();
946  data_delimiters.shrink_to_fit();
947  }
949 
966  size_type concat_size() const noexcept
967  {
968  return data_values.size();
969  }
970 
984  size_type concat_capacity() const noexcept
985  {
986  return data_values.capacity();
987  }
988 
1009  void concat_reserve(size_type const new_cap)
1010  {
1011  data_values.reserve(new_cap);
1012  }
1014 
1015 
1032  void clear() noexcept
1033  {
1034  data_values.clear();
1035  data_delimiters.clear();
1036  data_delimiters.push_back(0);
1037  }
1038 
1065  template <std::ranges::forward_range rng_type>
1066  iterator insert(const_iterator pos, rng_type && value)
1068  requires is_compatible_with_value_type<rng_type>
1070  {
1071  return insert(pos, 1, std::forward<rng_type>(value));
1072  }
1073  // no specialisation for temporaries, since we have to copy anyway
1074 
1101  template <std::ranges::forward_range rng_type>
1102  iterator insert(const_iterator pos, size_type const count, rng_type && value)
1104  requires is_compatible_with_value_type<rng_type>
1106  {
1107  auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
1108  // TODO SEQAN_UNLIKELY
1109  if (count == 0)
1110  return begin() + pos_as_num;
1111 
1112  /* TODO implement views::flat_repeat_n that is like
1113  * views::repeat_n(value, count) | std::views::join | ranges::views::bounded;
1114  * but preserves random access and size.
1115  *
1116  * then do
1117  * auto concatenated = ranges::views::flat_repeat_n(value, count);
1118  * insert(pos, concatenated.cbegin(), concatenated.cend())
1119  */
1120 
1121  size_type value_len = 0;
1122  if constexpr (std::ranges::sized_range<rng_type>)
1123  value_len = std::ranges::size(value);
1124  else
1125  value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
1126 
1127  data_values.reserve(data_values.size() + count * value_len);
1128  auto placeholder = views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len)
1129  | std::views::common;
1130  // insert placeholder so the tail is moved once:
1131  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1132  std::ranges::begin(placeholder),
1133  std::ranges::end(placeholder));
1134 
1135  // assign the actual values to the placeholder:
1136  size_t i = data_delimiters[pos_as_num];
1137  for (size_t j = 0; j < count; ++j)
1138  for (auto && v : value)
1139  data_values[i++] = v;
1140 
1141  data_delimiters.reserve(data_values.size() + count);
1142  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1143  count,
1144  *(data_delimiters.begin() + pos_as_num));
1145 
1146  // adapt delimiters of inserted
1147  for (size_type i = 0; i < count; ++i)
1148  data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
1149 
1150  // adapt delimiters after that
1151  // TODO parallel execution policy or vectorization?
1152  std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
1153  data_delimiters.end(),
1154  [full_len = value_len * count] (auto & d) { d += full_len; });
1155 
1156  return begin() + pos_as_num;
1157  }
1158 
1185  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1186  iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1188  requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
1189  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1191  {
1192  auto const pos_as_num = std::distance(cbegin(), pos);
1193  // TODO SEQAN_UNLIKELY
1194  if (last - first == 0)
1195  return begin() + pos_as_num;
1196 
1197  auto const ilist =
1198  std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1199  last,
1200  std::ranges::distance(first, last));
1201 
1202  data_delimiters.reserve(data_values.size() + ilist.size());
1203  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1204  ilist.size(),
1205  *(data_delimiters.begin() + pos_as_num));
1206 
1207 
1208  // adapt delimiters of inserted region
1209  size_type full_len = 0;
1210  for (size_type i = 0; i < ilist.size(); ++i, ++first)
1211  {
1212  full_len += std::ranges::distance(*first);
1213  data_delimiters[pos_as_num + 1 + i] += full_len;
1214  }
1215 
1216  // adapt values of inserted region
1217  auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len)
1218  | std::views::common;
1219  // insert placeholder so the tail is moved only once:
1220  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1221  std::ranges::begin(placeholder),
1222  std::ranges::end(placeholder));
1223 
1224  // assign the actual values to the placeholder:
1225  size_t i = data_delimiters[pos_as_num];
1226  for (auto && v0 : ilist)
1227  for (auto && v1 : v0)
1228  data_values[i++] = v1;
1229 
1230 
1231  // adapt delimiters behind inserted region
1232  // TODO parallel execution policy or vectorization?
1233  std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1234  data_delimiters.end(),
1235  [full_len] (auto & d) { d += full_len; });
1236 
1237  return begin() + pos_as_num;
1238  }
1239 
1261  template <std::ranges::forward_range rng_type>
1264  requires is_compatible_with_value_type<rng_type>
1266  {
1267  return insert(pos, ilist.begin(), ilist.end());
1268  }
1269 
1291  {
1292  auto const dist = std::distance(cbegin(), last);
1293  // TODO SEQAN_UNLIKELY
1294  if (last - first == 0)
1295  return begin() + dist;
1296 
1297  auto const distf = std::distance(cbegin(), first);
1298 
1299  // we need to scan once over the input
1300  size_type sum_size{0};
1301  for (; first != last; ++first)
1302  sum_size += std::ranges::size(*first);
1303 
1304  data_values.erase(data_values.begin() + data_delimiters[distf],
1305  data_values.begin() + data_delimiters[dist]);
1306 
1307  data_delimiters.erase(data_delimiters.begin() + distf + 1,
1308  data_delimiters.begin() + dist + 1);
1309 
1310  // adapt delimiters after that
1311  // TODO parallel execution policy or vectorization?
1312  std::for_each(data_delimiters.begin() + distf + 1,
1313  data_delimiters.end(),
1314  [sum_size] (auto & d) { d -= sum_size; });
1315  return begin() + dist;
1316  }
1317 
1339  {
1340  return erase(pos, pos + 1);
1341  }
1342 
1361  template <std::ranges::forward_range rng_type>
1362  void push_back(rng_type && value)
1364  requires is_compatible_with_value_type<rng_type>
1366  {
1367  data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1368  data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
1369  }
1370 
1389  void pop_back()
1390  {
1391  assert(size() > 0);
1392  auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1393  data_values.resize(data_values.size() - back_length);
1394  data_delimiters.pop_back();
1395  }
1396 
1425  void resize(size_type const count)
1426  {
1427  assert(count < max_size());
1428  data_delimiters.resize(count + 1, data_delimiters.back());
1429  data_values.resize(data_delimiters.back());
1430  }
1431 
1437  template <std::ranges::forward_range rng_type>
1438  void resize(size_type const count, rng_type && value)
1440  requires is_compatible_with_value_type<rng_type>
1442  {
1443  assert(count < max_size());
1444  assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
1445 
1446  if (count < size())
1447  resize(count);
1448  else if (count > size())
1449  insert(cend(), count - size(), std::forward<rng_type>(value));
1450  }
1451 
1465  constexpr void swap(concatenated_sequences & rhs) noexcept
1466  {
1467  std::swap(data_values, rhs.data_values);
1468  std::swap(data_delimiters, rhs.data_delimiters);
1469  }
1470 
1472  constexpr void swap(concatenated_sequences && rhs) noexcept
1473  {
1474  std::swap(data_values, rhs.data_values);
1475  std::swap(data_delimiters, rhs.data_delimiters);
1476  }
1478 
1487  constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
1488  {
1489  return raw_data() == rhs.raw_data();
1490  }
1491 
1496  constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
1497  {
1498  return raw_data() != rhs.raw_data();
1499  }
1500 
1505  constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1506  {
1507  return raw_data() < rhs.raw_data();
1508  }
1509 
1514  constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1515  {
1516  return raw_data() > rhs.raw_data();
1517  }
1518 
1523  constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1524  {
1525  return raw_data() <= rhs.raw_data();
1526  }
1527 
1532  constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1533  {
1534  return raw_data() >= rhs.raw_data();
1535  }
1537 
1545  template <cereal_archive archive_t>
1546  void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1547  {
1548  archive(data_values, data_delimiters);
1549  }
1551 };
1552 
1553 } // namespace seqan3
T as_const(T... args)
T begin(T... args)
Adaptions of concepts from the Cereal library.
Container that stores sequences concatenated internally.
Definition: concatenated_sequences.hpp:190
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:787
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1290
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:870
void shrink_to_fit()
Requests the removal of unused capacity.
Definition: concatenated_sequences.hpp:943
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition: concatenated_sequences.hpp:966
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:378
constexpr concatenated_sequences & operator=(concatenated_sequences const &)=default
Default constructors.
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:480
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition: concatenated_sequences.hpp:1505
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition: concatenated_sequences.hpp:849
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition: concatenated_sequences.hpp:984
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:532
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:617
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
iterator insert(const_iterator pos, rng_type &&value)
Inserts value before position in the container.
Definition: concatenated_sequences.hpp:1066
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:435
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1338
const_reference concat() const
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:775
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:713
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition: concatenated_sequences.hpp:1532
constexpr concatenated_sequences(concatenated_sequences const &)=default
Default constructors.
constexpr bool operator==(concatenated_sequences const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition: concatenated_sequences.hpp:1487
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition: concatenated_sequences.hpp:299
reference at(size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:653
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:720
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1465
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1472
concatenated_sequences()=default
Default constructors.
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:693
void resize(size_type const count)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1425
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:793
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition: concatenated_sequences.hpp:311
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:623
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition: concatenated_sequences.hpp:1362
bool empty() const noexcept
Checks whether the container is empty.
Definition: concatenated_sequences.hpp:831
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition: concatenated_sequences.hpp:1496
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:591
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:585
detail::concatenated_sequences_reference_proxy< value_type, false > reference
A proxy of type views::slice that represents the range on the concatenated vector.
Definition: concatenated_sequences.hpp:216
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition: concatenated_sequences.hpp:251
const_reference back() const
Return the last element as a view.
Definition: concatenated_sequences.hpp:747
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:408
~concatenated_sequences()=default
Default constructors.
reference back()
Return the last element as a view.
Definition: concatenated_sequences.hpp:740
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:505
detail::concatenated_sequences_reference_proxy< value_type, true > const_reference
An immutable proxy of type views::slice that represents the range on the concatenated vector.
Definition: concatenated_sequences.hpp:223
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition: concatenated_sequences.hpp:1514
void clear() noexcept
Removes all elements from the container.
Definition: concatenated_sequences.hpp:1032
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:629
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition: concatenated_sequences.hpp:892
detail::random_access_iterator< concatenated_sequences const > const_iterator
The const iterator type of this container (a random access iterator).
Definition: concatenated_sequences.hpp:237
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > data() const
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:808
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:1262
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:597
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition: concatenated_sequences.hpp:244
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:1186
detail::random_access_iterator< concatenated_sequences > iterator
The iterator type of this container (a random access iterator).
Definition: concatenated_sequences.hpp:230
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:662
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1438
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:455
std::pair< decltype(data_values) &, decltype(data_delimiters) & > data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:801
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:1102
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:1009
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:287
void pop_back()
Removes the last element of the container.
Definition: concatenated_sequences.hpp:1389
reference concat()
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:769
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:347
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:919
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:557
constexpr concatenated_sequences & operator=(concatenated_sequences &&)=default
Default constructors.
reference operator[](size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:686
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition: concatenated_sequences.hpp:1523
T distance(T... args)
T end(T... args)
T for_each(T... args)
decltype(detail::transform< trait_t >(list_t{})) transform
Apply a transformation trait to every type in the list and return a seqan3::type_list of the results.
Definition: traits.hpp:471
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:169
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:151
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition: slice.hpp:189
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition: repeat_n.hpp:95
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:74
A more refined container concept than seqan3::random_access_container.
Provides C++20 additions to the <iterator> header.
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
SeqAn specific customisations in the standard namespace.
#define SEQAN3_DEPRECATED_310
Deprecation message for SeqAn 3.1.0 release.
Definition: platform.hpp:203
Adaptations of concepts from the Ranges TS.
T swap(T... args)
Adaptations of concepts from the standard library.
Provides seqan3::views::repeat_n.
Provides seqan3::views::slice.