SeqAn3 3.4.0-rc.1
The Modern C++ library for sequence analysis.
Loading...
Searching...
No Matches
seqan3::detail::view_take_exactly< urng_t, or_throw > Class Template Reference

The type returned by seqan3::views::take, seqan3::detail::take_exactly and seqan3::detail::take_exactly_or_throw. More...

#include <seqan3/io/views/detail/take_exactly_view.hpp>

+ Inheritance diagram for seqan3::detail::view_take_exactly< urng_t, or_throw >:

Classes

class  basic_iterator
 The forward declared iterator type. More...
 

Public Member Functions

constexpr auto size () const noexcept
 Returns the number of elements in the view.
 
Constructors, destructor and assignment
 view_take_exactly ()=default
 Defaulted.
 
 view_take_exactly (view_take_exactly const &rhs)=default
 Defaulted.
 
 view_take_exactly (view_take_exactly &&rhs)=default
 Defaulted.
 
view_take_exactlyoperator= (view_take_exactly const &rhs)=default
 Defaulted.
 
view_take_exactlyoperator= (view_take_exactly &&rhs)=default
 Defaulted.
 
 ~view_take_exactly ()=default
 Defaulted.
 
constexpr view_take_exactly (urng_t _urange, size_t const _size)
 Construct from another View.
 
template<std::ranges::viewable_range rng_t>
requires std::constructible_from<rng_t, std::views::all_t<rng_t>>
constexpr view_take_exactly (rng_t &&_urange, size_t const _size)
 Construct from another viewable_range.
 
Iterators
constexpr auto begin () noexcept
 Returns an iterator to the first element of the container.
 
constexpr auto begin () const noexcept
 Returns an iterator to the first element of the container.
 
constexpr auto end () noexcept
 Returns an iterator to the element following the last element of the range.
 
constexpr auto end () const noexcept
 Returns an iterator to the element following the last element of the range.
 

Private Types

Associated types
using iterator = basic_iterator< false >
 The iterator type of this view (a random access iterator).
 
using const_iterator = basic_iterator< true >
 Note that this declaration does not give any compiler errors for non-const iterable ranges. Although basic_iterator inherits from std::ranges::iterator_t which is not defined on a const-range, i.e. `urng_t const, if it is not const-iterable. We only just declare this type and never instantiate it, i.e. use this type within this class, if the underlying range is not const-iterable.
 

Private Attributes

size_t target_size
 The desired target_size.
 
urng_t urange
 The underlying range.
 

Related Symbols

(Note that these are not member symbols.)

template<typename urng_t , bool or_throw = false>
 view_take_exactly (urng_t &&, size_t) -> view_take_exactly< std::views::all_t< urng_t >, or_throw >
 Template argument type deduction guide that strips references.
 

Detailed Description

template<std::ranges::view urng_t, bool or_throw>
class seqan3::detail::view_take_exactly< urng_t, or_throw >

The type returned by seqan3::views::take, seqan3::detail::take_exactly and seqan3::detail::take_exactly_or_throw.

Template Parameters
urng_tThe type of the underlying ranges, must satisfy seqan3::views::concept.
or_throwWhether to throw an exception when the input is exhausted before the end of line is reached.

Note that most members of this class are generated by std::ranges::view_interface which is not yet documented here.

Constructor & Destructor Documentation

◆ view_take_exactly() [1/2]

template<std::ranges::view urng_t, bool or_throw>
constexpr seqan3::detail::view_take_exactly< urng_t, or_throw >::view_take_exactly ( urng_t  _urange,
size_t const  _size 
)
inlineconstexpr

Construct from another View.

Parameters
[in]_urangeThe underlying range.
[in]_sizeThe desired size (after which to stop returning elements).
Exceptions
unexpected_end_of_inputIf or_throw && seqan3::sized_range<urng_t>.

◆ view_take_exactly() [2/2]

template<std::ranges::view urng_t, bool or_throw>
template<std::ranges::viewable_range rng_t>
requires std::constructible_from<rng_t, std::views::all_t<rng_t>>
constexpr seqan3::detail::view_take_exactly< urng_t, or_throw >::view_take_exactly ( rng_t &&  _urange,
size_t const  _size 
)
inlineconstexpr

Construct from another viewable_range.

Template Parameters
rng_tType of the passed range; urng_t must be constructible from this.
Parameters
[in]_urangeThe underlying range.
[in]_sizeThe desired size (after which to stop returning elements).
Exceptions
unexpected_end_of_inputIf or_throw && seqan3::sized_range<urng_t>.

Member Function Documentation

◆ begin() [1/2]

template<std::ranges::view urng_t, bool or_throw>
constexpr auto seqan3::detail::view_take_exactly< urng_t, or_throw >::begin ( ) const
inlineconstexprnoexcept

Returns an iterator to the first element of the container.

Returns
Iterator to the first element.

If the container is empty, the returned iterator will be equal to end().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ begin() [2/2]

template<std::ranges::view urng_t, bool or_throw>
constexpr auto seqan3::detail::view_take_exactly< urng_t, or_throw >::begin ( )
inlineconstexprnoexcept

Returns an iterator to the first element of the container.

Returns
Iterator to the first element.

If the container is empty, the returned iterator will be equal to end().

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ end() [1/2]

template<std::ranges::view urng_t, bool or_throw>
constexpr auto seqan3::detail::view_take_exactly< urng_t, or_throw >::end ( ) const
inlineconstexprnoexcept

Returns an iterator to the element following the last element of the range.

Returns
Iterator to the end.

This element acts as a placeholder; attempting to dereference it results in undefined behaviour.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ end() [2/2]

template<std::ranges::view urng_t, bool or_throw>
constexpr auto seqan3::detail::view_take_exactly< urng_t, or_throw >::end ( )
inlineconstexprnoexcept

Returns an iterator to the element following the last element of the range.

Returns
Iterator to the end.

This element acts as a placeholder; attempting to dereference it results in undefined behaviour.

Complexity

Constant.

Exceptions

No-throw guarantee.

◆ size()

template<std::ranges::view urng_t, bool or_throw>
constexpr auto seqan3::detail::view_take_exactly< urng_t, or_throw >::size ( ) const
inlineconstexprnoexcept

Returns the number of elements in the view.

Returns
The number of elements in the view.

Complexity

Constant.

Exceptions

No-throw guarantee.


The documentation for this class was generated from the following file:
Hide me