Improved some of the metaprogramming methods (refs #9046)

[SVN r85482]
This commit is contained in:
Antony Polukhin
2013-08-27 07:07:15 +00:00
parent 3ce36a2848
commit fac805ddf6

View File

@@ -2133,25 +2133,18 @@ namespace boost {
/*
* is_xchar_to_xchar<Target, Source>::value is true, when
* Target and Souce are the same char types, or when
* Target and Souce are char types of the same size.
* Target and Souce are char types of the same size (signed char, unsigned char).
*/
template<typename Target, typename Source>
struct is_xchar_to_xchar
{
BOOST_STATIC_CONSTANT(bool, value =
(
boost::type_traits::ice_or<
boost::type_traits::ice_and<
boost::is_same<Source,Target>::value,
boost::detail::is_character<Target>::value
>::value,
boost::type_traits::ice_and<
boost::type_traits::ice_eq< sizeof(char),sizeof(Target)>::value,
boost::type_traits::ice_eq< sizeof(char),sizeof(Source)>::value,
boost::type_traits::ice_eq<sizeof(Source), sizeof(Target)>::value,
boost::detail::is_character<Target>::value,
boost::detail::is_character<Source>::value
>::value
>::value
)
);
};
@@ -2321,6 +2314,7 @@ namespace boost {
{
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
boost::type_traits::ice_and<
boost::is_unsigned<Target>::value,
boost::type_traits::ice_or<
boost::is_signed<Source>::value,
boost::is_float<Source>::value
@@ -2330,8 +2324,7 @@ namespace boost {
>::value,
boost::type_traits::ice_not<
boost::is_same<Target, bool>::value
>::value,
boost::is_unsigned<Target>::value
>::value
>::value,
lexical_cast_dynamic_num_ignoring_minus<Target, Source>,
lexical_cast_dynamic_num_not_ignoring_minus<Target, Source>
@@ -2356,18 +2349,22 @@ namespace boost {
>::value
> shall_we_copy_t;
typedef BOOST_DEDUCED_TYPENAME
boost::detail::is_arithmetic_and_not_xchars<Target, src > shall_we_copy_with_dynamic_check_t;
typedef boost::detail::is_arithmetic_and_not_xchars<Target, src >
shall_we_copy_with_dynamic_check_t;
// We do evaluate second `if_` lazily to avoid unnecessary instantiations
// of `shall_we_copy_with_dynamic_check_t` and improve compilation times.
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
shall_we_copy_t::value,
boost::detail::lexical_cast_copy<src >,
BOOST_DEDUCED_TYPENAME boost::mpl::if_c<
shall_we_copy_with_dynamic_check_t::value,
boost::mpl::identity<boost::detail::lexical_cast_copy<src > >,
boost::mpl::if_<
shall_we_copy_with_dynamic_check_t,
boost::detail::lexical_cast_dynamic_num<Target, src >,
boost::detail::lexical_cast_do_cast<Target, src >
>::type
>::type caster_type;
>
>::type caster_type_lazy;
typedef BOOST_DEDUCED_TYPENAME caster_type_lazy::type caster_type;
return caster_type::lexical_cast_impl(arg);
}