// Copyright (c) 2001-2011 Hartmut Kaiser // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #if !defined(BOOST_SPIRIT_NUMERIC_TRAITS_JAN_07_2011_0722AM) #define BOOST_SPIRIT_NUMERIC_TRAITS_JAN_07_2011_0722AM #if defined(_MSC_VER) #pragma once #endif #include #include #include #include namespace boost { namespace spirit { namespace traits { /////////////////////////////////////////////////////////////////////////// // Determine if T is a boolean type /////////////////////////////////////////////////////////////////////////// template struct is_bool : mpl::false_ {}; template struct is_bool : is_bool {}; template <> struct is_bool : mpl::true_ {}; /////////////////////////////////////////////////////////////////////////// // Determine if T is a signed integer type /////////////////////////////////////////////////////////////////////////// template struct is_int : mpl::false_ {}; template struct is_int : is_int {}; template <> struct is_int : mpl::true_ {}; template <> struct is_int : mpl::true_ {}; template <> struct is_int : mpl::true_ {}; #ifdef BOOST_HAS_LONG_LONG template <> struct is_int : mpl::true_ {}; #endif /////////////////////////////////////////////////////////////////////////// // Determine if T is an unsigned integer type /////////////////////////////////////////////////////////////////////////// template struct is_uint : mpl::false_ {}; template struct is_uint : is_uint {}; #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) template <> struct is_uint : mpl::true_ {}; #endif template <> struct is_uint : mpl::true_ {}; template <> struct is_uint : mpl::true_ {}; #ifdef BOOST_HAS_LONG_LONG template <> struct is_uint : mpl::true_ {}; #endif /////////////////////////////////////////////////////////////////////////// // Determine if T is a floating point type /////////////////////////////////////////////////////////////////////////// template struct is_real : mpl::false_ {}; template struct is_real : is_uint {}; template <> struct is_real : mpl::true_ {}; template <> struct is_real : mpl::true_ {}; template <> struct is_real : mpl::true_ {}; /////////////////////////////////////////////////////////////////////////// // customization points for numeric operations /////////////////////////////////////////////////////////////////////////// template struct absolute_value; template struct is_negative; template struct is_zero; template struct pow10_helper; template struct is_nan; template struct is_infinite; template struct check_overflow : mpl::false_ {}; template struct check_overflow::is_integral>::type> : mpl::true_ {}; }}} #endif