Checked value. More...
#include <CheckedValue.hpp>
Public Types | |
using | value_type = ValueType |
Value type. | |
using | remove_pointer_type = typename std::remove_pointer< ValueType >::type |
Remove pointer type. | |
using | checker_type = CheckerType |
Checker type. | |
Public Member Functions | |
template<bool B = HasNullaryFunctor<CheckerType,ValueType>::value, typename std::enable_if_t< B, int > = 0> | |
constexpr | CheckedValue () noexcept(noexcept(CheckerType{}())) |
Default constructor available for checker types with acceptable nullary functors. | |
constexpr | CheckedValue (value_type value) noexcept(noexcept(checker_type{}(value))) |
Initializing constructor. More... | |
constexpr value_type | get () const noexcept |
Gets the underlying value. | |
constexpr | operator value_type () const noexcept |
Gets the underlying value. More... | |
template<typename U = ValueType> | |
constexpr std::enable_if_t< std::is_pointer< U >::value, U > | operator-> () const |
Member of pointer operator available for pointer ValueType . | |
template<typename U = ValueType> | |
constexpr std::enable_if_t< std::is_pointer< U >::value, remove_pointer_type > & | operator* () const |
Indirection operator available for pointer ValueType . | |
Private Attributes | |
value_type | m_value |
Underlying value. | |
Related Functions | |
(Note that these are not member functions.) | |
template<typename ValueType , typename CheckerType > | |
auto | operator<< (::std::ostream &os, const CheckedValue< ValueType, CheckerType > &value) -> decltype(os<< ValueType(value)) |
Constrained value stream output operator for value types which support it. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator== (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &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<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator!= (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &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<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator<= (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs)<=RhsValueType(rhs)) |
Constrained value less-than or equal-to operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator>= (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs) >=RhsValueType(rhs)) |
Constrained value greater-than or equal-to operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator< (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs)< RhsValueType(rhs)) |
Constrained value less-than operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator> (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs) > RhsValueType(rhs)) |
Constrained value greater-than operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator* (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs) *RhsValueType(rhs)) |
Constrained value multiplication operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator/ (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs)/RhsValueType(rhs)) |
Constrained value division operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator+ (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs)+RhsValueType(rhs)) |
Constrained value addition operator. More... | |
template<typename LhsValueType , typename LhsCheckerType , typename RhsValueType , typename RhsCheckerType > | |
constexpr auto | operator- (const CheckedValue< LhsValueType, LhsCheckerType > &lhs, const CheckedValue< RhsValueType, RhsCheckerType > &rhs) -> decltype(LhsValueType(lhs) - RhsValueType(rhs)) |
Constrained value subtraction operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator== (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs)==rhs) |
Constrained value equality operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator== (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs==ValueType(rhs)) |
Constrained value equality operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator!= (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs) !=rhs) |
Constrained value inequality operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator!= (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs !=ValueType(rhs)) |
Constrained value inequality operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator<= (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs)<=rhs) |
Constrained value less-than or equal-to operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator<= (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs<=ValueType(rhs)) |
Constrained value less-than or equal-to operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator>= (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs) >=rhs) |
Constrained value greater-than or equal-to operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator>= (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs >=ValueType(rhs)) |
Constrained value greater-than or equal-to operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator< (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs)< rhs) |
Constrained value less-than operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator< (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs< ValueType(rhs)) |
Constrained value less-than operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator> (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs) > rhs) |
Constrained value greater-than operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator> (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs > ValueType(rhs)) |
Constrained value greater-than ooperator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator* (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> std::enable_if_t<!IsMultipliable< CheckedValue< ValueType, CheckerType >, Other >::value, decltype(ValueType() *Other())> |
Constrained value multiplication operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator* (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> std::enable_if_t<!IsMultipliable< Other, CheckedValue< ValueType, CheckerType >>::value, decltype(Other() *ValueType())> |
Constrained value multiplication operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator/ (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs)/rhs) |
Constrained value division operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator/ (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs/ValueType(rhs)) |
Constrained value division operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator+ (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs)+rhs) |
Constrained value addition operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator+ (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs+ValueType(rhs)) |
Constrained value addition operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator- (const CheckedValue< ValueType, CheckerType > &lhs, const Other &rhs) -> decltype(ValueType(lhs) - rhs) |
Constrained value subtraction operator. More... | |
template<typename ValueType , typename CheckerType , typename Other > | |
constexpr auto | operator- (const Other &lhs, const CheckedValue< ValueType, CheckerType > &rhs) -> decltype(lhs - ValueType(rhs)) |
Constrained value subtraction operator. More... | |
Checked value.
ValueType | Type of the underlying value that will get checked. |
CheckerType | Checker type to check or possibly transform values with. |
|
inlineconstexprnoexcept |
Initializing constructor.
|
inlineconstexprnoexcept |
Gets the underlying value.
|
related |
Constrained value inequality operator for value types which support it.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value inequality operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value inequality operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value multiplication operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value multiplication operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value multiplication operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value addition operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value addition operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value addition operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value subtraction operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value subtraction operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value subtraction operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value division operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value division operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value division operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value less-than operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value less-than operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value less-than operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value stream output operator for value types which support it.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
|
related |
Constrained value less-than or equal-to operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value less-than or equal-to operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value less-than or equal-to operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value equality operator for value types which support it.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value equality operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value equality operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value greater-than operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value greater-than operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value greater-than ooperator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value greater-than or equal-to operator.
LhsValueType | Type of the value used by the left hand side checked value. |
LhsCheckerType | Type of the checker used by the left hand side checked value. |
RhsValueType | Type of the value used by the right hand side checked value. |
RhsCheckerType | Type of the checker used by the right hand side checked value. |
|
related |
Constrained value greater-than or equal-to operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |
|
related |
Constrained value greater-than or equal-to operator.
ValueType | Type of the value used by the checked value. |
CheckerType | Type of the checker used by the checked value. |
Other | Type of the other value that this operation will operator with. |