diff --git a/include/crap/algorithm.d/maxvalue.h b/include/crap/algorithm.d/maxvalue.h index 4b504c0..ad88ce1 100644 --- a/include/crap/algorithm.d/maxvalue.h +++ b/include/crap/algorithm.d/maxvalue.h @@ -1,7 +1,10 @@ #ifndef CRAP_ALGORITHM_MAXVALUE #define CRAP_ALGORITHM_MAXVALUE +#include + #include "../numeric.d/reducevalue.h" +#include "../version.d/libintegralconstantcallable.h" namespace crap { @@ -9,19 +12,11 @@ namespace crap template class Operator, Type Value> struct maxValue - { - constexpr const static Type value = Value; - using value_type = decltype(value); - constexpr operator value_type () const noexcept; - }; + : std :: integral_constant {}; template class Operator, Type Value1, Type Value2> struct maxValue - { - constexpr const static Type value = ((Operator :: value) ? Value1 : Value2); - using value_type = decltype(value); - constexpr operator value_type () const noexcept; - }; + : std :: integral_constant :: value) ? Value1 : Value2)> {}; template class Operator, Type ... Values> struct maxValue @@ -33,27 +28,25 @@ namespace crap constexpr const static Type value = reduceValue :: value; using value_type = decltype(value); constexpr operator value_type () const noexcept; +#if (crap_lib_integral_constant_callable >= 201304L) + constexpr value_type operator () () const noexcept; +#endif }; } -template class Operator, Type Value1> - inline constexpr crap :: maxValue :: operator - typename crap :: maxValue :: value_type () const noexcept -{ - return crap :: maxValue :: value; -} - -template class Operator, Type Value1, Type Value2> - inline constexpr crap :: maxValue :: operator - typename crap :: maxValue :: value_type () const noexcept +template class Operator, Type ... Values> + inline constexpr crap :: maxValue :: operator + typename crap :: maxValue :: value_type () const noexcept { - return crap :: maxValue :: value; + return crap :: maxValue :: value; } +#if (crap_lib_integral_constant_callable >= 201304L) template class Operator, Type ... Values> - inline constexpr crap :: maxValue :: operator - typename crap :: maxValue :: value_type () const noexcept + inline constexpr typename crap :: maxValue :: value_type + crap :: maxValue :: operator () () const noexcept { return crap :: maxValue :: value; } #endif +#endif