Simple-Vector v1.3.0
sl::vec::gen::range< TRange > Class Template Reference

Generator which retrieves its values out of the given source iterator. More...

#include <Generators.hpp>

Public Types

using range_type = std::conditional_t< std::ranges::borrowed_range< TRange >, TRange, std::remove_cvref_t< TRange > >
 
using iterator_type = std::ranges::iterator_t< range_type >
 
using value_type = std::ranges::range_value_t< TRange >
 

Public Member Functions

constexpr range (TRange &&range)
 Constructs the generator with a given range. More...
 
constexpr value_type operator() ()
 post-increments the stored iterator and returns a copy of the previously pointed element. More...
 

Detailed Description

template<std::ranges::forward_range TRange>
class sl::vec::gen::range< TRange >

Generator which retrieves its values out of the given source iterator.

Template Parameters
TRangetype of source range

If the given range is a borrowed range then the generator will use that type as range_type, otherwise the whole source range will be stored internally.

Attention
Requesting values from beyond the last element of the source range is undefined.

Member Typedef Documentation

◆ iterator_type

template<std::ranges::forward_range TRange>
using sl::vec::gen::range< TRange >::iterator_type = std::ranges::iterator_t<range_type>

◆ range_type

template<std::ranges::forward_range TRange>
using sl::vec::gen::range< TRange >::range_type = std::conditional_t < std::ranges::borrowed_range<TRange>, TRange, std::remove_cvref_t<TRange> >

◆ value_type

template<std::ranges::forward_range TRange>
using sl::vec::gen::range< TRange >::value_type = std::ranges::range_value_t<TRange>

Constructor & Destructor Documentation

◆ range()

template<std::ranges::forward_range TRange>
constexpr sl::vec::gen::range< TRange >::range ( TRange &&  range)
inlineexplicitconstexpr

Constructs the generator with a given range.

Parameters
rangeThe source range to be used

Member Function Documentation

◆ operator()()

template<std::ranges::forward_range TRange>
constexpr value_type sl::vec::gen::range< TRange >::operator() ( )
inlineconstexpr

post-increments the stored iterator and returns a copy of the previously pointed element.

Returns
copy of value

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