PlayRho  2.0.0
An interactive physics engine & library.
Checked.hpp File Reference

Declarations of the Checked class template and closely related code. More...

#include <iostream>
#include <type_traits>
#include <utility>
#include <playrho/InvalidArgument.hpp>
#include <playrho/Templates.hpp>
Include dependency graph for Checked.hpp:
This graph shows which files directly or indirectly include this file:

Classes

class  playrho::detail::Checked< ValueType, Checker, NoExcept >
 Class template for construction-time constraining a type's value. More...
 
struct  playrho::detail::Checked< ValueType, Checker, NoExcept >::IsChecked< U >
 Failing is-checked class template trait. More...
 
struct  playrho::detail::Checked< ValueType, Checker, NoExcept >::IsChecked< Checked< V, C, N > >
 Succeeding is-checked class template trait. More...
 
struct  playrho::detail::NoOpChecker< T >
 No-op value checker. More...
 

Namespaces

 playrho
 
 playrho::detail
 

Typedefs

template<class T >
using playrho::detail::DefaultCheckedValue = Checked< T >
 Default checked value type. More...
 

Functions

template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator!= (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) noexcept(noexcept(std::declval< LhsValueType >() !=std::declval< RhsValueType >())) -> decltype(LhsValueType(lhs) !=RhsValueType(rhs))
 Constrained value inequality operator for value types which support it. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator!= (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs) !=rhs)
 Constrained value inequality operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator!= (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(lhs !=ValueType(rhs))
 Constrained value inequality operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator* (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs) *RhsValueType(rhs))
 Constrained value multiplication operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator* (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> std::enable_if_t<!IsMultipliableV< Checked< ValueType, Checker, NoExcept >, Other >, decltype(ValueType() *Other())>
 Constrained value multiplication operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator* (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> std::enable_if_t<!IsMultipliableV< Other, Checked< ValueType, Checker, NoExcept >>, decltype(Other() *ValueType())>
 Constrained value multiplication operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator+ (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs)+RhsValueType(rhs))
 Constrained value addition operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator+ (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs)+rhs)
 Constrained value addition operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator+ (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(lhs+ValueType(rhs))
 Constrained value addition operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator- (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs) - RhsValueType(rhs))
 Constrained value subtraction operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator- (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs) - rhs)
 Constrained value subtraction operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator- (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(lhs - ValueType(rhs))
 Constrained value subtraction operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator/ (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs)/RhsValueType(rhs))
 Constrained value division operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator/ (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs)/rhs)
 Constrained value division operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator/ (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(lhs/ValueType(rhs))
 Constrained value division operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator< (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs)< RhsValueType(rhs))
 Constrained value less-than operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator< (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs)< ValueType(rhs))
 Constrained value less-than operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator< (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(ValueType(lhs)< ValueType(rhs))
 Constrained value less-than operator. More...
 
template<class ValueType , class Checker , bool NoExcept>
auto playrho::detail::operator<< (::std::ostream &os, const Checked< ValueType, Checker, NoExcept > &value) -> decltype(os<< ValueType(value))
 Constrained value stream output operator for value types which support it. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator<= (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs)<=RhsValueType(rhs))
 Constrained value less-than or equal-to operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator<= (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs)<=ValueType(rhs))
 Constrained value less-than or equal-to operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator<= (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(ValueType(lhs)<=ValueType(rhs))
 Constrained value less-than or equal-to operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator== (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) noexcept(noexcept(std::declval< LhsValueType >()==std::declval< RhsValueType >())) -> decltype(LhsValueType(lhs)==RhsValueType(rhs))
 Constrained value equality operator for value types which support it. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator== (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs)==rhs)
 Constrained value equality operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator== (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(lhs==ValueType(rhs))
 Constrained value equality operator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator> (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs) > RhsValueType(rhs))
 Constrained value greater-than operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator> (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs) > ValueType(rhs))
 Constrained value greater-than operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator> (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(ValueType(lhs) > ValueType(rhs))
 Constrained value greater-than ooperator. More...
 
template<class LhsValueType , class LhsChecker , bool LhsNoExcept, class RhsValueType , class RhsChecker , bool RhsNoExcept>
constexpr auto playrho::detail::operator>= (const Checked< LhsValueType, LhsChecker, LhsNoExcept > &lhs, const Checked< RhsValueType, RhsChecker, RhsNoExcept > &rhs) -> decltype(LhsValueType(lhs) >=RhsValueType(rhs))
 Constrained value greater-than or equal-to operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator>= (const Checked< ValueType, Checker, NoExcept > &lhs, const Other &rhs) -> decltype(ValueType(lhs) >=ValueType(rhs))
 Constrained value greater-than or equal-to operator. More...
 
template<class ValueType , class Checker , bool NoExcept, class Other >
constexpr auto playrho::detail::operator>= (const Other &lhs, const Checked< ValueType, Checker, NoExcept > &rhs) -> decltype(ValueType(lhs) >=ValueType(rhs))
 Constrained value greater-than or equal-to operator. More...
 

Detailed Description

Declarations of the Checked class template and closely related code.