/*-----------------------------------------------------------------------------+ Copyright (c) 2010-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENCE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +-----------------------------------------------------------------------------*/ #ifndef BOOST_ICL_TYPE_TRAITS_IS_NUMERIC_HPP_JOFA_100322 #define BOOST_ICL_TYPE_TRAITS_IS_NUMERIC_HPP_JOFA_100322 #include #include #include #include #include namespace boost{ namespace icl { template struct is_fixed_numeric { typedef is_fixed_numeric type; BOOST_STATIC_CONSTANT(bool, value = (0 < std::numeric_limits::digits)); }; template struct is_std_numeric { typedef is_std_numeric type; BOOST_STATIC_CONSTANT(bool, value = (std::numeric_limits::is_specialized)); }; template struct is_std_integral { typedef is_std_integral type; BOOST_STATIC_CONSTANT(bool, value = (std::numeric_limits::is_integer)); }; template struct is_numeric { typedef is_numeric type; BOOST_STATIC_CONSTANT(bool, value = (mpl::or_< is_std_numeric , boost::is_integral , is_std_integral >::value) ); }; template struct is_numeric > { typedef is_numeric type; BOOST_STATIC_CONSTANT(bool, value = true); }; //-------------------------------------------------------------------------- template struct numeric_minimum { static bool is_less_than(Type){ return true; } static bool is_less_than_or(Type, bool){ return true; } }; template struct numeric_minimum, true> { static bool is_less_than(Type value) { return std::less()((std::numeric_limits::min)(), value); } static bool is_less_than_or(Type value, bool cond) { return cond || is_less_than(value); } }; template struct numeric_minimum, true> { static bool is_less_than(Type value) { return std::greater()((std::numeric_limits::max)(), value); } static bool is_less_than_or(Type value, bool cond) { return cond || is_less_than(value); } }; //-------------------------------------------------------------------------- template struct is_non_floating_point { typedef is_non_floating_point type; BOOST_STATIC_CONSTANT(bool, value = (mpl::not_< is_floating_point >::value)); }; }} // namespace boost icl #endif