Template Class Numeric
Defined in File strongly_typed_numeric.hpp
Class Documentation
-
template<typename T, typename PhantomType, typename = std::enable_if_t<std::is_arithmetic_v<T>>>
class Numeric Helper for creating strongly typed numeric types.
Usage: using YOUR_TYPE = Numeric< UNDERLYING_TYPE , struct UNDERLYING_TYPETag >;
Types resulting from this pattern will allow for implicit conversions in both ways (from underlying type, and to underlying type). This results in a more convenient usage, but not type safety strictly speaking.
std::numeric_limits
andstd::hash
will be specialized for this new type.- Template Parameters:
T – Underlying type, i.e. ‘double’.
PhantomType – empty type to use as phantom type.