diff --git a/include/crap/algorithm.d/minvalue.h b/include/crap/algorithm.d/minvalue.h index 958b310..1c595c5 100644 --- a/include/crap/algorithm.d/minvalue.h +++ b/include/crap/algorithm.d/minvalue.h @@ -1,7 +1,10 @@ #ifndef CRAP_ALGORITHM_MINVALUE #define CRAP_ALGORITHM_MINVALUE +#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 minValue - { - 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 minValue - { - 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 minValue @@ -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 :: minValue :: operator - typename crap :: minValue :: value_type () const noexcept -{ - return crap :: minValue :: value; -} - -template class Operator, Type Value1, Type Value2> - inline constexpr crap :: minValue :: operator - typename crap :: minValue :: value_type () const noexcept +template class Operator, Type ... Values> + inline constexpr crap :: minValue :: operator + typename crap :: minValue :: value_type () const noexcept { - return crap :: minValue :: value; + return crap :: minValue :: value; } +#if (crap_lib_integral_constant_callable >= 201304L) template class Operator, Type ... Values> - inline constexpr crap :: minValue :: operator - typename crap :: minValue :: value_type () const noexcept + inline constexpr typename crap :: minValue :: value_type + crap :: minValue :: operator () () const noexcept { return crap :: minValue :: value; } #endif +#endif