34 constexpr auto operator()(ptrdiff_t begin_pos, ptrdiff_t end_pos)
const noexcept
42 template <std::ranges::viewable_range urng_t>
44 std::ranges::range_difference_t<urng_t> begin_pos,
45 std::ranges::range_difference_t<urng_t> end_pos)
const
47 using position_t = std::ranges::range_difference_t<urng_t>;
48 if constexpr (std::ranges::sized_range<urng_t>)
50 position_t urange_size =
static_cast<position_t
>(std::ranges::size(urange));
52 begin_pos =
std::min(begin_pos, urange_size);
53 end_pos =
std::min(end_pos, urange_size);
55 position_t target_size = end_pos - begin_pos;
57 if (end_pos < begin_pos)
58 throw std::invalid_argument{
"end_pos argument to seqan3::views::slice must be >= the begin_pos argument."};
Provides seqan3::detail::adaptor_from_functor.
Template for range adaptor closure objects that store arguments and wrap a proto-adaptor.
Definition adaptor_from_functor.hpp:54
constexpr auto slice
A view adaptor that returns a half-open interval on the underlying range.
Definition slice.hpp:137
constexpr auto type_reduce
A view adaptor that behaves like std::views::all, but type erases certain ranges.
Definition type_reduce.hpp:147
Provides exceptions used in the I/O module.
The internal SeqAn3 namespace.
Definition aligned_sequence_concept.hpp:26
The SeqAn namespace for views.
Definition char_strictly_to.hpp:19
View adaptor definition for views::slice.
Definition slice.hpp:32
constexpr auto operator()(ptrdiff_t begin_pos, ptrdiff_t end_pos) const noexcept
Store the arguments and return a range adaptor closure object.
Definition slice.hpp:34
constexpr auto operator()(urng_t &&urange, std::ranges::range_difference_t< urng_t > begin_pos, std::ranges::range_difference_t< urng_t > end_pos) const
Call the view's constructor with the underlying view as argument.
Definition slice.hpp:43
Provides seqan3::views::type_reduce.