diff options
| author | robot-contrib <[email protected]> | 2022-08-15 15:45:01 +0300 |
|---|---|---|
| committer | robot-contrib <[email protected]> | 2022-08-15 15:45:01 +0300 |
| commit | 961b7c6798905ce0489c11cb85ca64f8621c4209 (patch) | |
| tree | d0f7567dfe7e957cdcdf0ef8d5679898b3574b3b | |
| parent | 6ad0163d8a1e258b75889ed4e1143ab1301fc6b0 (diff) | |
Update contrib/restricted/boost/lexical_cast to 1.80.0
15 files changed, 525 insertions, 215 deletions
diff --git a/contrib/restricted/boost/core/include/boost/core/cmath.hpp b/contrib/restricted/boost/core/include/boost/core/cmath.hpp new file mode 100644 index 00000000000..a18c81b5819 --- /dev/null +++ b/contrib/restricted/boost/core/include/boost/core/cmath.hpp @@ -0,0 +1,298 @@ +#ifndef BOOST_CORE_CMATH_HPP_INCLUDED +#define BOOST_CORE_CMATH_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// boost/core/cmath.hpp +// +// Floating point classification and sign manipulation functions +// Extracted from https://github.com/boostorg/lexical_cast/pull/37 +// +// Copyright 2020, 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <cmath> + +#if defined(BOOST_CORE_USE_GENERIC_CMATH) || (!defined(_MSC_VER) && !defined(FP_SUBNORMAL)) + +#include <boost/cstdint.hpp> +#include <boost/static_assert.hpp> +#include <limits> +#include <cstring> + +namespace boost +{ +namespace core +{ + +// fpclassify return values + +int const fp_zero = 0; +int const fp_subnormal = 1; +int const fp_normal = 2; +int const fp_infinite = 3; +int const fp_nan = 4; + +// Classification functions + +template<class T> bool isfinite( T x ) +{ + return x <= (std::numeric_limits<T>::max)() && x >= -(std::numeric_limits<T>::max)(); +} + +template<class T> bool isinf( T x ) +{ + return x > (std::numeric_limits<T>::max)() || x < -(std::numeric_limits<T>::max)(); +} + +template<class T> bool isnan( T x ) +{ + return !isfinite( x ) && !isinf( x ); +} + +template<class T> bool isnormal( T x ) +{ + return isfinite( x ) && ( x >= (std::numeric_limits<T>::min)() || x <= -(std::numeric_limits<T>::min)() ); +} + +template<class T> int fpclassify( T x ) +{ + if( x == 0 ) return fp_zero; + + if( x < 0 ) x = -x; + + if( x > (std::numeric_limits<T>::max)() ) return fp_infinite; + + if( x >= (std::numeric_limits<T>::min)() ) return fp_normal; + + if( x < (std::numeric_limits<T>::min)() ) return fp_subnormal; + + return fp_nan; +} + +// Sign manipulation functions + +inline bool signbit( float x ) +{ + boost::int32_t y; + + BOOST_STATIC_ASSERT( sizeof( x ) == sizeof( y ) ); + + std::memcpy( &y, &x, sizeof( y ) ); + + return y < 0; +} + +inline bool signbit( double x ) +{ + boost::int64_t y; + + BOOST_STATIC_ASSERT( sizeof( x ) == sizeof( y ) ); + + std::memcpy( &y, &x, sizeof( y ) ); + + return y < 0; +} + +inline bool signbit( long double x ) +{ + return signbit( static_cast<double>( x ) ); +} + +template<class T> T copysign( T x, T y ) +{ + return signbit( x ) == signbit( y )? x: -x; +} + +} // namespace core +} // namespace boost + +#else // defined(BOOST_CORE_USE_GENERIC_CMATH) + +#if defined(_MSC_VER) && _MSC_VER < 1800 +# include <float.h> +#endif + +namespace boost +{ +namespace core +{ +#if defined(_MSC_VER) && _MSC_VER < 1800 + +template<class T> T copysign( T x, T y ) +{ + return static_cast<T>( _copysign( static_cast<double>( x ), static_cast<double>( y ) ) ); +} + +template<class T> bool isnan( T x ) +{ + return _isnan( static_cast<double>( x ) ) != 0; +} + +template<class T> bool isfinite( T x ) +{ + return _finite( static_cast<double>( x ) ) != 0; +} + +template<class T> bool isinf( T x ) +{ + return ( _fpclass( static_cast<double>( x ) ) & ( _FPCLASS_PINF | _FPCLASS_NINF ) ) != 0; +} + +inline bool isnormal( float x ) +{ + // no _fpclassf in 32 bit mode + unsigned y = reinterpret_cast< unsigned const& >( x ); + unsigned exp = ( y >> 23 ) & 0xFF; + return exp != 0 && exp != 0xFF; +} + +inline bool isnormal( double x ) +{ + return ( _fpclass( x ) & ( _FPCLASS_PN | _FPCLASS_NN ) ) != 0; +} + +inline bool isnormal( long double x ) +{ + return boost::core::isnormal( static_cast<double>( x ) ); +} + +template<class T> bool signbit( T x ) +{ + return _copysign( 1.0, static_cast<double>( x ) ) < 0.0; +} + +int const fp_zero = 0; +int const fp_subnormal = 1; +int const fp_normal = 2; +int const fp_infinite = 3; +int const fp_nan = 4; + +inline int fpclassify( float x ) +{ + switch( _fpclass( x ) ) + { + case _FPCLASS_SNAN: + case _FPCLASS_QNAN: + + return fp_nan; + + case _FPCLASS_NINF: + case _FPCLASS_PINF: + + return fp_infinite; + + case _FPCLASS_NZ: + case _FPCLASS_PZ: + + return fp_zero; + + default: + + return boost::core::isnormal( x )? fp_normal: fp_subnormal; + } +} + +inline int fpclassify( double x ) +{ + switch( _fpclass( x ) ) + { + case _FPCLASS_SNAN: + case _FPCLASS_QNAN: + + return fp_nan; + + case _FPCLASS_NINF: + case _FPCLASS_PINF: + + return fp_infinite; + + case _FPCLASS_NZ: + case _FPCLASS_PZ: + + return fp_zero; + + case _FPCLASS_ND: + case _FPCLASS_PD: + + return fp_subnormal; + + default: + + return fp_normal; + } +} + +inline int fpclassify( long double x ) +{ + return boost::core::fpclassify( static_cast<double>( x ) ); +} + +#else + +using std::isfinite; +using std::isnan; +using std::isinf; +using std::isnormal; +using std::fpclassify; + +int const fp_zero = FP_ZERO; +int const fp_subnormal = FP_SUBNORMAL; +int const fp_normal = FP_NORMAL; +int const fp_infinite = FP_INFINITE; +int const fp_nan = FP_NAN; + +using std::signbit; + +// std::copysign doesn't exist in libstdc++ under -std=c++03 + +#if !defined(__GNUC__) + +template<class T> T copysign( T x, T y ) +{ + return std::copysign( x, y ); +} + +#else + +namespace detail +{ + +// ::copysignl is unreliable, use the built-ins + +inline float copysign_impl( float x, float y ) +{ + return __builtin_copysignf( x, y ); +} + +inline double copysign_impl( double x, double y ) +{ + return __builtin_copysign( x, y ); +} + +inline long double copysign_impl( long double x, long double y ) +{ + return __builtin_copysignl( x, y ); +} + +} // namespace detail + +template<class T> T copysign( T x, T y ) +{ + return boost::core::detail::copysign_impl( x, y ); +} + +#endif // !defined(__GNUC__) +#endif // #if defined(_MSC_VER) && _MSC_VER < 1800 + +} // namespace core +} // namespace boost + +#endif // defined(BOOST_CORE_USE_GENERIC_CMATH) + +#endif // #ifndef BOOST_CORE_CMATH_HPP_INCLUDED diff --git a/contrib/restricted/boost/lexical_cast/README.md b/contrib/restricted/boost/lexical_cast/README.md index 4a804f4459a..8a32fe26a29 100644 --- a/contrib/restricted/boost/lexical_cast/README.md +++ b/contrib/restricted/boost/lexical_cast/README.md @@ -1,16 +1,15 @@ -# [Boost.LexicalCast](http://boost.org/libs/lexical_cast) -Boost.LexicalCast is one of the [Boost C++ Libraries](http://github.com/boostorg). This library is meant for general literal text conversions, such as an int represented a string, or vice-versa. +# [Boost.LexicalCast](https://boost.org/libs/lexical_cast) +Boost.LexicalCast is one of the [Boost C++ Libraries](https://github.com/boostorg). This library is meant for general literal text conversions, such as an int represented a string, or vice-versa. ### Test results @ | Build | Tests coverage | More info ----------------|-------------- | -------------- |----------- -Develop branch: | [](https://travis-ci.org/apolukhin/lexical_cast) [](https://ci.appveyor.com/project/apolukhin/lexical-cast/branch/develop) | [](https://coveralls.io/r/apolukhin/lexical_cast?branch=develop) | [details...](http://www.boost.org/development/tests/develop/developer/lexical_cast.html) -Master branch: | [](https://travis-ci.org/apolukhin/lexical_cast) [](https://ci.appveyor.com/project/apolukhin/lexical-cast/branch/master) | [](https://coveralls.io/r/apolukhin/lexical_cast?branch=master) | [details...](http://www.boost.org/development/tests/master/developer/lexical_cast.html) +Develop branch: | [](https://github.com/boostorg/lexical_cast/actions/workflows/ci.yml) [](https://ci.appveyor.com/project/apolukhin/lexical-cast/branch/develop) | [](https://coveralls.io/r/boostorg/lexical_cast?branch=develop) | [details...](https://www.boost.org/development/tests/develop/developer/lexical_cast.html) +Master branch: | [](https://github.com/boostorg/lexical_cast/actions/workflows/ci.yml) [](https://ci.appveyor.com/project/apolukhin/lexical-cast/branch/master) | [](https://coveralls.io/r/boostorg/lexical_cast?branch=master) | [details...](https://www.boost.org/development/tests/master/developer/lexical_cast.html) - -[Open Issues](https://svn.boost.org/trac/boost/query?status=!closed&component=lexical_cast) +[Latest developer documentation](https://www.boost.org/doc/libs/develop/doc/html/boost_lexical_cast.html) ### License -Distributed under the [Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt). +Distributed under the [Boost Software License, Version 1.0](https://boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/lexical_cast/include/boost/detail/basic_pointerbuf.hpp b/contrib/restricted/boost/lexical_cast/include/boost/detail/basic_pointerbuf.hpp index 85618f92abe..a92a489fced 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/detail/basic_pointerbuf.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/detail/basic_pointerbuf.hpp @@ -55,9 +55,9 @@ protected: // Marking those functions with `inline` suppresses the warnings. // There must be no harm from marking virtual functions as inline: inline virtual // call can be inlined ONLY when the compiler knows the "exact class". - inline base_type* setbuf(char_type* s, streamsize n); - inline typename this_type::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which); - inline typename this_type::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which); + inline base_type* setbuf(char_type* s, streamsize n) BOOST_OVERRIDE; + inline typename this_type::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which) BOOST_OVERRIDE; + inline typename this_type::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) BOOST_OVERRIDE; private: basic_pointerbuf& operator=(const basic_pointerbuf&); @@ -136,4 +136,3 @@ basic_pointerbuf<charT, BufferT>::seekpos(pos_type sp, ::std::ios_base::openmode }} // namespace boost::detail #endif // BOOST_DETAIL_BASIC_POINTERBUF_HPP - diff --git a/contrib/restricted/boost/lexical_cast/include/boost/detail/lcast_precision.hpp b/contrib/restricted/boost/lexical_cast/include/boost/detail/lcast_precision.hpp index 2be88fd87fc..84bf1222b1f 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/detail/lcast_precision.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/detail/lcast_precision.hpp @@ -17,7 +17,7 @@ #ifndef BOOST_NO_IS_ABSTRACT // Fix for SF:1358600 - lexical_cast & pure virtual functions & VC 8 STL -#include <boost/mpl/if.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_abstract.hpp> #endif @@ -47,8 +47,8 @@ struct lcast_precision #ifdef BOOST_NO_IS_ABSTRACT typedef std::numeric_limits<T> limits; // No fix for SF:1358600. #else - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< - boost::is_abstract<T> + typedef BOOST_DEDUCED_TYPENAME boost::conditional< + boost::is_abstract<T>::value , std::numeric_limits<lcast_abstract_stub> , std::numeric_limits<T> >::type limits; @@ -105,8 +105,8 @@ inline std::streamsize lcast_get_precision(T* = 0) #ifdef BOOST_NO_IS_ABSTRACT typedef std::numeric_limits<T> limits; // No fix for SF:1358600. #else - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_< - boost::is_abstract<T> + typedef BOOST_DEDUCED_TYPENAME boost::conditional< + boost::is_abstract<T>::value , std::numeric_limits<lcast_abstract_stub> , std::numeric_limits<T> >::type limits; diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp index 3dc21f88a43..b9304f76845 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -31,7 +31,7 @@ #include <boost/lexical_cast/bad_lexical_cast.hpp> #include <boost/lexical_cast/try_lexical_convert.hpp> -namespace boost +namespace boost { template <typename Target, typename Source> inline Target lexical_cast(const Source &arg) diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp index 093121565e1..3a2c704998e 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/bad_lexical_cast.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,22 +23,22 @@ # pragma once #endif -#include <typeinfo> #include <exception> +#include <typeinfo> #include <boost/throw_exception.hpp> namespace boost { // exception used to indicate runtime lexical_cast failure class BOOST_SYMBOL_VISIBLE bad_lexical_cast : - // workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0 -#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS - public std::exception -#else - public std::bad_cast -#endif + // workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0 +#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS + public std::exception +#else + public std::bad_cast +#endif -#if defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x560 ) +#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 @@ -51,32 +51,39 @@ namespace boost #endif {} - virtual const char *what() const BOOST_NOEXCEPT_OR_NOTHROW { + const char *what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE { return "bad lexical cast: " "source type value could not be interpreted as target"; } - virtual ~bad_lexical_cast() BOOST_NOEXCEPT_OR_NOTHROW + ~bad_lexical_cast() BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE {} #ifndef BOOST_NO_TYPEID + private: +#ifdef BOOST_NO_STD_TYPEINFO + typedef ::type_info type_info_t; +#else + typedef ::std::type_info type_info_t; +#endif + public: bad_lexical_cast( - const std::type_info &source_type_arg, - const std::type_info &target_type_arg) BOOST_NOEXCEPT + const type_info_t &source_type_arg, + const type_info_t &target_type_arg) BOOST_NOEXCEPT : source(&source_type_arg), target(&target_type_arg) {} - const std::type_info &source_type() const BOOST_NOEXCEPT { + const type_info_t &source_type() const BOOST_NOEXCEPT { return *source; } - const std::type_info &target_type() const BOOST_NOEXCEPT { + const type_info_t &target_type() const BOOST_NOEXCEPT { return *target; } private: - const std::type_info *source; - const std::type_info *target; + const type_info_t *source; + const type_info_t *target; #endif }; @@ -94,8 +101,6 @@ namespace boost #endif }} // namespace conversion::detail - } // namespace boost #endif // BOOST_LEXICAL_CAST_BAD_LEXICAL_CAST_HPP - diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp index fd866d84e51..23a2f57f54c 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -30,9 +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/integral_constant.hpp> +#include <boost/type_traits/type_identity.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_float.hpp> #include <boost/type_traits/has_left_shift.hpp> @@ -59,7 +59,7 @@ namespace boost { { // Converts signed/unsigned char to char template < class Char > - struct normalize_single_byte_char + struct normalize_single_byte_char { typedef Char type; }; @@ -79,7 +79,7 @@ namespace boost { namespace detail // deduce_character_type_later<T> { - // Helper type, meaning that stram character for T must be deduced + // Helper type, meaning that stram character for T must be deduced // at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) template < class T > struct deduce_character_type_later {}; } @@ -90,35 +90,35 @@ namespace boost { // Returns one of char, wchar_t, char16_t, char32_t or deduce_character_type_later<T> types // Executed on Stage 1 (See deduce_source_char<T> and deduce_target_char<T>) template < typename Type > - struct stream_char_common: public boost::mpl::if_c< + struct stream_char_common: public boost::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::mpl::if_c< + struct stream_char_common< Char* >: public boost::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::mpl::if_c< + struct stream_char_common< const Char* >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< const Char* > > {}; template < typename Char > - struct stream_char_common< boost::iterator_range< Char* > >: public boost::mpl::if_c< + struct stream_char_common< boost::iterator_range< Char* > >: public boost::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::mpl::if_c< + struct stream_char_common< boost::iterator_range< const Char* > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::iterator_range< const Char* > > @@ -137,14 +137,14 @@ namespace boost { }; template < typename Char, std::size_t N > - struct stream_char_common< boost::array< Char, N > >: public boost::mpl::if_c< + struct stream_char_common< boost::array< Char, N > >: public boost::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::mpl::if_c< + struct stream_char_common< boost::array< const Char, N > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< boost::array< const Char, N > > @@ -152,14 +152,14 @@ namespace boost { #ifndef BOOST_NO_CXX11_HDR_ARRAY template < typename Char, std::size_t N > - struct stream_char_common< std::array<Char, N > >: public boost::mpl::if_c< + struct stream_char_common< std::array<Char, N > >: public boost::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::mpl::if_c< + struct stream_char_common< std::array< const Char, N > >: public boost::conditional< boost::detail::is_character< Char >::value, Char, boost::detail::deduce_character_type_later< std::array< const Char, N > > @@ -167,8 +167,8 @@ namespace boost { #endif #ifdef BOOST_HAS_INT128 - template <> struct stream_char_common< boost::int128_type >: public boost::mpl::identity< char > {}; - template <> struct stream_char_common< boost::uint128_type >: public boost::mpl::identity< char > {}; + template <> struct stream_char_common< boost::int128_type >: public boost::type_identity< char > {}; + template <> struct stream_char_common< boost::uint128_type >: public boost::type_identity< char > {}; #endif #if !defined(BOOST_LCAST_NO_WCHAR_T) && defined(BOOST_NO_INTRINSIC_WCHAR_T) @@ -187,27 +187,27 @@ namespace boost { // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char<Char>. // Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) - template < class Char > + template < class Char > struct deduce_source_char_impl - { - typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type; + { + typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type; }; - - template < class T > - struct deduce_source_char_impl< deduce_character_type_later< T > > + + template < class T > + struct deduce_source_char_impl< deduce_character_type_later< T > > { 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), + BOOST_STATIC_ASSERT_MSG((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::mpl::if_c< + typedef BOOST_DEDUCED_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), + BOOST_STATIC_ASSERT_MSG((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 }; @@ -220,47 +220,47 @@ namespace boost { // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char<Char>. // Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) - template < class Char > - struct deduce_target_char_impl - { - typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type; + template < class Char > + struct deduce_target_char_impl + { + typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type; }; - - template < class T > - struct deduce_target_char_impl< deduce_character_type_later<T> > - { + + template < class T > + struct deduce_target_char_impl< deduce_character_type_later<T> > + { typedef boost::has_right_shift<std::basic_istream<char>, T > result_t; #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), + BOOST_STATIC_ASSERT_MSG((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::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< result_t::value, char, wchar_t >::type type; - - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value), + + BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value), "Target type is neither std::istream`able nor std::wistream`able"); #endif }; - } + } namespace detail // deduce_target_char<T> and deduce_source_char<T> { // We deduce stream character types in two stages. // - // Stage 1 is common for Target and Source. At Stage 1 we get + // Stage 1 is common for Target and Source. At Stage 1 we get // non normalized character type (may contain unsigned/signed char) // or deduce_character_type_later<T> where T is the original type. // Stage 1 is executed by stream_char_common<T> // - // At Stage 2 we normalize character types or try to deduce character - // type using metafunctions. - // Stage 2 is executed by deduce_target_char_impl<T> and + // At Stage 2 we normalize character types or try to deduce character + // type using metafunctions. + // Stage 2 is executed by deduce_target_char_impl<T> and // deduce_source_char_impl<T> // - // deduce_target_char<T> and deduce_source_char<T> functions combine + // deduce_target_char<T> and deduce_source_char<T> functions combine // both stages template < class T > @@ -322,7 +322,7 @@ namespace boost { typedef const T * type; }; } - + namespace detail // lcast_src_length { // Return max. length of string representation of Source; @@ -368,7 +368,7 @@ namespace boost { // -1.23456789e-123456 // ^ sign // ^ leading digit - // ^ decimal point + // ^ decimal point // ^^^^^^^^ lcast_precision<Source>::value // ^ "e" // ^ exponent sign @@ -401,11 +401,11 @@ namespace boost { struct lexical_cast_stream_traits { typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay<Source>::type src; typedef BOOST_DEDUCED_TYPENAME boost::remove_cv<src>::type no_cv_src; - + typedef boost::detail::deduce_source_char<no_cv_src> 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<Target>::type target_char_t; - + typedef BOOST_DEDUCED_TYPENAME boost::detail::widest_char< target_char_t, src_char_t >::type char_type; @@ -421,38 +421,38 @@ namespace boost { "Your compiler does not have full support for char32_t" ); #endif - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< boost::detail::extract_char_traits<char_type, Target>::value, 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::mpl::bool_ - < - boost::is_same<char, src_char_t>::value && // source is not a wide character based type + + typedef boost::integral_constant< + 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; + > is_string_widening_required_t; - typedef boost::mpl::bool_ - < - !(boost::is_integral<no_cv_src>::value || + typedef boost::integral_constant< + 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 - ) - > is_source_input_not_optimized_t; - + ) + > 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 = - (is_string_widening_required_t::value || is_source_input_not_optimized_t::value) + BOOST_STATIC_CONSTANT(bool, requires_stringbuf = + (is_string_widening_required_t::value || is_source_input_not_optimized_t::value) ); - + typedef boost::detail::lcast_src_length<no_cv_src> len_t; }; } - + namespace detail { template<typename Target, typename Source> diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp index 3758a9cc219..01913b220c7 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_lexical_streams.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2016. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -33,12 +33,12 @@ #include <cstring> #include <cstdio> #include <boost/limits.hpp> -#include <boost/mpl/if.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_pointer.hpp> #include <boost/static_assert.hpp> +#include <boost/detail/lcast_precision.hpp> #include <boost/detail/workaround.hpp> - #ifndef BOOST_NO_STD_LOCALE # include <locale> #else @@ -137,13 +137,13 @@ namespace boost { , std::size_t CharacterBufferSize > class lexical_istream_limited_src: boost::noncopyable { - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< RequiresStringbuffer, BOOST_DEDUCED_TYPENAME out_stream_helper_trait<CharT, Traits>::out_stream_t, do_not_construct_out_stream_t >::type deduced_out_stream_t; - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< RequiresStringbuffer, BOOST_DEDUCED_TYPENAME out_stream_helper_trait<CharT, Traits>::stringbuffer_t, do_not_construct_out_buffer_t @@ -154,7 +154,7 @@ namespace boost { CharT buffer[CharacterBufferSize]; // After the `operator <<` finishes, `[start, finish)` is - // the range to output by `operator >>` + // the range to output by `operator >>` const CharT* start; const CharT* finish; @@ -165,7 +165,7 @@ namespace boost { , start(buffer) , finish(buffer + CharacterBufferSize) {} - + const CharT* cbegin() const BOOST_NOEXCEPT { return start; } @@ -282,7 +282,7 @@ namespace boost { #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) sprintf_s(begin, CharacterBufferSize, #else - sprintf(begin, + sprintf(begin, #endif "%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val_as_double); return finish > start; @@ -294,7 +294,7 @@ namespace boost { #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) sprintf_s(begin, CharacterBufferSize, #else - sprintf(begin, + sprintf(begin, #endif "%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val); return finish > start; @@ -307,7 +307,7 @@ namespace boost { #if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) sprintf_s(begin, CharacterBufferSize, #else - sprintf(begin, + sprintf(begin, #endif "%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double>()), val ); return finish > start; @@ -375,15 +375,15 @@ namespace boost { } template <class C> - BOOST_DEDUCED_TYPENAME boost::disable_if<boost::is_const<C>, bool>::type + BOOST_DEDUCED_TYPENAME boost::disable_if<boost::is_const<C>, bool>::type operator<<(const iterator_range<C*>& rng) BOOST_NOEXCEPT { return (*this) << iterator_range<const C*>(rng.begin(), rng.end()); } - + bool operator<<(const iterator_range<const CharT*>& rng) BOOST_NOEXCEPT { start = rng.begin(); finish = rng.end(); - return true; + return true; } bool operator<<(const iterator_range<const signed char*>& rng) BOOST_NOEXCEPT { @@ -454,43 +454,43 @@ namespace boost { return shl_real(static_cast<double>(val)); #endif } - + // Adding constness to characters. Constness does not change layout template <class C, std::size_t N> BOOST_DEDUCED_TYPENAME boost::disable_if<boost::is_const<C>, bool>::type - operator<<(boost::array<C, N> const& input) BOOST_NOEXCEPT { + operator<<(boost::array<C, N> const& input) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG( (sizeof(boost::array<const C, N>) == sizeof(boost::array<C, N>)), "boost::array<C, N> and boost::array<const C, N> must have exactly the same layout." ); - return ((*this) << reinterpret_cast<boost::array<const C, N> const& >(input)); + return ((*this) << reinterpret_cast<boost::array<const C, N> const& >(input)); } template <std::size_t N> - bool operator<<(boost::array<const CharT, N> const& input) BOOST_NOEXCEPT { + bool operator<<(boost::array<const CharT, N> const& input) BOOST_NOEXCEPT { return shl_char_array_limited(input.data(), N); } template <std::size_t N> - bool operator<<(boost::array<const unsigned char, N> const& input) BOOST_NOEXCEPT { - return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); + bool operator<<(boost::array<const unsigned char, N> const& input) BOOST_NOEXCEPT { + return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } template <std::size_t N> - bool operator<<(boost::array<const signed char, N> const& input) BOOST_NOEXCEPT { - return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); + bool operator<<(boost::array<const signed char, N> const& input) BOOST_NOEXCEPT { + return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } - + #ifndef BOOST_NO_CXX11_HDR_ARRAY // Making a Boost.Array from std::array template <class C, std::size_t N> - bool operator<<(std::array<C, N> const& input) BOOST_NOEXCEPT { + bool operator<<(std::array<C, N> const& input) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG( (sizeof(std::array<C, N>) == sizeof(boost::array<C, N>)), "std::array and boost::array must have exactly the same layout. " "Bug in implementation of std::array or boost::array." ); - return ((*this) << reinterpret_cast<boost::array<C, N> const& >(input)); + return ((*this) << reinterpret_cast<boost::array<C, N> const& >(input)); } #endif template <class InStreamable> @@ -500,7 +500,7 @@ namespace boost { template <class CharT, class Traits> class lexical_ostream_limited_src: boost::noncopyable { - //`[start, finish)` is the range to output by `operator >>` + //`[start, finish)` is the range to output by `operator >>` const CharT* start; const CharT* const finish; @@ -580,7 +580,7 @@ namespace boost { #else typedef BOOST_DEDUCED_TYPENAME out_stream_helper_trait<CharT, Traits>::buffer_t buffer_t; buffer_t buf; - // Usually `istream` and `basic_istream` do not modify + // Usually `istream` and `basic_istream` do not modify // content of buffer; `buffer_t` assures that this is true buf.setbuf(const_cast<CharT*>(start), static_cast<typename buffer_t::streamsize>(finish - start)); #if defined(BOOST_NO_STD_LOCALE) @@ -597,7 +597,7 @@ namespace boost { stream.unsetf(std::ios::skipws); lcast_set_precision(stream, static_cast<InputStreamable*>(0)); - return (stream >> output) + return (stream >> output) && (stream.get() == Traits::eof()); #ifndef BOOST_NO_EXCEPTIONS @@ -625,7 +625,7 @@ namespace boost { bool shr_std_array(ArrayT& output) BOOST_NOEXCEPT { using namespace std; const std::size_t size = static_cast<std::size_t>(finish - start); - if (size > N - 1) { // `-1` because we need to store \0 at the end + if (size > N - 1) { // `-1` because we need to store \0 at the end return false; } @@ -668,33 +668,33 @@ namespace boost { bool operator>>(char32_t& output) { return shr_xchar(output); } #endif template<class Alloc> - bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) { - str.assign(start, finish); return true; + bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) { + str.assign(start, finish); return true; } template<class Alloc> - bool operator>>(boost::container::basic_string<CharT,Traits,Alloc>& str) { - str.assign(start, finish); return true; + bool operator>>(boost::container::basic_string<CharT,Traits,Alloc>& str) { + str.assign(start, finish); return true; } template <std::size_t N> - bool operator>>(boost::array<CharT, N>& output) BOOST_NOEXCEPT { - return shr_std_array<N>(output); + bool operator>>(boost::array<CharT, N>& output) BOOST_NOEXCEPT { + return shr_std_array<N>(output); } template <std::size_t N> - bool operator>>(boost::array<unsigned char, N>& output) BOOST_NOEXCEPT { - return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); + bool operator>>(boost::array<unsigned char, N>& output) BOOST_NOEXCEPT { + return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); } template <std::size_t N> - bool operator>>(boost::array<signed char, N>& output) BOOST_NOEXCEPT { - return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); + bool operator>>(boost::array<signed char, N>& output) BOOST_NOEXCEPT { + return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); } - + #ifndef BOOST_NO_CXX11_HDR_ARRAY template <class C, std::size_t N> - bool operator>>(std::array<C, N>& output) BOOST_NOEXCEPT { + bool operator>>(std::array<C, N>& output) BOOST_NOEXCEPT { BOOST_STATIC_ASSERT_MSG( (sizeof(std::array<C, N>) == sizeof(boost::array<C, N>)), "std::array<C, N> and boost::array<C, N> must have exactly the same layout." @@ -773,8 +773,8 @@ namespace boost { // Generic istream-based algorithm. // lcast_streambuf_for_target<InputStreamable>::value is true. template <typename InputStreamable> - bool operator>>(InputStreamable& output) { - return shr_using_base_class(output); + bool operator>>(InputStreamable& output) { + return shr_using_base_class(output); } }; } diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp index f50e2ca0fb3..9178076f82d 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/converter_numeric.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2016. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -24,9 +24,8 @@ #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/type_identity.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_integral.hpp> @@ -43,8 +42,8 @@ struct detect_precision_loss { typedef Source source_type; typedef boost::numeric::Trunc<Source> Rounder; - typedef BOOST_DEDUCED_TYPENAME mpl::if_< - boost::is_arithmetic<Source>, Source, Source const& + typedef BOOST_DEDUCED_TYPENAME conditional< + boost::is_arithmetic<Source>::value, Source, Source const& >::type argument_type ; static inline source_type nearbyint(argument_type s, bool& is_ok) BOOST_NOEXCEPT { @@ -66,8 +65,8 @@ template <typename Base, class Source> struct fake_precision_loss: public Base { typedef Source source_type ; - typedef BOOST_DEDUCED_TYPENAME mpl::if_< - boost::is_arithmetic<Source>, Source, Source const& + typedef BOOST_DEDUCED_TYPENAME conditional< + boost::is_arithmetic<Source>::value, Source, Source const& >::type argument_type ; static inline source_type nearbyint(argument_type s, bool& /*is_ok*/) BOOST_NOEXCEPT { @@ -92,14 +91,17 @@ inline bool noexcept_numeric_convert(const Source& arg, Target& result) BOOST_NO detect_precision_loss<Source > > converter_orig_t; - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< boost::is_base_of< detect_precision_loss<Source >, converter_orig_t >::value, converter_orig_t, fake_precision_loss<converter_orig_t, Source> >::type converter_t; bool res = nothrow_overflow_handler()(converter_t::out_of_range(arg)); - result = converter_t::low_level_convert(converter_t::nearbyint(arg, res)); + if (res) { + result = converter_t::low_level_convert(converter_t::nearbyint(arg, res)); + } + return res; } @@ -115,11 +117,12 @@ template <typename Target, typename Source> struct lexical_cast_dynamic_num_ignoring_minus { static inline bool try_convert(const Source &arg, Target& result) BOOST_NOEXCEPT { - typedef BOOST_DEDUCED_TYPENAME boost::mpl::eval_if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< boost::is_float<Source>::value, - boost::mpl::identity<Source>, + boost::type_identity<Source>, boost::make_unsigned<Source> - >::type usource_t; + >::type usource_lazy_t; + typedef BOOST_DEDUCED_TYPENAME usource_lazy_t::type usource_t; if (arg < 0) { const bool res = noexcept_numeric_convert<Target, usource_t>(0u - arg, result); @@ -153,7 +156,7 @@ template <typename Target, typename Source> 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< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< boost::is_unsigned<Target>::value && (boost::is_signed<Source>::value || boost::is_float<Source>::value) && !(boost::is_same<Source, bool>::value) && diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp index c10457ecd2a..dd68b173e50 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/inf_nan.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -27,12 +27,11 @@ #define BOOST_LCAST_NO_WCHAR_T #endif -#include <cstddef> -#include <cstring> #include <boost/limits.hpp> #include <boost/detail/workaround.hpp> -#include <boost/math/special_functions/sign.hpp> -#include <boost/math/special_functions/fpclassify.hpp> +#include <boost/core/cmath.hpp> +#include <cstddef> +#include <cstring> #include <boost/lexical_cast/detail/lcast_char_constants.hpp> @@ -55,7 +54,6 @@ namespace boost { , const CharT* lc_INFINITY, const CharT* lc_infinity , const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT { - using namespace std; if (begin == end) return false; const CharT minus = lcast_char_constants<CharT>::minus; const CharT plus = lcast_char_constants<CharT>::plus; @@ -72,14 +70,14 @@ namespace boost { begin += 3; if (end != begin) { /* It is 'nan(...)' or some bad input*/ - + if (end - begin < 2) return false; // bad input -- end; if (*begin != opening_brace || *end != closing_brace) return false; // bad input } if( !has_minus ) value = std::numeric_limits<T>::quiet_NaN(); - else value = (boost::math::changesign) (std::numeric_limits<T>::quiet_NaN()); + else value = boost::core::copysign(std::numeric_limits<T>::quiet_NaN(), static_cast<T>(-1)); return true; } else if ( ( /* 'INF' or 'inf' */ @@ -94,7 +92,7 @@ namespace boost { ) { if( !has_minus ) value = std::numeric_limits<T>::infinity(); - else value = (boost::math::changesign) (std::numeric_limits<T>::infinity()); + else value = -std::numeric_limits<T>::infinity(); return true; } @@ -106,24 +104,23 @@ namespace boost { , const CharT* lc_nan , const CharT* lc_infinity) BOOST_NOEXCEPT { - using namespace std; const CharT minus = lcast_char_constants<CharT>::minus; - if ((boost::math::isnan)(value)) { - if ((boost::math::signbit)(value)) { + if (boost::core::isnan(value)) { + if (boost::core::signbit(value)) { *begin = minus; ++ begin; } - memcpy(begin, lc_nan, 3 * sizeof(CharT)); + std::memcpy(begin, lc_nan, 3 * sizeof(CharT)); end = begin + 3; return true; - } else if ((boost::math::isinf)(value)) { - if ((boost::math::signbit)(value)) { + } else if (boost::core::isinf(value)) { + if (boost::core::signbit(value)) { *begin = minus; ++ begin; } - memcpy(begin, lc_infinity, 3 * sizeof(CharT)); + std::memcpy(begin, lc_infinity, 3 * sizeof(CharT)); end = begin + 3; return true; } diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp index 732c39f8e80..dd6ff06adcf 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/is_character.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,7 +23,7 @@ # pragma once #endif -#include <boost/mpl/bool.hpp> +#include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/is_same.hpp> namespace boost { @@ -34,8 +34,9 @@ namespace boost { template < typename T > struct is_character { - typedef BOOST_DEDUCED_TYPENAME boost::mpl::bool_< - boost::is_same< T, char >::value || + typedef BOOST_DEDUCED_TYPENAME boost::integral_constant< + bool, + boost::is_same< T, char >::value || #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) boost::is_same< T, wchar_t >::value || #endif @@ -45,8 +46,8 @@ namespace boost { #ifndef BOOST_NO_CXX11_CHAR32_T boost::is_same< T, char32_t >::value || #endif - boost::is_same< T, unsigned char >::value || - boost::is_same< T, signed char >::value + boost::is_same< T, unsigned char >::value || + boost::is_same< T, signed char >::value > type; BOOST_STATIC_CONSTANT(bool, value = (type::value) ); diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp index fd651ee3e99..6be846c74b3 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_char_constants.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,7 +23,7 @@ # pragma once #endif -namespace boost +namespace boost { namespace detail // '0', '-', '+', 'e', 'E' and '.' constants { diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp index 268961ee72f..5f2f90c9d4e 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/lcast_unsigned_converters.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -29,7 +29,7 @@ #include <cstring> #include <cstdio> #include <boost/limits.hpp> -#include <boost/mpl/if.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/static_assert.hpp> #include <boost/detail/workaround.hpp> @@ -52,7 +52,7 @@ #include <boost/type_traits/is_signed.hpp> #include <boost/noncopyable.hpp> -namespace boost +namespace boost { namespace detail // lcast_to_unsigned { @@ -60,8 +60,8 @@ namespace boost inline BOOST_DEDUCED_TYPENAME boost::make_unsigned<T>::type lcast_to_unsigned(const T value) BOOST_NOEXCEPT { typedef BOOST_DEDUCED_TYPENAME boost::make_unsigned<T>::type result_type; - return value < 0 - ? static_cast<result_type>(0u - static_cast<result_type>(value)) + return value < 0 + ? static_cast<result_type>(0u - static_cast<result_type>(value)) : static_cast<result_type>(value); } } @@ -71,9 +71,9 @@ namespace boost template <class Traits, class T, class CharT> class lcast_put_unsigned: boost::noncopyable { typedef BOOST_DEDUCED_TYPENAME Traits::int_type int_type; - BOOST_DEDUCED_TYPENAME boost::mpl::if_c< - (sizeof(int_type) > sizeof(T)) - , int_type + BOOST_DEDUCED_TYPENAME boost::conditional< + (sizeof(unsigned) > sizeof(T)) + , unsigned , T >::type m_value; CharT* m_finish; @@ -81,7 +81,7 @@ 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) BOOST_NOEXCEPT : m_value(n_param), m_finish(finish) , m_czero(lcast_char_constants<CharT>::zero), m_zero(Traits::to_int_type(m_czero)) { @@ -162,7 +162,7 @@ namespace boost T& m_value; const CharT* const m_begin; const CharT* m_end; - + public: lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) BOOST_NOEXCEPT : m_multiplier_overflowed(false), m_multiplier(1), m_value(value), m_begin(begin), m_end(end) @@ -250,7 +250,7 @@ namespace boost } private: - // Iteration that does not care about grouping/separators and assumes that all + // Iteration that does not care about grouping/separators and assumes that all // input characters are digits inline bool main_convert_iteration() BOOST_NOEXCEPT { CharT const czero = lcast_char_constants<CharT>::zero; @@ -265,7 +265,7 @@ namespace boost // We must correctly handle situations like `000000000000000000000000000001`. // So we take care of overflow only if `dig_value` is not '0'. if (*m_end < czero || *m_end >= czero + 10 // checking for correct digit - || (dig_value && ( // checking for overflow of ... + || (dig_value && ( // checking for overflow of ... m_multiplier_overflowed // ... multiplier || static_cast<T>(maxv / dig_value) < m_multiplier // ... subvalue || static_cast<T>(maxv - new_sub_value) < m_value // ... whole expression @@ -273,7 +273,7 @@ namespace boost ) return false; m_value = static_cast<T>(m_value + new_sub_value); - + return true; } @@ -283,7 +283,7 @@ namespace boost return false; } } - + return true; } }; diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp index 013aaf119de..a5427bb1583 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/detail/widest_char.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2014. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -23,11 +23,14 @@ # pragma once #endif + +#include <boost/type_traits/conditional.hpp> + namespace boost { namespace detail { template <typename TargetChar, typename SourceChar> struct widest_char { - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< (sizeof(TargetChar) > sizeof(SourceChar)) , TargetChar , SourceChar diff --git a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp index b079fd42aec..b1a52be4294 100644 --- a/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp +++ b/contrib/restricted/boost/lexical_cast/include/boost/lexical_cast/try_lexical_convert.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2016. +// Copyright Antony Polukhin, 2011-2022. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -28,12 +28,14 @@ (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wuninitialized" +#pragma GCC diagnostic ignored "-Wsign-conversion" #endif + #include <string> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/identity.hpp> -#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/type_identity.hpp> +#include <boost/type_traits/conditional.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_arithmetic.hpp> @@ -72,32 +74,34 @@ namespace boost { template<typename Target, typename Source> struct is_arithmetic_and_not_xchars { - typedef boost::mpl::bool_< - !(boost::detail::is_character<Target>::value) && + typedef boost::integral_constant< + 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 = ( type::value )); }; /* - * is_xchar_to_xchar<Target, Source>::value is true, + * is_xchar_to_xchar<Target, Source>::value is true, * Target and Souce are char types of the same size 1 (char, signed char, unsigned char). */ template<typename Target, typename Source> - struct is_xchar_to_xchar + struct is_xchar_to_xchar { - typedef boost::mpl::bool_< - sizeof(Source) == sizeof(Target) && + typedef boost::integral_constant< + bool, + sizeof(Source) == sizeof(Target) && sizeof(Source) == sizeof(char) && boost::detail::is_character<Target>::value && boost::detail::is_character<Source>::value > type; - + BOOST_STATIC_CONSTANT(bool, value = ( type::value )); @@ -162,7 +166,8 @@ namespace boost { { typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay<Source>::type src; - typedef boost::mpl::bool_< + typedef boost::integral_constant< + bool, boost::detail::is_xchar_to_xchar<Target, src >::value || boost::detail::is_char_array_to_stdstring<Target, src >::value || boost::detail::is_char_array_to_booststring<Target, src >::value || @@ -181,11 +186,11 @@ 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::mpl::if_c< + typedef BOOST_DEDUCED_TYPENAME boost::conditional< shall_we_copy_t::value, - boost::mpl::identity<boost::detail::copy_converter_impl<Target, src > >, - boost::mpl::if_< - shall_we_copy_with_dynamic_check_t, + boost::type_identity<boost::detail::copy_converter_impl<Target, src > >, + boost::conditional< + shall_we_copy_with_dynamic_check_t::value, boost::detail::dynamic_num_converter_impl<Target, src >, boost::detail::lexical_converter_impl<Target, src > > |
