File indexing completed on 2025-01-18 09:41:38
0001
0002 #ifndef BOOST_MPL_AUX_LARGEST_INT_HPP_INCLUDED
0003 #define BOOST_MPL_AUX_LARGEST_INT_HPP_INCLUDED
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017 #include <boost/mpl/if.hpp>
0018 #include <boost/mpl/int.hpp>
0019 #include <boost/mpl/aux_/config/integral.hpp>
0020 #include <boost/config.hpp>
0021
0022 namespace boost { namespace mpl { namespace aux {
0023
0024 template< typename T > struct integral_rank;
0025
0026 template<> struct integral_rank<bool> : int_<1> {};
0027 template<> struct integral_rank<signed char> : int_<2> {};
0028 template<> struct integral_rank<char> : int_<3> {};
0029 template<> struct integral_rank<unsigned char> : int_<4> {};
0030 #if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
0031 template<> struct integral_rank<wchar_t> : int_<5> {};
0032 #endif
0033 template<> struct integral_rank<short> : int_<6> {};
0034 template<> struct integral_rank<unsigned short> : int_<7> {};
0035 template<> struct integral_rank<int> : int_<8> {};
0036 template<> struct integral_rank<unsigned int> : int_<9> {};
0037 template<> struct integral_rank<long> : int_<10> {};
0038 template<> struct integral_rank<unsigned long> : int_<11> {};
0039
0040 #if defined(BOOST_HAS_LONG_LONG)
0041 template<> struct integral_rank<long_long_type> : int_<12> {};
0042 template<> struct integral_rank<ulong_long_type>: int_<13> {};
0043 #endif
0044
0045 template< typename T1, typename T2 > struct largest_int
0046 #if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC)
0047 : if_c<
0048 ( integral_rank<T1>::value >= integral_rank<T2>::value )
0049 , T1
0050 , T2
0051 >
0052 {
0053 #else
0054 {
0055 enum { rank1 = integral_rank<T1>::value };
0056 enum { rank2 = integral_rank<T2>::value };
0057 typedef typename if_c< (rank1 >= rank2),T1,T2 >::type type;
0058 #endif
0059 };
0060
0061 }}}
0062
0063 #endif