Arene Base
Fundamental Utilities For Safety Critical C++
Loading...
Searching...
No Matches
arene::base::testing::nan_rejecting_distribution< Distribution > Class Template Reference

A distribution adaptor that discards NaN values drawn from the wrapped distribution and redraws. More...

Public Types

using result_type = typename Distribution::result_type
 The value type produced by this adaptor.
 

Public Member Functions

template<class T = Distribution, constraints< std::enable_if_t< std::is_default_constructible< T >::value > > = nullptr>
constexpr nan_rejecting_distribution () noexcept
 Default construct adapted distribution.
 
constexpr nan_rejecting_distribution (Distribution dist) noexcept
 Construct the adaptor wrapping the given distribution.
 
template<class PRNG, class T = result_type, constraints< std::enable_if_t< std::is_floating_point< T >::value > > = nullptr>
constexpr auto operator() (PRNG &prng) const noexcept(noexcept(std::declval< Distribution const & >()(prng))) -> result_type
 Draw a non-NaN value from the wrapped distribution; SFINAE overload for floating-point types.
 
template<class PRNG, class T = result_type, constraints< std::enable_if_t<!std::is_floating_point< T >::value > > = nullptr>
constexpr auto operator() (PRNG &prng) const noexcept(noexcept(std::declval< Distribution const & >()(prng))) -> result_type
 Draw a non-NaN value from the wrapped distribution; SFINAE overload for non-floating-point types.
 

Detailed Description

template<class Distribution>
class arene::base::testing::nan_rejecting_distribution< Distribution >

A distribution adaptor that discards NaN values drawn from the wrapped distribution and redraws.

Template Parameters
DistributionA distribution return floating point values

Member Typedef Documentation

◆ result_type

template<class Distribution>
using arene::base::testing::nan_rejecting_distribution< Distribution >::result_type = typename Distribution::result_type

The value type produced by this adaptor.

Constructor & Destructor Documentation

◆ nan_rejecting_distribution() [1/2]

template<class Distribution>
template<class T = Distribution, constraints< std::enable_if_t< std::is_default_constructible< T >::value > > = nullptr>
arene::base::testing::nan_rejecting_distribution< Distribution >::nan_rejecting_distribution ( )
inlineconstexprnoexcept

Default construct adapted distribution.

◆ nan_rejecting_distribution() [2/2]

template<class Distribution>
arene::base::testing::nan_rejecting_distribution< Distribution >::nan_rejecting_distribution ( Distribution dist)
inlineexplicitconstexprnoexcept

Construct the adaptor wrapping the given distribution.

Parameters
distThe distribution to adapt

Member Function Documentation

◆ operator()() [1/2]

template<class Distribution>
template<class PRNG, class T = result_type, constraints< std::enable_if_t< std::is_floating_point< T >::value > > = nullptr>
auto arene::base::testing::nan_rejecting_distribution< Distribution >::operator() ( PRNG & prng) const -> result_type
inlineconstexprnoexcept

Draw a non-NaN value from the wrapped distribution; SFINAE overload for floating-point types.

Template Parameters
PRNGA bit generator (PRNG) type satisfying UniformRandomBitGenerator
Parameters
prngA bit generator (PRNG) instance
Returns
A value drawn from the wrapped distribution with NaN results discarded and redrawn

◆ operator()() [2/2]

template<class Distribution>
template<class PRNG, class T = result_type, constraints< std::enable_if_t<!std::is_floating_point< T >::value > > = nullptr>
auto arene::base::testing::nan_rejecting_distribution< Distribution >::operator() ( PRNG & prng) const -> result_type
inlineconstexprnoexcept

Draw a non-NaN value from the wrapped distribution; SFINAE overload for non-floating-point types.

Template Parameters
PRNGA bit generator (PRNG) type satisfying UniformRandomBitGenerator
Parameters
prngA bit generator (PRNG) instance
Returns
Any value drawn from the wrapped distribution; it's assumed that NaNs can not actually be generated

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