diff --git a/CMakeLists.txt b/CMakeLists.txt index 17103a3..3a46e67 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,15 +14,12 @@ target_include_directories(boost_lexical_cast INTERFACE include) target_link_libraries(boost_lexical_cast INTERFACE - Boost::array - Boost::assert Boost::config Boost::container Boost::core Boost::integer Boost::numeric_conversion Boost::range - Boost::static_assert Boost::throw_exception Boost::type_traits ) diff --git a/doc/lexical_cast.qbk b/doc/lexical_cast.qbk index 5e26ff3..221b0a4 100644 --- a/doc/lexical_cast.qbk +++ b/doc/lexical_cast.qbk @@ -235,6 +235,10 @@ limitation of compiler options that you use. [section Changes] +* [*boost 1.84.0 :] + + * Dropped support of C++98 and C++03. + * [*boost 1.56.0 :] * Added `boost::conversion::try_lexical_convert` functions. diff --git a/example/generic_stringize.cpp b/example/generic_stringize.cpp index c8c8737..dfe4eef 100644 --- a/example/generic_stringize.cpp +++ b/example/generic_stringize.cpp @@ -47,11 +47,11 @@ std::string stringize(const Sequence& seq) { } //` Step 3: Using the `stringize` with different types: -#include +#include #include int main() { - boost::tuple decim('-', 10, 'e', 5); + std::tuple decim('-', 10, 'e', 5); if (stringize(decim) != "-10e5") { return 1; } diff --git a/example/small_examples.cpp b/example/small_examples.cpp index 33d32d4..13aba4b 100644 --- a/example/small_examples.cpp +++ b/example/small_examples.cpp @@ -5,6 +5,8 @@ // or a copy at .) #include + +#include #include #include @@ -30,9 +32,9 @@ void log_errno(int yoko) void number_to_file(int number, std::FILE* file) { - typedef boost::array buf_t; // You can use std::array if your compiler supports it + using buf_t = std::array; buf_t buffer = boost::lexical_cast(number); // No dynamic memory allocation - std::fputs(buffer.begin(), file); + std::fputs(buffer.data(), file); } //] [/lexical_cast_fixed_buffer] diff --git a/include/boost/detail/basic_pointerbuf.hpp b/include/boost/detail/basic_pointerbuf.hpp index a92a489..424dcac 100644 --- a/include/boost/detail/basic_pointerbuf.hpp +++ b/include/boost/detail/basic_pointerbuf.hpp @@ -42,13 +42,8 @@ public: basic_pointerbuf() : base_type() { this_type::setbuf(0, 0); } const charT* getnext() { return this->gptr(); } -#ifndef BOOST_NO_USING_TEMPLATE using base_type::pptr; using base_type::pbase; -#else - charT* pptr() const { return base_type::pptr(); } - charT* pbase() const { return base_type::pbase(); } -#endif protected: // VC mistakenly assumes that `setbuf` and other functions are not referenced. diff --git a/include/boost/detail/lcast_precision.hpp b/include/boost/detail/lcast_precision.hpp index 84bf122..dadf9c9 100644 --- a/include/boost/detail/lcast_precision.hpp +++ b/include/boost/detail/lcast_precision.hpp @@ -21,23 +21,10 @@ #include #endif -#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || \ - (defined(BOOST_MSVC) && (BOOST_MSVC<1310)) - -#define BOOST_LCAST_NO_COMPILE_TIME_PRECISION -#endif - -#ifdef BOOST_LCAST_NO_COMPILE_TIME_PRECISION -#include -#else -#include -#endif - namespace boost { namespace detail { class lcast_abstract_stub {}; -#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION // Calculate an argument to pass to std::ios_base::precision from // lexical_cast. See alternative implementation for broken standard // libraries in lcast_get_precision below. Keep them in sync, please. @@ -47,7 +34,7 @@ struct lcast_precision #ifdef BOOST_NO_IS_ABSTRACT typedef std::numeric_limits limits; // No fix for SF:1358600. #else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< boost::is_abstract::value , std::numeric_limits , std::numeric_limits @@ -74,95 +61,31 @@ struct lcast_precision BOOST_STATIC_CONSTANT(unsigned int, precision_dec = limits::digits10 + 1U); - BOOST_STATIC_ASSERT(!is_specialized_dec || + static_assert(!is_specialized_dec || precision_dec <= streamsize_max + 0UL - ); + , ""); BOOST_STATIC_CONSTANT(unsigned long, precision_bin = 2UL + limits::digits * 30103UL / 100000UL ); - BOOST_STATIC_ASSERT(!is_specialized_bin || + static_assert(!is_specialized_bin || (limits::digits + 0UL < ULONG_MAX / 30103UL && precision_bin > limits::digits10 + 0UL && precision_bin <= streamsize_max + 0UL) - ); + , ""); BOOST_STATIC_CONSTANT(std::streamsize, value = is_specialized_bin ? precision_bin : is_specialized_dec ? precision_dec : 6 ); }; -#endif + template inline std::streamsize lcast_get_precision(T* = 0) { -#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION return lcast_precision::value; -#else // Follow lcast_precision algorithm at run-time: - -#ifdef BOOST_NO_IS_ABSTRACT - typedef std::numeric_limits limits; // No fix for SF:1358600. -#else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< - boost::is_abstract::value - , std::numeric_limits - , std::numeric_limits - >::type limits; -#endif - - bool const use_default_precision = - !limits::is_specialized || limits::is_exact; - - if(!use_default_precision) - { // Includes all built-in floating-point types, float, double ... - // and UDT types for which digits (significand bits) is defined (not zero) - - bool const is_specialized_bin = - limits::radix == 2 && limits::digits > 0; - bool const is_specialized_dec = - limits::radix == 10 && limits::digits10 > 0; - std::streamsize const streamsize_max = - (boost::integer_traits::max)(); - (void)streamsize_max; - - if(is_specialized_bin) - { // Floating-point types with - // limits::digits defined by the specialization. - - unsigned long const digits = limits::digits; - unsigned long const precision = 2UL + digits * 30103UL / 100000UL; - // unsigned long is selected because it is at least 32-bits - // and thus ULONG_MAX / 30103UL is big enough for all types. - BOOST_ASSERT( - digits < ULONG_MAX / 30103UL && - precision > limits::digits10 + 0UL && - precision <= streamsize_max + 0UL - ); - return precision; - } - else if(is_specialized_dec) - { // Decimal Floating-point type, most likely a User Defined Type - // rather than a real floating-point hardware type. - unsigned int const precision = limits::digits10 + 1U; - BOOST_ASSERT(precision <= streamsize_max + 0UL); - return precision; - } - } - - // Integral type (for which precision has no effect) - // or type T for which limits is NOT specialized, - // so assume stream precision remains the default 6 decimal digits. - // Warning: if your User-defined Floating-point type T is NOT specialized, - // then you may lose accuracy by only using 6 decimal digits. - // To avoid this, you need to specialize T with either - // radix == 2 and digits == the number of significand bits, - // OR - // radix = 10 and digits10 == the number of decimal digits. - - return 6; -#endif } template diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 2c8b773..f8adc4f 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -23,24 +23,6 @@ # pragma once #endif -#include -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ - defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) || \ - defined(BOOST_NO_CXX11_CONSTEXPR) || \ - defined(BOOST_NO_CXX11_NULLPTR) || \ - defined(BOOST_NO_CXX11_NOEXCEPT) || \ - defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || \ - defined(BOOST_NO_CXX11_FINAL) || \ - defined(BOOST_NO_CXX11_ALIGNOF) || \ - defined(BOOST_NO_CXX11_STATIC_ASSERT) || \ - defined(BOOST_NO_CXX11_SMART_PTR) || \ - defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) || \ - defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) - -BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.LexicalCast 1.82 and will be removed in Boost.LexicalCast 1.84.") - -#endif - #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) #define BOOST_LCAST_NO_WCHAR_T #endif @@ -96,7 +78,6 @@ namespace boost ); } #endif -#ifndef BOOST_NO_CXX11_CHAR16_T template inline Target lexical_cast(const char16_t* chars, std::size_t count) { @@ -104,8 +85,6 @@ namespace boost ::boost::iterator_range(chars, chars + count) ); } -#endif -#ifndef BOOST_NO_CXX11_CHAR32_T template inline Target lexical_cast(const char32_t* chars, std::size_t count) { @@ -113,7 +92,6 @@ namespace boost ::boost::iterator_range(chars, chars + count) ); } -#endif } // namespace boost diff --git a/include/boost/lexical_cast/bad_lexical_cast.hpp b/include/boost/lexical_cast/bad_lexical_cast.hpp index 07ae40c..3854f5f 100644 --- a/include/boost/lexical_cast/bad_lexical_cast.hpp +++ b/include/boost/lexical_cast/bad_lexical_cast.hpp @@ -37,29 +37,23 @@ namespace boost #else public std::bad_cast #endif - -#if defined(BOOST_BORLANDC) && BOOST_WORKAROUND( BOOST_BORLANDC, < 0x560 ) - // under bcc32 5.5.1 bad_cast doesn't derive from exception - , public std::exception -#endif - { public: - bad_lexical_cast() BOOST_NOEXCEPT + bad_lexical_cast() noexcept #ifndef BOOST_NO_TYPEID : source(&typeid(void)), target(&typeid(void)) #endif {} - const char *what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { + const char *what() const noexcept override { return "bad lexical cast: " "source type value could not be interpreted as target"; } - ~bad_lexical_cast() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE = default; + ~bad_lexical_cast() override = default; - bad_lexical_cast(const bad_lexical_cast&) BOOST_NOEXCEPT_OR_NOTHROW = default; - bad_lexical_cast& operator=(const bad_lexical_cast&) BOOST_NOEXCEPT_OR_NOTHROW = default; + bad_lexical_cast(const bad_lexical_cast&) = default; + bad_lexical_cast& operator=(const bad_lexical_cast&) = default; #ifndef BOOST_NO_TYPEID private: @@ -71,15 +65,15 @@ namespace boost public: bad_lexical_cast( const type_info_t &source_type_arg, - const type_info_t &target_type_arg) BOOST_NOEXCEPT + const type_info_t &target_type_arg) noexcept : source(&source_type_arg), target(&target_type_arg) {} - const type_info_t &source_type() const BOOST_NOEXCEPT { + const type_info_t &source_type() const noexcept { return *source; } - const type_info_t &target_type() const BOOST_NOEXCEPT { + const type_info_t &target_type() const noexcept { return *target; } diff --git a/include/boost/lexical_cast/detail/converter_lexical.hpp b/include/boost/lexical_cast/detail/converter_lexical.hpp index 39b2bbf..7ba548d 100644 --- a/include/boost/lexical_cast/detail/converter_lexical.hpp +++ b/include/boost/lexical_cast/detail/converter_lexical.hpp @@ -37,17 +37,13 @@ #include #include #include -#include #include #include #include -#ifndef BOOST_NO_CXX11_HDR_ARRAY #include -#endif -#include #include #include @@ -55,6 +51,10 @@ namespace boost { + // Forward declaration + template + class array; + namespace detail // normalize_single_byte_char { // Converts signed/unsigned char to char @@ -190,7 +190,7 @@ namespace boost { template < class Char > struct deduce_source_char_impl { - typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type; + typedef typename boost::detail::normalize_single_byte_char< Char >::type type; }; template < class T > @@ -199,15 +199,15 @@ namespace boost { typedef boost::has_left_shift< std::basic_ostream< char >, T > result_t; #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), + static_assert(result_t::value, "Source type is not std::ostream`able and std::wostream`s are not supported by your STL implementation"); typedef char type; #else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< result_t::value, char, wchar_t >::type type; - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_left_shift< std::basic_ostream< type >, T >::value), + static_assert(result_t::value || boost::has_left_shift< std::basic_ostream< type >, T >::value, "Source type is neither std::ostream`able nor std::wostream`able"); #endif }; @@ -223,7 +223,7 @@ namespace boost { template < class Char > struct deduce_target_char_impl { - typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type; + typedef typename normalize_single_byte_char< Char >::type type; }; template < class T > @@ -232,15 +232,15 @@ namespace boost { typedef boost::has_right_shift, T > result_t; #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), + static_assert(result_t::value, "Target type is not std::istream`able and std::wistream`s are not supported by your STL implementation"); typedef char type; #else - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< result_t::value, char, wchar_t >::type type; - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift, T >::value), + static_assert(result_t::value || boost::has_right_shift, T >::value, "Target type is neither std::istream`able nor std::wistream`able"); #endif }; @@ -266,8 +266,8 @@ namespace boost { template < class T > struct deduce_target_char { - typedef BOOST_DEDUCED_TYPENAME stream_char_common< T >::type stage1_type; - typedef BOOST_DEDUCED_TYPENAME deduce_target_char_impl< stage1_type >::type stage2_type; + typedef typename stream_char_common< T >::type stage1_type; + typedef typename deduce_target_char_impl< stage1_type >::type stage2_type; typedef stage2_type type; }; @@ -275,8 +275,8 @@ namespace boost { template < class T > struct deduce_source_char { - typedef BOOST_DEDUCED_TYPENAME stream_char_common< T >::type stage1_type; - typedef BOOST_DEDUCED_TYPENAME deduce_source_char_impl< stage1_type >::type stage2_type; + typedef typename stream_char_common< T >::type stage1_type; + typedef typename deduce_source_char_impl< stage1_type >::type stage2_type; typedef stage2_type type; }; @@ -349,7 +349,7 @@ namespace boost { // When is_specialized is false, the whole expression is 0. template struct lcast_src_length< - Source, BOOST_DEDUCED_TYPENAME boost::enable_if >::type + Source, typename boost::enable_if >::type > { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS @@ -360,7 +360,7 @@ namespace boost { ); #else BOOST_STATIC_CONSTANT(std::size_t, value = 156); - BOOST_STATIC_ASSERT(sizeof(Source) * CHAR_BIT <= 256); + static_assert(sizeof(Source) * CHAR_BIT <= 256, ""); #endif }; @@ -376,15 +376,15 @@ namespace boost { // sign + leading digit + decimal point + "e" + exponent sign == 5 template struct lcast_src_length< - Source, BOOST_DEDUCED_TYPENAME boost::enable_if >::type + Source, typename boost::enable_if >::type > { #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION - BOOST_STATIC_ASSERT( + static_assert( std::numeric_limits::max_exponent10 <= 999999L && std::numeric_limits::min_exponent10 >= -999999L - ); + , ""); BOOST_STATIC_CONSTANT(std::size_t, value = 5 + lcast_precision::value + 6 @@ -399,32 +399,32 @@ namespace boost { { template struct lexical_cast_stream_traits { - typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay::type src; - typedef BOOST_DEDUCED_TYPENAME boost::remove_cv::type no_cv_src; + typedef typename boost::detail::array_to_pointer_decay::type src; + typedef typename boost::remove_cv::type no_cv_src; typedef boost::detail::deduce_source_char deduce_src_char_metafunc; - typedef BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::type src_char_t; - typedef BOOST_DEDUCED_TYPENAME boost::detail::deduce_target_char::type target_char_t; + typedef typename deduce_src_char_metafunc::type src_char_t; + typedef typename boost::detail::deduce_target_char::type target_char_t; - typedef BOOST_DEDUCED_TYPENAME boost::detail::widest_char< + typedef typename boost::detail::widest_char< target_char_t, src_char_t >::type char_type; #if !defined(BOOST_NO_CXX11_CHAR16_T) && defined(BOOST_NO_CXX11_UNICODE_LITERALS) - BOOST_STATIC_ASSERT_MSG(( !boost::is_same::value - && !boost::is_same::value), + static_assert(!boost::is_same::value + && !boost::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) - BOOST_STATIC_ASSERT_MSG(( !boost::is_same::value - && !boost::is_same::value), + static_assert(!boost::is_same::value + && !boost::is_same::value, "Your compiler does not have full support for char32_t" ); #endif - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< boost::detail::extract_char_traits::value, - BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits, - BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits + typename boost::detail::extract_char_traits, + typename boost::detail::extract_char_traits >::type::trait_t traits; typedef boost::integral_constant< @@ -438,7 +438,7 @@ namespace boost { bool, !(boost::is_integral::value || boost::detail::is_character< - BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::stage1_type // if we did not get character type at stage1 + 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 ) > is_source_input_not_optimized_t; @@ -461,15 +461,15 @@ namespace boost { typedef lexical_cast_stream_traits stream_trait; typedef detail::lexical_istream_limited_src< - BOOST_DEDUCED_TYPENAME stream_trait::char_type, - BOOST_DEDUCED_TYPENAME stream_trait::traits, + typename stream_trait::char_type, + typename stream_trait::traits, stream_trait::requires_stringbuf, stream_trait::len_t::value + 1 > i_interpreter_type; typedef detail::lexical_ostream_limited_src< - BOOST_DEDUCED_TYPENAME stream_trait::char_type, - BOOST_DEDUCED_TYPENAME stream_trait::traits + typename stream_trait::char_type, + typename stream_trait::traits > o_interpreter_type; static inline bool try_convert(const Source& arg, Target& result) { diff --git a/include/boost/lexical_cast/detail/converter_lexical_streams.hpp b/include/boost/lexical_cast/detail/converter_lexical_streams.hpp index 04383bf..430e373 100644 --- a/include/boost/lexical_cast/detail/converter_lexical_streams.hpp +++ b/include/boost/lexical_cast/detail/converter_lexical_streams.hpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -65,11 +64,8 @@ #include -#ifndef BOOST_NO_CXX11_HDR_ARRAY #include -#endif -#include #include #include #include @@ -84,6 +80,10 @@ namespace boost { + // Forward declaration + template + class array; + namespace detail // basic_unlockedbuf { // acts as a stream buffer which wraps around a pair of pointers @@ -92,7 +92,7 @@ namespace boost { class basic_unlockedbuf : public basic_pointerbuf { public: typedef basic_pointerbuf base_type; - typedef BOOST_DEDUCED_TYPENAME base_type::streamsize streamsize; + typedef typename base_type::streamsize streamsize; #ifndef BOOST_NO_USING_TEMPLATE using base_type::pptr; @@ -138,15 +138,15 @@ namespace boost { , std::size_t CharacterBufferSize > class lexical_istream_limited_src: boost::noncopyable { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< RequiresStringbuffer, - BOOST_DEDUCED_TYPENAME out_stream_helper_trait::out_stream_t, + typename out_stream_helper_trait::out_stream_t, do_not_construct_out_stream_t >::type deduced_out_stream_t; - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< RequiresStringbuffer, - BOOST_DEDUCED_TYPENAME out_stream_helper_trait::stringbuffer_t, + typename out_stream_helper_trait::stringbuffer_t, do_not_construct_out_buffer_t >::type deduced_out_buffer_t; @@ -160,24 +160,24 @@ namespace boost { const CharT* finish; public: - lexical_istream_limited_src() BOOST_NOEXCEPT + lexical_istream_limited_src() noexcept : out_buffer() , out_stream(&out_buffer) , start(buffer) , finish(buffer + CharacterBufferSize) {} - const CharT* cbegin() const BOOST_NOEXCEPT { + const CharT* cbegin() const noexcept { return start; } - const CharT* cend() const BOOST_NOEXCEPT { + const CharT* cend() const noexcept { return finish; } private: /************************************ HELPER FUNCTIONS FOR OPERATORS << ( ... ) ********************************/ - bool shl_char(CharT ch) BOOST_NOEXCEPT { + bool shl_char(CharT ch) noexcept { Traits::assign(buffer[0], ch); finish = start + 1; return true; @@ -186,7 +186,7 @@ namespace boost { #ifndef BOOST_LCAST_NO_WCHAR_T template bool shl_char(T ch) { - BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)) , + static_assert(sizeof(T) <= sizeof(CharT), "boost::lexical_cast does not support narrowing of char types." "Use boost::locale instead" ); #ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE @@ -201,7 +201,7 @@ namespace boost { } #endif - bool shl_char_array(CharT const* str_value) BOOST_NOEXCEPT { + bool shl_char_array(CharT const* str_value) noexcept { start = str_value; finish = start + Traits::length(str_value); return true; @@ -209,13 +209,13 @@ namespace boost { template bool shl_char_array(T const* str_value) { - BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)), + static_assert(sizeof(T) <= sizeof(CharT), "boost::lexical_cast does not support narrowing of char types." "Use boost::locale instead" ); return shl_input_streamable(str_value); } - bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT { + bool shl_char_array_limited(CharT const* str, std::size_t max_size) noexcept { start = str; finish = std::find(start, start + max_size, Traits::to_char_type(0)); return true; @@ -226,7 +226,7 @@ namespace boost { #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. - BOOST_STATIC_ASSERT((boost::is_same::value)); + static_assert(boost::is_same::value, ""); #endif #ifndef BOOST_NO_EXCEPTIONS @@ -258,7 +258,7 @@ namespace boost { template inline bool shl_signed(const T n) { CharT* tmp_finish = buffer + CharacterBufferSize; - typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned::type utype; + typedef typename boost::make_unsigned::type utype; CharT* tmp_start = lcast_put_unsigned(lcast_to_unsigned(n), tmp_finish).convert(); if (n < 0) { --tmp_start; @@ -343,20 +343,20 @@ namespace boost { /************************************ OPERATORS << ( ... ) ********************************/ public: template - bool operator<<(std::basic_string const& str) BOOST_NOEXCEPT { + bool operator<<(std::basic_string const& str) noexcept { start = str.data(); finish = start + str.length(); return true; } template - bool operator<<(boost::container::basic_string const& str) BOOST_NOEXCEPT { + bool operator<<(boost::container::basic_string const& str) noexcept { start = str.data(); finish = start + str.length(); return true; } - bool operator<<(bool value) BOOST_NOEXCEPT { + bool operator<<(bool value) noexcept { CharT const czero = lcast_char_constants::zero; Traits::assign(buffer[0], Traits::to_char_type(czero + value)); finish = start + 1; @@ -364,25 +364,25 @@ namespace boost { } template - BOOST_DEDUCED_TYPENAME boost::disable_if, bool>::type - operator<<(const iterator_range& rng) BOOST_NOEXCEPT { + typename boost::disable_if, bool>::type + operator<<(const iterator_range& rng) noexcept { return (*this) << iterator_range(rng.begin(), rng.end()); } - bool operator<<(const iterator_range& rng) BOOST_NOEXCEPT { + bool operator<<(const iterator_range& rng) noexcept { start = rng.begin(); finish = rng.end(); return true; } - bool operator<<(const iterator_range& rng) BOOST_NOEXCEPT { + bool operator<<(const iterator_range& rng) noexcept { return (*this) << iterator_range( reinterpret_cast(rng.begin()), reinterpret_cast(rng.end()) ); } - bool operator<<(const iterator_range& rng) BOOST_NOEXCEPT { + bool operator<<(const iterator_range& rng) noexcept { return (*this) << iterator_range( reinterpret_cast(rng.begin()), reinterpret_cast(rng.end()) @@ -446,36 +446,36 @@ namespace boost { // Adding constness to characters. Constness does not change layout template - BOOST_DEDUCED_TYPENAME boost::disable_if, bool>::type - operator<<(boost::array const& input) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - (sizeof(boost::array) == sizeof(boost::array)), + typename boost::disable_if, bool>::type + operator<<(boost::array const& input) noexcept { + static_assert( + sizeof(boost::array) == sizeof(boost::array), "boost::array and boost::array must have exactly the same layout." ); return ((*this) << reinterpret_cast const& >(input)); } template - bool operator<<(boost::array const& input) BOOST_NOEXCEPT { + bool operator<<(boost::array const& input) noexcept { return shl_char_array_limited(input.data(), N); } template - bool operator<<(boost::array const& input) BOOST_NOEXCEPT { + bool operator<<(boost::array const& input) noexcept { return ((*this) << reinterpret_cast const& >(input)); } template - bool operator<<(boost::array const& input) BOOST_NOEXCEPT { + bool operator<<(boost::array const& input) noexcept { return ((*this) << reinterpret_cast const& >(input)); } #ifndef BOOST_NO_CXX11_HDR_ARRAY // Making a Boost.Array from std::array template - bool operator<<(std::array const& input) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - (sizeof(std::array) == sizeof(boost::array)), + bool operator<<(std::array const& input) noexcept { + static_assert( + sizeof(std::array) == sizeof(boost::array), "std::array and boost::array must have exactly the same layout. " "Bug in implementation of std::array or boost::array." ); @@ -494,7 +494,7 @@ namespace boost { const CharT* const finish; public: - lexical_ostream_limited_src(const CharT* begin, const CharT* end) BOOST_NOEXCEPT + lexical_ostream_limited_src(const CharT* begin, const CharT* end) noexcept : start(begin) , finish(end) {} @@ -527,7 +527,7 @@ namespace boost { if (start == finish) return false; CharT const minus = lcast_char_constants::minus; CharT const plus = lcast_char_constants::plus; - typedef BOOST_DEDUCED_TYPENAME make_unsigned::type utype; + typedef typename make_unsigned::type utype; utype out_tmp = 0; bool const has_minus = Traits::eq(minus, *start); @@ -552,13 +552,13 @@ namespace boost { template bool shr_using_base_class(InputStreamable& output) { - BOOST_STATIC_ASSERT_MSG( - (!boost::is_pointer::value), + static_assert( + !boost::is_pointer::value, "boost::lexical_cast can not convert to pointers" ); #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) - BOOST_STATIC_ASSERT_MSG((boost::is_same::value), + static_assert(boost::is_same::value, "boost::lexical_cast can not convert, because your STL library does not " "support such conversions. Try updating it." ); @@ -567,7 +567,7 @@ namespace boost { #if defined(BOOST_NO_STRINGSTREAM) std::istrstream stream(start, static_cast(finish - start)); #else - typedef BOOST_DEDUCED_TYPENAME out_stream_helper_trait::buffer_t buffer_t; + typedef typename out_stream_helper_trait::buffer_t buffer_t; buffer_t buf; // Usually `istream` and `basic_istream` do not modify // content of buffer; `buffer_t` assures that this is true @@ -597,8 +597,8 @@ namespace boost { } template - inline bool shr_xchar(T& output) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG(( sizeof(CharT) == sizeof(T) ), + inline bool shr_xchar(T& output) noexcept { + static_assert(sizeof(CharT) == sizeof(T), "boost::lexical_cast does not support narrowing of character types." "Use boost::locale instead" ); bool const ok = (finish - start == 1); @@ -611,7 +611,7 @@ namespace boost { } template - bool shr_std_array(ArrayT& output) BOOST_NOEXCEPT { + bool shr_std_array(ArrayT& output) noexcept { using namespace std; const std::size_t size = static_cast(finish - start); if (size > N - 1) { // `-1` because we need to store \0 at the end @@ -667,32 +667,30 @@ namespace boost { } template - bool operator>>(boost::array& output) BOOST_NOEXCEPT { + bool operator>>(std::array& output) noexcept { return shr_std_array(output); } template - bool operator>>(boost::array& output) BOOST_NOEXCEPT { - return ((*this) >> reinterpret_cast& >(output)); + bool operator>>(std::array& output) noexcept { + return ((*this) >> reinterpret_cast& >(output)); } template - bool operator>>(boost::array& output) BOOST_NOEXCEPT { - return ((*this) >> reinterpret_cast& >(output)); + bool operator>>(std::array& output) noexcept { + return ((*this) >> reinterpret_cast& >(output)); } -#ifndef BOOST_NO_CXX11_HDR_ARRAY template - bool operator>>(std::array& output) BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT_MSG( - (sizeof(std::array) == sizeof(boost::array)), + bool operator>>(boost::array& output) noexcept { + static_assert( + sizeof(std::array) == sizeof(boost::array), "std::array and boost::array must have exactly the same layout." ); - return ((*this) >> reinterpret_cast& >(output)); + return ((*this) >> reinterpret_cast& >(output)); } -#endif - bool operator>>(bool& output) BOOST_NOEXCEPT { + bool operator>>(bool& output) noexcept { output = false; // Suppress warning about uninitalized variable if (start == finish) return false; diff --git a/include/boost/lexical_cast/detail/converter_numeric.hpp b/include/boost/lexical_cast/detail/converter_numeric.hpp index 853e254..a2c992d 100644 --- a/include/boost/lexical_cast/detail/converter_numeric.hpp +++ b/include/boost/lexical_cast/detail/converter_numeric.hpp @@ -43,11 +43,11 @@ struct detect_precision_loss { typedef Source source_type; typedef boost::numeric::Trunc Rounder; - typedef BOOST_DEDUCED_TYPENAME conditional< + typedef typename conditional< boost::is_arithmetic::value, Source, Source const& >::type argument_type ; - static inline source_type nearbyint(argument_type s, bool& is_ok) BOOST_NOEXCEPT { + static inline source_type nearbyint(argument_type s, bool& is_ok) noexcept { const source_type near_int = Rounder::nearbyint(s); if (near_int && is_ok) { const source_type orig_div_round = s / near_int; @@ -66,24 +66,24 @@ template struct fake_precision_loss: public Base { typedef Source source_type ; - typedef BOOST_DEDUCED_TYPENAME conditional< + typedef typename conditional< boost::is_arithmetic::value, Source, Source const& >::type argument_type ; - static inline source_type nearbyint(argument_type s, bool& /*is_ok*/) BOOST_NOEXCEPT { + static inline source_type nearbyint(argument_type s, bool& /*is_ok*/) noexcept { return s; } }; struct nothrow_overflow_handler { - inline bool operator() ( boost::numeric::range_check_result r ) const BOOST_NOEXCEPT { + inline bool operator() ( boost::numeric::range_check_result r ) const noexcept { return (r == boost::numeric::cInRange); } }; template -inline bool noexcept_numeric_convert(const Source& arg, Target& result) BOOST_NOEXCEPT { +inline bool noexcept_numeric_convert(const Source& arg, Target& result) noexcept { typedef boost::numeric::converter< Target, Source, @@ -92,7 +92,7 @@ inline bool noexcept_numeric_convert(const Source& arg, Target& result) BOOST_NO detect_precision_loss > converter_orig_t; - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< boost::is_base_of< detect_precision_loss, converter_orig_t >::value, converter_orig_t, fake_precision_loss @@ -109,7 +109,7 @@ inline bool noexcept_numeric_convert(const Source& arg, Target& result) BOOST_NO template struct lexical_cast_dynamic_num_not_ignoring_minus { - static inline bool try_convert(const Source &arg, Target& result) BOOST_NOEXCEPT { + static inline bool try_convert(const Source &arg, Target& result) noexcept { return noexcept_numeric_convert(arg, result); } }; @@ -117,13 +117,13 @@ struct lexical_cast_dynamic_num_not_ignoring_minus template struct lexical_cast_dynamic_num_ignoring_minus { - static inline bool try_convert(const Source &arg, Target& result) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + static inline bool try_convert(const Source &arg, Target& result) noexcept { + typedef typename boost::conditional< boost::is_float::value, boost::type_identity, boost::make_unsigned >::type usource_lazy_t; - typedef BOOST_DEDUCED_TYPENAME usource_lazy_t::type usource_t; + typedef typename usource_lazy_t::type usource_t; if (arg < 0) { const bool res = noexcept_numeric_convert(0u - arg, result); @@ -156,10 +156,10 @@ struct lexical_cast_dynamic_num_ignoring_minus template struct dynamic_num_converter_impl { - typedef BOOST_DEDUCED_TYPENAME boost::remove_volatile::type source_type; + typedef typename boost::remove_volatile::type source_type; - static inline bool try_convert(source_type arg, Target& result) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + static inline bool try_convert(source_type arg, Target& result) noexcept { + typedef typename boost::conditional< boost::is_unsigned::value && (boost::is_signed::value || boost::is_float::value) && !(boost::is_same::value) && diff --git a/include/boost/lexical_cast/detail/inf_nan.hpp b/include/boost/lexical_cast/detail/inf_nan.hpp index ef53e52..a9f92b2 100644 --- a/include/boost/lexical_cast/detail/inf_nan.hpp +++ b/include/boost/lexical_cast/detail/inf_nan.hpp @@ -39,7 +39,7 @@ namespace boost { namespace detail { template - bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) BOOST_NOEXCEPT { + bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) noexcept { for( unsigned int i=0; i < len; ++i ) { if ( val[i] != lcase[i] && val[i] != ucase[i] ) return false; } @@ -52,7 +52,7 @@ namespace boost { inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value , const CharT* lc_NAN, const CharT* lc_nan , const CharT* lc_INFINITY, const CharT* lc_infinity - , const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT + , const CharT opening_brace, const CharT closing_brace) noexcept { if (begin == end) return false; const CharT minus = lcast_char_constants::minus; @@ -102,7 +102,7 @@ namespace boost { template bool put_inf_nan_impl(CharT* begin, CharT*& end, const T& value , const CharT* lc_nan - , const CharT* lc_infinity) BOOST_NOEXCEPT + , const CharT* lc_infinity) noexcept { const CharT minus = lcast_char_constants::minus; if (boost::core::isnan(value)) { @@ -131,7 +131,7 @@ namespace boost { #ifndef BOOST_LCAST_NO_WCHAR_T template - bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , L"NAN", L"nan" , L"INFINITY", L"infinity" @@ -139,14 +139,14 @@ namespace boost { } template - bool put_inf_nan(wchar_t* begin, wchar_t*& end, const T& value) BOOST_NOEXCEPT { + bool put_inf_nan(wchar_t* begin, wchar_t*& end, const T& value) noexcept { return put_inf_nan_impl(begin, end, value, L"nan", L"infinity"); } #endif #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) template - bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , u"NAN", u"nan" , u"INFINITY", u"infinity" @@ -154,13 +154,13 @@ namespace boost { } template - bool put_inf_nan(char16_t* begin, char16_t*& end, const T& value) BOOST_NOEXCEPT { + bool put_inf_nan(char16_t* begin, char16_t*& end, const T& value) noexcept { return put_inf_nan_impl(begin, end, value, u"nan", u"infinity"); } #endif #if !defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) template - bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , U"NAN", U"nan" , U"INFINITY", U"infinity" @@ -168,13 +168,13 @@ namespace boost { } template - bool put_inf_nan(char32_t* begin, char32_t*& end, const T& value) BOOST_NOEXCEPT { + bool put_inf_nan(char32_t* begin, char32_t*& end, const T& value) noexcept { return put_inf_nan_impl(begin, end, value, U"nan", U"infinity"); } #endif template - bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) BOOST_NOEXCEPT { + bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) noexcept { return parse_inf_nan_impl(begin, end, value , "NAN", "nan" , "INFINITY", "infinity" @@ -182,7 +182,7 @@ namespace boost { } template - bool put_inf_nan(CharT* begin, CharT*& end, const T& value) BOOST_NOEXCEPT { + bool put_inf_nan(CharT* begin, CharT*& end, const T& value) noexcept { return put_inf_nan_impl(begin, end, value, "nan", "infinity"); } } diff --git a/include/boost/lexical_cast/detail/is_character.hpp b/include/boost/lexical_cast/detail/is_character.hpp index 176dd3d..c0e4929 100644 --- a/include/boost/lexical_cast/detail/is_character.hpp +++ b/include/boost/lexical_cast/detail/is_character.hpp @@ -34,7 +34,7 @@ namespace boost { template < typename T > struct is_character { - typedef BOOST_DEDUCED_TYPENAME boost::integral_constant< + typedef typename boost::integral_constant< bool, boost::is_same< T, char >::value || #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) diff --git a/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp index e4a581e..cfb0c2e 100644 --- a/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +++ b/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp @@ -30,7 +30,6 @@ #include #include #include -#include #include @@ -58,8 +57,8 @@ namespace boost { template inline - BOOST_DEDUCED_TYPENAME boost::make_unsigned::type lcast_to_unsigned(const T value) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned::type result_type; + typename boost::make_unsigned::type lcast_to_unsigned(const T value) noexcept { + typedef typename boost::make_unsigned::type result_type; return value < 0 ? static_cast(0u - static_cast(value)) : static_cast(value); @@ -70,8 +69,8 @@ namespace boost { template class lcast_put_unsigned: boost::noncopyable { - typedef BOOST_DEDUCED_TYPENAME Traits::int_type int_type; - BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename Traits::int_type int_type; + typename boost::conditional< (sizeof(unsigned) > sizeof(T)) , unsigned , T @@ -81,12 +80,12 @@ namespace boost int_type const m_zero; public: - lcast_put_unsigned(const T n_param, CharT* finish) BOOST_NOEXCEPT + lcast_put_unsigned(const T n_param, CharT* finish) noexcept : m_value(n_param), m_finish(finish) , m_czero(lcast_char_constants::zero), m_zero(Traits::to_int_type(m_czero)) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); + static_assert(!std::numeric_limits::is_signed, ""); #endif } @@ -108,7 +107,7 @@ namespace boost #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS // Check that ulimited group is unreachable: - BOOST_STATIC_ASSERT(std::numeric_limits::digits10 < CHAR_MAX); + static_assert(std::numeric_limits::digits10 < CHAR_MAX, ""); #endif CharT const thousands_sep = np.thousands_sep(); std::string::size_type group = 0; // current group number @@ -138,7 +137,7 @@ namespace boost } private: - inline bool main_convert_iteration() BOOST_NOEXCEPT { + inline bool main_convert_iteration() noexcept { --m_finish; int_type const digit = static_cast(m_value % 10U); Traits::assign(*m_finish, Traits::to_char_type(m_zero + digit)); @@ -146,7 +145,7 @@ namespace boost return !!m_value; // suppressing warnings } - inline CharT* main_convert_loop() BOOST_NOEXCEPT { + inline CharT* main_convert_loop() noexcept { while (main_convert_iteration()); return m_finish; } @@ -164,18 +163,18 @@ namespace boost const CharT* m_end; public: - lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) BOOST_NOEXCEPT + lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) noexcept : m_multiplier_overflowed(false), m_multiplier(1), m_value(value), m_begin(begin), m_end(end) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(!std::numeric_limits::is_signed); + static_assert(!std::numeric_limits::is_signed, ""); // GCC when used with flag -std=c++0x may not have std::numeric_limits // specializations for __int128 and unsigned __int128 types. // Try compilation with -std=gnu++0x or -std=gnu++11. // // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40856 - BOOST_STATIC_ASSERT_MSG(std::numeric_limits::is_specialized, + static_assert(std::numeric_limits::is_specialized, "std::numeric_limits are not specialized for integral type passed to boost::lexical_cast" ); #endif @@ -252,7 +251,7 @@ namespace boost private: // Iteration that does not care about grouping/separators and assumes that all // input characters are digits - inline bool main_convert_iteration() BOOST_NOEXCEPT { + inline bool main_convert_iteration() noexcept { CharT const czero = lcast_char_constants::zero; T const maxv = (std::numeric_limits::max)(); @@ -277,7 +276,7 @@ namespace boost return true; } - bool main_convert_loop() BOOST_NOEXCEPT { + bool main_convert_loop() noexcept { for ( ; m_end >= m_begin; --m_end) { if (!main_convert_iteration()) { return false; diff --git a/include/boost/lexical_cast/detail/widest_char.hpp b/include/boost/lexical_cast/detail/widest_char.hpp index ca1e39d..f7a36fa 100644 --- a/include/boost/lexical_cast/detail/widest_char.hpp +++ b/include/boost/lexical_cast/detail/widest_char.hpp @@ -30,7 +30,7 @@ namespace boost { namespace detail { template struct widest_char { - typedef BOOST_DEDUCED_TYPENAME boost::conditional< + typedef typename boost::conditional< (sizeof(TargetChar) > sizeof(SourceChar)) , TargetChar , SourceChar diff --git a/include/boost/lexical_cast/lexical_cast_old.hpp b/include/boost/lexical_cast/lexical_cast_old.hpp index b7b7358..28248d9 100644 --- a/include/boost/lexical_cast/lexical_cast_old.hpp +++ b/include/boost/lexical_cast/lexical_cast_old.hpp @@ -34,7 +34,6 @@ #include #include #include -#include #include #include @@ -154,8 +153,8 @@ namespace boost { Target lexical_cast(Source arg) { typedef typename detail::widest_char< - BOOST_DEDUCED_TYPENAME detail::stream_char::type - , BOOST_DEDUCED_TYPENAME detail::stream_char::type + typename detail::stream_char::type + , typename detail::stream_char::type >::type char_type; typedef std::char_traits traits; diff --git a/include/boost/lexical_cast/try_lexical_convert.hpp b/include/boost/lexical_cast/try_lexical_convert.hpp index d326f12..3c0d36d 100644 --- a/include/boost/lexical_cast/try_lexical_convert.hpp +++ b/include/boost/lexical_cast/try_lexical_convert.hpp @@ -164,7 +164,7 @@ namespace boost { template inline bool try_lexical_convert(const Source& arg, Target& result) { - typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay::type src; + typedef typename boost::detail::array_to_pointer_decay::type src; typedef boost::integral_constant< bool, @@ -186,7 +186,7 @@ namespace boost { // 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::conditional< + typedef typename boost::conditional< shall_we_copy_t::value, boost::type_identity >, boost::conditional< @@ -196,7 +196,7 @@ namespace boost { > >::type caster_type_lazy; - typedef BOOST_DEDUCED_TYPENAME caster_type_lazy::type caster_type; + typedef typename caster_type_lazy::type caster_type; return caster_type::try_convert(arg, result); } @@ -204,7 +204,7 @@ namespace boost { template inline bool try_lexical_convert(const CharacterT* chars, std::size_t count, Target& result) { - BOOST_STATIC_ASSERT_MSG( + static_assert( boost::detail::is_character::value, "This overload of try_lexical_convert is meant to be used only with arrays of characters." ); diff --git a/meta/libraries.json b/meta/libraries.json index 7d73efc..150c515 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -12,5 +12,5 @@ "maintainers": [ "Antony Polukhin " ], - "cxxstd": "03" + "cxxstd": "11" } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 71b163e..d24373d 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -8,9 +8,11 @@ import testing ; import feature ; +import ../../config/checks/config : requires ; + project : requirements - /boost/test//boost_unit_test_framework + [ requires cxx11_rvalue_references ] static gcc-4.7:-ftrapv gcc-4.6:-ftrapv @@ -64,9 +66,6 @@ test-suite conversion [ compile-fail to_pointer_test.cpp ] [ run filesystem_test.cpp ../../filesystem/build//boost_filesystem/static ] [ run try_lexical_convert.cpp ] - [ run no_comp_time_prcision.cpp : : : - msvc:/wd4127 # conditional expression is constant - ] ; # Assuring that examples compile and run. Adding sources from `example` directory to the `conversion` test suite. diff --git a/test/abstract_test.cpp b/test/abstract_test.cpp index ff1b2bb..3922ef1 100644 --- a/test/abstract_test.cpp +++ b/test/abstract_test.cpp @@ -3,6 +3,7 @@ // See http://www.boost.org for most recent version, including documentation. // // Copyright Sergey Shandar 2005, Alexander Nasonov, 2007. +// Copyright Antony Polukhin, 2023. // // Distributed under the Boost // Software License, Version 1.0. (See accompanying file @@ -11,29 +12,9 @@ // Test abstract class. Bug 1358600: // http://sf.net/tracker/?func=detail&aid=1358600&group_id=7586&atid=107586 -#include - -#if defined(__INTEL_COMPILER) -#pragma warning(disable: 193 383 488 981 1418 1419) -#elif defined(BOOST_MSVC) -#pragma warning(disable: 4097 4100 4121 4127 4146 4244 4245 4511 4512 4701 4800) -#endif - #include -#include -using namespace boost; - -void test_abstract(); - -unit_test::test_suite *init_unit_test_suite(int, char *[]) -{ - unit_test::test_suite *suite = - BOOST_TEST_SUITE("lexical_cast unit test"); - suite->add(BOOST_TEST_CASE(&test_abstract)); - - return suite; -} +#include class A { @@ -57,6 +38,12 @@ std::ostream &operator<<(std::ostream &O, const A &a) void test_abstract() { const A &a = B(); - BOOST_CHECK(boost::lexical_cast(a) == "B"); + BOOST_TEST(boost::lexical_cast(a) == "B"); +} + +int main() +{ + test_abstract(); + return boost::report_errors(); } diff --git a/test/arrays_test.cpp b/test/arrays_test.cpp index 41a207c..0f6e374 100644 --- a/test/arrays_test.cpp +++ b/test/arrays_test.cpp @@ -10,16 +10,10 @@ #include -#include +#include #include -void testing_boost_array_output_conversion(); -void testing_std_array_output_conversion(); - -void testing_boost_array_input_conversion(); -void testing_std_array_input_conversion(); - using namespace boost; #if !defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(_LIBCPP_VERSION) && !defined(BOOST_MSVC) @@ -30,19 +24,6 @@ using namespace boost; #define BOOST_LC_RUNU32 #endif -boost::unit_test::test_suite *init_unit_test_suite(int, char *[]) -{ - unit_test::test_suite *suite = - BOOST_TEST_SUITE("Testing boost::lexical_cast with boost::array and std::array"); - - suite->add(BOOST_TEST_CASE(testing_boost_array_output_conversion)); - suite->add(BOOST_TEST_CASE(testing_std_array_output_conversion)); - suite->add(BOOST_TEST_CASE(testing_boost_array_input_conversion)); - suite->add(BOOST_TEST_CASE(testing_std_array_input_conversion)); - - return suite; -} - template