PlayRho  2.0.0
An interactive physics engine & library.
playrho::detail::ZeroToUnderOneChecker< T > Struct Template Reference

Right open unit-interval constrained value checker. More...

#include <playrho/detail/ZeroToUnderOneChecker.hpp>

Public Member Functions

constexpr auto operator() () const noexcept -> decltype(static_cast< T >(0))
 Default value supplying functor. More...
 
constexpr auto operator() (const T &v) const noexcept -> decltype((v >=static_cast< T >(0)) &&(v< static_cast< T >(1)), static_cast< const char * >(nullptr))
 Value checking functor. More...
 

Detailed Description

template<typename T>
struct playrho::detail::ZeroToUnderOneChecker< T >

Right open unit-interval constrained value checker.

Provides functors ensuring values are: greater-than or equal-to zero, and less-than one. By definition, this is called the right open unit interval [0, 1).

Note
This is meant to be used as a checker with types like Checked.
Template Parameters
TUnderlying type for this checker.
See also
Checked.
https://en.wikipedia.org/wiki/Unit_interval.

Member Function Documentation

◆ operator()() [1/2]

template<typename T >
constexpr auto playrho::detail::ZeroToUnderOneChecker< T >::operator() ( ) const -> decltype(static_cast<T>(0))
inlineconstexprnoexcept

Default value supplying functor.

Returns
Zero casted to the checked type.

◆ operator()() [2/2]

template<typename T >
constexpr auto playrho::detail::ZeroToUnderOneChecker< T >::operator() ( const T &  v) const -> decltype((v >= static_cast<T>(0)) && (v < static_cast<T>(1)), static_cast<const char*>(nullptr))
inlineconstexprnoexcept

Value checking functor.

Returns
nullptr if the given value is within 0 and under 1, else a non-null pointer to the C-style nul-terminated string indicating whether the value is less than zero or not less than 1.

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