PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::UnitIntervalChecker< T > Struct Template Reference

Unit-interval constrained value checker. More...

#include <UnitInterval.hpp>

Public Types

using exception_type = std::invalid_argument
 Exception type possibly thrown by this checker.
 

Public Member Functions

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

Detailed Description

template<typename T>
struct playrho::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.

Note
This is meant to be used as a checker with types like CheckedValue.
See also
CheckedValue.

Member Function Documentation

◆ operator()() [1/2]

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

Valid value supplying functor.

Returns
Zero casted to the checked type.

◆ operator()() [2/2]

template<typename T >
constexpr auto playrho::UnitIntervalChecker< T >::operator() ( const T &  v) -> decltype((v >= static_cast<T>(0) && v <= static_cast<T>(1)), T(v))
inlineconstexpr

Value checking functor.

Exceptions
exception_typeif given value is not valid.
Returns
Value given if greater-than or equal-to zero and less-than or equal-to one.

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