diff --git a/include/boost/lexical_cast/detail/converter_lexical.hpp b/include/boost/lexical_cast/detail/converter_lexical.hpp index 7cda698..1b9c515 100644 --- a/include/boost/lexical_cast/detail/converter_lexical.hpp +++ b/include/boost/lexical_cast/detail/converter_lexical.hpp @@ -29,16 +29,14 @@ #include #include +#include #include -#include #include -#include -#include -#include #include #include #include +#include #include @@ -97,21 +95,21 @@ namespace boost { // Returns one of char, wchar_t, char16_t, char32_t or deduce_character_type_later types // Executed on Stage 1 (See deduce_source_char and deduce_target_char) template < typename Type > - struct stream_char_common: public boost::conditional< + struct stream_char_common: public std::conditional< boost::detail::is_character< Type >::value, Type, boost::detail::deduce_character_type_later< Type > > {}; template < typename Char > - struct stream_char_common< Char* >: public boost::conditional< + struct stream_char_common< Char* >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< Char* > > {}; template < typename Char > - struct stream_char_common< const Char* >: public boost::conditional< + struct stream_char_common< const Char* >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< const Char* > @@ -124,14 +122,14 @@ namespace boost { }; template < typename Char > - struct stream_char_common< boost::iterator_range< Char* > >: public boost::conditional< + struct stream_char_common< boost::iterator_range< Char* > >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::iterator_range< Char* > > > {}; template < typename Char > - struct stream_char_common< boost::iterator_range< const Char* > >: public boost::conditional< + struct stream_char_common< boost::iterator_range< const Char* > >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::iterator_range< const Char* > > @@ -150,14 +148,14 @@ namespace boost { }; template < typename Char, std::size_t N > - struct stream_char_common< boost::array< Char, N > >: public boost::conditional< + struct stream_char_common< boost::array< Char, N > >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::array< Char, N > > > {}; template < typename Char, std::size_t N > - struct stream_char_common< boost::array< const Char, N > >: public boost::conditional< + struct stream_char_common< boost::array< const Char, N > >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::array< const Char, N > > @@ -165,14 +163,14 @@ namespace boost { #ifndef BOOST_NO_CXX11_HDR_ARRAY template < typename Char, std::size_t N > - struct stream_char_common< std::array >: public boost::conditional< + struct stream_char_common< std::array >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< std::array< Char, N > > > {}; template < typename Char, std::size_t N > - struct stream_char_common< std::array< const Char, N > >: public boost::conditional< + struct stream_char_common< std::array< const Char, N > >: public std::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< std::array< const Char, N > > @@ -363,7 +361,7 @@ namespace boost { // When is_specialized is false, the whole expression is 0. template struct lcast_src_length< - Source, typename boost::enable_if >::type + Source, typename std::enable_if::value >::type > { BOOST_STATIC_CONSTANT(std::size_t, value = @@ -385,7 +383,7 @@ namespace boost { // sign + leading digit + decimal point + "e" + exponent sign == 5 template struct lcast_src_length< - Source, typename boost::enable_if >::type + Source, typename std::enable_if::value >::type > { static_assert( @@ -404,7 +402,7 @@ namespace boost { template struct lexical_cast_stream_traits { typedef typename boost::detail::array_to_pointer_decay::type src; - typedef typename boost::remove_cv::type no_cv_src; + typedef typename std::remove_cv::type no_cv_src; typedef boost::detail::deduce_source_char deduce_src_char_metafunc; typedef typename deduce_src_char_metafunc::type src_char_t; @@ -415,13 +413,13 @@ namespace boost { >::type char_type; #if !defined(BOOST_NO_CXX11_CHAR16_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) - static_assert(!boost::is_same::value - && !boost::is_same::value, + static_assert(!std::is_same::value + && !std::is_same::value, "Your compiler does not have full support for char16_t" ); #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) - static_assert(!boost::is_same::value - && !boost::is_same::value, + static_assert(!std::is_same::value + && !std::is_same::value, "Your compiler does not have full support for char32_t" ); #endif diff --git a/include/boost/lexical_cast/detail/converter_lexical_streams.hpp b/include/boost/lexical_cast/detail/converter_lexical_streams.hpp index 1fa6c03..3cfec66 100644 --- a/include/boost/lexical_cast/detail/converter_lexical_streams.hpp +++ b/include/boost/lexical_cast/detail/converter_lexical_streams.hpp @@ -32,13 +32,10 @@ #include #include #include +#include #include -#include -#include -#include -#include -#include #include +#include #include #include @@ -71,13 +68,7 @@ #include -#include -#include -#include -#include -#include #include -#include #ifndef BOOST_NO_CWCHAR # include #endif @@ -97,8 +88,8 @@ namespace boost { namespace detail { namespace lcast { template struct exact { - static_assert(!boost::is_const::value, ""); - static_assert(!boost::is_reference::value, ""); + static_assert(!std::is_const::value, ""); + static_assert(!std::is_reference::value, ""); const T& payload; }; @@ -185,7 +176,7 @@ namespace boost { namespace detail { namespace lcast { template inline bool shl_signed(const T n) { CharT* tmp_finish = buffer + CharacterBufferSize; - typedef typename boost::make_unsigned::type utype; + typedef typename boost::detail::lcast::make_unsigned::type utype; CharT* tmp_start = lcast_put_unsigned(lcast_to_unsigned(n), tmp_finish).convert(); if (n < 0) { --tmp_start; @@ -256,11 +247,11 @@ namespace boost { namespace detail { namespace lcast { #endif public: template - using enable_if_compatible_char_t = typename boost::enable_if_c< - boost::is_same::value || ( - boost::is_same::value && ( - boost::is_same::value || - boost::is_same::value + using enable_if_compatible_char_t = typename std::enable_if< + std::is_same::value || ( + std::is_same::value && ( + std::is_same::value || + std::is_same::value ) ), bool >::type; @@ -304,7 +295,7 @@ namespace boost { namespace detail { namespace lcast { bool stream_in(lcast::exact x) { return shl_char(static_cast(x.payload)); } template - typename boost::enable_if_c::value, bool>::type + typename std::enable_if::value, bool>::type stream_in(lcast::exact x) { return shl_char(x.payload); } template @@ -312,11 +303,11 @@ namespace boost { namespace detail { namespace lcast { stream_in(lcast::exact x) { return shl_char_array(reinterpret_cast(x.payload)); } template - typename boost::enable_if_c::value && !boost::is_enum::value, bool>::type + typename std::enable_if::value && boost::detail::lcast::is_signed::value && !std::is_enum::value, bool>::type stream_in(lcast::exact x) { return shl_signed(x.payload); } template - typename boost::enable_if_c::value && !boost::is_enum::value, bool>::type + typename std::enable_if::value && !std::is_enum::value, bool>::type stream_in(lcast::exact x) { return shl_unsigned(x.payload); } template @@ -398,7 +389,7 @@ namespace boost { namespace detail { namespace lcast { #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) // If you have compilation error at this point, than your STL library // does not support such conversions. Try updating it. - static_assert(boost::is_same::value, ""); + static_assert(std::is_same::value, ""); #endif #ifndef BOOST_NO_EXCEPTIONS @@ -440,11 +431,11 @@ namespace boost { namespace detail { namespace lcast { public: template - typename boost::enable_if_c::value && sizeof(char) == sizeof(Type), bool>::type + typename std::enable_if::value && sizeof(char) == sizeof(Type), bool>::type stream_in(lcast::exact x) { return shl_char_array(reinterpret_cast(x.payload)); } template - typename boost::enable_if_c::value && sizeof(char) != sizeof(Type), bool>::type + typename std::enable_if::value && sizeof(char) != sizeof(Type), bool>::type stream_in(lcast::exact x) { return shl_char_array(x.payload); } bool stream_in(lcast::exact x) { return shl_real(x.payload); } @@ -458,14 +449,14 @@ namespace boost { namespace detail { namespace lcast { } template - typename boost::enable_if_c::value, bool>::type + typename std::enable_if::value, bool>::type stream_in(lcast::exact> x) noexcept { auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end()); return stream_in(lcast::exact{buf}); } template - typename boost::enable_if_c::value, bool>::type + typename std::enable_if::value, bool>::type stream_in(lcast::exact> x) noexcept { auto buf = boost::conversion::detail::make_buffer_view(x.payload.begin(), x.payload.end()); return stream_in(lcast::exact{buf}); @@ -526,7 +517,7 @@ namespace boost { namespace detail { namespace lcast { if (start == finish) return false; CharT const minus = lcast_char_constants::minus; CharT const plus = lcast_char_constants::plus; - typedef typename make_unsigned::type utype; + typedef typename boost::detail::lcast::make_unsigned::type utype; utype out_tmp = 0; bool const has_minus = Traits::eq(minus, *start); @@ -552,12 +543,12 @@ namespace boost { namespace detail { namespace lcast { bool shr_using_base_class(InputStreamable& output) { static_assert( - !boost::is_pointer::value, + !std::is_pointer::value, "boost::lexical_cast can not convert to pointers" ); #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) - static_assert(boost::is_same::value, + static_assert(std::is_same::value, "boost::lexical_cast can not convert, because your STL library does not " "support such conversions. Try updating it." ); diff --git a/include/boost/lexical_cast/detail/converter_numeric.hpp b/include/boost/lexical_cast/detail/converter_numeric.hpp index 7873274..9ecf87c 100644 --- a/include/boost/lexical_cast/detail/converter_numeric.hpp +++ b/include/boost/lexical_cast/detail/converter_numeric.hpp @@ -23,15 +23,11 @@ # pragma once #endif +#include #include -#include #include #include -#include -#include -#include -#include -#include +#include namespace boost { namespace detail { @@ -52,8 +48,8 @@ constexpr bool is_out_of_range_for(T value) noexcept { // integral -> integral template -typename boost::enable_if_c< - !boost::is_floating_point::value && !boost::is_floating_point::value, bool +typename std::enable_if< + !std::is_floating_point::value && !std::is_floating_point::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { const Target target_tmp = static_cast(arg); const Source arg_restored = static_cast(target_tmp); @@ -66,8 +62,8 @@ typename boost::enable_if_c< // integral -> floating point template -typename boost::enable_if_c< - !boost::is_floating_point::value && boost::is_floating_point::value, bool +typename std::enable_if< + !std::is_floating_point::value && std::is_floating_point::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { const Target target_tmp = static_cast(arg); result = target_tmp; @@ -77,8 +73,8 @@ typename boost::enable_if_c< // floating point -> floating point template -typename boost::enable_if_c< - boost::is_floating_point::value && boost::is_floating_point::value, bool +typename std::enable_if< + std::is_floating_point::value && std::is_floating_point::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { const Target target_tmp = static_cast(arg); const Source arg_restored = static_cast(target_tmp); @@ -92,8 +88,8 @@ typename boost::enable_if_c< // floating point -> integral template -typename boost::enable_if_c< - boost::is_floating_point::value && !boost::is_floating_point::value, bool +typename std::enable_if< + std::is_floating_point::value && !std::is_floating_point::value, bool >::type noexcept_numeric_convert(Source arg, Target& result) noexcept { if (detail::is_out_of_range_for(arg)) { return false; @@ -124,10 +120,10 @@ struct lexical_cast_dynamic_num_ignoring_minus __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif static inline bool try_convert(Source arg, Target& result) noexcept { - typedef typename boost::conditional< - boost::is_float::value, + typedef typename std::conditional< + std::is_floating_point::value, boost::type_identity, - boost::make_unsigned + boost::detail::lcast::make_unsigned >::type usource_lazy_t; typedef typename usource_lazy_t::type usource_t; @@ -165,11 +161,11 @@ template struct dynamic_num_converter_impl { static inline bool try_convert(Source arg, Target& result) noexcept { - typedef typename boost::conditional< - boost::is_unsigned::value && - (boost::is_signed::value || boost::is_float::value) && - !(boost::is_same::value) && - !(boost::is_same::value), + typedef typename std::conditional< + boost::detail::lcast::is_unsigned::value && + (boost::detail::lcast::is_signed::value || std::is_floating_point::value) && + !(std::is_same::value) && + !(std::is_same::value), lexical_cast_dynamic_num_ignoring_minus, lexical_cast_dynamic_num_not_ignoring_minus >::type caster_type; diff --git a/include/boost/lexical_cast/detail/is_character.hpp b/include/boost/lexical_cast/detail/is_character.hpp index 1079d7d..ff7d0df 100644 --- a/include/boost/lexical_cast/detail/is_character.hpp +++ b/include/boost/lexical_cast/detail/is_character.hpp @@ -18,32 +18,31 @@ #ifndef BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP #define BOOST_LEXICAL_CAST_DETAIL_IS_CHARACTER_HPP +#include + #include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif -#include -#include - namespace boost { namespace detail { // returns true, if T is one of the character types template < typename T > -using is_character = boost::integral_constant< +using is_character = std::integral_constant< bool, - boost::is_same< T, char >::value || + std::is_same< T, char >::value || #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) - boost::is_same< T, wchar_t >::value || + std::is_same< T, wchar_t >::value || #endif #ifndef BOOST_NO_CXX11_CHAR16_T - boost::is_same< T, char16_t >::value || + std::is_same< T, char16_t >::value || #endif #ifndef BOOST_NO_CXX11_CHAR32_T - boost::is_same< T, char32_t >::value || + std::is_same< T, char32_t >::value || #endif - boost::is_same< T, unsigned char >::value || - boost::is_same< T, signed char >::value + std::is_same< T, unsigned char >::value || + std::is_same< T, signed char >::value >; }} diff --git a/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp index 9e43c60..275ea36 100644 --- a/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +++ b/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp @@ -28,9 +28,10 @@ #include #include #include +#include #include -#include #include +#include #ifndef BOOST_NO_STD_LOCALE @@ -47,8 +48,6 @@ #endif #include -#include -#include #include namespace boost @@ -60,8 +59,8 @@ namespace boost __attribute__((no_sanitize("unsigned-integer-overflow"))) #endif inline - typename boost::make_unsigned::type lcast_to_unsigned(const T value) noexcept { - typedef typename boost::make_unsigned::type result_type; + typename boost::detail::lcast::make_unsigned::type lcast_to_unsigned(const T value) noexcept { + typedef typename boost::detail::lcast::make_unsigned::type result_type; return value < 0 ? static_cast(0u - static_cast(value)) : static_cast(value); @@ -73,7 +72,7 @@ namespace boost template class lcast_put_unsigned: boost::noncopyable { typedef typename Traits::int_type int_type; - typename boost::conditional< + typename std::conditional< (sizeof(unsigned) > sizeof(T)) , unsigned , T diff --git a/include/boost/lexical_cast/detail/type_traits.hpp b/include/boost/lexical_cast/detail/type_traits.hpp new file mode 100644 index 0000000..5287606 --- /dev/null +++ b/include/boost/lexical_cast/detail/type_traits.hpp @@ -0,0 +1,81 @@ +// Copyright Peter Dimov, 2025. +// Copyright Romain Geissler, 2025. +// +// 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) + +#ifndef BOOST_LEXICAL_CAST_DETAIL_TYPE_TRAITS_HPP +#define BOOST_LEXICAL_CAST_DETAIL_TYPE_TRAITS_HPP + +#include +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#include + +namespace boost { namespace detail { namespace lcast { + +// libstdc++ from gcc <= 15 doesn't provide support for __int128 in the standard traits, +// so define them explicitly. +// This was fixed with gcc >= 16, so we may eventually remove this workaround and use +// directly the standard type_traits. + +template struct is_integral: public std::is_integral +{ +}; + +template struct is_signed: public std::is_signed +{ +}; + +template struct is_unsigned: public std::is_unsigned +{ +}; + +template struct make_unsigned: public std::make_unsigned +{ +}; + +#if defined(__SIZEOF_INT128__) + +template<> struct is_integral<__int128_t>: public std::true_type +{ +}; + +template<> struct is_integral<__uint128_t>: public std::true_type +{ +}; + +template<> struct is_signed<__int128_t>: public std::true_type +{ +}; + +template<> struct is_signed<__uint128_t>: public std::false_type +{ +}; + +template<> struct is_unsigned<__int128_t>: public std::false_type +{ +}; + +template<> struct is_unsigned<__uint128_t>: public std::true_type +{ +}; + +template<> struct make_unsigned<__int128_t> +{ + typedef __uint128_t type; +}; + +template<> struct make_unsigned<__uint128_t> +{ + typedef __uint128_t type; +}; + +#endif + +}}} // namespace boost::detail::lcast + +#endif // BOOST_LEXICAL_CAST_DETAIL_TYPE_TRAITS_HPP diff --git a/include/boost/lexical_cast/detail/widest_char.hpp b/include/boost/lexical_cast/detail/widest_char.hpp index b25942b..b086eba 100644 --- a/include/boost/lexical_cast/detail/widest_char.hpp +++ b/include/boost/lexical_cast/detail/widest_char.hpp @@ -18,18 +18,18 @@ #ifndef BOOST_LEXICAL_CAST_DETAIL_WIDEST_CHAR_HPP #define BOOST_LEXICAL_CAST_DETAIL_WIDEST_CHAR_HPP +#include + #include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif -#include - namespace boost { namespace detail { template -using widest_char = boost::conditional< +using widest_char = std::conditional< (sizeof(TargetChar) > sizeof(SourceChar)) , TargetChar , SourceChar diff --git a/include/boost/lexical_cast/try_lexical_convert.hpp b/include/boost/lexical_cast/try_lexical_convert.hpp index f2605c0..2acc3cd 100644 --- a/include/boost/lexical_cast/try_lexical_convert.hpp +++ b/include/boost/lexical_cast/try_lexical_convert.hpp @@ -18,14 +18,13 @@ #ifndef BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP #define BOOST_LEXICAL_CAST_TRY_LEXICAL_CONVERT_HPP +#include + #include #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif -#include -#include - #include #include #include @@ -35,12 +34,12 @@ namespace boost { namespace detail { template - using is_arithmetic_and_not_xchars = boost::integral_constant< + using is_arithmetic_and_not_xchars = std::integral_constant< bool, !(boost::detail::is_character::value) && !(boost::detail::is_character::value) && - boost::is_arithmetic::value && - boost::is_arithmetic::value + std::is_arithmetic::value && + std::is_arithmetic::value >; } @@ -50,7 +49,7 @@ namespace boost { inline bool try_lexical_convert(const Source& arg, Target& result) { static_assert( - !boost::is_volatile::value, + !std::is_volatile::value, "Boost.LexicalCast does not support volatile input"); typedef typename boost::detail::array_to_pointer_decay::type src; @@ -58,7 +57,7 @@ namespace boost { typedef boost::detail::is_arithmetic_and_not_xchars shall_we_copy_with_dynamic_check_t; - typedef typename boost::conditional< + typedef typename std::conditional< shall_we_copy_with_dynamic_check_t::value, boost::detail::dynamic_num_converter_impl, boost::detail::lexical_converter_impl diff --git a/perf/performance_test.cpp b/perf/performance_test.cpp index 25240da..497e77b 100644 --- a/perf/performance_test.cpp +++ b/perf/performance_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -242,7 +243,7 @@ static inline void perf_test_impl(const FromT& in_val, const char* const conv) { lexical_cast_time.count(), ss_constr_time.count(), ss_noconstr_time.count(), - boost::is_same::value ? fake_test_value : printf_time.count() + std::is_same::value ? fake_test_value : printf_time.count() ); } diff --git a/test/float_types_test.cpp b/test/float_types_test.cpp index 06ab0af..a080dd7 100644 --- a/test/float_types_test.cpp +++ b/test/float_types_test.cpp @@ -15,10 +15,11 @@ #include "lexical_cast_old.hpp" #endif +#include + #include #include -#include -#include +#include #ifndef BOOST_TEST_CLOSE_FRACTION // Naiive, but works for most tests in this file @@ -303,7 +304,7 @@ void test_float_typess_for_overflows() BOOST_TEST_THROWS(lexical_cast("9"+s_max_value), bad_lexical_cast); #endif - if ( is_same::value ) + if ( std::is_same::value ) { BOOST_TEST_THROWS(lexical_cast( (std::numeric_limits::max)() ), bad_lexical_cast); BOOST_TEST( @@ -549,7 +550,7 @@ void test_conversion_integral_float() BOOST_TEST_EQ(lexical_cast(static_cast(8.0)), 8); BOOST_TEST_EQ(lexical_cast(static_cast(16.0)), 16); - if (boost::is_signed::value) { + if (boost::detail::lcast::is_signed::value) { BOOST_TEST_EQ(lexical_cast(static_cast(-1.0)), -1); BOOST_TEST_EQ(lexical_cast(static_cast(-8.0)), -8); BOOST_TEST_EQ(lexical_cast(static_cast(-16.0)), -16); diff --git a/test/inf_nan_test.cpp b/test/inf_nan_test.cpp index 8de332d..c180c0d 100644 --- a/test/inf_nan_test.cpp +++ b/test/inf_nan_test.cpp @@ -8,10 +8,11 @@ // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt). +#include + #include #include -#include #include @@ -46,7 +47,7 @@ bool is_neg_nan(T value) * It is a IA64 feature, or it is a boost::math feature, not a lexical_cast bug */ #if defined(__ia64__) || defined(_M_IA64) return (boost::core::isnan)(value) - && ( boost::is_same::value || (boost::core::signbit)(value) ); + && ( std::is_same::value || (boost::core::signbit)(value) ); #else return (boost::core::isnan)(value) && (boost::core::signbit)(value); #endif diff --git a/test/integral_types_test.cpp b/test/integral_types_test.cpp index ee4c854..cbaaeda 100644 --- a/test/integral_types_test.cpp +++ b/test/integral_types_test.cpp @@ -25,11 +25,13 @@ #include +#include + #include -#include #include #include #include +#include #if (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64)) \ && !(defined(BOOST_MSVC) && BOOST_MSVC < 1300) @@ -249,7 +251,7 @@ void test_conversion_from_string_to_integral(CharT) } typedef typename boost::integral_promotion::type promoted; - if ( !(boost::is_same::value) ) + if ( !(std::is_same::value) ) { promoted prom = max_val; s = to_str(max_val); @@ -564,7 +566,7 @@ template void test_integral_conversions_on_min_max_impl() { typedef SignedT signed_t; - typedef typename boost::make_unsigned::type unsigned_t; + typedef typename boost::detail::lcast::make_unsigned::type unsigned_t; typedef std::numeric_limits s_limits; typedef std::numeric_limits uns_limits; diff --git a/test/lexical_cast_old.hpp b/test/lexical_cast_old.hpp index f3f2451..207c697 100644 --- a/test/lexical_cast_old.hpp +++ b/test/lexical_cast_old.hpp @@ -32,8 +32,8 @@ #include #include #include +#include #include -#include #include #include @@ -115,7 +115,7 @@ namespace boost { template bool operator>>(InputStreamable &output) { - return !is_pointer::value && + return !std::is_pointer::value && stream >> output && stream.get() == traits_type::eof(); } diff --git a/test/stream_detection_test.cpp b/test/stream_detection_test.cpp index 081ee89..f546ad8 100644 --- a/test/stream_detection_test.cpp +++ b/test/stream_detection_test.cpp @@ -13,6 +13,7 @@ #include #include +#include ///////////////////////// char streamable classes /////////////////////////////////////////// @@ -28,12 +29,12 @@ std::istream& operator >> (std::istream& istr, const streamable_easy&) { struct streamable_medium { enum ENU {value = 1}; }; template -typename boost::enable_if, std::basic_ostream&>::type +typename std::enable_if::value, std::basic_ostream&>::type operator << (std::basic_ostream& ostr, const streamable_medium&) { return ostr << streamable_medium::value; } template -typename boost::enable_if, std::basic_istream&>::type +typename std::enable_if::value, std::basic_istream&>::type operator >> (std::basic_istream& istr, const streamable_medium&) { int i; istr >> i; BOOST_TEST_EQ(i, streamable_medium::value); return istr; @@ -41,12 +42,12 @@ operator >> (std::basic_istream& istr, const streamable_medium&) { struct streamable_hard { enum ENU {value = 2}; }; template -typename boost::enable_if, std::basic_ostream&>::type +typename std::enable_if::value, std::basic_ostream&>::type operator << (std::basic_ostream& ostr, const streamable_hard&) { return ostr << streamable_hard::value; } template -typename boost::enable_if, std::basic_istream&>::type +typename std::enable_if::value, std::basic_istream&>::type operator >> (std::basic_istream& istr, const streamable_hard&) { int i; istr >> i; BOOST_TEST_EQ(i, streamable_hard::value); return istr; @@ -77,12 +78,12 @@ std::wistream& operator >> (std::wistream& istr, const wstreamable_easy&) { struct wstreamable_medium { enum ENU {value = 5}; }; template -typename boost::enable_if, std::basic_ostream& >::type +typename std::enable_if::value, std::basic_ostream& >::type operator << (std::basic_ostream& ostr, const wstreamable_medium&) { return ostr << wstreamable_medium::value; } template -typename boost::enable_if, std::basic_istream& >::type +typename std::enable_if::value, std::basic_istream& >::type operator >> (std::basic_istream& istr, const wstreamable_medium&) { int i; istr >> i; BOOST_TEST_EQ(i, wstreamable_medium::value); return istr; @@ -90,12 +91,12 @@ operator >> (std::basic_istream& istr, const wstreamable_medium&) { struct wstreamable_hard { enum ENU {value = 6}; }; template -typename boost::enable_if, std::basic_ostream&>::type +typename std::enable_if::value, std::basic_ostream&>::type operator << (std::basic_ostream& ostr, const wstreamable_hard&) { return ostr << wstreamable_hard::value; } template -typename boost::enable_if, std::basic_istream&>::type +typename std::enable_if::value, std::basic_istream&>::type operator >> (std::basic_istream& istr, const wstreamable_hard&) { int i; istr >> i; BOOST_TEST_EQ(i, wstreamable_hard::value); return istr; diff --git a/test/stream_traits_test.cpp b/test/stream_traits_test.cpp index 40336d7..0d1aff5 100644 --- a/test/stream_traits_test.cpp +++ b/test/stream_traits_test.cpp @@ -13,11 +13,13 @@ #include #include +#include + template -struct is_optimized_stream : boost::false_type {}; +struct is_optimized_stream : std::false_type {}; template -struct is_optimized_stream< boost::detail::lcast::optimized_src_stream > : boost::true_type {}; +struct is_optimized_stream< boost::detail::lcast::optimized_src_stream > : std::true_type {}; template static void assert_optimized_stream() @@ -32,21 +34,21 @@ static void test_optimized_types_to_string_const() { namespace de = boost::detail; typedef de::lexical_cast_stream_traits trait_1; - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); assert_optimized_stream(); assert_optimized_stream(); typedef de::lexical_cast_stream_traits trait_2; - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); typedef de::lexical_cast_stream_traits trait_3; - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); assert_optimized_stream(); assert_optimized_stream(); } @@ -59,20 +61,20 @@ static void test_optimized_types_to_string() namespace de = boost::detail; typedef de::lexical_cast_stream_traits trait_4; - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); assert_optimized_stream(); typedef de::lexical_cast_stream_traits trait_5; - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); typedef de::lexical_cast_stream_traits trait_6; - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); - BOOST_TEST((boost::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); + BOOST_TEST((std::is_same::value)); }