Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
beluga::views::detail::sample_view< Range, Distribution, URNG > Struct Template Reference

Implementation of the sample view. More...

#include <sample.hpp>

Inheritance diagram for beluga::views::detail::sample_view< Range, Distribution, URNG >:
Inheritance graph
[legend]

Classes

struct  cursor
 Cursor class that handles the iteration logic. More...
 

Public Member Functions

 sample_view ()=default
 Default constructor. More...
 
constexpr sample_view (Range range, Distribution distribution, URNG &engine=ranges::detail::get_random_engine())
 Construct the view from an existing range. More...
 

Private Member Functions

constexpr auto begin_cursor ()
 Return the cursor for the begin iterator. More...
 
constexpr auto compute_offset ()
 Return a new offset value to advance the current iterator. More...
 
constexpr auto end_cursor () const noexcept
 Return an unreachable sentinel since this is an infinite range. More...
 

Private Attributes

Distribution distribution_
 
URNG * engine_
 
Range range_
 

Detailed Description

template<class Range, class Distribution, class URNG = typename ranges::detail::default_random_engine>
struct beluga::views::detail::sample_view< Range, Distribution, URNG >

Implementation of the sample view.

Template Parameters
RangeA random access and sized range.
DistributionA random number distribution that satisfies the RandomNumberDistribution.
URNGA random number generator that satisfies the UniformRandomBitGenerator requirements.

Definition at line 47 of file sample.hpp.

Constructor & Destructor Documentation

◆ sample_view() [1/2]

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
beluga::views::detail::sample_view< Range, Distribution, URNG >::sample_view ( )
default

Default constructor.

◆ sample_view() [2/2]

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
constexpr beluga::views::detail::sample_view< Range, Distribution, URNG >::sample_view ( Range  range,
Distribution  distribution,
URNG &  engine = ranges::detail::get_random_engine() 
)
inlineconstexpr

Construct the view from an existing range.

Parameters
rangeThe range to be adapted.
distributionThe random number distribution to use to sample elements.
engineThe random number generator object.

Definition at line 58 of file sample.hpp.

Member Function Documentation

◆ begin_cursor()

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
constexpr auto beluga::views::detail::sample_view< Range, Distribution, URNG >::begin_cursor ( )
inlineconstexprprivate

Return the cursor for the begin iterator.

Definition at line 96 of file sample.hpp.

◆ compute_offset()

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
constexpr auto beluga::views::detail::sample_view< Range, Distribution, URNG >::compute_offset ( )
inlineconstexprprivate

Return a new offset value to advance the current iterator.

Definition at line 102 of file sample.hpp.

◆ end_cursor()

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
constexpr auto beluga::views::detail::sample_view< Range, Distribution, URNG >::end_cursor ( ) const
inlineconstexprprivatenoexcept

Return an unreachable sentinel since this is an infinite range.

Definition at line 99 of file sample.hpp.

Member Data Documentation

◆ distribution_

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
Distribution beluga::views::detail::sample_view< Range, Distribution, URNG >::distribution_
private

Definition at line 105 of file sample.hpp.

◆ engine_

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
URNG* beluga::views::detail::sample_view< Range, Distribution, URNG >::engine_
private

Definition at line 106 of file sample.hpp.

◆ range_

template<class Range , class Distribution , class URNG = typename ranges::detail::default_random_engine>
Range beluga::views::detail::sample_view< Range, Distribution, URNG >::range_
private

Definition at line 104 of file sample.hpp.


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


beluga
Author(s):
autogenerated on Tue Jul 16 2024 02:59:54