Include bind in ndnboost.
diff --git a/ndnboost/numeric/conversion/detail/bounds.hpp b/ndnboost/numeric/conversion/detail/bounds.hpp
new file mode 100644
index 0000000..34effae
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/bounds.hpp
@@ -0,0 +1,58 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_BOUNDS_DETAIL_FLC_12NOV2002_HPP
+
+#include "ndnboost/limits.hpp"
+#include "ndnboost/config.hpp"
+#include "ndnboost/mpl/if.hpp"
+
+namespace ndnboost { namespace numeric { namespace boundsdetail
+{
+ template<class N>
+ class Integral
+ {
+ typedef std::numeric_limits<N> limits ;
+
+ public :
+
+ static N lowest () { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
+ static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
+ static N smallest() { return static_cast<N>(1); }
+ } ;
+
+ template<class N>
+ class Float
+ {
+ typedef std::numeric_limits<N> limits ;
+
+ public :
+
+ static N lowest () { return static_cast<N>(-limits::max BOOST_PREVENT_MACRO_SUBSTITUTION ()) ; }
+ static N highest () { return limits::max BOOST_PREVENT_MACRO_SUBSTITUTION (); }
+ static N smallest() { return limits::min BOOST_PREVENT_MACRO_SUBSTITUTION (); }
+ } ;
+
+ template<class N>
+ struct get_impl
+ {
+ typedef mpl::bool_< ::std::numeric_limits<N>::is_integer > is_int ;
+
+ typedef Integral<N> impl_int ;
+ typedef Float <N> impl_float ;
+
+ typedef typename mpl::if_<is_int,impl_int,impl_float>::type type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::boundsdetail.
+
+#endif
+//
+///////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/ndnboost/numeric/conversion/detail/conversion_traits.hpp b/ndnboost/numeric/conversion/detail/conversion_traits.hpp
new file mode 100644
index 0000000..55c7d86
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/conversion_traits.hpp
@@ -0,0 +1,97 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERSION_TRAITS_FLC_12NOV2002_HPP
+
+#include "ndnboost/type_traits/is_arithmetic.hpp"
+#include "ndnboost/type_traits/is_same.hpp"
+#include "ndnboost/type_traits/remove_cv.hpp"
+
+#include "ndnboost/numeric/conversion/detail/meta.hpp"
+#include "ndnboost/numeric/conversion/detail/int_float_mixture.hpp"
+#include "ndnboost/numeric/conversion/detail/sign_mixture.hpp"
+#include "ndnboost/numeric/conversion/detail/udt_builtin_mixture.hpp"
+#include "ndnboost/numeric/conversion/detail/is_subranged.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ //-------------------------------------------------------------------
+ // Implementation of the Conversion Traits for T != S
+ //
+ // This is a VISIBLE base class of the user-level conversion_traits<> class.
+ //-------------------------------------------------------------------
+ template<class T,class S>
+ struct non_trivial_traits_impl
+ {
+ typedef typename get_int_float_mixture <T,S>::type int_float_mixture ;
+ typedef typename get_sign_mixture <T,S>::type sign_mixture ;
+ typedef typename get_udt_builtin_mixture <T,S>::type udt_builtin_mixture ;
+
+ typedef typename get_is_subranged<T,S>::type subranged ;
+
+ typedef mpl::false_ trivial ;
+
+ typedef T target_type ;
+ typedef S source_type ;
+ typedef T result_type ;
+
+ typedef typename mpl::if_< is_arithmetic<S>, S, S const&>::type argument_type ;
+
+ typedef typename mpl::if_<subranged,S,T>::type supertype ;
+ typedef typename mpl::if_<subranged,T,S>::type subtype ;
+ } ;
+
+ //-------------------------------------------------------------------
+ // Implementation of the Conversion Traits for T == S
+ //
+ // This is a VISIBLE base class of the user-level conversion_traits<> class.
+ //-------------------------------------------------------------------
+ template<class N>
+ struct trivial_traits_impl
+ {
+ typedef typename get_int_float_mixture <N,N>::type int_float_mixture ;
+ typedef typename get_sign_mixture <N,N>::type sign_mixture ;
+ typedef typename get_udt_builtin_mixture<N,N>::type udt_builtin_mixture ;
+
+ typedef mpl::false_ subranged ;
+ typedef mpl::true_ trivial ;
+
+ typedef N target_type ;
+ typedef N source_type ;
+ typedef N const& result_type ;
+ typedef N const& argument_type ;
+
+ typedef N supertype ;
+ typedef N subtype ;
+
+ } ;
+
+ //-------------------------------------------------------------------
+ // Top level implementation selector.
+ //-------------------------------------------------------------------
+ template<class T, class S>
+ struct get_conversion_traits
+ {
+ typedef typename remove_cv<T>::type target_type ;
+ typedef typename remove_cv<S>::type source_type ;
+
+ typedef typename is_same<target_type,source_type>::type is_trivial ;
+
+ typedef trivial_traits_impl <target_type> trivial_imp ;
+ typedef non_trivial_traits_impl<target_type,source_type> non_trivial_imp ;
+
+ typedef typename mpl::if_<is_trivial,trivial_imp,non_trivial_imp>::type type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+
+
diff --git a/ndnboost/numeric/conversion/detail/converter.hpp b/ndnboost/numeric/conversion/detail/converter.hpp
new file mode 100644
index 0000000..813a5c3
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/converter.hpp
@@ -0,0 +1,602 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_CONVERTER_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_CONVERTER_FLC_12NOV2002_HPP
+
+#include <functional>
+
+#include "ndnboost/numeric/conversion/detail/meta.hpp"
+#include "ndnboost/numeric/conversion/detail/conversion_traits.hpp"
+#include "ndnboost/numeric/conversion/bounds.hpp"
+
+#include "ndnboost/type_traits/is_same.hpp"
+
+#include "ndnboost/mpl/integral_c.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ // Integral Constants representing rounding modes
+ typedef mpl::integral_c<std::float_round_style, std::round_toward_zero> round2zero_c ;
+ typedef mpl::integral_c<std::float_round_style, std::round_to_nearest> round2nearest_c ;
+ typedef mpl::integral_c<std::float_round_style, std::round_toward_infinity> round2inf_c ;
+ typedef mpl::integral_c<std::float_round_style, std::round_toward_neg_infinity> round2neg_inf_c ;
+
+ // Metafunction:
+ //
+ // for_round_style<RoundStyle,RoundToZero,RoundToNearest,RoundToInf,RoundToNegInf>::type
+ //
+ // {RoundStyle} Integral Constant specifying a round style as declared above.
+ // {RoundToZero,RoundToNearest,RoundToInf,RoundToNegInf} arbitrary types.
+ //
+ // Selects one of the 4 types according to the value of RoundStyle.
+ //
+ template<class RoundStyle,class RoundToZero,class RoundToNearest,class RoundToInf,class RoundToNegInf>
+ struct for_round_style
+ {
+ typedef ct_switch4<RoundStyle
+ , round2zero_c, round2nearest_c, round2inf_c // round2neg_inf_c
+ , RoundToZero , RoundToNearest , RoundToInf , RoundToNegInf
+ > selector ;
+
+ typedef typename selector::type type ;
+ } ;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+//--------------------------------------------------------------------------
+// Range Checking Logic.
+//
+// The range checking logic is built up by combining 1 or 2 predicates.
+// Each predicate is encapsulated in a template class and exposes
+// the static member function 'apply'.
+//
+//--------------------------------------------------------------------------
+
+
+ // Because a particular logic can combine either 1 or two predicates, the following
+ // tags are used to allow the predicate applier to receive 2 preds, but optimize away
+ // one of them if it is 'non-applicable'
+ struct non_applicable { typedef mpl::false_ do_apply ; } ;
+ struct applicable { typedef mpl::true_ do_apply ; } ;
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Range Checking Logic implementations.
+ //
+ // The following classes, collectivelly named 'Predicates', are instantiated within
+ // the corresponding range checkers.
+ // Their static member function 'apply' is called to perform the actual range checking logic.
+ //--------------------------------------------------------------------------
+
+ // s < Lowest(T) ? cNegOverflow : cInRange
+ //
+ template<class Traits>
+ struct LT_LoT : applicable
+ {
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s < static_cast<S>(bounds<T>::lowest()) ? cNegOverflow : cInRange ;
+ }
+ } ;
+
+ // s < 0 ? cNegOverflow : cInRange
+ //
+ template<class Traits>
+ struct LT_Zero : applicable
+ {
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s < static_cast<S>(0) ? cNegOverflow : cInRange ;
+ }
+ } ;
+
+ // s <= Lowest(T)-1 ? cNegOverflow : cInRange
+ //
+ template<class Traits>
+ struct LE_PrevLoT : applicable
+ {
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s <= static_cast<S>(bounds<T>::lowest()) - static_cast<S>(1.0)
+ ? cNegOverflow : cInRange ;
+ }
+ } ;
+
+ // s < Lowest(T)-0.5 ? cNegOverflow : cInRange
+ //
+ template<class Traits>
+ struct LT_HalfPrevLoT : applicable
+ {
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s < static_cast<S>(bounds<T>::lowest()) - static_cast<S>(0.5)
+ ? cNegOverflow : cInRange ;
+ }
+ } ;
+
+ // s > Highest(T) ? cPosOverflow : cInRange
+ //
+ template<class Traits>
+ struct GT_HiT : applicable
+ {
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s > static_cast<S>(bounds<T>::highest())
+ ? cPosOverflow : cInRange ;
+ }
+ } ;
+
+ // s >= Lowest(T) + 1 ? cPosOverflow : cInRange
+ //
+ template<class Traits>
+ struct GE_SuccHiT : applicable
+ {
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s >= static_cast<S>(bounds<T>::highest()) + static_cast<S>(1.0)
+ ? cPosOverflow : cInRange ;
+ }
+ } ;
+
+ // s >= Lowest(T) + 0.5 ? cPosgOverflow : cInRange
+ //
+ template<class Traits>
+ struct GT_HalfSuccHiT : applicable
+ {
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ return s >= static_cast<S>(bounds<T>::highest()) + static_cast<S>(0.5)
+ ? cPosOverflow : cInRange ;
+ }
+ } ;
+
+
+ //--------------------------------------------------------------------------
+ //
+ // Predicate Combiner.
+ //
+ // This helper classes are used to possibly combine the range checking logic
+ // individually performed by the predicates
+ //
+ //--------------------------------------------------------------------------
+
+
+ // Applies both predicates: first 'PredA', and if it equals 'cInRange', 'PredB'
+ template<class PredA, class PredB>
+ struct applyBoth
+ {
+ typedef typename PredA::argument_type argument_type ;
+
+ static range_check_result apply ( argument_type s )
+ {
+ range_check_result r = PredA::apply(s) ;
+ if ( r == cInRange )
+ r = PredB::apply(s);
+ return r ;
+ }
+ } ;
+
+ template<class PredA, class PredB>
+ struct combine
+ {
+ typedef applyBoth<PredA,PredB> Both ;
+ typedef void NNone ; // 'None' is defined as a macro in (/usr/X11R6/include/X11/X.h)
+
+ typedef typename PredA::do_apply do_applyA ;
+ typedef typename PredB::do_apply do_applyB ;
+
+ typedef typename for_both<do_applyA, do_applyB, Both, PredA, PredB, NNone>::type type ;
+ } ;
+
+
+
+
+
+
+
+
+
+
+
+
+//--------------------------------------------------------------------------
+// Range Checker classes.
+//
+// The following classes are VISIBLE base classes of the user-level converter<> class.
+// They supply the optimized 'out_of_range()' and 'validate_range()' static member functions
+// visible in the user interface.
+//
+//--------------------------------------------------------------------------
+
+ // Dummy range checker.
+ template<class Traits>
+ struct dummy_range_checker
+ {
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result out_of_range ( argument_type ) { return cInRange ; }
+ static void validate_range ( argument_type ) {}
+ } ;
+
+ // Generic range checker.
+ //
+ // All the range checking logic for all possible combinations of source and target
+ // can be arranged in terms of one or two predicates, which test overflow on both neg/pos 'sides'
+ // of the ranges.
+ //
+ // These predicates are given here as IsNegOverflow and IsPosOverflow.
+ //
+ template<class Traits, class IsNegOverflow, class IsPosOverflow, class OverflowHandler>
+ struct generic_range_checker
+ {
+ typedef OverflowHandler overflow_handler ;
+
+ typedef typename Traits::argument_type argument_type ;
+
+ static range_check_result out_of_range ( argument_type s )
+ {
+ typedef typename combine<IsNegOverflow,IsPosOverflow>::type Predicate ;
+
+ return Predicate::apply(s);
+ }
+
+ static void validate_range ( argument_type s )
+ { OverflowHandler()( out_of_range(s) ) ; }
+ } ;
+
+
+
+//--------------------------------------------------------------------------
+//
+// Selectors for the optimized Range Checker class.
+//
+//--------------------------------------------------------------------------
+
+ template<class Traits,class OverflowHandler>
+ struct GetRC_Sig2Sig_or_Unsig2Unsig
+ {
+ typedef dummy_range_checker<Traits> Dummy ;
+
+ typedef LT_LoT<Traits> Pred1 ;
+ typedef GT_HiT<Traits> Pred2 ;
+
+ typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> Normal ;
+
+ typedef typename Traits::subranged subranged ;
+
+ typedef typename mpl::if_<subranged,Normal,Dummy>::type type ;
+ } ;
+
+ template<class Traits, class OverflowHandler>
+ struct GetRC_Sig2Unsig
+ {
+ typedef LT_Zero<Traits> Pred1 ;
+ typedef GT_HiT <Traits> Pred2 ;
+
+ typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> ChoiceA ;
+
+ typedef generic_range_checker<Traits,Pred1,non_applicable,OverflowHandler> ChoiceB ;
+
+ typedef typename Traits::target_type T ;
+ typedef typename Traits::source_type S ;
+
+ typedef typename subranged_Unsig2Sig<S,T>::type oposite_subranged ;
+
+ typedef typename mpl::not_<oposite_subranged>::type positively_subranged ;
+
+ typedef typename mpl::if_<positively_subranged,ChoiceA,ChoiceB>::type type ;
+ } ;
+
+ template<class Traits, class OverflowHandler>
+ struct GetRC_Unsig2Sig
+ {
+ typedef GT_HiT<Traits> Pred1 ;
+
+ typedef generic_range_checker<Traits,non_applicable,Pred1,OverflowHandler> type ;
+ } ;
+
+ template<class Traits,class OverflowHandler>
+ struct GetRC_Int2Int
+ {
+ typedef GetRC_Sig2Sig_or_Unsig2Unsig<Traits,OverflowHandler> Sig2SigQ ;
+ typedef GetRC_Sig2Unsig <Traits,OverflowHandler> Sig2UnsigQ ;
+ typedef GetRC_Unsig2Sig <Traits,OverflowHandler> Unsig2SigQ ;
+ typedef Sig2SigQ Unsig2UnsigQ ;
+
+ typedef typename Traits::sign_mixture sign_mixture ;
+
+ typedef typename
+ for_sign_mixture<sign_mixture,Sig2SigQ,Sig2UnsigQ,Unsig2SigQ,Unsig2UnsigQ>::type
+ selector ;
+
+ typedef typename selector::type type ;
+ } ;
+
+ template<class Traits>
+ struct GetRC_Int2Float
+ {
+ typedef dummy_range_checker<Traits> type ;
+ } ;
+
+ template<class Traits, class OverflowHandler, class Float2IntRounder>
+ struct GetRC_Float2Int
+ {
+ typedef LE_PrevLoT <Traits> Pred1 ;
+ typedef GE_SuccHiT <Traits> Pred2 ;
+ typedef LT_HalfPrevLoT<Traits> Pred3 ;
+ typedef GT_HalfSuccHiT<Traits> Pred4 ;
+ typedef GT_HiT <Traits> Pred5 ;
+ typedef LT_LoT <Traits> Pred6 ;
+
+ typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> ToZero ;
+ typedef generic_range_checker<Traits,Pred3,Pred4,OverflowHandler> ToNearest ;
+ typedef generic_range_checker<Traits,Pred1,Pred5,OverflowHandler> ToInf ;
+ typedef generic_range_checker<Traits,Pred6,Pred2,OverflowHandler> ToNegInf ;
+
+ typedef typename Float2IntRounder::round_style round_style ;
+
+ typedef typename for_round_style<round_style,ToZero,ToNearest,ToInf,ToNegInf>::type type ;
+ } ;
+
+ template<class Traits, class OverflowHandler>
+ struct GetRC_Float2Float
+ {
+ typedef dummy_range_checker<Traits> Dummy ;
+
+ typedef LT_LoT<Traits> Pred1 ;
+ typedef GT_HiT<Traits> Pred2 ;
+
+ typedef generic_range_checker<Traits,Pred1,Pred2,OverflowHandler> Normal ;
+
+ typedef typename Traits::subranged subranged ;
+
+ typedef typename mpl::if_<subranged,Normal,Dummy>::type type ;
+ } ;
+
+ template<class Traits, class OverflowHandler, class Float2IntRounder>
+ struct GetRC_BuiltIn2BuiltIn
+ {
+ typedef GetRC_Int2Int<Traits,OverflowHandler> Int2IntQ ;
+ typedef GetRC_Int2Float<Traits> Int2FloatQ ;
+ typedef GetRC_Float2Int<Traits,OverflowHandler,Float2IntRounder> Float2IntQ ;
+ typedef GetRC_Float2Float<Traits,OverflowHandler> Float2FloatQ ;
+
+ typedef typename Traits::int_float_mixture int_float_mixture ;
+
+ typedef typename for_int_float_mixture<int_float_mixture, Int2IntQ, Int2FloatQ, Float2IntQ, Float2FloatQ>::type selector ;
+
+ typedef typename selector::type type ;
+ } ;
+
+ template<class Traits, class OverflowHandler, class Float2IntRounder>
+ struct GetRC
+ {
+ typedef GetRC_BuiltIn2BuiltIn<Traits,OverflowHandler,Float2IntRounder> BuiltIn2BuiltInQ ;
+
+ typedef dummy_range_checker<Traits> Dummy ;
+
+ typedef mpl::identity<Dummy> DummyQ ;
+
+ typedef typename Traits::udt_builtin_mixture udt_builtin_mixture ;
+
+ typedef typename for_udt_builtin_mixture<udt_builtin_mixture,BuiltIn2BuiltInQ,DummyQ,DummyQ,DummyQ>::type selector ;
+
+ typedef typename selector::type type ;
+ } ;
+
+
+
+
+//--------------------------------------------------------------------------
+// Converter classes.
+//
+// The following classes are VISIBLE base classes of the user-level converter<> class.
+// They supply the optimized 'nearbyint()' and 'convert()' static member functions
+// visible in the user interface.
+//
+//--------------------------------------------------------------------------
+
+ //
+ // Trivial Converter : used when (cv-unqualified) T == (cv-unqualified) S
+ //
+ template<class Traits>
+ struct trivial_converter_impl : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
+ ,BOOST_DEDUCED_TYPENAME Traits::result_type
+ >
+ ,public dummy_range_checker<Traits>
+ {
+ typedef Traits traits ;
+
+ typedef typename Traits::source_type source_type ;
+ typedef typename Traits::argument_type argument_type ;
+ typedef typename Traits::result_type result_type ;
+
+ static result_type low_level_convert ( argument_type s ) { return s ; }
+ static source_type nearbyint ( argument_type s ) { return s ; }
+ static result_type convert ( argument_type s ) { return s ; }
+ } ;
+
+
+ //
+ // Rounding Converter : used for float to integral conversions.
+ //
+ template<class Traits,class RangeChecker,class RawConverter,class Float2IntRounder>
+ struct rounding_converter : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
+ ,BOOST_DEDUCED_TYPENAME Traits::result_type
+ >
+ ,public RangeChecker
+ ,public Float2IntRounder
+ ,public RawConverter
+ {
+ typedef RangeChecker RangeCheckerBase ;
+ typedef Float2IntRounder Float2IntRounderBase ;
+ typedef RawConverter RawConverterBase ;
+
+ typedef Traits traits ;
+
+ typedef typename Traits::source_type source_type ;
+ typedef typename Traits::argument_type argument_type ;
+ typedef typename Traits::result_type result_type ;
+
+ static result_type convert ( argument_type s )
+ {
+ RangeCheckerBase::validate_range(s);
+ source_type s1 = Float2IntRounderBase::nearbyint(s);
+ return RawConverterBase::low_level_convert(s1);
+ }
+ } ;
+
+
+ //
+ // Non-Rounding Converter : used for all other conversions.
+ //
+ template<class Traits,class RangeChecker,class RawConverter>
+ struct non_rounding_converter : public std::unary_function< BOOST_DEDUCED_TYPENAME Traits::argument_type
+ ,BOOST_DEDUCED_TYPENAME Traits::result_type
+ >
+ ,public RangeChecker
+ ,public RawConverter
+ {
+ typedef RangeChecker RangeCheckerBase ;
+ typedef RawConverter RawConverterBase ;
+
+ typedef Traits traits ;
+
+ typedef typename Traits::source_type source_type ;
+ typedef typename Traits::argument_type argument_type ;
+ typedef typename Traits::result_type result_type ;
+
+ static source_type nearbyint ( argument_type s ) { return s ; }
+
+ static result_type convert ( argument_type s )
+ {
+ RangeCheckerBase::validate_range(s);
+ return RawConverterBase::low_level_convert(s);
+ }
+ } ;
+
+
+
+
+//--------------------------------------------------------------------------
+//
+// Selectors for the optimized Converter class.
+//
+//--------------------------------------------------------------------------
+
+ template<class Traits,class OverflowHandler,class Float2IntRounder,class RawConverter, class UserRangeChecker>
+ struct get_non_trivial_converter
+ {
+ typedef GetRC<Traits,OverflowHandler,Float2IntRounder> InternalRangeCheckerQ ;
+
+ typedef is_same<UserRangeChecker,UseInternalRangeChecker> use_internal_RC ;
+
+ typedef mpl::identity<UserRangeChecker> UserRangeCheckerQ ;
+
+ typedef typename
+ mpl::eval_if<use_internal_RC,InternalRangeCheckerQ,UserRangeCheckerQ>::type
+ RangeChecker ;
+
+ typedef non_rounding_converter<Traits,RangeChecker,RawConverter> NonRounding ;
+ typedef rounding_converter<Traits,RangeChecker,RawConverter,Float2IntRounder> Rounding ;
+
+ typedef mpl::identity<NonRounding> NonRoundingQ ;
+ typedef mpl::identity<Rounding> RoundingQ ;
+
+ typedef typename Traits::int_float_mixture int_float_mixture ;
+
+ typedef typename
+ for_int_float_mixture<int_float_mixture, NonRoundingQ, NonRoundingQ, RoundingQ, NonRoundingQ>::type
+ selector ;
+
+ typedef typename selector::type type ;
+ } ;
+
+ template< class Traits
+ ,class OverflowHandler
+ ,class Float2IntRounder
+ ,class RawConverter
+ ,class UserRangeChecker
+ >
+ struct get_converter_impl
+ {
+#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT( 0x0561 ) )
+ // bcc55 prefers sometimes template parameters to be explicit local types.
+ // (notice that is is illegal to reuse the names like this)
+ typedef Traits Traits ;
+ typedef OverflowHandler OverflowHandler ;
+ typedef Float2IntRounder Float2IntRounder ;
+ typedef RawConverter RawConverter ;
+ typedef UserRangeChecker UserRangeChecker ;
+#endif
+
+ typedef trivial_converter_impl<Traits> Trivial ;
+ typedef mpl::identity <Trivial> TrivialQ ;
+
+ typedef get_non_trivial_converter< Traits
+ ,OverflowHandler
+ ,Float2IntRounder
+ ,RawConverter
+ ,UserRangeChecker
+ > NonTrivialQ ;
+
+ typedef typename Traits::trivial trivial ;
+
+ typedef typename mpl::eval_if<trivial,TrivialQ,NonTrivialQ>::type type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+
+
diff --git a/ndnboost/numeric/conversion/detail/int_float_mixture.hpp b/ndnboost/numeric/conversion/detail/int_float_mixture.hpp
new file mode 100644
index 0000000..437b56a
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/int_float_mixture.hpp
@@ -0,0 +1,72 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_INT_FLOAT_MIXTURE_FLC_12NOV2002_HPP
+
+#include "ndnboost/config.hpp"
+#include "ndnboost/limits.hpp"
+
+#include "ndnboost/numeric/conversion/int_float_mixture_enum.hpp"
+#include "ndnboost/numeric/conversion/detail/meta.hpp"
+
+#include "ndnboost/mpl/integral_c.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ // Integral Constants for 'IntFloatMixture'
+ typedef mpl::integral_c<int_float_mixture_enum, integral_to_integral> int2int_c ;
+ typedef mpl::integral_c<int_float_mixture_enum, integral_to_float> int2float_c ;
+ typedef mpl::integral_c<int_float_mixture_enum, float_to_integral> float2int_c ;
+ typedef mpl::integral_c<int_float_mixture_enum, float_to_float> float2float_c ;
+
+ // Metafunction:
+ //
+ // get_int_float_mixture<T,S>::type
+ //
+ // Selects the appropriate Int-Float Mixture Integral Constant for the combination T,S.
+ //
+ template<class T,class S>
+ struct get_int_float_mixture
+ {
+ typedef mpl::bool_< ::std::numeric_limits<S>::is_integer > S_int ;
+ typedef mpl::bool_< ::std::numeric_limits<T>::is_integer > T_int ;
+
+ typedef typename
+ for_both<S_int, T_int, int2int_c, int2float_c, float2int_c, float2float_c>::type
+ type ;
+ } ;
+
+ // Metafunction:
+ //
+ // for_int_float_mixture<Mixture,int_int,int_float,float_int,float_float>::type
+ //
+ // {Mixture} is one of the Integral Constants for Mixture, declared above.
+ // {int_int,int_float,float_int,float_float} are aribtrary types. (not metafunctions)
+ //
+ // According to the value of 'IntFloatMixture', selects the corresponding type.
+ //
+ template<class IntFloatMixture, class Int2Int, class Int2Float, class Float2Int, class Float2Float>
+ struct for_int_float_mixture
+ {
+ typedef typename
+ ct_switch4<IntFloatMixture
+ ,int2int_c, int2float_c, float2int_c // default
+ ,Int2Int , Int2Float , Float2Int , Float2Float
+ >::type
+ type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+//
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+
diff --git a/ndnboost/numeric/conversion/detail/is_subranged.hpp b/ndnboost/numeric/conversion/detail/is_subranged.hpp
new file mode 100644
index 0000000..6f84872
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/is_subranged.hpp
@@ -0,0 +1,234 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_IS_SUBRANGED_FLC_12NOV2002_HPP
+
+#include "ndnboost/config.hpp"
+#include "ndnboost/limits.hpp"
+
+#include "ndnboost/mpl/int.hpp"
+#include "ndnboost/mpl/multiplies.hpp"
+#include "ndnboost/mpl/less.hpp"
+#include "ndnboost/mpl/equal_to.hpp"
+
+#include "ndnboost/type_traits/is_same.hpp"
+
+#include "ndnboost/numeric/conversion/detail/meta.hpp"
+#include "ndnboost/numeric/conversion/detail/int_float_mixture.hpp"
+#include "ndnboost/numeric/conversion/detail/sign_mixture.hpp"
+#include "ndnboost/numeric/conversion/detail/udt_builtin_mixture.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ //---------------------------------------------------------------
+ // Implementations of the compile time predicate "T is subranged"
+ //---------------------------------------------------------------
+
+ // for integral to integral conversions
+ template<class T,class S>
+ struct subranged_Sig2Unsig
+ {
+ // Signed to unsigned conversions are 'subranged' because of possible loose
+ // of negative values.
+ typedef mpl::true_ type ;
+ } ;
+
+ // for unsigned integral to signed integral conversions
+ template<class T,class S>
+ struct subranged_Unsig2Sig
+ {
+ // IMPORTANT NOTE:
+ //
+ // This code assumes that signed/unsigned integral values are represented
+ // such that:
+ //
+ // numeric_limits<signed T>::digits + 1 == numeric_limits<unsigned T>::digits
+ //
+ // The '+1' is required since numeric_limits<>::digits gives 1 bit less for signed integral types.
+ //
+ // This fact is used by the following logic:
+ //
+ // if ( (numeric_limits<T>::digits+1) < (2*numeric_limits<S>::digits) )
+ // then the conversion is subranged.
+ //
+
+ typedef mpl::int_< ::std::numeric_limits<S>::digits > S_digits ;
+ typedef mpl::int_< ::std::numeric_limits<T>::digits > T_digits ;
+
+ // T is signed, so take digits+1
+ typedef typename T_digits::next u_T_digits ;
+
+ typedef mpl::int_<2> Two ;
+
+ typedef typename mpl::multiplies<S_digits,Two>::type S_digits_times_2 ;
+
+ typedef typename mpl::less<u_T_digits,S_digits_times_2>::type type ;
+ } ;
+
+ // for integral to integral conversions of the same sign.
+ template<class T,class S>
+ struct subranged_SameSign
+ {
+ // An integral conversion of the same sign is subranged if digits(T) < digits(S).
+
+ typedef mpl::int_< ::std::numeric_limits<S>::digits > S_digits ;
+ typedef mpl::int_< ::std::numeric_limits<T>::digits > T_digits ;
+
+ typedef typename mpl::less<T_digits,S_digits>::type type ;
+ } ;
+
+ // for integral to float conversions
+ template<class T,class S>
+ struct subranged_Int2Float
+ {
+ typedef mpl::false_ type ;
+ } ;
+
+ // for float to integral conversions
+ template<class T,class S>
+ struct subranged_Float2Int
+ {
+ typedef mpl::true_ type ;
+ } ;
+
+ // for float to float conversions
+ template<class T,class S>
+ struct subranged_Float2Float
+ {
+ // If both T and S are floats,
+ // compare exponent bits and if they match, mantisa bits.
+
+ typedef mpl::int_< ::std::numeric_limits<S>::digits > S_mantisa ;
+ typedef mpl::int_< ::std::numeric_limits<T>::digits > T_mantisa ;
+
+ typedef mpl::int_< ::std::numeric_limits<S>::max_exponent > S_exponent ;
+ typedef mpl::int_< ::std::numeric_limits<T>::max_exponent > T_exponent ;
+
+ typedef typename mpl::less<T_exponent,S_exponent>::type T_smaller_exponent ;
+
+ typedef typename mpl::equal_to<T_exponent,S_exponent>::type equal_exponents ;
+
+ typedef mpl::less<T_mantisa,S_mantisa> T_smaller_mantisa ;
+
+ typedef mpl::eval_if<equal_exponents,T_smaller_mantisa,mpl::false_> not_bigger_exponent_case ;
+
+ typedef typename
+ mpl::eval_if<T_smaller_exponent,mpl::true_,not_bigger_exponent_case>::type
+ type ;
+ } ;
+
+ // for Udt to built-in conversions
+ template<class T,class S>
+ struct subranged_Udt2BuiltIn
+ {
+ typedef mpl::true_ type ;
+ } ;
+
+ // for built-in to Udt conversions
+ template<class T,class S>
+ struct subranged_BuiltIn2Udt
+ {
+ typedef mpl::false_ type ;
+ } ;
+
+ // for Udt to Udt conversions
+ template<class T,class S>
+ struct subranged_Udt2Udt
+ {
+ typedef mpl::false_ type ;
+ } ;
+
+ //-------------------------------------------------------------------
+ // Selectors for the implementations of the subranged predicate
+ //-------------------------------------------------------------------
+
+ template<class T,class S>
+ struct get_subranged_Int2Int
+ {
+ typedef subranged_SameSign<T,S> Sig2Sig ;
+ typedef subranged_Sig2Unsig<T,S> Sig2Unsig ;
+ typedef subranged_Unsig2Sig<T,S> Unsig2Sig ;
+ typedef Sig2Sig Unsig2Unsig ;
+
+ typedef typename get_sign_mixture<T,S>::type sign_mixture ;
+
+ typedef typename
+ for_sign_mixture<sign_mixture, Sig2Sig, Sig2Unsig, Unsig2Sig, Unsig2Unsig>::type
+ type ;
+ } ;
+
+ template<class T,class S>
+ struct get_subranged_BuiltIn2BuiltIn
+ {
+ typedef get_subranged_Int2Int<T,S> Int2IntQ ;
+
+ typedef subranged_Int2Float <T,S> Int2Float ;
+ typedef subranged_Float2Int <T,S> Float2Int ;
+ typedef subranged_Float2Float<T,S> Float2Float ;
+
+ typedef mpl::identity<Int2Float > Int2FloatQ ;
+ typedef mpl::identity<Float2Int > Float2IntQ ;
+ typedef mpl::identity<Float2Float> Float2FloatQ ;
+
+ typedef typename get_int_float_mixture<T,S>::type int_float_mixture ;
+
+ typedef for_int_float_mixture<int_float_mixture, Int2IntQ, Int2FloatQ, Float2IntQ, Float2FloatQ> for_ ;
+
+ typedef typename for_::type selected ;
+
+ typedef typename selected::type type ;
+ } ;
+
+ template<class T,class S>
+ struct get_subranged
+ {
+ typedef get_subranged_BuiltIn2BuiltIn<T,S> BuiltIn2BuiltInQ ;
+
+ typedef subranged_BuiltIn2Udt<T,S> BuiltIn2Udt ;
+ typedef subranged_Udt2BuiltIn<T,S> Udt2BuiltIn ;
+ typedef subranged_Udt2Udt<T,S> Udt2Udt ;
+
+ typedef mpl::identity<BuiltIn2Udt> BuiltIn2UdtQ ;
+ typedef mpl::identity<Udt2BuiltIn> Udt2BuiltInQ ;
+ typedef mpl::identity<Udt2Udt > Udt2UdtQ ;
+
+ typedef typename get_udt_builtin_mixture<T,S>::type udt_builtin_mixture ;
+
+ typedef typename
+ for_udt_builtin_mixture<udt_builtin_mixture, BuiltIn2BuiltInQ, BuiltIn2UdtQ, Udt2BuiltInQ, Udt2UdtQ>::type
+ selected ;
+
+ typedef typename selected::type selected2 ;
+
+ typedef typename selected2::type type ;
+ } ;
+
+
+ //-------------------------------------------------------------------
+ // Top level implementation selector.
+ //-------------------------------------------------------------------
+ template<class T, class S>
+ struct get_is_subranged
+ {
+ typedef get_subranged<T,S> non_trivial_case ;
+ typedef mpl::identity<mpl::false_> trivial_case ;
+
+ typedef is_same<T,S> is_trivial ;
+
+ typedef typename mpl::if_<is_trivial,trivial_case,non_trivial_case>::type selected ;
+
+ typedef typename selected::type type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+
+
diff --git a/ndnboost/numeric/conversion/detail/meta.hpp b/ndnboost/numeric/conversion/detail/meta.hpp
new file mode 100644
index 0000000..a79d670
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/meta.hpp
@@ -0,0 +1,120 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_META_FLC_12NOV2002_HPP
+
+#include "ndnboost/type_traits/remove_cv.hpp"
+
+#include "ndnboost/mpl/if.hpp"
+#include "ndnboost/mpl/eval_if.hpp"
+#include "ndnboost/mpl/equal_to.hpp"
+#include "ndnboost/mpl/not.hpp"
+#include "ndnboost/mpl/and.hpp"
+#include "ndnboost/mpl/bool.hpp"
+#include "ndnboost/mpl/identity.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ template< class T1, class T2>
+ struct equal_to
+ {
+ #if !defined(__BORLANDC__)
+
+ enum { x = ( BOOST_MPL_AUX_VALUE_WKND(T1)::value == BOOST_MPL_AUX_VALUE_WKND(T2)::value ) };
+
+ BOOST_STATIC_CONSTANT(bool, value = x);
+
+ typedef mpl::bool_<value> type;
+
+ #else
+
+ BOOST_STATIC_CONSTANT(bool, value = (
+ BOOST_MPL_AUX_VALUE_WKND(T1)::value
+ == BOOST_MPL_AUX_VALUE_WKND(T2)::value
+ ));
+
+ typedef mpl::bool_<(
+ BOOST_MPL_AUX_VALUE_WKND(T1)::value
+ == BOOST_MPL_AUX_VALUE_WKND(T2)::value
+ )> type;
+ #endif
+ };
+
+// Metafunction:
+ //
+ // ct_switch4<Value,Case0Val,Case1Val,Case2Val,Case0Type,Case1Type,Case2Type,DefaultType>::type
+ //
+ // {Value,Case(X)Val} are Integral Constants (such as: mpl::int_<>)
+ // {Case(X)Type,DefaultType} are arbitrary types. (not metafunctions)
+ //
+ // Returns Case(X)Type if Val==Case(X)Val; DefaultType otherwise.
+ //
+ template<class Value,
+ class Case0Val,
+ class Case1Val,
+ class Case2Val,
+ class Case0Type,
+ class Case1Type,
+ class Case2Type,
+ class DefaultType
+ >
+ struct ct_switch4
+ {
+ typedef mpl::identity<Case0Type> Case0TypeQ ;
+ typedef mpl::identity<Case1Type> Case1TypeQ ;
+
+ typedef equal_to<Value,Case0Val> is_case0 ;
+ typedef equal_to<Value,Case1Val> is_case1 ;
+ typedef equal_to<Value,Case2Val> is_case2 ;
+
+ typedef mpl::if_<is_case2,Case2Type,DefaultType> choose_2_3Q ;
+ typedef mpl::eval_if<is_case1,Case1TypeQ,choose_2_3Q> choose_1_2_3Q ;
+
+ typedef typename
+ mpl::eval_if<is_case0,Case0TypeQ,choose_1_2_3Q>::type
+ type ;
+ } ;
+
+
+
+
+ // Metafunction:
+ //
+ // for_both<expr0,expr1,TT,TF,FT,FF>::type
+ //
+ // {exp0,expr1} are Boolean Integral Constants
+ // {TT,TF,FT,FF} are aribtrary types. (not metafunctions)
+ //
+ // According to the combined boolean value of 'expr0 && expr1', selects the corresponding type.
+ //
+ template<class expr0, class expr1, class TT, class TF, class FT, class FF>
+ struct for_both
+ {
+ typedef mpl::identity<TF> TF_Q ;
+ typedef mpl::identity<TT> TT_Q ;
+
+ typedef typename mpl::not_<expr0>::type not_expr0 ;
+ typedef typename mpl::not_<expr1>::type not_expr1 ;
+
+ typedef typename mpl::and_<expr0,expr1>::type caseTT ;
+ typedef typename mpl::and_<expr0,not_expr1>::type caseTF ;
+ typedef typename mpl::and_<not_expr0,expr1>::type caseFT ;
+
+ typedef mpl::if_<caseFT,FT,FF> choose_FT_FF_Q ;
+ typedef mpl::eval_if<caseTF,TF_Q,choose_FT_FF_Q> choose_TF_FT_FF_Q ;
+
+ typedef typename mpl::eval_if<caseTT,TT_Q,choose_TF_FT_FF_Q>::type type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+
+
diff --git a/ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp b/ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp
new file mode 100644
index 0000000..eaccf5c
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp
@@ -0,0 +1,138 @@
+//
+//! Copyright (c) 2011-2012
+//! Brandon Kohn
+//
+// 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_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES)
+
+ #include <ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp>
+
+ #if !defined(BOOST_NO_LONG_LONG)
+ #include <ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp>
+ #endif
+
+#else
+#if !BOOST_PP_IS_ITERATING
+
+ #include <ndnboost/preprocessor/seq/elem.hpp>
+ #include <ndnboost/preprocessor/seq/size.hpp>
+ #include <ndnboost/preprocessor/iteration/iterate.hpp>
+
+ #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp")
+ #endif
+//
+//! Copyright (c) 2011-2012
+//! Brandon Kohn
+//
+// 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(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 1)
+ #endif
+
+ //! These are the assumed common built in fundamental types (not typedefs/macros.)
+ #define BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \
+ (char) \
+ (signed char) \
+ (unsigned char) \
+ (short) \
+ (unsigned short) \
+ (int) \
+ (unsigned int) \
+ (long) \
+ (unsigned long) \
+ (float) \
+ (double) \
+ (long double) \
+ /***/
+
+ #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
+ #define BOOST_NUMERIC_CONVERSION_SEQ_B() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
+
+namespace ndnboost { namespace numeric {
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp>))
+ #include BOOST_PP_ITERATE()
+
+}}//namespace ndnboost::numeric;
+
+ #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(output: null)
+ #endif
+
+ #if ( defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(BOOST_NO_LONG_LONG)
+
+ #undef BOOST_NUMERIC_CONVERSION_SEQ_A
+ #undef BOOST_NUMERIC_CONVERSION_SEQ_B
+
+ #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp")
+ #endif
+
+//
+//! Copyright (c) 2011-2012
+//! Brandon Kohn
+//
+// 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(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(preserve: 1)
+ #endif
+
+namespace ndnboost { namespace numeric {
+
+ #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(ndnboost::long_long_type)(ndnboost::ulong_long_type)
+ #define BOOST_NUMERIC_CONVERSION_SEQ_B() (ndnboost::long_long_type)(ndnboost::ulong_long_type)
+
+ #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp>))
+ #include BOOST_PP_ITERATE()
+
+}}//namespace ndnboost::numeric;
+
+ #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
+ #pragma wave option(output: null)
+ #endif
+
+ #endif
+
+ #undef BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES
+ #undef BOOST_NUMERIC_CONVERSION_SEQ_A
+ #undef BOOST_NUMERIC_CONVERSION_SEQ_B
+
+#elif BOOST_PP_ITERATION_DEPTH() == 1
+
+ #define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_B())), <ndnboost/numeric/conversion/detail/numeric_cast_traits.hpp>))
+ #include BOOST_PP_ITERATE()
+
+#elif BOOST_PP_ITERATION_DEPTH() == 2
+
+ //! Generate default traits for the specified source and target.
+ #define BOOST_NUMERIC_CONVERSION_A BOOST_PP_FRAME_ITERATION(1)
+ #define BOOST_NUMERIC_CONVERSION_B BOOST_PP_FRAME_ITERATION(2)
+
+ template <>
+ struct numeric_cast_traits
+ <
+ BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_A, BOOST_NUMERIC_CONVERSION_SEQ_A())
+ , BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())> rounding_policy;
+ };
+
+ #undef BOOST_NUMERIC_CONVERSION_A
+ #undef BOOST_NUMERIC_CONVERSION_B
+
+#endif//! Depth 2.
+#endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES
diff --git a/ndnboost/numeric/conversion/detail/old_numeric_cast.hpp b/ndnboost/numeric/conversion/detail/old_numeric_cast.hpp
new file mode 100644
index 0000000..10d9596
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/old_numeric_cast.hpp
@@ -0,0 +1,339 @@
+// boost cast.hpp header file ----------------------------------------------//
+
+// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
+// 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)
+
+// See http://www.boost.org/libs/conversion for Documentation.
+
+// Revision History
+// 23 JUN 05 Code extracted from /boost/cast.hpp into this new header.
+// Keeps this legacy version of numeric_cast<> for old compilers
+// wich can't compile the new version in /boost/numeric/conversion/cast.hpp
+// (Fernando Cacciola)
+// 02 Apr 01 Removed BOOST_NO_LIMITS workarounds and included
+// <ndnboost/limits.hpp> instead (the workaround did not
+// actually compile when BOOST_NO_LIMITS was defined in
+// any case, so we loose nothing). (John Maddock)
+// 21 Jan 01 Undid a bug I introduced yesterday. numeric_cast<> never
+// worked with stock GCC; trying to get it to do that broke
+// vc-stlport.
+// 20 Jan 01 Moved BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS to config.hpp.
+// Removed unused BOOST_EXPLICIT_TARGET macro. Moved
+// ndnboost::detail::type to boost/type.hpp. Made it compile with
+// stock gcc again (Dave Abrahams)
+// 29 Nov 00 Remove nested namespace cast, cleanup spacing before Formal
+// Review (Beman Dawes)
+// 19 Oct 00 Fix numeric_cast for floating-point types (Dave Abrahams)
+// 15 Jul 00 Suppress numeric_cast warnings for GCC, Borland and MSVC
+// (Dave Abrahams)
+// 30 Jun 00 More MSVC6 wordarounds. See comments below. (Dave Abrahams)
+// 28 Jun 00 Removed implicit_cast<>. See comment below. (Beman Dawes)
+// 27 Jun 00 More MSVC6 workarounds
+// 15 Jun 00 Add workarounds for MSVC6
+// 2 Feb 00 Remove bad_numeric_cast ";" syntax error (Doncho Angelov)
+// 26 Jan 00 Add missing throw() to bad_numeric_cast::what(0 (Adam Levar)
+// 29 Dec 99 Change using declarations so usages in other namespaces work
+// correctly (Dave Abrahams)
+// 23 Sep 99 Change polymorphic_downcast assert to also detect M.I. errors
+// as suggested Darin Adler and improved by Valentin Bonnard.
+// 2 Sep 99 Remove controversial asserts, simplify, rename.
+// 30 Aug 99 Move to cast.hpp, replace value_cast with numeric_cast,
+// place in nested namespace.
+// 3 Aug 99 Initial version
+
+#ifndef BOOST_OLD_NUMERIC_CAST_HPP
+#define BOOST_OLD_NUMERIC_CAST_HPP
+
+# include <ndnboost/config.hpp>
+# include <cassert>
+# include <typeinfo>
+# include <ndnboost/type.hpp>
+# include <ndnboost/limits.hpp>
+# include <ndnboost/numeric/conversion/converter_policies.hpp>
+
+// It has been demonstrated numerous times that MSVC 6.0 fails silently at link
+// time if you use a template function which has template parameters that don't
+// appear in the function's argument list.
+//
+// TODO: Add this to config.hpp?
+// FLC: This macro is repeated in boost/cast.hpp but only locally (is undefined at the bottom)
+// so is OK to reproduce it here.
+# if defined(BOOST_MSVC) && BOOST_MSVC < 1300
+# define BOOST_EXPLICIT_DEFAULT_TARGET , ::ndnboost::type<Target>* = 0
+# else
+# define BOOST_EXPLICIT_DEFAULT_TARGET
+# endif
+
+namespace ndnboost
+{
+ using numeric::bad_numeric_cast;
+
+// LEGACY numeric_cast [only for some old broken compilers] --------------------------------------//
+
+// Contributed by Kevlin Henney
+
+// numeric_cast ------------------------------------------------------------//
+
+#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_SGI_CPP_LIMITS)
+
+ namespace detail
+ {
+ template <class T>
+ struct signed_numeric_limits : std::numeric_limits<T>
+ {
+ static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+ return (std::numeric_limits<T>::min)() >= 0
+ // unary minus causes integral promotion, thus the static_cast<>
+ ? static_cast<T>(-(std::numeric_limits<T>::max)())
+ : (std::numeric_limits<T>::min)();
+ };
+ };
+
+ // Move to namespace ndnboost in utility.hpp?
+ template <class T, bool specialized>
+ struct fixed_numeric_limits_base
+ : public if_true< std::numeric_limits<T>::is_signed >
+ ::BOOST_NESTED_TEMPLATE then< signed_numeric_limits<T>,
+ std::numeric_limits<T>
+ >::type
+ {};
+
+ template <class T>
+ struct fixed_numeric_limits
+ : fixed_numeric_limits_base<T,(std::numeric_limits<T>::is_specialized)>
+ {};
+
+# ifdef BOOST_HAS_LONG_LONG
+ // cover implementations which supply no specialization for long
+ // long / unsigned long long. Not intended to be full
+ // numeric_limits replacements, but good enough for numeric_cast<>
+ template <>
+ struct fixed_numeric_limits_base< ::ndnboost::long_long_type, false>
+ {
+ BOOST_STATIC_CONSTANT(bool, is_specialized = true);
+ BOOST_STATIC_CONSTANT(bool, is_signed = true);
+ static ::ndnboost::long_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+# ifdef LONGLONG_MAX
+ return LONGLONG_MAX;
+# else
+ return 9223372036854775807LL; // hope this is portable
+# endif
+ }
+
+ static ::ndnboost::long_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+# ifdef LONGLONG_MIN
+ return LONGLONG_MIN;
+# else
+ return -( 9223372036854775807LL )-1; // hope this is portable
+# endif
+ }
+ };
+
+ template <>
+ struct fixed_numeric_limits_base< ::ndnboost::ulong_long_type, false>
+ {
+ BOOST_STATIC_CONSTANT(bool, is_specialized = true);
+ BOOST_STATIC_CONSTANT(bool, is_signed = false);
+ static ::ndnboost::ulong_long_type max BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+# ifdef ULONGLONG_MAX
+ return ULONGLONG_MAX;
+# else
+ return 0xffffffffffffffffULL; // hope this is portable
+# endif
+ }
+
+ static ::ndnboost::ulong_long_type min BOOST_PREVENT_MACRO_SUBSTITUTION () { return 0; }
+ };
+# endif
+ } // namespace detail
+
+// less_than_type_min -
+ // x_is_signed should be numeric_limits<X>::is_signed
+ // y_is_signed should be numeric_limits<Y>::is_signed
+ // y_min should be numeric_limits<Y>::min()
+ //
+ // check(x, y_min) returns true iff x < y_min without invoking comparisons
+ // between signed and unsigned values.
+ //
+ // "poor man's partial specialization" is in use here.
+ template <bool x_is_signed, bool y_is_signed>
+ struct less_than_type_min
+ {
+ template <class X, class Y>
+ static bool check(X x, Y y_min)
+ { return x < y_min; }
+ };
+
+ template <>
+ struct less_than_type_min<false, true>
+ {
+ template <class X, class Y>
+ static bool check(X, Y)
+ { return false; }
+ };
+
+ template <>
+ struct less_than_type_min<true, false>
+ {
+ template <class X, class Y>
+ static bool check(X x, Y)
+ { return x < 0; }
+ };
+
+ // greater_than_type_max -
+ // same_sign should be:
+ // numeric_limits<X>::is_signed == numeric_limits<Y>::is_signed
+ // y_max should be numeric_limits<Y>::max()
+ //
+ // check(x, y_max) returns true iff x > y_max without invoking comparisons
+ // between signed and unsigned values.
+ //
+ // "poor man's partial specialization" is in use here.
+ template <bool same_sign, bool x_is_signed>
+ struct greater_than_type_max;
+
+ template<>
+ struct greater_than_type_max<true, true>
+ {
+ template <class X, class Y>
+ static inline bool check(X x, Y y_max)
+ { return x > y_max; }
+ };
+
+ template <>
+ struct greater_than_type_max<false, true>
+ {
+ // What does the standard say about this? I think it's right, and it
+ // will work with every compiler I know of.
+ template <class X, class Y>
+ static inline bool check(X x, Y)
+ { return x >= 0 && static_cast<X>(static_cast<Y>(x)) != x; }
+
+# if defined(BOOST_MSVC) && BOOST_MSVC < 1300
+ // MSVC6 can't static_cast unsigned __int64 -> floating types
+# define BOOST_UINT64_CAST(src_type) \
+ static inline bool check(src_type x, unsigned __int64) \
+ { \
+ if (x < 0) return false; \
+ unsigned __int64 y = static_cast<unsigned __int64>(x); \
+ bool odd = y & 0x1; \
+ __int64 div2 = static_cast<__int64>(y >> 1); \
+ return ((static_cast<src_type>(div2) * 2.0) + odd) != x; \
+ }
+
+ BOOST_UINT64_CAST(long double);
+ BOOST_UINT64_CAST(double);
+ BOOST_UINT64_CAST(float);
+# undef BOOST_UINT64_CAST
+# endif
+ };
+
+ template<>
+ struct greater_than_type_max<true, false>
+ {
+ template <class X, class Y>
+ static inline bool check(X x, Y y_max)
+ { return x > y_max; }
+ };
+
+ template <>
+ struct greater_than_type_max<false, false>
+ {
+ // What does the standard say about this? I think it's right, and it
+ // will work with every compiler I know of.
+ template <class X, class Y>
+ static inline bool check(X x, Y)
+ { return static_cast<X>(static_cast<Y>(x)) != x; }
+ };
+
+#else // use #pragma hacks if available
+
+ namespace detail
+ {
+# if BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4018)
+# pragma warning(disable : 4146)
+#elif defined(__BORLANDC__)
+# pragma option push -w-8041
+# endif
+
+ // Move to namespace ndnboost in utility.hpp?
+ template <class T>
+ struct fixed_numeric_limits : public std::numeric_limits<T>
+ {
+ static inline T min BOOST_PREVENT_MACRO_SUBSTITUTION ()
+ {
+ return std::numeric_limits<T>::is_signed && (std::numeric_limits<T>::min)() >= 0
+ ? T(-(std::numeric_limits<T>::max)()) : (std::numeric_limits<T>::min)();
+ }
+ };
+
+# if BOOST_MSVC
+# pragma warning(pop)
+#elif defined(__BORLANDC__)
+# pragma option pop
+# endif
+ } // namespace detail
+
+#endif
+
+ template<typename Target, typename Source>
+ inline Target numeric_cast(Source arg BOOST_EXPLICIT_DEFAULT_TARGET)
+ {
+ // typedefs abbreviating respective trait classes
+ typedef detail::fixed_numeric_limits<Source> arg_traits;
+ typedef detail::fixed_numeric_limits<Target> result_traits;
+
+#if defined(BOOST_STRICT_CONFIG) \
+ || (!defined(__HP_aCC) || __HP_aCC > 33900) \
+ && (!defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) \
+ || defined(BOOST_SGI_CPP_LIMITS))
+ // typedefs that act as compile time assertions
+ // (to be replaced by boost compile time assertions
+ // as and when they become available and are stable)
+ typedef bool argument_must_be_numeric[arg_traits::is_specialized];
+ typedef bool result_must_be_numeric[result_traits::is_specialized];
+
+ const bool arg_is_signed = arg_traits::is_signed;
+ const bool result_is_signed = result_traits::is_signed;
+ const bool same_sign = arg_is_signed == result_is_signed;
+
+ if (less_than_type_min<arg_is_signed, result_is_signed>::check(arg, (result_traits::min)())
+ || greater_than_type_max<same_sign, arg_is_signed>::check(arg, (result_traits::max)())
+ )
+
+#else // We need to use #pragma hacks if available
+
+# if BOOST_MSVC
+# pragma warning(push)
+# pragma warning(disable : 4018)
+#elif defined(__BORLANDC__)
+#pragma option push -w-8012
+# endif
+ if ((arg < 0 && !result_traits::is_signed) // loss of negative range
+ || (arg_traits::is_signed && arg < (result_traits::min)()) // underflow
+ || arg > (result_traits::max)()) // overflow
+# if BOOST_MSVC
+# pragma warning(pop)
+#elif defined(__BORLANDC__)
+#pragma option pop
+# endif
+#endif
+ {
+ throw bad_numeric_cast();
+ }
+ return static_cast<Target>(arg);
+ } // numeric_cast
+
+# undef BOOST_EXPLICIT_DEFAULT_TARGET
+
+} // namespace ndnboost
+
+#endif // BOOST_OLD_NUMERIC_CAST_HPP
diff --git a/ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp b/ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp
new file mode 100644
index 0000000..48eee6a
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp
@@ -0,0 +1,1741 @@
+//
+//! Copyright (c) 2011-2012
+//! Brandon Kohn
+//
+// 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)
+//
+
+
+
+namespace ndnboost { namespace numeric {
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , signed char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<signed char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , unsigned char
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned char> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , unsigned short
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned short> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , unsigned int
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned int> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , unsigned long
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<unsigned long> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , float
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<float> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<double> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , long double
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<long double> rounding_policy;
+ };
+}}
diff --git a/ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp b/ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp
new file mode 100644
index 0000000..ef8d541
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp
@@ -0,0 +1,347 @@
+//
+//! Copyright (c) 2011-2012
+//! Brandon Kohn
+//
+// 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)
+//
+namespace ndnboost { namespace numeric {
+
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ char
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ signed char
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned char
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ short
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned short
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ int
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned int
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ unsigned long
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ float
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ double
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ long double
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ ndnboost::long_long_type
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ ndnboost::long_long_type
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ ndnboost::ulong_long_type
+ , ndnboost::long_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::long_long_type> rounding_policy;
+ };
+
+ template <>
+ struct numeric_cast_traits
+ <
+ ndnboost::ulong_long_type
+ , ndnboost::ulong_long_type
+ >
+ {
+ typedef def_overflow_handler overflow_policy;
+ typedef UseInternalRangeChecker range_checking_policy;
+ typedef Trunc<ndnboost::ulong_long_type> rounding_policy;
+ };
+}}
diff --git a/ndnboost/numeric/conversion/detail/sign_mixture.hpp b/ndnboost/numeric/conversion/detail/sign_mixture.hpp
new file mode 100644
index 0000000..e49ad1d
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/sign_mixture.hpp
@@ -0,0 +1,72 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_SIGN_MIXTURE_FLC_12NOV2002_HPP
+
+#include "ndnboost/config.hpp"
+#include "ndnboost/limits.hpp"
+
+#include "ndnboost/numeric/conversion/sign_mixture_enum.hpp"
+#include "ndnboost/numeric/conversion/detail/meta.hpp"
+
+#include "ndnboost/mpl/integral_c.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ // Integral Constants for 'SignMixture'
+ typedef mpl::integral_c<sign_mixture_enum, unsigned_to_unsigned> unsig2unsig_c ;
+ typedef mpl::integral_c<sign_mixture_enum, signed_to_signed> sig2sig_c ;
+ typedef mpl::integral_c<sign_mixture_enum, signed_to_unsigned> sig2unsig_c ;
+ typedef mpl::integral_c<sign_mixture_enum, unsigned_to_signed> unsig2sig_c ;
+
+ // Metafunction:
+ //
+ // get_sign_mixture<T,S>::type
+ //
+ // Selects the appropriate SignMixture Integral Constant for the combination T,S.
+ //
+ template<class T,class S>
+ struct get_sign_mixture
+ {
+ typedef mpl::bool_< ::std::numeric_limits<S>::is_signed > S_signed ;
+ typedef mpl::bool_< ::std::numeric_limits<T>::is_signed > T_signed ;
+
+ typedef typename
+ for_both<S_signed, T_signed, sig2sig_c, sig2unsig_c, unsig2sig_c, unsig2unsig_c>::type
+ type ;
+ } ;
+
+ // Metafunction:
+ //
+ // for_sign_mixture<SignMixture,Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig>::type
+ //
+ // {SignMixture} is one of the Integral Constants for SignMixture, declared above.
+ // {Sig2Sig,Sig2Unsig,Unsig2Sig,Unsig2Unsig} are aribtrary types. (not metafunctions)
+ //
+ // According to the value of 'SignMixture', selects the corresponding type.
+ //
+ template<class SignMixture, class Sig2Sig, class Sig2Unsig, class Unsig2Sig, class Unsig2Unsig>
+ struct for_sign_mixture
+ {
+ typedef typename
+ ct_switch4<SignMixture
+ , sig2sig_c, sig2unsig_c, unsig2sig_c // default
+ , Sig2Sig , Sig2Unsig , Unsig2Sig , Unsig2Unsig
+ >::type
+ type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+//
+///////////////////////////////////////////////////////////////////////////////////////////////
+
+
diff --git a/ndnboost/numeric/conversion/detail/udt_builtin_mixture.hpp b/ndnboost/numeric/conversion/detail/udt_builtin_mixture.hpp
new file mode 100644
index 0000000..6b1e282
--- /dev/null
+++ b/ndnboost/numeric/conversion/detail/udt_builtin_mixture.hpp
@@ -0,0 +1,69 @@
+// (c) Copyright Fernando Luis Cacciola Carballal 2000-2004
+// Use, modification, and distribution is subject to 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)
+
+// See library home page at http://www.boost.org/libs/numeric/conversion
+//
+// Contact the author at: fernando_cacciola@hotmail.com
+//
+#ifndef BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
+#define BOOST_NUMERIC_CONVERSION_DETAIL_UDT_BUILTIN_MIXTURE_FLC_12NOV2002_HPP
+
+#include "ndnboost/type_traits/is_arithmetic.hpp"
+
+#include "ndnboost/numeric/conversion/udt_builtin_mixture_enum.hpp"
+#include "ndnboost/numeric/conversion/detail/meta.hpp"
+
+#include "ndnboost/mpl/integral_c.hpp"
+
+namespace ndnboost { namespace numeric { namespace convdetail
+{
+ // Integral Constants for 'UdtMixture'
+ typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_builtin> builtin2builtin_c ;
+ typedef mpl::integral_c<udt_builtin_mixture_enum, builtin_to_udt> builtin2udt_c ;
+ typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_builtin> udt2builtin_c ;
+ typedef mpl::integral_c<udt_builtin_mixture_enum, udt_to_udt> udt2udt_c ;
+
+ // Metafunction:
+ //
+ // for_udt_mixture<UdtMixture,BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt>::type
+ //
+ // {UdtMixture} is one of the Integral Constants for UdMixture, declared above.
+ // {BuiltIn2BuiltIn,BuiltIn2Udt,Udt2BuiltIn,Udt2Udt} are aribtrary types. (not metafunctions)
+ //
+ // According to the value of 'UdtMixture', selects the corresponding type.
+ //
+ template<class UdtMixture, class BuiltIn2BuiltIn, class BuiltIn2Udt, class Udt2BuiltIn, class Udt2Udt>
+ struct for_udt_builtin_mixture
+ {
+ typedef typename
+ ct_switch4<UdtMixture
+ , builtin2builtin_c, builtin2udt_c, udt2builtin_c // default
+ , BuiltIn2BuiltIn , BuiltIn2Udt , Udt2BuiltIn , Udt2Udt
+ >::type
+ type ;
+ } ;
+
+ // Metafunction:
+ //
+ // get_udt_mixture<T,S>::type
+ //
+ // Selects the appropriate UdtMixture Integral Constant for the combination T,S.
+ //
+ template<class T,class S>
+ struct get_udt_builtin_mixture
+ {
+ typedef is_arithmetic<S> S_builtin ;
+ typedef is_arithmetic<T> T_builtin ;
+
+ typedef typename
+ for_both<S_builtin, T_builtin, builtin2builtin_c, builtin2udt_c, udt2builtin_c, udt2udt_c>::type
+ type ;
+ } ;
+
+} } } // namespace ndnboost::numeric::convdetail
+
+#endif
+
+