SeqAn3  3.0.1
The Modern C++ library for sequence analysis.
concatenated_sequences.hpp
Go to the documentation of this file.
1 // -----------------------------------------------------------------------------------------------------
2 // Copyright (c) 2006-2020, Knut Reinert & Freie Universität Berlin
3 // Copyright (c) 2016-2020, 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 <type_traits>
16 #include <vector>
17 
27 #include <seqan3/std/iterator>
28 #include <seqan3/std/ranges>
29 
30 #if SEQAN3_WITH_CEREAL
31 #include <cereal/types/vector.hpp>
32 #endif
33 
34 namespace seqan3::detail
35 {
36 
49 template <typename value_type, bool const_>
50 struct concatenated_sequences_reference_proxy :
51  public std::conditional_t<const_,
52  decltype(std::declval<value_type const &>() | views::as_const | views::slice(0,1)),
53  decltype(std::declval<value_type &>() | views::slice(0,1))>
54 {
56  using base_t =
57  std::conditional_t<const_,
58  decltype(std::declval<value_type const &>() | views::as_const | views::slice(0,1)),
59  decltype(std::declval<value_type &>() | views::slice(0,1))>;
60 
62  using base_t::base_t;
63 
65  concatenated_sequences_reference_proxy(base_t && rhs) : base_t{std::move(rhs)} {}
66 
68  operator value_type() const
69  {
70  value_type ret;
71  ret.resize(std::ranges::size(*this));
72  std::ranges::copy(*this, std::ranges::begin(ret));
73  return ret;
74  }
75 };
76 
77 } // namespace seqan3::detail
78 
79 namespace seqan3
80 {
81 
126 template <typename inner_type,
127  typename data_delimiters_type = std::vector<typename inner_type::size_type>>
129  requires reservible_container<std::remove_reference_t<inner_type>> &&
130  reservible_container<std::remove_reference_t<data_delimiters_type>> &&
131  std::is_same_v<size_type_t<inner_type>, value_type_t<data_delimiters_type>>
134 {
135 protected:
138  std::decay_t<inner_type> data_values;
140  data_delimiters_type data_delimiters{0};
141 
142 public:
144 
150 
153  using reference = detail::concatenated_sequences_reference_proxy<value_type, false>;
154 
157  using const_reference = detail::concatenated_sequences_reference_proxy<value_type, true>;
158 
161  using iterator = detail::random_access_iterator<concatenated_sequences>;
162 
165  using const_iterator = detail::random_access_iterator<concatenated_sequences const>;
166 
170 
175 
177  // this signals to range-v3 that something is a container :|
178  using allocator_type = void;
180 
181 protected:
186  // we explicitly check same-ness, because these types may not be fully resolved, yet
189  template <typename t>
190  static constexpr bool is_compatible_value = std::is_same_v<remove_cvref_t<t>, value_type> ||
191  std::is_same_v<remove_cvref_t<t>, reference> ||
192  std::is_same_v<remove_cvref_t<t>, const_reference> ||
193  (dimension_v<t> == dimension_v<value_type> &&
196 
198  // unfortunately we cannot specialise the variable template so we have to add an auxiliary here
199  template <typename t>
200  requires (dimension_v<t> == dimension_v<value_type> + 1) &&
201  is_compatible_value<reference_t<t>>
202  static constexpr bool is_compatible_this_aux = true;
204 
207  // cannot use the concept, because this class is not yet fully defined
208  template <typename t>
209  static constexpr bool is_compatible_this = is_compatible_this_aux<t> ||
210  std::is_same_v<remove_cvref_t<t>, concatenated_sequences> ||
211  std::is_same_v<remove_cvref_t<t>, iterator> ||
212  std::is_same_v<remove_cvref_t<t>, const_iterator>;
213 
214 public:
218  concatenated_sequences() = default;
221  constexpr concatenated_sequences(concatenated_sequences const &) = default;
223  constexpr concatenated_sequences(concatenated_sequences &&) = default;
225  constexpr concatenated_sequences & operator=(concatenated_sequences const &) = default;
227  constexpr concatenated_sequences & operator=(concatenated_sequences &&) = default;
229  ~concatenated_sequences() = default;
230 
243  template <std::ranges::input_range rng_of_rng_type>
244  concatenated_sequences(rng_of_rng_type && rng_of_rng)
246  requires is_compatible_this<rng_of_rng_type>
248  {
249  if constexpr (std::ranges::sized_range<rng_of_rng_type>)
250  data_delimiters.reserve(seqan3::size(rng_of_rng) + 1);
251 
252  for (auto && val : rng_of_rng)
253  {
254  data_values.insert(data_values.end(), val.begin(), val.end());
255  data_delimiters.push_back(data_delimiters.back() + val.size());
256  }
257  }
258 
272  template <std::ranges::forward_range rng_type>
273  concatenated_sequences(size_type const count, rng_type && value)
275  requires is_compatible_value<rng_type>
277  {
278  // TODO SEQAN_UNLIKELY
279  if (count == 0)
280  return;
281 
282  insert(cend(), count, std::forward<rng_type>(value));
283  }
284 
300  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
301  concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
303  requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type> &&
304  is_compatible_this<begin_iterator_type>
306  {
307  insert(cend(), begin_it, end_it);
308  }
309 
322  template <std::ranges::forward_range rng_type = value_type>
325  requires is_compatible_value<rng_type>
327  {
328  assign(std::begin(ilist), std::end(ilist));
329  }
330 
343  template <std::ranges::forward_range rng_type>
346  requires is_compatible_value<rng_type>
348  {
349  assign(std::begin(ilist), std::end(ilist));
350  return *this;
351  }
352 
365  template <std::ranges::input_range rng_of_rng_type>
366  void assign(rng_of_rng_type && rng_of_rng)
368  requires is_compatible_this<rng_of_rng_type>
370  {
371  concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
372  swap(rhs);
373  }
374 
388  template <typename rng_type>
389  void assign(size_type const count, rng_type && value)
391  requires (std::ranges::forward_range<rng_type> && is_compatible_value<rng_type>)
393  {
394  concatenated_sequences rhs{count, value};
395  swap(rhs);
396  }
397 
412  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
413  void assign(begin_iterator_type begin_it, end_iterator_type end_it)
415  requires is_compatible_this<begin_iterator_type> &&
416  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
418  {
419  concatenated_sequences rhs{begin_it, end_it};
420  swap(rhs);
421  }
422 
435  template <std::ranges::forward_range rng_type = value_type>
438  requires is_compatible_value<rng_type>
440  {
441  assign(std::begin(ilist), std::end(ilist));
442  }
443 
445 
462  iterator begin() noexcept
463  {
464  return iterator{*this};
465  }
466 
468  const_iterator begin() const noexcept
469  {
470  return const_iterator{*this};
471  }
472 
474  const_iterator cbegin() const noexcept
475  {
476  return const_iterator{*this};
477  }
478 
492  iterator end() noexcept
493  {
494  return iterator{*this, size()};
495  }
496 
498  const_iterator end() const noexcept
499  {
500  return const_iterator{*this, size()};
501  }
502 
504  const_iterator cend() const noexcept
505  {
506  return const_iterator{*this, size()};
507  }
509 
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 
535  const_reference at(size_type const i) const
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 
558  {
559  assert(i < size());
560  return data_values | views::slice(data_delimiters[i], data_delimiters[i+1]);
561  }
562 
565  {
566  assert(i < size());
567  return data_values | views::as_const | views::slice(data_delimiters[i], data_delimiters[i+1]);
568  }
569 
583  {
584  assert(size() > 0);
585  return (*this)[0];
586  }
587 
590  {
591  assert(size() > 0);
592  return (*this)[0];
593  }
594 
608  {
609  assert(size() > 0);
610  return (*this)[size()-1];
611  }
612 
615  {
616  assert(size() > 0);
617  return (*this)[size()-1];
618  }
619 
635  {
636  return data_values | views::slice(static_cast<size_type>(0), concat_size());
637  }
638 
641  {
642  return data_values | views::as_const | views::slice(static_cast<size_type>(0), concat_size());
643  }
644 
655  {
656  return {data_values, data_delimiters};
657  }
658 
661  {
662  return {std::as_const(data_values), std::as_const(data_delimiters)};
663  }
664 
668  {
669  return raw_data();
670  }
671 
675  {
676  return raw_data();
677  }
679 
694  bool empty() const noexcept
695  {
696  return size() == 0;
697  }
698 
710  size_type size() const noexcept
711  {
712  return data_delimiters.size() - 1;
713  }
714 
729  size_type max_size() const noexcept
730  {
731  return data_delimiters.max_size() - 1;
732  }
733 
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 
821  size_type concat_size() const noexcept
822  {
823  return data_values.size();
824  }
825 
837  size_type concat_capacity() const noexcept
838  {
839  return data_values.capacity();
840  }
841 
860  void concat_reserve(size_type const new_cap)
861  {
862  data_values.reserve(new_cap);
863  }
865 
866 
881  void clear() noexcept
882  {
883  data_values.clear();
884  data_delimiters.clear();
885  data_delimiters.push_back(0);
886  }
887 
912  template <std::ranges::forward_range rng_type>
913  iterator insert(const_iterator pos, rng_type && value)
914  requires is_compatible_value<rng_type>
915  {
916  return insert(pos, 1, std::forward<rng_type>(value));
917  }
918  // no specialisation for temporaries, since we have to copy anyway
919 
944  template <std::ranges::forward_range rng_type>
945  iterator insert(const_iterator pos, size_type const count, rng_type && value)
946  requires is_compatible_value<rng_type>
947 
948  {
949  auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
950  // TODO SEQAN_UNLIKELY
951  if (count == 0)
952  return begin() + pos_as_num;
953 
954  /* TODO implement views::flat_repeat_n that is like
955  * views::repeat_n(value, count) | views::join | ranges::view::bounded;
956  * but preserves random access and size.
957  *
958  * then do
959  * auto concatenated = ranges::view::flat_repeat_n(value, count);
960  * insert(pos, concatenated.cbegin(), concatenated.cend())
961  */
962 
963  size_type value_len = 0;
964  if constexpr (std::ranges::sized_range<rng_type>)
965  value_len = seqan3::size(value);
966  else
967  value_len = std::distance(seqan3::begin(value), seqan3::end(value));
968 
969  data_values.reserve(data_values.size() + count * value_len);
970  auto placeholder = views::repeat_n(value_type_t<rng_type>{}, count * value_len)
971  | std::views::common;
972  // insert placeholder so the tail is moved once:
973  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
974  seqan3::begin(placeholder),
975  seqan3::end(placeholder));
976 
977  // assign the actual values to the placeholder:
978  size_t i = data_delimiters[pos_as_num];
979  for (size_t j = 0; j < count; ++j)
980  for (auto && v : value)
981  data_values[i++] = v;
982 
983  data_delimiters.reserve(data_values.size() + count);
984  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
985  count,
986  *(data_delimiters.begin() + pos_as_num));
987 
988  // adapt delimiters of inserted
989  for (size_type i = 0; i < count; ++i)
990  data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
991 
992  // adapt delimiters after that
993  // TODO parallel execution policy or vectorization?
994  std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
995  data_delimiters.end(),
996  [full_len = value_len * count] (auto & d) { d += full_len; });
997 
998  return begin() + pos_as_num;
999  }
1000 
1024  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1025  iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1027  requires is_compatible_this<begin_iterator_type> &&
1028  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1030  {
1031  auto const pos_as_num = std::distance(cbegin(), pos);
1032  // TODO SEQAN_UNLIKELY
1033  if (last - first == 0)
1034  return begin() + pos_as_num;
1035 
1036  auto const ilist =
1037  std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1038  last,
1039  std::ranges::distance(first, last));
1040 
1041  data_delimiters.reserve(data_values.size() + ilist.size());
1042  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1043  ilist.size(),
1044  *(data_delimiters.begin() + pos_as_num));
1045 
1046 
1047  // adapt delimiters of inserted region
1048  size_type full_len = 0;
1049  for (size_type i = 0; i < ilist.size(); ++i, ++first)
1050  {
1051  full_len += std::ranges::distance(*first);
1052  data_delimiters[pos_as_num + 1 + i] += full_len;
1053  }
1054 
1055  // adapt values of inserted region
1056  auto placeholder = views::repeat_n(value_type_t<value_type>{}, full_len)
1057  | std::views::common;
1058  // insert placeholder so the tail is moved only once:
1059  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1060  seqan3::begin(placeholder),
1061  seqan3::end(placeholder));
1062 
1063  // assign the actual values to the placeholder:
1064  size_t i = data_delimiters[pos_as_num];
1065  for (auto && v0 : ilist)
1066  for (auto && v1 : v0)
1067  data_values[i++] = v1;
1068 
1069 
1070  // adapt delimiters behind inserted region
1071  // TODO parallel execution policy or vectorization?
1072  std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1073  data_delimiters.end(),
1074  [full_len] (auto & d) { d += full_len; });
1075 
1076  return begin() + pos_as_num;
1077  }
1078 
1098  template <std::ranges::forward_range rng_type>
1099  iterator insert(const_iterator pos, std::initializer_list<rng_type> const & ilist)
1100  requires is_compatible_value<rng_type>
1101  {
1102  return insert(pos, ilist.begin(), ilist.end());
1103  }
1104 
1123  iterator erase(const_iterator first, const_iterator last)
1124  {
1125  auto const dist = std::distance(cbegin(), last);
1126  // TODO SEQAN_UNLIKELY
1127  if (last - first == 0)
1128  return begin() + dist;
1129 
1130  auto const distf = std::distance(cbegin(), first);
1131 
1132  // we need to scan once over the input
1133  size_type sum_size{0};
1134  for (; first != last; ++first)
1135  sum_size += seqan3::size(*first);
1136 
1137  data_values.erase(data_values.begin() + data_delimiters[distf],
1138  data_values.begin() + data_delimiters[dist]);
1139 
1140  data_delimiters.erase(data_delimiters.begin() + distf + 1,
1141  data_delimiters.begin() + dist + 1);
1142 
1143  // adapt delimiters after that
1144  // TODO parallel execution policy or vectorization?
1145  std::for_each(data_delimiters.begin() + distf + 1,
1146  data_delimiters.end(),
1147  [sum_size] (auto & d) { d -= sum_size; });
1148  return begin() + dist;
1149  }
1150 
1169  iterator erase(const_iterator pos)
1170  {
1171  return erase(pos, pos + 1);
1172  }
1173 
1190  template <std::ranges::forward_range rng_type>
1191  void push_back(rng_type && value)
1192  requires is_compatible_value<rng_type>
1193  {
1194  data_values.insert(data_values.end(), seqan3::begin(value), seqan3::end(value));
1195  data_delimiters.push_back(data_delimiters.back() + seqan3::size(value));
1196  }
1197 
1214  void pop_back()
1215  {
1216  assert(size() > 0);
1217  auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1218  data_values.resize(data_values.size() - back_length);
1219  data_delimiters.pop_back();
1220  }
1221 
1248  void resize(size_type const count)
1249  {
1250  assert(count < max_size());
1251  data_delimiters.resize(count + 1, data_delimiters.back());
1252  data_values.resize(data_delimiters.back());
1253  }
1254 
1260  template <std::ranges::forward_range rng_type>
1261  void resize(size_type const count, rng_type && value)
1262  requires is_compatible_value<rng_type>
1263  {
1264  assert(count < max_size());
1265  assert(concat_size() + count * seqan3::size(value) < data_values.max_size());
1266 
1267  if (count < size())
1268  resize(count);
1269  else if (count > size())
1270  insert(cend(), count - size(), std::forward<rng_type>(value));
1271  }
1272 
1284  constexpr void swap(concatenated_sequences & rhs) noexcept
1285  {
1286  std::swap(data_values, rhs.data_values);
1287  std::swap(data_delimiters, rhs.data_delimiters);
1288  }
1289 
1291  constexpr void swap(concatenated_sequences && rhs) noexcept
1292  {
1293  std::swap(data_values, rhs.data_values);
1294  std::swap(data_delimiters, rhs.data_delimiters);
1295  }
1297 
1302  constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
1304  {
1305  return raw_data() == rhs.raw_data();
1306  }
1307 
1309  constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
1310  {
1311  return raw_data() != rhs.raw_data();
1312  }
1313 
1315  constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1316  {
1317  return raw_data() < rhs.raw_data();
1318  }
1319 
1321  constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1322  {
1323  return raw_data() > rhs.raw_data();
1324  }
1325 
1327  constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1328  {
1329  return raw_data() <= rhs.raw_data();
1330  }
1331 
1333  constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1334  {
1335  return raw_data() >= rhs.raw_data();
1336  }
1338 
1346  template <cereal_archive archive_t>
1347  void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1348  {
1349  archive(data_values, data_delimiters);
1350  }
1352 };
1353 
1354 } // namespace seqan3
detail::random_access_iterator< concatenated_sequences > iterator
The iterator type of this container (a random access iterator).
Definition: concatenated_sequences.hpp:161
Provides seqan3::views::as_const.
typename value_type< t >::type value_type_t
Shortcut for seqan3::value_type (transformation_trait shortcut).
Definition: pre.hpp:48
T distance(T... args)
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:654
void concat_reserve(size_type const new_cap)
Increase the concat_capacity() to a value that&#39;s greater or equal to new_cap.
Definition: concatenated_sequences.hpp:860
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:535
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:729
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1169
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:492
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:153
T swap(T... args)
void reserve(size_type const new_cap)
Increase the capacity to a value that&#39;s greater or equal to new_cap.
Definition: concatenated_sequences.hpp:776
Provides C++20 additions to the <iterator> header.
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1284
Provides various shortcuts for common std::ranges functions.
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1123
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:301
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:660
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition: concatenated_sequences.hpp:1333
Provides seqan3::views::join.
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:157
T as_const(T... args)
void pop_back()
Removes the last element of the container.
Definition: concatenated_sequences.hpp:1214
T end(T... args)
Provides the seqan3::detail::random_access_iterator class.
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:366
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:504
The main SeqAn3 namespace.
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > data() const
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:674
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition: concatenated_sequences.hpp:1321
typename difference_type< t >::type difference_type_t
Shortcut for seqan3::difference_type (transformation_trait shortcut).
Definition: pre.hpp:166
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:1291
const_reference concat() const
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:640
difference_type_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition: concatenated_sequences.hpp:169
void clear() noexcept
Removes all elements from the container.
Definition: concatenated_sequences.hpp:881
size_type_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition: concatenated_sequences.hpp:173
Container that stores sequences concatenated internally.
Definition: concatenated_sequences.hpp:133
bool empty() const noexcept
Checks whether the container is empty.
Definition: concatenated_sequences.hpp:694
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition: concatenated_sequences.hpp:837
concatenated_sequences(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:323
Provides various type traits.
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:564
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition: concatenated_sequences.hpp:710
Provides seqan3::views::repeat_n.
std::pair< decltype(data_values) &, decltype(data_delimiters) & > data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:667
iterator insert(const_iterator pos, rng_type &&value) requires is_compatible_value< rng_type >
Inserts value before position in the container.
Definition: concatenated_sequences.hpp:913
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:582
void resize(size_type const count)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1248
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition: concatenated_sequences.hpp:1309
Adaptations of concepts from the Ranges TS.
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:462
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:589
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:468
auto const as_const
A view that provides only const & to elements of the underlying range.
Definition: as_const.hpp:87
Adaptions of concepts from the Cereal library.
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:413
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:116
void resize(size_type const count, rng_type &&value) requires is_compatible_value< rng_type >
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1261
typename size_type< t >::type size_type_t
Shortcut for seqan3::size_type (transformation_trait shortcut).
Definition: pre.hpp:195
Definition: aligned_sequence_concept.hpp:36
iterator insert(const_iterator pos, std::initializer_list< rng_type > const &ilist) requires is_compatible_value< rng_type >
Inserts elements from initializer list before position in the container.
Definition: concatenated_sequences.hpp:1099
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition: concatenated_sequences.hpp:749
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:68
T begin(T... args)
reference operator[](size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:557
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:498
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:244
The concept std::convertible_to<From, To> specifies that an expression of the type and value category...
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition: concatenated_sequences.hpp:1327
void shrink_to_fit()
Requests the removal of unused capacity.
Definition: concatenated_sequences.hpp:800
Provides seqan3::views::slice.
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition: concatenated_sequences.hpp:1315
iterator insert(const_iterator pos, size_type const count, rng_type &&value) requires is_compatible_value< rng_type >
Inserts count copies of value before position in the container.
Definition: concatenated_sequences.hpp:945
reference concat()
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:634
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:474
#define SEQAN3_DEPRECATED_310
Deprecation message for SeqAn 3.1.0 release.
Definition: platform.hpp:185
detail::random_access_iterator< concatenated_sequences const > const_iterator
The const iterator type of this container (a random access iterator).
Definition: concatenated_sequences.hpp:165
reference back()
Return the last element as a view.
Definition: concatenated_sequences.hpp:607
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:436
Adaptations of concepts from the standard library.
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:1025
T for_each(T... args)
const_reference back() const
Return the last element as a view.
Definition: concatenated_sequences.hpp:614
reference at(size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:526
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:134
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition: slice.hpp:141
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:389
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:273
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition: repeat_n.hpp:94
void push_back(rng_type &&value) requires is_compatible_value< rng_type >
Appends the given element value to the end of the container.
Definition: concatenated_sequences.hpp:1191
concatenated_sequences & operator=(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:344