16# include <cereal/types/array.hpp>
42template <
typename value_type_,
size_t capacity_>
47 static constexpr bool is_noexcept = std::is_nothrow_copy_constructible_v<value_type_>;
126 template <
size_t capacity2>
130 static_assert(capacity2 <= capacity_,
"You can only initialize from array that has smaller or equal capacity.");
148 template <
size_t capacity2>
151 static_assert(
capacity2 <=
capacity_,
"You can only initialize from array that has smaller or equal capacity.");
169 requires (std::same_as<value_type, other_value_type> && ...)
174 static_assert(
sizeof...(other_value_type) <=
capacity_,
"Value list must not exceed the capacity.");
194 template <std::forward_iterator begin_it_type,
typename end_it_type>
195 requires std::sentinel_for<end_it_type, begin_it_type>
196 && std::constructible_from<value_type, std::iter_reference_t<begin_it_type>>
217 template <std::ranges::input_range other_range_t>
218 requires (!std::is_same_v<std::remove_cvref_t<other_range_t>,
small_vector>)
219 && std::constructible_from<
value_type, std::ranges::range_reference_t<other_range_t>>
316 template <std::ranges::input_range other_range_t>
317 requires std::constructible_from<value_type, std::ranges::range_reference_t<other_range_t>>
340 template <std::forward_iterator begin_it_type,
typename end_it_type>
341 requires std::sentinel_for<end_it_type, begin_it_type>
342 && std::constructible_from<value_type, std::iter_reference_t<begin_it_type>>
380 return data_.
data() + sz;
386 return data_.
data() + sz;
392 return data_.
data() + sz;
420 throw std::out_of_range{
"Trying to access element behind the last in small_vector."};
430 throw std::out_of_range{
"Trying to access element behind the last in small_vector."};
511 return (*
this)[
size() - 1];
518 return (*
this)[
size() - 1];
673 return insert(pos, 1, value);
722 template <std::forward_iterator begin_it_type,
typename end_it_type>
723 requires std::sentinel_for<end_it_type, begin_it_type>
724 && std::constructible_from<value_type, std::iter_reference_t<begin_it_type>>
728 auto const length = std::ranges::distance(begin_it, end_it);
736 data_[
i] = data_[
i - length];
738#if SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
739# pragma GCC diagnostic push
740# pragma GCC diagnostic ignored "-Wstringop-overflow"
743#if SEQAN3_WORKAROUND_GCC_BOGUS_MEMCPY
744# pragma GCC diagnostic pop
794 if (begin_it >= end_it)
795 return begin() + std::ranges::distance(
cbegin(), end_it);
797 size_type const length = std::ranges::distance(begin_it, end_it);
800 while (end_it !=
cend())
801 *(
out_it++) = *(end_it++);
804 return begin() + std::ranges::distance(
cbegin(), begin_it);
829 return erase(pos, pos + 1);
904 for (
size_t i = sz;
i < count; ++
i)
973 template <
size_t cap2>
983 template <
size_t cap2>
993 template <
size_t cap2>
1001 return lhs.size() <
rhs.size();
1008 template <
size_t cap2>
1016 return lhs.size() >
rhs.size();
1023 template <
size_t cap2>
1033 template <
size_t cap2>
1055 template <cereal_archive archive_t>
1056 void CEREAL_SERIALIZE_FUNCTION_NAME(archive_t & archive)
1072template <
size_t capacity2,
typename value_type>
Adaptions of concepts from the Cereal library.
A "pretty printer" for most SeqAn data structures and related types.
Definition debug_stream_type.hpp:79
A constexpr vector implementation with dynamic size at compile time.
Definition small_vector.hpp:44
constexpr void swap(small_vector &rhs) noexcept(is_noexcept)
Swap contents with another instance.
Definition small_vector.hpp:922
constexpr small_vector(other_value_type... args) noexcept(is_noexcept)
Construct from a list of values of value_type.
Definition small_vector.hpp:170
constexpr reference operator[](size_type const i) noexcept
Return the i-th element.
Definition small_vector.hpp:452
constexpr bool empty() const noexcept
Checks whether the container is empty.
Definition small_vector.hpp:553
friend constexpr void swap(small_vector &lhs, small_vector &rhs) noexcept(is_noexcept)
Swap contents with another instance.
Definition small_vector.hpp:955
constexpr reference front() noexcept
Return the first element. Calling front on an empty container is undefined.
Definition small_vector.hpp:480
constexpr void shrink_to_fit() const noexcept
Since the capacity is fixed on compile time, this is a no-op.
Definition small_vector.hpp:628
constexpr const_iterator cbegin() const noexcept
Returns the begin to the string.
Definition small_vector.hpp:369
constexpr iterator insert(const_iterator pos, size_type const count, value_type const value) noexcept(is_noexcept)
Inserts count copies of value before position in the container.
Definition small_vector.hpp:694
constexpr void resize(size_type const count) noexcept
Resizes the container to contain count elements.
Definition small_vector.hpp:891
constexpr size_type capacity() const noexcept
Returns the number of elements that the container is able to hold and resolves to capacity_.
Definition small_vector.hpp:610
constexpr small_vector() noexcept=default
Defaulted.
constexpr void assign(size_type const count, value_type const value) noexcept(is_noexcept)
Assign with count times value.
Definition small_vector.hpp:294
constexpr void swap(small_vector &&rhs) noexcept(is_noexcept)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition small_vector.hpp:934
constexpr const_reference operator[](size_type const i) const noexcept
Return the i-th element.
Definition small_vector.hpp:459
constexpr void push_back(value_type const value) noexcept
Appends the given element value to the end of the container.
Definition small_vector.hpp:847
constexpr void pop_back() noexcept
Removes the last element of the container.
Definition small_vector.hpp:870
constexpr void assign(std::initializer_list< value_type > ilist) noexcept(is_noexcept)
Assign from std::initializer_list.
Definition small_vector.hpp:275
constexpr small_vector & operator=(std::initializer_list< value_type > ilist) noexcept(is_noexcept)
Assign from std::initializer_list.
Definition small_vector.hpp:256
constexpr small_vector(size_type n, value_type value) noexcept(is_noexcept)
Construct with n times value.
Definition small_vector.hpp:238
friend constexpr void swap(small_vector &&lhs, small_vector &&rhs) noexcept(is_noexcept)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition small_vector.hpp:961
friend constexpr bool operator>(small_vector const &lhs, small_vector< value_type, cap2 > const &rhs) noexcept
Performs element-wise comparison.
Definition small_vector.hpp:1009
constexpr iterator erase(const_iterator pos) noexcept
Removes specified elements from the container.
Definition small_vector.hpp:827
constexpr small_vector(other_range_t &&range) noexcept(is_noexcept)
Construct from a different range.
Definition small_vector.hpp:220
constexpr iterator erase(const_iterator begin_it, const_iterator end_it) noexcept
Removes specified elements from the container.
Definition small_vector.hpp:792
constexpr iterator insert(const_iterator pos, value_type const value) noexcept(is_noexcept)
Inserts value before position in the container.
Definition small_vector.hpp:671
constexpr void resize(size_type const count, value_type const value) noexcept
Resizes the container to contain count elements.
Definition small_vector.hpp:901
value_type_ value_type
The value_type type.
Definition small_vector.hpp:57
constexpr const_iterator begin() const noexcept
Returns the begin to the string.
Definition small_vector.hpp:363
detail::min_viable_uint_t< capacity_ > size_type
The size_type type.
Definition small_vector.hpp:93
friend constexpr bool operator==(small_vector const &lhs, small_vector< value_type, cap2 > const &rhs) noexcept
Performs element-wise comparison.
Definition small_vector.hpp:974
constexpr size_type size() const noexcept
Returns the number of elements in the container, i.e. std::distance(begin(), end()).
Definition small_vector.hpp:571
constexpr const_iterator cend() const noexcept
Returns iterator past the end of the vector.
Definition small_vector.hpp:390
constexpr reference back() noexcept
Return the last element.
Definition small_vector.hpp:508
constexpr value_type const * data() const noexcept
Direct access to the underlying array.
Definition small_vector.hpp:531
constexpr void assign(other_range_t &&range) noexcept(is_noexcept)
Assign from a different range.
Definition small_vector.hpp:318
const_reference at(size_type const i) const
Return the i-th element.
Definition small_vector.hpp:426
constexpr iterator begin() noexcept
Returns the begin to the string.
Definition small_vector.hpp:357
constexpr small_vector(value_type const (&array)[capacity2]) noexcept(is_noexcept)
Construct from a (smaller or equally sized) built in array over the same value type.
Definition small_vector.hpp:149
constexpr void clear() noexcept
Removes all elements from the container.
Definition small_vector.hpp:649
ptrdiff_t difference_type
The difference_type type.
Definition small_vector.hpp:87
constexpr small_vector(begin_it_type begin_it, end_it_type end_it) noexcept(is_noexcept)
Construct from two iterators.
Definition small_vector.hpp:197
constexpr iterator end() noexcept
Returns iterator past the end of the vector.
Definition small_vector.hpp:378
constexpr value_type * data() noexcept
Direct access to the underlying array.
Definition small_vector.hpp:525
friend constexpr bool operator!=(small_vector const &lhs, small_vector< value_type, cap2 > const &rhs) noexcept
Performs element-wise comparison.
Definition small_vector.hpp:984
friend constexpr bool operator<(small_vector const &lhs, small_vector< value_type, cap2 > const &rhs) noexcept
Performs element-wise comparison.
Definition small_vector.hpp:994
friend constexpr bool operator<=(small_vector const &lhs, small_vector< value_type, cap2 > const &rhs) noexcept
Performs element-wise comparison.
Definition small_vector.hpp:1024
friend constexpr bool operator>=(small_vector const &lhs, small_vector< value_type, cap2 > const &rhs) noexcept
Performs element-wise comparison.
Definition small_vector.hpp:1034
constexpr iterator insert(const_iterator pos, begin_it_type begin_it, end_it_type end_it) noexcept(is_noexcept)
Inserts elements from range [begin_it, end_it) before position in the container.
Definition small_vector.hpp:725
constexpr const_reference front() const noexcept
Return the first element. Calling front on an empty container is undefined.
Definition small_vector.hpp:487
constexpr void assign(begin_it_type begin_it, end_it_type end_it) noexcept(is_noexcept)
Assign from pair of iterators.
Definition small_vector.hpp:343
reference at(size_type const i)
Return the i-th element.
Definition small_vector.hpp:416
constexpr void reserve(size_type) const noexcept
Since the capacity is fixed on compile time, this is a no-op.
Definition small_vector.hpp:619
constexpr const_reference back() const noexcept
Return the last element.
Definition small_vector.hpp:515
constexpr size_type max_size() const noexcept
Returns the maximum number of elements the container is able to hold and resolves to capacity_.
Definition small_vector.hpp:592
constexpr const_iterator end() const noexcept
Returns iterator past the end of the vector.
Definition small_vector.hpp:384
constexpr iterator insert(const_iterator pos, std::initializer_list< value_type > const &ilist) noexcept(is_noexcept)
Inserts elements from initializer list before position in the container.
Definition small_vector.hpp:767
constexpr auto repeat_n
A view factory that repeats a given value n times.
Definition repeat_n.hpp:88
Provides metaprogramming utilities for integer types.
The main SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
SeqAn specific customisations in the standard namespace.
Provides seqan3::views::repeat_n.
Provides type traits for working with templates.