summaryrefslogtreecommitdiff
path: root/boost/lexical_cast
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:30:07 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2016-10-06 10:32:57 +0900
commit71d216b90256936a9638f325af9bc69d720e75de (patch)
tree9c5f682d341c7c88ad0c8e3d4b262e00b6fb691a /boost/lexical_cast
parent733b5d5ae2c5d625211e2985ac25728ac3f54883 (diff)
downloadboost-71d216b90256936a9638f325af9bc69d720e75de.tar.gz
boost-71d216b90256936a9638f325af9bc69d720e75de.tar.bz2
boost-71d216b90256936a9638f325af9bc69d720e75de.zip
Imported Upstream version 1.59.0
Change-Id: I2dde00f4eca71df3eea9d251dcaecde18a6c90a5 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/lexical_cast')
-rw-r--r--boost/lexical_cast/detail/converter_lexical.hpp38
-rw-r--r--boost/lexical_cast/detail/converter_lexical_streams.hpp1
-rw-r--r--boost/lexical_cast/detail/converter_numeric.hpp42
-rw-r--r--boost/lexical_cast/detail/is_character.hpp19
-rw-r--r--boost/lexical_cast/detail/lcast_unsigned_converters.hpp1
-rw-r--r--boost/lexical_cast/try_lexical_convert.hpp53
6 files changed, 84 insertions, 70 deletions
diff --git a/boost/lexical_cast/detail/converter_lexical.hpp b/boost/lexical_cast/detail/converter_lexical.hpp
index 961dbde277..6a7878bdbe 100644
--- a/boost/lexical_cast/detail/converter_lexical.hpp
+++ b/boost/lexical_cast/detail/converter_lexical.hpp
@@ -30,8 +30,9 @@
#include <cstddef>
#include <string>
#include <boost/limits.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
-#include <boost/type_traits/ice.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/is_float.hpp>
#include <boost/type_traits/has_left_shift.hpp>
@@ -422,28 +423,27 @@ namespace boost {
BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits<char_type, Target>,
BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits<char_type, no_cv_src>
>::type::trait_t traits;
-
- typedef boost::type_traits::ice_and<
- boost::is_same<char, src_char_t>::value, // source is not a wide character based type
- boost::type_traits::ice_ne<sizeof(char), sizeof(target_char_t) >::value, // target type is based on wide character
- boost::type_traits::ice_not<
- boost::detail::is_character<no_cv_src>::value // single character widening is optimized
- >::value // and does not requires stringbuffer
- > is_string_widening_required_t;
-
- typedef boost::type_traits::ice_not< boost::type_traits::ice_or<
- boost::is_integral<no_cv_src>::value,
- boost::detail::is_character<
+
+ typedef boost::mpl::bool_
+ <
+ boost::is_same<char, src_char_t>::value && // source is not a wide character based type
+ (sizeof(char) != sizeof(target_char_t)) && // target type is based on wide character
+ (!(boost::detail::is_character<no_cv_src>::value))
+ > is_string_widening_required_t;
+
+ typedef boost::mpl::bool_
+ <
+ !(boost::is_integral<no_cv_src>::value ||
+ boost::detail::is_character<
BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::stage1_type // if we did not get character type at stage1
- >::value // then we have no optimization for that type
- >::value > is_source_input_not_optimized_t;
-
+ >::value // then we have no optimization for that type
+ )
+ > is_source_input_not_optimized_t;
+
// If we have an optimized conversion for
// Source, we do not need to construct stringbuf.
BOOST_STATIC_CONSTANT(bool, requires_stringbuf =
- (boost::type_traits::ice_or<
- is_string_widening_required_t::value, is_source_input_not_optimized_t::value
- >::value)
+ (is_string_widening_required_t::value || is_source_input_not_optimized_t::value)
);
typedef boost::detail::lcast_src_length<no_cv_src> len_t;
diff --git a/boost/lexical_cast/detail/converter_lexical_streams.hpp b/boost/lexical_cast/detail/converter_lexical_streams.hpp
index 2d6617dadd..ba8d3b4dc3 100644
--- a/boost/lexical_cast/detail/converter_lexical_streams.hpp
+++ b/boost/lexical_cast/detail/converter_lexical_streams.hpp
@@ -34,7 +34,6 @@
#include <cstdio>
#include <boost/limits.hpp>
#include <boost/mpl/if.hpp>
-#include <boost/type_traits/ice.hpp>
#include <boost/type_traits/is_pointer.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
diff --git a/boost/lexical_cast/detail/converter_numeric.hpp b/boost/lexical_cast/detail/converter_numeric.hpp
index 54f7a35ff4..a6cc8e77b8 100644
--- a/boost/lexical_cast/detail/converter_numeric.hpp
+++ b/boost/lexical_cast/detail/converter_numeric.hpp
@@ -24,8 +24,9 @@
#endif
#include <boost/limits.hpp>
+#include <boost/mpl/eval_if.hpp>
+#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
-#include <boost/type_traits/ice.hpp>
#include <boost/type_traits/make_unsigned.hpp>
#include <boost/type_traits/is_signed.hpp>
#include <boost/type_traits/is_integral.hpp>
@@ -153,22 +154,35 @@ struct dynamic_num_converter_impl
{
static inline bool try_convert(const Source &arg, Target& result) BOOST_NOEXCEPT {
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
- >::value,
- boost::type_traits::ice_not<
- boost::is_same<Source, bool>::value
- >::value,
- boost::type_traits::ice_not<
- boost::is_same<Target, bool>::value
- >::value
- >::value,
+ boost::is_unsigned<Target>::value &&
+ (boost::is_signed<Source>::value || boost::is_float<Source>::value) &&
+ !(boost::is_same<Source, bool>::value) &&
+ !(boost::is_same<Target, bool>::value),
lexical_cast_dynamic_num_ignoring_minus<Target, Source>,
lexical_cast_dynamic_num_not_ignoring_minus<Target, Source>
>::type caster_type;
+
+#if 0
+
+ typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
+ BOOST_DEDUCED_TYPENAME boost::mpl::and_<
+ boost::is_unsigned<Target>,
+ boost::mpl::or_<
+ boost::is_signed<Source>,
+ boost::is_float<Source>
+ >,
+ boost::mpl::not_<
+ boost::is_same<Source, bool>
+ >,
+ boost::mpl::not_<
+ boost::is_same<Target, bool>
+ >
+ >::type,
+ lexical_cast_dynamic_num_ignoring_minus<Target, Source>,
+ lexical_cast_dynamic_num_not_ignoring_minus<Target, Source>
+ >::type caster_type;
+
+#endif
return caster_type::try_convert(arg, result);
}
diff --git a/boost/lexical_cast/detail/is_character.hpp b/boost/lexical_cast/detail/is_character.hpp
index e967f58525..732c39f8e8 100644
--- a/boost/lexical_cast/detail/is_character.hpp
+++ b/boost/lexical_cast/detail/is_character.hpp
@@ -23,6 +23,7 @@
# pragma once
#endif
+#include <boost/mpl/bool.hpp>
#include <boost/type_traits/is_same.hpp>
namespace boost {
@@ -33,22 +34,22 @@ namespace boost {
template < typename T >
struct is_character
{
- typedef boost::type_traits::ice_or<
- boost::is_same< T, char >::value,
+ typedef BOOST_DEDUCED_TYPENAME boost::mpl::bool_<
+ boost::is_same< T, char >::value ||
#if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING)
- boost::is_same< T, wchar_t >::value,
+ boost::is_same< T, wchar_t >::value ||
#endif
#ifndef BOOST_NO_CXX11_CHAR16_T
- boost::is_same< T, char16_t >::value,
+ boost::is_same< T, char16_t >::value ||
#endif
#ifndef BOOST_NO_CXX11_CHAR32_T
- boost::is_same< T, char32_t >::value,
+ boost::is_same< T, char32_t >::value ||
#endif
- boost::is_same< T, unsigned char >::value,
- boost::is_same< T, signed char >::value
- > result_type;
+ boost::is_same< T, unsigned char >::value ||
+ boost::is_same< T, signed char >::value
+ > type;
- BOOST_STATIC_CONSTANT(bool, value = (result_type::value) );
+ BOOST_STATIC_CONSTANT(bool, value = (type::value) );
};
}
}
diff --git a/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
index efe91ede9a..268961ee72 100644
--- a/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
+++ b/boost/lexical_cast/detail/lcast_unsigned_converters.hpp
@@ -30,7 +30,6 @@
#include <cstdio>
#include <boost/limits.hpp>
#include <boost/mpl/if.hpp>
-#include <boost/type_traits/ice.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp>
diff --git a/boost/lexical_cast/try_lexical_convert.hpp b/boost/lexical_cast/try_lexical_convert.hpp
index a9e0a0aa2f..66270eee76 100644
--- a/boost/lexical_cast/try_lexical_convert.hpp
+++ b/boost/lexical_cast/try_lexical_convert.hpp
@@ -24,8 +24,9 @@
#endif
#include <string>
+#include <boost/mpl/bool.hpp>
+#include <boost/mpl/identity.hpp>
#include <boost/mpl/if.hpp>
-#include <boost/type_traits/ice.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/is_arithmetic.hpp>
@@ -57,17 +58,15 @@ namespace boost {
template<typename Target, typename Source>
struct is_arithmetic_and_not_xchars
{
+ typedef boost::mpl::bool_<
+ !(boost::detail::is_character<Target>::value) &&
+ !(boost::detail::is_character<Source>::value) &&
+ boost::is_arithmetic<Source>::value &&
+ boost::is_arithmetic<Target>::value
+ > type;
+
BOOST_STATIC_CONSTANT(bool, value = (
- boost::type_traits::ice_and<
- boost::type_traits::ice_not<
- boost::detail::is_character<Target>::value
- >::value,
- boost::type_traits::ice_not<
- boost::detail::is_character<Source>::value
- >::value,
- boost::is_arithmetic<Source>::value,
- boost::is_arithmetic<Target>::value
- >::value
+ type::value
));
};
@@ -78,13 +77,15 @@ namespace boost {
template<typename Target, typename Source>
struct is_xchar_to_xchar
{
- BOOST_STATIC_CONSTANT(bool, value = (
- boost::type_traits::ice_and<
- boost::type_traits::ice_eq<sizeof(Source), sizeof(Target)>::value,
- boost::type_traits::ice_eq<sizeof(Source), sizeof(char)>::value,
- boost::detail::is_character<Target>::value,
+ typedef boost::mpl::bool_<
+ sizeof(Source) == sizeof(Target) &&
+ sizeof(Source) == sizeof(char) &&
+ boost::detail::is_character<Target>::value &&
boost::detail::is_character<Source>::value
- >::value
+ > type;
+
+ BOOST_STATIC_CONSTANT(bool, value = (
+ type::value
));
};
@@ -140,17 +141,17 @@ namespace boost {
{
typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay<Source>::type src;
- typedef BOOST_DEDUCED_TYPENAME boost::type_traits::ice_or<
- boost::detail::is_xchar_to_xchar<Target, src >::value,
- boost::detail::is_char_array_to_stdstring<Target, src >::value,
- boost::type_traits::ice_and<
- boost::is_same<Target, src >::value,
+ typedef boost::mpl::bool_<
+ boost::detail::is_xchar_to_xchar<Target, src >::value ||
+ boost::detail::is_char_array_to_stdstring<Target, src >::value ||
+ (
+ boost::is_same<Target, src >::value &&
boost::detail::is_stdstring<Target >::value
- >::value,
- boost::type_traits::ice_and<
- boost::is_same<Target, src >::value,
+ ) ||
+ (
+ boost::is_same<Target, src >::value &&
boost::detail::is_character<Target >::value
- >::value
+ )
> shall_we_copy_t;
typedef boost::detail::is_arithmetic_and_not_xchars<Target, src >