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

Unit-interval constrained value checker. More...

#include <playrho/detail/UnitIntervalChecker.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::UnitIntervalChecker< T >

Unit-interval constrained value checker.

Provides functors ensuring values are: greater-than or equal-to zero, and less-than or equal-to one. By definition, this is called the "closed 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::UnitIntervalChecker< 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::UnitIntervalChecker< 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 1 inclusively, else a non-null pointer to the C-style nul-terminated string indicating whether the value is less than zero or greater than 1.

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