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-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 <seqan3/std/iterator>
16 #include <seqan3/std/ranges>
17 #include <type_traits>
18 #include <vector>
19 
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_>
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 
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 
126 template <typename inner_type,
127  typename data_delimiters_type = std::vector<typename inner_type::size_type>>
131  std::is_same_v<std::ranges::range_size_t<inner_type>, std::ranges::range_value_t<data_delimiters_type>>
134 {
135 protected:
140  data_delimiters_type data_delimiters{0};
141 
142 public:
144 
154 
161 
168 
175 
182 
188  using difference_type = std::ranges::range_difference_t<data_delimiters_type>;
189 
195  using size_type = std::ranges::range_size_t<data_delimiters_type>;
197 
199  // this signals to range-v3 that something is a container :|
200  using allocator_type = void;
202 
203 protected:
210  // unfortunately we cannot specialise the variable template so we have to add an auxiliary here
211  template <std::ranges::range t>
212  static constexpr bool is_compatible_with_value_type_aux(std::type_identity<t>)
213  {
214  return range_dimension_v<t> == range_dimension_v<value_type> &&
215  std::convertible_to<std::ranges::range_reference_t<t>, std::ranges::range_value_t<value_type>>;
216  }
217 
218  static constexpr bool is_compatible_with_value_type_aux(...)
219  {
220  return false;
221  }
223 
229  // we explicitly check same-ness, because these types may not be fully resolved, yet
230  template <std::ranges::range t>
231  static constexpr bool is_compatible_with_value_type = is_compatible_with_value_type_aux(std::type_identity<t>{});
232 
238  // cannot use the concept, because this class is not yet fully defined
239  template <typename t>
241  requires is_compatible_with_value_type<std::iter_reference_t<t>>
243  static constexpr bool iter_value_t_is_compatible_with_value_type = true;
244 
250  // cannot use the concept, because this class is not yet fully defined
251  template <std::ranges::range t>
253  requires is_compatible_with_value_type<std::ranges::range_reference_t<t>>
255  static constexpr bool range_value_t_is_compatible_with_value_type = true;
257 
258 public:
265  constexpr concatenated_sequences(concatenated_sequences const &) = default;
274 
290  template <std::ranges::input_range rng_of_rng_type>
291  concatenated_sequences(rng_of_rng_type && rng_of_rng)
293  requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
295  {
296  if constexpr (std::ranges::sized_range<rng_of_rng_type>)
297  data_delimiters.reserve(std::ranges::size(rng_of_rng) + 1);
298 
299  for (auto && val : rng_of_rng)
300  {
301  data_values.insert(data_values.end(), val.begin(), val.end());
302  data_delimiters.push_back(data_delimiters.back() + val.size());
303  }
304  }
305 
321  template <std::ranges::forward_range rng_type>
322  concatenated_sequences(size_type const count, rng_type && value)
324  requires is_compatible_with_value_type<rng_type>
326  {
327  // TODO SEQAN_UNLIKELY
328  if (count == 0)
329  return;
330 
331  insert(cend(), count, std::forward<rng_type>(value));
332  }
333 
351  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
352  concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
354  requires std::sized_sentinel_for<end_iterator_type, begin_iterator_type> &&
355  iter_value_t_is_compatible_with_value_type<begin_iterator_type>
357  {
358  insert(cend(), begin_it, end_it);
359  }
360 
375  template <std::ranges::forward_range value_type_t = value_type>
377  requires is_compatible_with_value_type<value_type_t>
380  {
381  assign(std::begin(ilist), std::end(ilist));
382  }
383 
398  template <std::ranges::forward_range value_type_t>
401  requires is_compatible_with_value_type<value_type_t>
403  {
404  assign(std::begin(ilist), std::end(ilist));
405  return *this;
406  }
407 
423  template <std::ranges::input_range rng_of_rng_type>
424  void assign(rng_of_rng_type && rng_of_rng)
426  requires range_value_t_is_compatible_with_value_type<rng_of_rng_type>
428  {
429  concatenated_sequences rhs{std::forward<rng_of_rng_type>(rng_of_rng)};
430  swap(rhs);
431  }
432 
448  template <std::ranges::forward_range rng_type>
449  void assign(size_type const count, rng_type && value)
451  requires (is_compatible_with_value_type<rng_type>)
453  {
454  concatenated_sequences rhs{count, value};
455  swap(rhs);
456  }
457 
475  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
476  void assign(begin_iterator_type begin_it, end_iterator_type end_it)
478  requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
479  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
481  {
482  concatenated_sequences rhs{begin_it, end_it};
483  swap(rhs);
484  }
485 
500  template <std::ranges::forward_range rng_type = value_type>
503  requires is_compatible_with_value_type<rng_type>
505  {
506  assign(std::begin(ilist), std::end(ilist));
507  }
508 
510 
529  iterator begin() noexcept
530  {
531  return iterator{*this};
532  }
533 
535  const_iterator begin() const noexcept
536  {
537  return const_iterator{*this};
538  }
539 
541  const_iterator cbegin() const noexcept
542  {
543  return const_iterator{*this};
544  }
545 
561  iterator end() noexcept
562  {
563  return iterator{*this, size()};
564  }
565 
567  const_iterator end() const noexcept
568  {
569  return const_iterator{*this, size()};
570  }
571 
573  const_iterator cend() const noexcept
574  {
575  return const_iterator{*this, size()};
576  }
578 
598  {
599  //TODO add SEQAN_UNLIKELY
600  if (i >= size())
601  throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
602  return (*this)[i];
603  }
604 
606  const_reference at(size_type const i) const
607  {
608  //TODO add SEQAN_UNLIKELY
609  if (i >= size())
610  throw std::out_of_range{"Trying to access element behind the last in concatenated_sequences."};
611  return (*this)[i];
612  }
613 
631  {
632  assert(i < size());
634  }
635 
638  {
639  assert(i < size());
641  }
642 
658  {
659  assert(size() > 0);
660  return (*this)[0];
661  }
662 
665  {
666  assert(size() > 0);
667  return (*this)[0];
668  }
669 
685  {
686  assert(size() > 0);
687  return (*this)[size()-1];
688  }
689 
692  {
693  assert(size() > 0);
694  return (*this)[size()-1];
695  }
696 
714  {
715  return data_values | views::slice(static_cast<size_type>(0), concat_size());
716  }
717 
720  {
721  return data_values | views::as_const | views::slice(static_cast<size_type>(0), concat_size());
722  }
723 
731  std::pair<decltype(data_values) &, decltype(data_delimiters) &> raw_data()
732  {
733  return {data_values, data_delimiters};
734  }
735 
737  std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> raw_data() const
738  {
740  }
741 
745  {
746  return raw_data();
747  }
748 
751  SEQAN3_DEPRECATED_310 std::pair<decltype(data_values) const &, decltype(data_delimiters) const &> data() const
752  {
753  return raw_data();
754  }
756 
773  bool empty() const noexcept
774  {
775  return size() == 0;
776  }
777 
791  size_type size() const noexcept
792  {
793  return data_delimiters.size() - 1;
794  }
795 
812  size_type max_size() const noexcept
813  {
814  return data_delimiters.max_size() - 1;
815  }
816 
834  size_type capacity() const noexcept
835  {
836  return data_delimiters.capacity();
837  }
838 
861  void reserve(size_type const new_cap)
862  {
863  data_delimiters.reserve(new_cap + 1);
864  }
865 
886  {
887  data_values.shrink_to_fit();
888  data_delimiters.shrink_to_fit();
889  }
891 
908  size_type concat_size() const noexcept
909  {
910  return data_values.size();
911  }
912 
926  size_type concat_capacity() const noexcept
927  {
928  return data_values.capacity();
929  }
930 
951  void concat_reserve(size_type const new_cap)
952  {
953  data_values.reserve(new_cap);
954  }
956 
957 
974  void clear() noexcept
975  {
976  data_values.clear();
977  data_delimiters.clear();
978  data_delimiters.push_back(0);
979  }
980 
1007  template <std::ranges::forward_range rng_type>
1008  iterator insert(const_iterator pos, rng_type && value)
1010  requires is_compatible_with_value_type<rng_type>
1012  {
1013  return insert(pos, 1, std::forward<rng_type>(value));
1014  }
1015  // no specialisation for temporaries, since we have to copy anyway
1016 
1043  template <std::ranges::forward_range rng_type>
1044  iterator insert(const_iterator pos, size_type const count, rng_type && value)
1046  requires is_compatible_with_value_type<rng_type>
1048  {
1049  auto const pos_as_num = std::distance(cbegin(), pos); // we want to insert BEFORE this position
1050  // TODO SEQAN_UNLIKELY
1051  if (count == 0)
1052  return begin() + pos_as_num;
1053 
1054  /* TODO implement views::flat_repeat_n that is like
1055  * views::repeat_n(value, count) | views::join | ranges::views::bounded;
1056  * but preserves random access and size.
1057  *
1058  * then do
1059  * auto concatenated = ranges::views::flat_repeat_n(value, count);
1060  * insert(pos, concatenated.cbegin(), concatenated.cend())
1061  */
1062 
1063  size_type value_len = 0;
1064  if constexpr (std::ranges::sized_range<rng_type>)
1065  value_len = std::ranges::size(value);
1066  else
1067  value_len = std::distance(std::ranges::begin(value), std::ranges::end(value));
1068 
1069  data_values.reserve(data_values.size() + count * value_len);
1070  auto placeholder = views::repeat_n(std::ranges::range_value_t<rng_type>{}, count * value_len)
1071  | std::views::common;
1072  // insert placeholder so the tail is moved once:
1073  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1074  std::ranges::begin(placeholder),
1075  std::ranges::end(placeholder));
1076 
1077  // assign the actual values to the placeholder:
1078  size_t i = data_delimiters[pos_as_num];
1079  for (size_t j = 0; j < count; ++j)
1080  for (auto && v : value)
1081  data_values[i++] = v;
1082 
1083  data_delimiters.reserve(data_values.size() + count);
1084  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1085  count,
1086  *(data_delimiters.begin() + pos_as_num));
1087 
1088  // adapt delimiters of inserted
1089  for (size_type i = 0; i < count; ++i)
1090  data_delimiters[pos_as_num + i + 1] += value_len * (i + 1);
1091 
1092  // adapt delimiters after that
1093  // TODO parallel execution policy or vectorization?
1094  std::for_each(data_delimiters.begin() + pos_as_num + count + 1,
1095  data_delimiters.end(),
1096  [full_len = value_len * count] (auto & d) { d += full_len; });
1097 
1098  return begin() + pos_as_num;
1099  }
1100 
1127  template <std::forward_iterator begin_iterator_type, typename end_iterator_type>
1128  iterator insert(const_iterator pos, begin_iterator_type first, end_iterator_type last)
1130  requires iter_value_t_is_compatible_with_value_type<begin_iterator_type> &&
1131  std::sized_sentinel_for<end_iterator_type, begin_iterator_type>
1133  {
1134  auto const pos_as_num = std::distance(cbegin(), pos);
1135  // TODO SEQAN_UNLIKELY
1136  if (last - first == 0)
1137  return begin() + pos_as_num;
1138 
1139  auto const ilist =
1140  std::ranges::subrange<begin_iterator_type, end_iterator_type>(first,
1141  last,
1142  std::ranges::distance(first, last));
1143 
1144  data_delimiters.reserve(data_values.size() + ilist.size());
1145  data_delimiters.insert(data_delimiters.begin() + pos_as_num,
1146  ilist.size(),
1147  *(data_delimiters.begin() + pos_as_num));
1148 
1149 
1150  // adapt delimiters of inserted region
1151  size_type full_len = 0;
1152  for (size_type i = 0; i < ilist.size(); ++i, ++first)
1153  {
1154  full_len += std::ranges::distance(*first);
1155  data_delimiters[pos_as_num + 1 + i] += full_len;
1156  }
1157 
1158  // adapt values of inserted region
1159  auto placeholder = views::repeat_n(std::ranges::range_value_t<value_type>{}, full_len)
1160  | std::views::common;
1161  // insert placeholder so the tail is moved only once:
1162  data_values.insert(data_values.begin() + data_delimiters[pos_as_num],
1163  std::ranges::begin(placeholder),
1164  std::ranges::end(placeholder));
1165 
1166  // assign the actual values to the placeholder:
1167  size_t i = data_delimiters[pos_as_num];
1168  for (auto && v0 : ilist)
1169  for (auto && v1 : v0)
1170  data_values[i++] = v1;
1171 
1172 
1173  // adapt delimiters behind inserted region
1174  // TODO parallel execution policy or vectorization?
1175  std::for_each(data_delimiters.begin() + pos_as_num + ilist.size() + 1,
1176  data_delimiters.end(),
1177  [full_len] (auto & d) { d += full_len; });
1178 
1179  return begin() + pos_as_num;
1180  }
1181 
1203  template <std::ranges::forward_range rng_type>
1206  requires is_compatible_with_value_type<rng_type>
1208  {
1209  return insert(pos, ilist.begin(), ilist.end());
1210  }
1211 
1233  {
1234  auto const dist = std::distance(cbegin(), last);
1235  // TODO SEQAN_UNLIKELY
1236  if (last - first == 0)
1237  return begin() + dist;
1238 
1239  auto const distf = std::distance(cbegin(), first);
1240 
1241  // we need to scan once over the input
1242  size_type sum_size{0};
1243  for (; first != last; ++first)
1244  sum_size += std::ranges::size(*first);
1245 
1246  data_values.erase(data_values.begin() + data_delimiters[distf],
1247  data_values.begin() + data_delimiters[dist]);
1248 
1249  data_delimiters.erase(data_delimiters.begin() + distf + 1,
1250  data_delimiters.begin() + dist + 1);
1251 
1252  // adapt delimiters after that
1253  // TODO parallel execution policy or vectorization?
1254  std::for_each(data_delimiters.begin() + distf + 1,
1255  data_delimiters.end(),
1256  [sum_size] (auto & d) { d -= sum_size; });
1257  return begin() + dist;
1258  }
1259 
1281  {
1282  return erase(pos, pos + 1);
1283  }
1284 
1303  template <std::ranges::forward_range rng_type>
1304  void push_back(rng_type && value)
1306  requires is_compatible_with_value_type<rng_type>
1308  {
1309  data_values.insert(data_values.end(), std::ranges::begin(value), std::ranges::end(value));
1310  data_delimiters.push_back(data_delimiters.back() + std::ranges::size(value));
1311  }
1312 
1331  void pop_back()
1332  {
1333  assert(size() > 0);
1334  auto back_length = data_delimiters[size()] - data_delimiters[size() - 1];
1335  data_values.resize(data_values.size() - back_length);
1336  data_delimiters.pop_back();
1337  }
1338 
1367  void resize(size_type const count)
1368  {
1369  assert(count < max_size());
1370  data_delimiters.resize(count + 1, data_delimiters.back());
1371  data_values.resize(data_delimiters.back());
1372  }
1373 
1379  template <std::ranges::forward_range rng_type>
1380  void resize(size_type const count, rng_type && value)
1382  requires is_compatible_with_value_type<rng_type>
1384  {
1385  assert(count < max_size());
1386  assert(concat_size() + count * std::ranges::size(value) < data_values.max_size());
1387 
1388  if (count < size())
1389  resize(count);
1390  else if (count > size())
1391  insert(cend(), count - size(), std::forward<rng_type>(value));
1392  }
1393 
1407  constexpr void swap(concatenated_sequences & rhs) noexcept
1408  {
1409  std::swap(data_values, rhs.data_values);
1410  std::swap(data_delimiters, rhs.data_delimiters);
1411  }
1412 
1414  constexpr void swap(concatenated_sequences && rhs) noexcept
1415  {
1416  std::swap(data_values, rhs.data_values);
1417  std::swap(data_delimiters, rhs.data_delimiters);
1418  }
1420 
1429  constexpr bool operator==(concatenated_sequences const & rhs) const noexcept
1430  {
1431  return raw_data() == rhs.raw_data();
1432  }
1433 
1438  constexpr bool operator!=(concatenated_sequences const & rhs) const noexcept
1439  {
1440  return raw_data() != rhs.raw_data();
1441  }
1442 
1447  constexpr bool operator<(concatenated_sequences const & rhs) const noexcept
1448  {
1449  return raw_data() < rhs.raw_data();
1450  }
1451 
1456  constexpr bool operator>(concatenated_sequences const & rhs) const noexcept
1457  {
1458  return raw_data() > rhs.raw_data();
1459  }
1460 
1465  constexpr bool operator<=(concatenated_sequences const & rhs) const noexcept
1466  {
1467  return raw_data() <= rhs.raw_data();
1468  }
1469 
1474  constexpr bool operator>=(concatenated_sequences const & rhs) const noexcept
1475  {
1476  return raw_data() >= rhs.raw_data();
1477  }
1479 
1487  template <cereal_archive archive_t>
1488  void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1489  {
1490  archive(data_values, data_delimiters);
1491  }
1493 };
1494 
1495 } // namespace seqan3
Provides seqan3::views::as_const.
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:134
std::pair< decltype(data_values) &, decltype(data_delimiters) & > raw_data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:731
iterator erase(const_iterator first, const_iterator last)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1232
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:812
void shrink_to_fit()
Requests the removal of unused capacity.
Definition: concatenated_sequences.hpp:885
size_type concat_size() const noexcept
Returns the cumulative size of all elements in the container.
Definition: concatenated_sequences.hpp:908
concatenated_sequences(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:322
constexpr concatenated_sequences & operator=(concatenated_sequences const &)=default
Default constructors.
data_delimiters_type data_delimiters
Where the delimiters are stored; begins with 0, has size of size() + 1.
Definition: concatenated_sequences.hpp:140
void assign(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:424
constexpr bool operator<(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than rhs.
Definition: concatenated_sequences.hpp:1447
size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition: concatenated_sequences.hpp:791
size_type concat_capacity() const noexcept
Returns the concatenated size the container has currently allocated space for.
Definition: concatenated_sequences.hpp:926
void assign(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:476
iterator end() noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:561
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:1008
concatenated_sequences(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:379
std::decay_t< inner_type > data_values
Where the concatenation is stored.
Definition: concatenated_sequences.hpp:138
iterator erase(const_iterator pos)
Removes specified elements from the container.
Definition: concatenated_sequences.hpp:1280
const_reference concat() const
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:719
reference front()
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:657
constexpr bool operator>=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than or equal to rhs.
Definition: concatenated_sequences.hpp:1474
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:1429
static constexpr bool iter_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition: concatenated_sequences.hpp:243
reference at(size_type const i)
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:597
const_reference front() const
Return the first element as a view. Calling front on an empty container is undefined.
Definition: concatenated_sequences.hpp:664
constexpr void swap(concatenated_sequences &rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1407
constexpr void swap(concatenated_sequences &&rhs) noexcept
Swap contents with another instance.
Definition: concatenated_sequences.hpp:1414
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:637
void resize(size_type const count)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1367
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:737
static constexpr bool range_value_t_is_compatible_with_value_type
Whether a type is compatible with this class.
Definition: concatenated_sequences.hpp:255
const_iterator end() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:567
void push_back(rng_type &&value)
Appends the given element value to the end of the container.
Definition: concatenated_sequences.hpp:1304
bool empty() const noexcept
Checks whether the container is empty.
Definition: concatenated_sequences.hpp:773
constexpr bool operator!=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is not equal to rhs.
Definition: concatenated_sequences.hpp:1438
const_iterator begin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:535
iterator begin() noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:529
std::ranges::range_size_t< data_delimiters_type > size_type
An unsigned integer type (usually std::size_t)
Definition: concatenated_sequences.hpp:195
const_reference back() const
Return the last element as a view.
Definition: concatenated_sequences.hpp:691
concatenated_sequences(begin_iterator_type begin_it, end_iterator_type end_it)
Construct/assign from pair of iterators.
Definition: concatenated_sequences.hpp:352
~concatenated_sequences()=default
Default constructors.
reference back()
Return the last element as a view.
Definition: concatenated_sequences.hpp:684
void assign(size_type const count, rng_type &&value)
Construct/assign with count times value.
Definition: concatenated_sequences.hpp:449
constexpr bool operator>(concatenated_sequences const &rhs) const noexcept
Checks whether *this is greater than rhs.
Definition: concatenated_sequences.hpp:1456
void clear() noexcept
Removes all elements from the container.
Definition: concatenated_sequences.hpp:974
const_iterator cend() const noexcept
Returns an iterator to the element following the last element of the container.
Definition: concatenated_sequences.hpp:573
size_type capacity() const noexcept
Returns the number of elements that the container has currently allocated space for.
Definition: concatenated_sequences.hpp:834
std::pair< decltype(data_values) const &, decltype(data_delimiters) const & > data() const
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:751
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:1204
const_iterator cbegin() const noexcept
Returns an iterator to the first element of the container.
Definition: concatenated_sequences.hpp:541
std::ranges::range_difference_t< data_delimiters_type > difference_type
A signed integer type (usually std::ptrdiff_t)
Definition: concatenated_sequences.hpp:188
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:1128
const_reference at(size_type const i) const
Return the i-th element as a view.
Definition: concatenated_sequences.hpp:606
void resize(size_type const count, rng_type &&value)
Resizes the container to contain count elements.
Definition: concatenated_sequences.hpp:1380
concatenated_sequences & operator=(std::initializer_list< value_type_t > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:399
std::pair< decltype(data_values) &, decltype(data_delimiters) & > data()
Provides direct, unsafe access to underlying data structures.
Definition: concatenated_sequences.hpp:744
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:1044
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:951
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:231
void pop_back()
Removes the last element of the container.
Definition: concatenated_sequences.hpp:1331
reference concat()
Return the concatenation of all members.
Definition: concatenated_sequences.hpp:713
concatenated_sequences(rng_of_rng_type &&rng_of_rng)
Construct/assign from a different range.
Definition: concatenated_sequences.hpp:291
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:861
void assign(std::initializer_list< rng_type > ilist)
Construct/assign from std::initializer_list.
Definition: concatenated_sequences.hpp:501
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:630
constexpr bool operator<=(concatenated_sequences const &rhs) const noexcept
Checks whether *this is less than or equal to rhs.
Definition: concatenated_sequences.hpp:1465
A generic random access iterator that delegates most operations to the range.
Definition: random_access_iterator.hpp:310
T distance(T... args)
T end(T... args)
T for_each(T... args)
constexpr ptrdiff_t count
Count the occurrences of a type in a pack.
Definition: traits.hpp:168
constexpr size_t size
The size of a type pack.
Definition: traits.hpp:150
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition: slice.hpp:191
auto const as_const
A view that provides only const & to elements of the underlying range.
Definition: as_const.hpp:88
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:70
A more refined container concept than seqan3::random_access_container.
Provides C++20 additions to the <iterator> header.
Provides seqan3::views::join.
The internal SeqAn3 namespace.
Definition: aligned_sequence_concept.hpp:29
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:202
#define CEREAL_SERIALIZE_FUNCTION_NAME
Macro for Cereal's serialize function.
Definition: platform.hpp:134
Provides the seqan3::detail::random_access_iterator class.
Adaptations of concepts from the standard library.
Adaptations of concepts from the Ranges TS.
Provides seqan3::views::slice.
The reference type of seqan3::concatenated_sequences.
Definition: concatenated_sequences.hpp:52
concatenated_sequences_reference_proxy(base_t &&rhs)
Construct from base type.
Definition: concatenated_sequences.hpp:63
This is helper structure to deprecate seqan3::value_type and will be removed before SeqAn 3....
Definition: pre.hpp:33
T swap(T... args)
Provides seqan3::views::repeat_n.