SeqAn3  3.0.2
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 
25 #include <seqan3/std/iterator>
26 #include <seqan3/std/ranges>
27 
28 #if SEQAN3_WITH_CEREAL
29 #include <cereal/types/vector.hpp>
30 #endif
31 
32 namespace seqan3::detail
33 {
34 
47 template <typename value_type, bool const_>
48 struct concatenated_sequences_reference_proxy :
49  public std::conditional_t<const_,
50  decltype(std::declval<value_type const &>() | views::as_const | views::slice(0,1)),
51  decltype(std::declval<value_type &>() | views::slice(0,1))>
52 {
54  using base_t =
55  std::conditional_t<const_,
56  decltype(std::declval<value_type const &>() | views::as_const | views::slice(0,1)),
57  decltype(std::declval<value_type &>() | views::slice(0,1))>;
58 
60  using base_t::base_t;
61 
63  concatenated_sequences_reference_proxy(base_t && rhs) : base_t{std::move(rhs)} {}
64 
66  operator value_type() const
67  {
68  value_type ret;
69  ret.resize(std::ranges::size(*this));
70  std::ranges::copy(*this, std::ranges::begin(ret));
71  return ret;
72  }
73 };
74 
75 } // namespace seqan3::detail
76 
77 namespace seqan3
78 {
79 
125 template <typename inner_type,
126  typename data_delimiters_type = std::vector<typename inner_type::size_type>>
130  std::is_same_v<std::ranges::range_size_t<inner_type>, std::ranges::range_value_t<data_delimiters_type>>
133 {
134 protected:
137  std::decay_t<inner_type> data_values;
139  data_delimiters_type data_delimiters{0};
140 
141 public:
143 
149 
152  using reference = detail::concatenated_sequences_reference_proxy<value_type, false>;
153 
156  using const_reference = detail::concatenated_sequences_reference_proxy<value_type, true>;
157 
160  using iterator = detail::random_access_iterator<concatenated_sequences>;
161 
164  using const_iterator = detail::random_access_iterator<concatenated_sequences const>;
165 
168  using difference_type = std::ranges::range_difference_t<data_delimiters_type>;
169 
172  using size_type = std::ranges::range_size_t<data_delimiters_type>;
174 
176  // this signals to range-v3 that something is a container :|
177  using allocator_type = void;
179 
180 protected:
185  // unfortunately we cannot specialise the variable template so we have to add an auxiliary here
187  template <std::ranges::range t>
188  static constexpr bool is_compatible_with_value_type_aux(std::type_identity<t>)
189  {
190  return range_dimension_v<t> == range_dimension_v<value_type> &&
191  std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
192  }
193 
194  static constexpr bool is_compatible_with_value_type_aux(...)
195  {
196  return false;
197  }
199 
202  // we explicitly check same-ness, because these types may not be fully resolved, yet
203  template <std::ranges::range t>
204  static constexpr bool is_compatible_with_value_type = is_compatible_with_value_type_aux(std::type_identity<t>{});
205 
208  // cannot use the concept, because this class is not yet fully defined
209  template <typename t>
211  requires is_compatible_with_value_type<std::iter_reference_t<t>>
213  static constexpr bool iter_value_t_is_compatible_with_value_type = true;
214 
217  // cannot use the concept, because this class is not yet fully defined
218  template <std::ranges::range t>
220  requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
222  static constexpr bool range_value_t_is_compatible_with_value_type = true;
224 
225 public:
229  concatenated_sequences() = default;
232  constexpr concatenated_sequences(concatenated_sequences const &) = default;
241 
255  template <std::ranges::input_range rng_of_rng_type>
256  concatenated_sequences(rng_of_rng_type && rng_of_rng)
258  requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
260  {
261  if constexpr (std::ranges::sized_range<rng_of_rng_type>)
262  data_delimiters.reserve(std::ranges::size(rng_of_rng) + 1);
263 
264  for (auto && val : rng_of_rng)
265  {
266  data_values.insert(data_values.end(), val.begin(), val.end());
267  data_delimiters.push_back(data_delimiters.back() + val.size());
268  }
269  }
270 
284  template <std::ranges::forward_range rng_type>
285  concatenated_sequences(size_type const count, rng_type && value)
287  requires is_compatible_with_value_type<rng_type>
289  {
290  // TODO SEQAN_UNLIKELY
291  if (count == 0)
292  return;
293 
294  insert(cend(), count, std::forward<rng_type>(value));
295  }
296 
312  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
313  concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
315  requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type> &&
316  iter_value_t_is_compatible_with_value_type<begin_iterator_type>
318  {
319  insert(cend(), begin_it, end_it);
320  }
321 
334  template <std::ranges::forward_range value_type_t = value_type>
336  requires is_compatible_with_value_type<value_type_t>
339  {
340  assign(std::begin(ilist), std::end(ilist));
341  }
342 
355  template <std::ranges::forward_range value_type_t>
358  requires is_compatible_with_value_type<value_type_t>
360  {
361  assign(std::begin(ilist), std::end(ilist));
362  return *this;
363  }
364 
378  template <std::ranges::input_range rng_of_rng_type>
379  void assign(rng_of_rng_type && rng_of_rng)
381  requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
383  {
384  concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
385  swap(rhs);
386  }
387 
401  template <std::ranges::forward_range rng_type>
402  void assign(size_type const count, rng_type && value)
404  requires (is_compatible_with_value_type<rng_type>)
406  {
407  concatenated_sequences rhs{count, value};
408  swap(rhs);
409  }
410 
426  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
427  void assign(begin_iterator_type begin_it, end_iterator_type end_it)
429  requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
430  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
432  {
433  concatenated_sequences rhs{begin_it, end_it};
434  swap(rhs);
435  }
436 
449  template <std::ranges::forward_range rng_type = value_type>
452  requires is_compatible_with_value_type<rng_type>
454  {
455  assign(std::begin(ilist), std::end(ilist));
456  }
457 
459 
476  iterator begin() noexcept
477  {
478  return iterator{*this};
479  }
480 
482  const_iterator begin() const noexcept
483  {
484  return const_iterator{*this};
485  }
486 
488  const_iterator cbegin() const noexcept
489  {
490  return const_iterator{*this};
491  }
492 
506  iterator end() noexcept
507  {
508  return iterator{*this, size()};
509  }
510 
512  const_iterator end() const noexcept
513  {
514  return const_iterator{*this, size()};
515  }
516 
518  const_iterator cend() const noexcept
519  {
520  return const_iterator{*this, size()};
521  }
523 
541  {
542  //TODO add SEQAN_UNLIKELY
543  if (i >= size())
544  throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
545  return (*this)[i];
546  }
547 
549  const_reference at(size_type const i) const
550  {
551  //TODO add SEQAN_UNLIKELY
552  if (i >= size())
553  throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
554  return (*this)[i];
555  }
556 
572  {
573  assert(i < size());
574  return data_values | views::slice(data_delimiters[i], data_delimiters[i+1]);
575  }
576 
579  {
580  assert(i < size());
581  return data_values | views::as_const | views::slice(data_delimiters[i], data_delimiters[i+1]);
582  }
583 
597  {
598  assert(size() > 0);
599  return (*this)[0];
600  }
601 
604  {
605  assert(size() > 0);
606  return (*this)[0];
607  }
608 
622  {
623  assert(size() > 0);
624  return (*this)[size()-1];
625  }
626 
629  {
630  assert(size() > 0);
631  return (*this)[size()-1];
632  }
633 
649  {
650  return data_values | views::slice(static_cast<size_type>(0), concat_size());
651  }
652 
655  {
656  return data_values | views::as_const | views::slice(static_cast<size_type>(0), concat_size());
657  }
658 
668  std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
669  {
670  return {data_values, data_delimiters};
671  }
672 
674  std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
675  {
676  return {std::as_const(data_values), std::as_const(data_delimiters)};
677  }
678 
681  SEQAN3_DEPRECATED_310 std::pair<decltype(data_values) &, decltype(data_delimiters) &> data()
682  {
683  return raw_data();
684  }
685 
688  SEQAN3_DEPRECATED_310 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> data() const
689  {
690  return raw_data();
691  }
693 
708  bool empty() const noexcept
709  {
710  return size() == 0;
711  }
712 
724  size_type size() const noexcept
725  {
726  return data_delimiters.size() - 1;
727  }
728 
743  size_type max_size() const noexcept
744  {
745  return data_delimiters.max_size() - 1;
746  }
747 
763  size_type capacity() const noexcept
764  {
765  return data_delimiters.capacity();
766  }
767 
790  void reserve(size_type const new_cap)
791  {
792  data_delimiters.reserve(new_cap + 1);
793  }
794 
815  {
816  data_values.shrink_to_fit();
817  data_delimiters.shrink_to_fit();
818  }
820 
835  size_type concat_size() const noexcept
836  {
837  return data_values.size();
838  }
839 
851  size_type concat_capacity() const noexcept
852  {
853  return data_values.capacity();
854  }
855 
874  void concat_reserve(size_type const new_cap)
875  {
876  data_values.reserve(new_cap);
877  }
879 
880 
895  void clear() noexcept
896  {
897  data_values.clear();
898  data_delimiters.clear();
899  data_delimiters.push_back(0);
900  }
901 
926  template <std::ranges::forward_range rng_type>
927  iterator insert(const_iterator pos, rng_type && value)
929  requires is_compatible_with_value_type<rng_type>
931  {
932  return insert(pos, 1, std::forward<rng_type>(value));
933  }
934  // no specialisation for temporaries, since we have to copy anyway
935 
960  template <std::ranges::forward_range rng_type>
961  iterator insert(const_iterator pos, size_type const count, rng_type && value)
963  requires is_compatible_with_value_type<rng_type>
965  {
966  auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
967  // TODO SEQAN_UNLIKELY
968  if (count == 0)
969  return begin() + pos_as_num;
970 
971  /* TODO implement views::flat_repeat_n that is like
972  * views::repeat_n(value, count) | views::join | ranges::views::bounded;
973  * but preserves random access and size.
974  *
975  * then do
976  * auto concatenated = ranges::views::flat_repeat_n(value, count);
977  * insert(pos, concatenated.cbegin(), concatenated.cend())
978  */
979 
980  size_type value_len = 0;
981  if constexpr (std::ranges::sized_range<rng_type>)
982  value_len = std::ranges::size(value);
983  else
984  value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
985 
986  data_values.reserve(data_values.size() + count * value_len);
987  auto placeholder = views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len)
988  | std::views::common;
989  // insert placeholder so the tail is moved once:
990  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
991  std::ranges::begin(placeholder),
992  std::ranges::end(placeholder));
993 
994  // assign the actual values to the placeholder:
995  size_t i = data_delimiters[pos_as_num];
996  for (size_t j = 0; j < count; ++j)
997  for (auto && v : value)
998  data_values[i++] = v;
999 
1000  data_delimiters.reserve(data_values.size() + count);
1001  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1002  count,
1003  *(data_delimiters.begin() + pos_as_num));
1004 
1005  // adapt delimiters of inserted
1006  for (size_type i = 0; i < count; ++i)
1007  data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
1008 
1009  // adapt delimiters after that
1010  // TODO parallel execution policy or vectorization?
1011  std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
1012  data_delimiters.end(),
1013  [full_len = value_len * count] (auto & d) { d += full_len; });
1014 
1015  return begin() + pos_as_num;
1016  }
1017 
1042  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1043  iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1045  requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
1046  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1048  {
1049  auto const pos_as_num = std::distance(cbegin(), pos);
1050  // TODO SEQAN_UNLIKELY
1051  if (last - first == 0)
1052  return begin() + pos_as_num;
1053 
1054  auto const ilist =
1055  std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1056  last,
1057  std::ranges::distance(first, last));
1058 
1059  data_delimiters.reserve(data_values.size() + ilist.size());
1060  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1061  ilist.size(),
1062  *(data_delimiters.begin() + pos_as_num));
1063 
1064 
1065  // adapt delimiters of inserted region
1066  size_type full_len = 0;
1067  for (size_type i = 0; i < ilist.size(); ++i, ++first)
1068  {
1069  full_len += std::ranges::distance(*first);
1070  data_delimiters[pos_as_num + 1 + i] += full_len;
1071  }
1072 
1073  // adapt values of inserted region
1074  auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len)
1075  | 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 
1088  // adapt delimiters behind inserted region
1089  // TODO parallel execution policy or vectorization?
1090  std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1091  data_delimiters.end(),
1092  [full_len] (auto & d) { d += full_len; });
1093 
1094  return begin() + pos_as_num;
1095  }
1096 
1116  template <std::ranges::forward_range rng_type>
1119  requires is_compatible_with_value_type<rng_type>
1121  {
1122  return insert(pos, ilist.begin(), ilist.end());
1123  }
1124 
1144  {
1145  auto const dist = std::distance(cbegin(), last);
1146  // TODO SEQAN_UNLIKELY
1147  if (last - first == 0)
1148  return begin() + dist;
1149 
1150  auto const distf = std::distance(cbegin(), first);
1151 
1152  // we need to scan once over the input
1153  size_type sum_size{0};
1154  for (; first != last; ++first)
1155  sum_size += std::ranges::size(*first);
1156 
1157  data_values.erase(data_values.begin() + data_delimiters[distf],
1158  data_values.begin() + data_delimiters[dist]);
1159 
1160  data_delimiters.erase(data_delimiters.begin() + distf + 1,
1161  data_delimiters.begin() + dist + 1);
1162 
1163  // adapt delimiters after that
1164  // TODO parallel execution policy or vectorization?
1165  std::for_each(data_delimiters.begin() + distf + 1,
1166  data_delimiters.end(),
1167  [sum_size] (auto & d) { d -= sum_size; });
1168  return begin() + dist;
1169  }
1170 
1190  {
1191  return erase(pos, pos + 1);
1192  }
1193 
1210  template <std::ranges::forward_range rng_type>
1211  void push_back(rng_type && value)
1213  requires is_compatible_with_value_type<rng_type>
1215  {
1216  data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1217  data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
1218  }
1219 
1236  void pop_back()
1237  {
1238  assert(size() > 0);
1239  auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1240  data_values.resize(data_values.size() - back_length);
1241  data_delimiters.pop_back();
1242  }
1243 
1270  void resize(size_type const count)
1271  {
1272  assert(count < max_size());
1273  data_delimiters.resize(count + 1, data_delimiters.back());
1274  data_values.resize(data_delimiters.back());
1275  }
1276 
1282  template <std::ranges::forward_range rng_type>
1283  void resize(size_type const count, rng_type && value)
1285  requires is_compatible_with_value_type<rng_type>
1287  {
1288  assert(count < max_size());
1289  assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
1290 
1291  if (count < size())
1292  resize(count);
1293  else if (count > size())
1294  insert(cend(), count - size(), std::forward<rng_type>(value));
1295  }
1296 
1308  constexpr void swap(concatenated_sequences & rhs) noexcept
1309  {
1310  std::swap(data_values, rhs.data_values);
1311  std::swap(data_delimiters, rhs.data_delimiters);
1312  }
1313 
1315  constexpr void swap(concatenated_sequences && rhs) noexcept
1316  {
1317  std::swap(data_values, rhs.data_values);
1318  std::swap(data_delimiters, rhs.data_delimiters);
1319  }
1321 
1326  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  }
1337 
1339  constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1340  {
1341  return raw_data() < rhs.raw_data();
1342  }
1343 
1345  constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1346  {
1347  return raw_data() > rhs.raw_data();
1348  }
1349 
1351  constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1352  {
1353  return raw_data() <= rhs.raw_data();
1354  }
1355 
1357  constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1358  {
1359  return raw_data() >= rhs.raw_data();
1360  }
1362 
1370  template <cereal_archive archive_t>
1371  void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1372  {
1373  archive(data_values, data_delimiters);
1374  }
1376 };
1377 
1378 } // namespace seqan3
reservible_container
A more refined container concept than seqan3::random_access_container.
as_const.hpp
Provides seqan3::views::as_const.
seqan3::concatenated_sequences::concat_size
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition: concatenated_sequences.hpp:835
seqan3::concatenated_sequences::reference
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:152
seqan3::concatenated_sequences::insert
iterator insert(const_iterator pos, rng_type &&value)
Inserts value before position in the container.
Definition: concatenated_sequences.hpp:927
seqan3::concatenated_sequences::at
reference at(size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:540
seqan3::concatenated_sequences::operator=
constexpr concatenated_sequences & operator=(concatenated_sequences const &)=default
Default constructors.
seqan3::concatenated_sequences::back
reference back()
Return the last element as a view.
Definition: concatenated_sequences.hpp:621
std::for_each
T for_each(T... args)
seqan3::concatenated_sequences::operator=
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:356
seqan3::concatenated_sequences::empty
bool empty() const noexcept
Checks whether the container is empty.
Definition: concatenated_sequences.hpp:708
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:256
seqan3::concatenated_sequences::shrink_to_fit
void shrink_to_fit()
Requests the removal of unused capacity.
Definition: concatenated_sequences.hpp:814
seqan3::concatenated_sequences::concatenated_sequences
constexpr concatenated_sequences(concatenated_sequences &&)=default
Default constructors.
seqan3::concatenated_sequences::operator==
constexpr bool operator==(concatenated_sequences const &rhs) const noexcept
Checks whether *this is equal to rhs.
Definition: concatenated_sequences.hpp:1327
seqan3::concatenated_sequences::capacity
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition: concatenated_sequences.hpp:763
seqan3::concatenated_sequences::cbegin
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:488
seqan3::concatenated_sequences::const_iterator
detail::random_access_iterator< concatenated_sequences const > const_iterator
The const iterator type of this container (a random access iterator).
Definition: concatenated_sequences.hpp:164
seqan3::concatenated_sequences::end
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:512
seqan3::concatenated_sequences::end
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:506
std::pair
seqan3::concatenated_sequences::erase
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1189
seqan3::concatenated_sequences::swap
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1308
vector
seqan3::concatenated_sequences::swap
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1315
seqan3::concatenated_sequences::iterator
detail::random_access_iterator< concatenated_sequences > iterator
The iterator type of this container (a random access iterator).
Definition: concatenated_sequences.hpp:160
iterator
Provides C++20 additions to the <iterator> header.
seqan3::concatenated_sequences::clear
void clear() noexcept
Removes all elements from the container.
Definition: concatenated_sequences.hpp:895
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:338
std::distance
T distance(T... args)
seqan3::concatenated_sequences::concat
const_reference concat() const
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:654
concept.hpp
Adaptations of concepts from the standard library.
seqan3::concatenated_sequences::push_back
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition: concatenated_sequences.hpp:1211
seqan3::concatenated_sequences::operator>=
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition: concatenated_sequences.hpp:1357
seqan3::concatenated_sequences::const_reference
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:156
seqan3::concatenated_sequences::reserve
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:790
seqan3::concatenated_sequences::pop_back
void pop_back()
Removes the last element of the container.
Definition: concatenated_sequences.hpp:1236
std::as_const
T as_const(T... args)
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences()=default
Default constructors.
seqan3::concatenated_sequences::resize
void resize(size_type const count)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1270
seqan3::concatenated_sequences::operator<=
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition: concatenated_sequences.hpp:1351
SEQAN3_DEPRECATED_310
#define SEQAN3_DEPRECATED_310
Deprecation message for SeqAn 3.1.0 release.
Definition: platform.hpp:194
seqan3::concatenated_sequences::erase
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1143
seqan3::concatenated_sequences::resize
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1283
random_access_iterator.hpp
Provides the seqan3::detail::random_access_iterator class.
seqan3::concatenated_sequences::assign
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:402
seqan3::concatenated_sequences::concat_reserve
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:874
seqan3::concatenated_sequences::begin
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:482
slice.hpp
Provides seqan3::views::slice.
seqan3::views::as_const
auto const as_const
A view that provides only const & to elements of the underlying range.
Definition: as_const.hpp:87
repeat_n.hpp
Provides seqan3::views::repeat_n.
seqan3::concatenated_sequences
Container that stores sequences concatenated internally.
Definition: concatenated_sequences.hpp:133
seqan3::views::move
auto const move
A view that turns lvalue-references into rvalue-references.
Definition: move.hpp:68
seqan3::concatenated_sequences::cend
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:518
seqan3::concatenated_sequences::operator=
constexpr concatenated_sequences & operator=(concatenated_sequences &&)=default
Default constructors.
seqan3::concatenated_sequences::begin
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:476
seqan3::concatenated_sequences::concat
reference concat()
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:648
seqan3
The main SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
seqan3::concatenated_sequences::operator[]
reference operator[](size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:571
seqan3::concatenated_sequences::at
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:549
seqan3::concatenated_sequences::max_size
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:743
seqan3::concatenated_sequences::back
const_reference back() const
Return the last element as a view.
Definition: concatenated_sequences.hpp:628
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:285
seqan3::concatenated_sequences::concatenated_sequences
constexpr concatenated_sequences(concatenated_sequences const &)=default
Default constructors.
seqan3::concatenated_sequences::data
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > data() const
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:688
seqan3::pack_traits::size
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:116
std::swap
T swap(T... args)
std::decay_t< inner_type >
join.hpp
Provides seqan3::views::join.
ranges
Adaptations of concepts from the Ranges TS.
seqan3::concatenated_sequences::concat_capacity
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition: concatenated_sequences.hpp:851
seqan3::concatenated_sequences::front
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:603
std::type_identity
The identity transformation (a transformation_trait that returns the input).
seqan3::concatenated_sequences::operator[]
const_reference operator[](size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:578
seqan3::concatenated_sequences::size
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition: concatenated_sequences.hpp:724
seqan3::concatenated_sequences::difference_type
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition: concatenated_sequences.hpp:168
std::begin
T begin(T... args)
seqan3::concatenated_sequences::size_type
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition: concatenated_sequences.hpp:172
seqan3::concatenated_sequences::~concatenated_sequences
~concatenated_sequences()=default
Default constructors.
seqan3::views::slice
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition: slice.hpp:141
seqan3::concatenated_sequences::assign
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:427
seqan3::concatenated_sequences::front
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:596
seqan3::concatenated_sequences::operator<
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition: concatenated_sequences.hpp:1339
seqan3::concatenated_sequences::concatenated_sequences
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:313
std::out_of_range
cereal.hpp
Adaptions of concepts from the Cereal library.
seqan3::views::repeat_n
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition: repeat_n.hpp:94
seqan3::concatenated_sequences::raw_data
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:668
std::end
T end(T... args)
seqan3::concatenated_sequences::assign
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:450
seqan3::concatenated_sequences::insert
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:1117
std::conditional_t
seqan3::concatenated_sequences::assign
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:379
seqan3::concatenated_sequences::insert
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:961
seqan3::concatenated_sequences::is_compatible_with_value_type
static constexpr bool is_compatible_with_value_type
Whether a type satisfies seqan3::range_compatible with this class's value_type or reference type.
Definition: concatenated_sequences.hpp:204
seqan3::concatenated_sequences::insert
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:1043
seqan3::concatenated_sequences::operator>
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition: concatenated_sequences.hpp:1345
seqan3::concatenated_sequences::data
std::pair< decltype(data_values) &, decltype(data_delimiters) & > data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:681
seqan3::concatenated_sequences::iter_value_t_is_compatible_with_value_type
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type satisfies seqan3::range_compatible with this class.
Definition: concatenated_sequences.hpp:213
seqan3::concatenated_sequences::raw_data
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:674
seqan3::pack_traits::count
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:134
seqan3::concatenated_sequences::operator!=
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition: concatenated_sequences.hpp:1333
seqan3::concatenated_sequences::range_value_t_is_compatible_with_value_type
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type satisfies seqan3::range_compatible with this class.
Definition: concatenated_sequences.hpp:222
std::initializer_list