diff options
author | robot-contrib <[email protected]> | 2022-08-08 23:18:08 +0300 |
---|---|---|
committer | robot-contrib <[email protected]> | 2022-08-08 23:18:08 +0300 |
commit | 97756e1f8069e2de8c4b5d27a358fa0c7eb29169 (patch) | |
tree | 6723c8a328354b8efc855ccb143807c0796f60d1 | |
parent | 134b8a706b6ac24bda99274fce27c0fb4ce22c03 (diff) |
Update contrib/restricted/boost/detail to 1.79.0
12 files changed, 237 insertions, 251 deletions
diff --git a/contrib/restricted/boost/detail/include/boost/blank.hpp b/contrib/restricted/boost/detail/include/boost/blank.hpp index d0fe5abca56..918723ca944 100644 --- a/contrib/restricted/boost/detail/include/boost/blank.hpp +++ b/contrib/restricted/boost/detail/include/boost/blank.hpp @@ -20,7 +20,7 @@ #include "boost/detail/templated_streams.hpp" #endif // BOOST_NO_IOSTREAM -#include "boost/mpl/bool.hpp" +#include "boost/type_traits/integral_constant.hpp" #include "boost/type_traits/is_empty.hpp" #include "boost/type_traits/is_pod.hpp" #include "boost/type_traits/is_stateless.hpp" @@ -36,19 +36,19 @@ struct blank template <> struct is_pod< blank > - : mpl::true_ + : boost::true_type { }; template <> struct is_empty< blank > - : mpl::true_ + : boost::true_type { }; template <> struct is_stateless< blank > - : mpl::true_ + : boost::true_type { }; diff --git a/contrib/restricted/boost/detail/include/boost/detail/allocator_utilities.hpp b/contrib/restricted/boost/detail/include/boost/detail/allocator_utilities.hpp index 11eecbe1b52..056ba37e2ce 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/allocator_utilities.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/allocator_utilities.hpp @@ -11,7 +11,7 @@ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/detail/workaround.hpp> -#include <boost/mpl/eval_if.hpp> +#include <boost/detail/select_type.hpp> #include <boost/type_traits/is_same.hpp> #include <cstddef> #include <memory> @@ -44,7 +44,7 @@ public: typedef Type value_type; - partial_std_allocator_wrapper(){}; + partial_std_allocator_wrapper(){} template<typename Other> partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){} @@ -52,7 +52,7 @@ public: partial_std_allocator_wrapper(const std::allocator<Type>& x): std::allocator<Type>(x) { - }; + } #if defined(BOOST_DINKUMWARE_STDLIB) /* Dinkumware guys didn't provide a means to call allocate() without @@ -142,11 +142,12 @@ struct compliant_allocator_rebind_to template<typename Allocator,typename Type> struct rebind_to: - mpl::eval_if_c< - is_partial_std_allocator<Allocator>::value, + boost::detail::if_true< + is_partial_std_allocator<Allocator>::value + >::template then< partial_std_allocator_rebind_to<Allocator,Type>, compliant_allocator_rebind_to<Allocator,Type> - > + >::type { }; diff --git a/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp b/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp index 3dca9b65092..0591563673e 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/binary_search.hpp @@ -1,11 +1,11 @@ -// Copyright (c) 2000 David Abrahams. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at +// Copyright (c) 2000 David Abrahams. +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// +// // Copyright (c) 1994 // Hewlett-Packard Company -// +// // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and @@ -13,10 +13,10 @@ // in supporting documentation. Hewlett-Packard Company makes no // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. -// +// // Copyright (c) 1996 // Silicon Graphics Computer Systems, Inc. -// +// // Permission to use, copy, modify, distribute and sell this software // and its documentation for any purpose is hereby granted without fee, // provided that the above copyright notice appear in all copies and @@ -24,22 +24,22 @@ // in supporting documentation. Silicon Graphics makes no // representations about the suitability of this software for any // purpose. It is provided "as is" without express or implied warranty. -// +// #ifndef BINARY_SEARCH_DWA_122600_H_ # define BINARY_SEARCH_DWA_122600_H_ -# include <boost/detail/iterator.hpp> # include <utility> +# include <iterator> namespace boost { namespace detail { template <class ForwardIter, class Tp> ForwardIter lower_bound(ForwardIter first, ForwardIter last, - const Tp& val) + const Tp& val) { - typedef detail::iterator_traits<ForwardIter> traits; - - typename traits::difference_type len = boost::detail::distance(first, last); + typedef std::iterator_traits<ForwardIter> traits; + + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -62,9 +62,9 @@ template <class ForwardIter, class Tp, class Compare> ForwardIter lower_bound(ForwardIter first, ForwardIter last, const Tp& val, Compare comp) { - typedef detail::iterator_traits<ForwardIter> traits; + typedef std::iterator_traits<ForwardIter> traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -87,9 +87,9 @@ template <class ForwardIter, class Tp> ForwardIter upper_bound(ForwardIter first, ForwardIter last, const Tp& val) { - typedef detail::iterator_traits<ForwardIter> traits; + typedef std::iterator_traits<ForwardIter> traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -112,9 +112,9 @@ template <class ForwardIter, class Tp, class Compare> ForwardIter upper_bound(ForwardIter first, ForwardIter last, const Tp& val, Compare comp) { - typedef detail::iterator_traits<ForwardIter> traits; + typedef std::iterator_traits<ForwardIter> traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle; @@ -137,9 +137,9 @@ template <class ForwardIter, class Tp> std::pair<ForwardIter, ForwardIter> equal_range(ForwardIter first, ForwardIter last, const Tp& val) { - typedef detail::iterator_traits<ForwardIter> traits; + typedef std::iterator_traits<ForwardIter> traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle, left, right; @@ -169,9 +169,9 @@ std::pair<ForwardIter, ForwardIter> equal_range(ForwardIter first, ForwardIter last, const Tp& val, Compare comp) { - typedef detail::iterator_traits<ForwardIter> traits; + typedef std::iterator_traits<ForwardIter> traits; - typename traits::difference_type len = boost::detail::distance(first, last); + typename traits::difference_type len = std::distance(first, last); typename traits::difference_type half; ForwardIter middle, left, right; @@ -194,7 +194,7 @@ equal_range(ForwardIter first, ForwardIter last, const Tp& val, } } return std::pair<ForwardIter, ForwardIter>(first, first); -} +} template <class ForwardIter, class Tp> bool binary_search(ForwardIter first, ForwardIter last, diff --git a/contrib/restricted/boost/detail/include/boost/detail/indirect_traits.hpp b/contrib/restricted/boost/detail/include/boost/detail/indirect_traits.hpp index 6294e40f6a9..94e9b34dc2f 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/indirect_traits.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/indirect_traits.hpp @@ -4,6 +4,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #ifndef INDIRECT_TRAITS_DWA2002131_HPP # define INDIRECT_TRAITS_DWA2002131_HPP +# include <boost/type_traits/integral_constant.hpp> # include <boost/type_traits/is_function.hpp> # include <boost/type_traits/is_reference.hpp> # include <boost/type_traits/is_pointer.hpp> @@ -17,13 +18,7 @@ # include <boost/type_traits/remove_pointer.hpp> # include <boost/detail/workaround.hpp> - -# include <boost/mpl/eval_if.hpp> -# include <boost/mpl/if.hpp> -# include <boost/mpl/bool.hpp> -# include <boost/mpl/and.hpp> -# include <boost/mpl/not.hpp> -# include <boost/mpl/aux_/lambda_support.hpp> +# include <boost/detail/select_type.hpp> namespace boost { namespace detail { @@ -31,24 +26,24 @@ namespace boost { namespace detail { namespace indirect_traits { template <class T> -struct is_reference_to_const : mpl::false_ +struct is_reference_to_const : boost::false_type { }; template <class T> -struct is_reference_to_const<T const&> : mpl::true_ +struct is_reference_to_const<T const&> : boost::true_type { }; # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround template<class T> -struct is_reference_to_const<T const volatile&> : mpl::true_ +struct is_reference_to_const<T const volatile&> : boost::true_type { }; -# endif +# endif template <class T> -struct is_reference_to_function : mpl::false_ +struct is_reference_to_function : boost::false_type { }; @@ -58,7 +53,7 @@ struct is_reference_to_function<T&> : is_function<T> }; template <class T> -struct is_pointer_to_function : mpl::false_ +struct is_pointer_to_function : boost::false_type { }; @@ -70,7 +65,7 @@ struct is_pointer_to_function<T*> : is_function<T> }; template <class T> -struct is_reference_to_member_function_pointer_impl : mpl::false_ +struct is_reference_to_member_function_pointer_impl : boost::false_type { }; @@ -85,18 +80,17 @@ template <class T> struct is_reference_to_member_function_pointer : is_reference_to_member_function_pointer_impl<T> { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) }; template <class T> struct is_reference_to_function_pointer_aux - : mpl::and_< - is_reference<T> - , is_pointer_to_function< + : boost::integral_constant<bool, + is_reference<T>::value && + is_pointer_to_function< typename remove_cv< typename remove_reference<T>::type >::type - > + >::value > { // There's no such thing as a pointer-to-cv-function, so we don't need specializations for those @@ -104,94 +98,91 @@ struct is_reference_to_function_pointer_aux template <class T> struct is_reference_to_function_pointer - : mpl::if_< - is_reference_to_function<T> - , mpl::false_ + : boost::detail::if_true< + is_reference_to_function<T>::value + >::template then< + boost::false_type , is_reference_to_function_pointer_aux<T> - >::type + >::type { }; template <class T> struct is_reference_to_non_const - : mpl::and_< - is_reference<T> - , mpl::not_< - is_reference_to_const<T> - > + : boost::integral_constant<bool, + is_reference<T>::value && + !is_reference_to_const<T>::value > { }; template <class T> -struct is_reference_to_volatile : mpl::false_ +struct is_reference_to_volatile : boost::false_type { }; template <class T> -struct is_reference_to_volatile<T volatile&> : mpl::true_ +struct is_reference_to_volatile<T volatile&> : boost::true_type { }; # if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround template <class T> -struct is_reference_to_volatile<T const volatile&> : mpl::true_ +struct is_reference_to_volatile<T const volatile&> : boost::true_type { }; -# endif +# endif template <class T> -struct is_reference_to_pointer : mpl::false_ +struct is_reference_to_pointer : boost::false_type { }; template <class T> -struct is_reference_to_pointer<T*&> : mpl::true_ +struct is_reference_to_pointer<T*&> : boost::true_type { }; template <class T> -struct is_reference_to_pointer<T* const&> : mpl::true_ +struct is_reference_to_pointer<T* const&> : boost::true_type { }; template <class T> -struct is_reference_to_pointer<T* volatile&> : mpl::true_ +struct is_reference_to_pointer<T* volatile&> : boost::true_type { }; template <class T> -struct is_reference_to_pointer<T* const volatile&> : mpl::true_ +struct is_reference_to_pointer<T* const volatile&> : boost::true_type { }; template <class T> struct is_reference_to_class - : mpl::and_< - is_reference<T> - , is_class< + : boost::integral_constant<bool, + is_reference<T>::value && + is_class< typename remove_cv< typename remove_reference<T>::type >::type - > + >::value > { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) }; template <class T> struct is_pointer_to_class - : mpl::and_< - is_pointer<T> - , is_class< + : boost::integral_constant<bool, + is_pointer<T>::value && + is_class< typename remove_cv< typename remove_pointer<T>::type >::type - > + >::value > { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T)) }; diff --git a/contrib/restricted/boost/detail/include/boost/detail/is_incrementable.hpp b/contrib/restricted/boost/detail/include/boost/detail/is_incrementable.hpp index 5ebf4b7acab..fa70cf2ed79 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/is_incrementable.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/is_incrementable.hpp @@ -6,8 +6,6 @@ # include <boost/type_traits/integral_constant.hpp> # include <boost/type_traits/remove_cv.hpp> -# include <boost/mpl/aux_/lambda_support.hpp> -# include <boost/mpl/bool.hpp> # include <boost/detail/workaround.hpp> namespace boost { namespace detail { @@ -106,14 +104,12 @@ template<typename T> struct is_incrementable : public boost::integral_constant<bool, boost::detail::is_incrementable_::impl<T>::value> { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T)) }; template<typename T> struct is_postfix_incrementable : public boost::integral_constant<bool, boost::detail::is_incrementable_::postfix_impl<T>::value> { - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T)) }; } // namespace detail diff --git a/contrib/restricted/boost/detail/include/boost/detail/is_sorted.hpp b/contrib/restricted/boost/detail/include/boost/detail/is_sorted.hpp index 5ab32e5c599..84357f9b49f 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/is_sorted.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/is_sorted.hpp @@ -8,8 +8,7 @@ #ifndef BOOST_DETAIL_SORTED_HPP #define BOOST_DETAIL_SORTED_HPP -#include <boost/detail/iterator.hpp> - +#include <iterator> #include <functional> namespace boost { @@ -31,23 +30,23 @@ inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) { template<class Iterator> inline Iterator is_sorted_until (Iterator first, Iterator last) { - typedef typename boost::detail::iterator_traits<Iterator>::value_type + typedef typename std::iterator_traits<Iterator>::value_type value_type; - typedef std::less<value_type> c; + typedef std::less<value_type> c; - return ::boost::detail::is_sorted_until(first, last, c()); + return ::boost::detail::is_sorted_until(first, last, c()); } template<class Iterator, class Comp> inline bool is_sorted (Iterator first, Iterator last, Comp c) { return ::boost::detail::is_sorted_until(first, last, c) == last; -} +} template<class Iterator> inline bool is_sorted (Iterator first, Iterator last) { return ::boost::detail::is_sorted_until(first, last) == last; -} +} } // detail } // boost diff --git a/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp b/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp index 3f9a1265eed..d54bf7b88c8 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/is_xxx.hpp @@ -5,13 +5,13 @@ # define BOOST_DETAIL_IS_XXX_DWA20051011_HPP # include <boost/config.hpp> -# include <boost/mpl/bool.hpp> +# include <boost/type_traits/integral_constant.hpp> # include <boost/preprocessor/enum_params.hpp> # define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ template <class T> \ -struct is_##name : mpl::false_ \ +struct is_##name : boost::false_type \ { \ }; \ \ @@ -19,7 +19,7 @@ template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \ struct is_##name< \ qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \ > \ - : mpl::true_ \ + : boost::true_type \ { \ }; diff --git a/contrib/restricted/boost/detail/include/boost/detail/reference_content.hpp b/contrib/restricted/boost/detail/include/boost/detail/reference_content.hpp index 36b80d244ec..c93ea6fdd01 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/reference_content.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/reference_content.hpp @@ -15,15 +15,15 @@ #include "boost/config.hpp" -# include "boost/mpl/bool.hpp" +# include "boost/type_traits/integral_constant.hpp" # include "boost/type_traits/has_nothrow_copy.hpp" -#include "boost/mpl/void.hpp" - namespace boost { namespace detail { +struct void_type {}; + /////////////////////////////////////////////////////////////////////////////// // (detail) class template reference_content // @@ -71,7 +71,7 @@ public: // queries // Wraps with reference_content if specified type is reference. // -template <typename T = mpl::void_> struct make_reference_content; +template <typename T = void_type> struct make_reference_content; template <typename T> @@ -88,7 +88,7 @@ struct make_reference_content< T& > template <> -struct make_reference_content< mpl::void_ > +struct make_reference_content< void_type > { template <typename T> struct apply @@ -96,7 +96,7 @@ struct make_reference_content< mpl::void_ > { }; - typedef mpl::void_ type; + typedef void_type type; }; } // namespace detail @@ -110,7 +110,7 @@ template <typename T> struct has_nothrow_copy< ::boost::detail::reference_content< T& > > - : mpl::true_ + : boost::true_type { }; diff --git a/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.hpp b/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.hpp index 71a4b1bba1c..385164fcb2d 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.hpp +++ b/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.hpp @@ -14,7 +14,7 @@ /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // utf8_codecvt_facet.hpp -// This header defines class utf8_codecvt_facet, derived from +// This header defines class utf8_codecvt_facet, derived from // std::codecvt<wchar_t, char>, which can be used to convert utf8 data in // files into wchar_t strings in the application. // @@ -23,10 +23,10 @@ // we want to avoid code duplication. It would be possible to create utf8 // library, but: // - this requires review process first -// - in the case, when linking the a library which uses utf8 +// - in the case, when linking the a library which uses utf8 // (say 'program_options'), user should also link to the utf8 library. -// This seems inconvenient, and asking a user to link to an unrevieved -// library is strange. +// This seems inconvenient, and asking a user to link to an unrevieved +// library is strange. // Until the above points are fixed, a library which wants to use utf8 must: // - include this header in one of it's headers or sources // - include the corresponding boost/detail/utf8_codecvt_facet.ipp file in one @@ -39,14 +39,14 @@ // symbols. // // For example, program_options library might contain: -// #define BOOST_UTF8_BEGIN_NAMESPACE <backslash character> +// #define BOOST_UTF8_BEGIN_NAMESPACE <backslash character> // namespace boost { namespace program_options { // #define BOOST_UTF8_END_NAMESPACE }} // #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL // #include <boost/detail/utf8_codecvt_facet.ipp> // // Essentially, each library will have its own copy of utf8 code, in -// different namespaces. +// different namespaces. // Note:(Robert Ramey). I have made the following alterations in the original // code. @@ -67,7 +67,7 @@ // use two template parameters // // utf8_codecvt_facet -// This is an implementation of a std::codecvt facet for translating +// This is an implementation of a std::codecvt facet for translating // from UTF-8 externally to UCS-4. Note that this is not tied to // any specific types in order to allow customization on platforms // where wchar_t is not big enough. @@ -109,28 +109,29 @@ BOOST_UTF8_BEGIN_NAMESPACE #define BOOST_UTF8_DECL #endif -struct BOOST_UTF8_DECL utf8_codecvt_facet : - public std::codecvt<wchar_t, char, std::mbstate_t> +struct BOOST_SYMBOL_VISIBLE utf8_codecvt_facet : + public std::codecvt<wchar_t, char, std::mbstate_t> { public: - explicit utf8_codecvt_facet(std::size_t no_locale_manage=0); - virtual ~utf8_codecvt_facet(){} + BOOST_UTF8_DECL explicit utf8_codecvt_facet(std::size_t no_locale_manage = 0); + BOOST_UTF8_DECL virtual ~utf8_codecvt_facet(); + protected: - virtual std::codecvt_base::result do_in( - std::mbstate_t& state, + BOOST_UTF8_DECL virtual std::codecvt_base::result do_in( + std::mbstate_t& state, const char * from, - const char * from_end, + const char * from_end, const char * & from_next, - wchar_t * to, - wchar_t * to_end, - wchar_t*& to_next + wchar_t * to, + wchar_t * to_end, + wchar_t * & to_next ) const; - virtual std::codecvt_base::result do_out( + BOOST_UTF8_DECL virtual std::codecvt_base::result do_out( std::mbstate_t & state, const wchar_t * from, const wchar_t * from_end, - const wchar_t* & from_next, + const wchar_t * & from_next, char * to, char * to_end, char * & to_next @@ -140,7 +141,7 @@ protected: return (octet_1 < 0x80|| 0xbf< octet_1); } - bool invalid_leading_octet(unsigned char octet_1) const { + bool invalid_leading_octet(unsigned char octet_1) const { return (0x7f < octet_1 && octet_1 < 0xc0) || (octet_1 > 0xfd); } @@ -150,11 +151,11 @@ protected: return get_octet_count(lead_octet) - 1; } - static unsigned int get_octet_count(unsigned char lead_octet); + BOOST_UTF8_DECL static unsigned int get_octet_count(unsigned char lead_octet); // How many "continuing octets" will be needed for this word // == total octets - 1. - int get_cont_octet_out_count(wchar_t word) const ; + BOOST_UTF8_DECL static int get_cont_octet_out_count(wchar_t word); virtual bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW { return false; @@ -162,7 +163,7 @@ protected: // UTF-8 isn't really stateful since we rewind on partial conversions virtual std::codecvt_base::result do_unshift( - std::mbstate_t&, + std::mbstate_t &, char * from, char * /*to*/, char * & next @@ -178,10 +179,10 @@ protected: // How many char objects can I process to get <= max_limit // wchar_t objects? - virtual int do_length( + BOOST_UTF8_DECL virtual int do_length( std::mbstate_t &, const char * from, - const char * from_end, + const char * from_end, std::size_t max_limit ) const #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) @@ -193,7 +194,7 @@ protected: virtual int do_length( const std::mbstate_t & s, const char * from, - const char * from_end, + const char * from_end, std::size_t max_limit ) const #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) diff --git a/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.ipp b/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.ipp index d60f9063417..65215cb5b12 100644 --- a/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.ipp +++ b/contrib/restricted/boost/detail/include/boost/detail/utf8_codecvt_facet.ipp @@ -2,7 +2,7 @@ // utf8_codecvt_facet.ipp // Copyright (c) 2001 Ronald Garcia, Indiana University ([email protected]) -// Andrew Lumsdaine, Indiana University ([email protected]). +// Andrew Lumsdaine, Indiana University ([email protected]). // Use, modification and distribution is subject to the Boost Software // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) @@ -18,7 +18,7 @@ #include <boost/limits.hpp> #include <boost/config.hpp> -// If we don't have wstring, then Unicode support +// If we don't have wstring, then Unicode support // is not available anyway, so we don't need to even // compiler this file. This also fixes the problem // with mingw, which can compile this file, but will @@ -30,105 +30,117 @@ BOOST_UTF8_BEGIN_NAMESPACE /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // implementation for wchar_t -utf8_codecvt_facet::utf8_codecvt_facet( +namespace detail { + +inline const wchar_t * get_octet1_modifier_table() BOOST_NOEXCEPT +{ + static const wchar_t octet1_modifier_table[] = { + 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc + }; + return octet1_modifier_table; +} + +} // namespace detail + + +BOOST_UTF8_DECL utf8_codecvt_facet::utf8_codecvt_facet( std::size_t no_locale_manage ) : std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage) {} +BOOST_UTF8_DECL utf8_codecvt_facet::~utf8_codecvt_facet() +{} + // Translate incoming UTF-8 into UCS-4 -std::codecvt_base::result utf8_codecvt_facet::do_in( - std::mbstate_t& /*state*/, +BOOST_UTF8_DECL std::codecvt_base::result utf8_codecvt_facet::do_in( + std::mbstate_t& /*state*/, const char * from, - const char * from_end, + const char * from_end, const char * & from_next, - wchar_t * to, - wchar_t * to_end, + wchar_t * to, + wchar_t * to_end, wchar_t * & to_next ) const { - // Basic algorithm: The first octet determines how many - // octets total make up the UCS-4 character. The remaining + // Basic algorithm: The first octet determines how many + // octets total make up the UCS-4 character. The remaining // "continuing octets" all begin with "10". To convert, subtract // the amount that specifies the number of octets from the first - // octet. Subtract 0x80 (1000 0000) from each continuing octet, - // then mash the whole lot together. Note that each continuing + // octet. Subtract 0x80 (1000 0000) from each continuing octet, + // then mash the whole lot together. Note that each continuing // octet only uses 6 bits as unique values, so only shift by // multiples of 6 to combine. + const wchar_t * const octet1_modifier_table = detail::get_octet1_modifier_table(); while (from != from_end && to != to_end) { - // Error checking on the first octet - if (invalid_leading_octet(*from)){ + // Error checking on the first octet + if (invalid_leading_octet(*from)) { from_next = from; to_next = to; return std::codecvt_base::error; } - // The first octet is adjusted by a value dependent upon - // the number of "continuing octets" encoding the character - const int cont_octet_count = get_cont_octet_count(*from); - const wchar_t octet1_modifier_table[] = { - 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc - }; + // The first octet is adjusted by a value dependent upon + // the number of "continuing octets" encoding the character + const int cont_octet_count = get_cont_octet_count(*from); // The unsigned char conversion is necessary in case char is - // signed (I learned this the hard way) - wchar_t ucs_result = + // signed (I learned this the hard way) + wchar_t ucs_result = (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count]; - // Invariants : - // 1) At the start of the loop, 'i' continuing characters have been - // processed - // 2) *from points to the next continuing character to be processed. - int i = 0; - while(i != cont_octet_count && from != from_end) { + // Invariants: + // 1) At the start of the loop, 'i' continuing characters have been + // processed + // 2) *from points to the next continuing character to be processed. + int i = 0; + while (i != cont_octet_count && from != from_end) { // Error checking on continuing characters if (invalid_continuing_octet(*from)) { - from_next = from; - to_next = to; + from_next = from; + to_next = to; return std::codecvt_base::error; } - ucs_result *= (1 << 6); + ucs_result *= (1 << 6); - // each continuing character has an extra (10xxxxxx)b attached to + // each continuing character has an extra (10xxxxxx)b attached to // it that must be removed. ucs_result += (unsigned char)(*from++) - 0x80; ++i; } - // If the buffer ends with an incomplete unicode character... - if (from == from_end && i != cont_octet_count) { + // If the buffer ends with an incomplete unicode character... + if (from == from_end && i != cont_octet_count) { // rewind "from" to before the current character translation - from_next = from - (i+1); + from_next = from - (i + 1); to_next = to; return std::codecvt_base::partial; } - *to++ = ucs_result; + *to++ = ucs_result; } from_next = from; to_next = to; // Were we done converting or did we run out of destination space? - if(from == from_end) return std::codecvt_base::ok; - else return std::codecvt_base::partial; + if (from == from_end) + return std::codecvt_base::ok; + else + return std::codecvt_base::partial; } -std::codecvt_base::result utf8_codecvt_facet::do_out( - std::mbstate_t& /*state*/, - const wchar_t * from, - const wchar_t * from_end, +BOOST_UTF8_DECL std::codecvt_base::result utf8_codecvt_facet::do_out( + std::mbstate_t& /*state*/, + const wchar_t * from, + const wchar_t * from_end, const wchar_t * & from_next, - char * to, - char * to_end, + char * to, + char * to_end, char * & to_next ) const { - // RG - consider merging this table with the other one - const wchar_t octet1_modifier_table[] = { - 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc - }; - + const wchar_t * const octet1_modifier_table = detail::get_octet1_modifier_table(); wchar_t max_wchar = (std::numeric_limits<wchar_t>::max)(); while (from != from_end && to != to_end) { @@ -141,75 +153,69 @@ std::codecvt_base::result utf8_codecvt_facet::do_out( int cont_octet_count = get_cont_octet_out_count(*from); - // RG - comment this formula better - int shift_exponent = (cont_octet_count) * 6; + // RG - comment this formula better + int shift_exponent = cont_octet_count * 6; // Process the first character *to++ = static_cast<char>(octet1_modifier_table[cont_octet_count] + (unsigned char)(*from / (1 << shift_exponent))); - // Process the continuation characters - // Invariants: At the start of the loop: - // 1) 'i' continuing octets have been generated - // 2) '*to' points to the next location to place an octet - // 3) shift_exponent is 6 more than needed for the next octet - int i = 0; - while (i != cont_octet_count && to != to_end) { + // Process the continuation characters + // Invariants: At the start of the loop: + // 1) 'i' continuing octets have been generated + // 2) '*to' points to the next location to place an octet + // 3) shift_exponent is 6 more than needed for the next octet + int i = 0; + while (i != cont_octet_count && to != to_end) { shift_exponent -= 6; *to++ = static_cast<char>(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6))); ++i; } - // If we filled up the out buffer before encoding the character - if(to == to_end && i != cont_octet_count) { + // If we filled up the out buffer before encoding the character + if (to == to_end && i != cont_octet_count) { from_next = from; - to_next = to - (i+1); + to_next = to - (i + 1); return std::codecvt_base::partial; } ++from; } from_next = from; to_next = to; + // Were we done or did we run out of destination space - if(from == from_end) return std::codecvt_base::ok; - else return std::codecvt_base::partial; + if (from == from_end) + return std::codecvt_base::ok; + else + return std::codecvt_base::partial; } // How many char objects can I process to get <= max_limit // wchar_t objects? -int utf8_codecvt_facet::do_length( +BOOST_UTF8_DECL int utf8_codecvt_facet::do_length( std::mbstate_t &, const char * from, - const char * from_end, + const char * from_end, std::size_t max_limit ) const #if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) throw() #endif -{ - // RG - this code is confusing! I need a better way to express it. - // and test cases. - - // Invariants: - // 1) last_octet_count has the size of the last measured character - // 2) char_count holds the number of characters shown to fit - // within the bounds so far (no greater than max_limit) - // 3) from_next points to the octet 'last_octet_count' before the - // last measured character. - int last_octet_count=0; - std::size_t char_count = 0; - const char* from_next = from; - // Use "<" because the buffer may represent incomplete characters - while (from_next+last_octet_count <= from_end && char_count <= max_limit) { - from_next += last_octet_count; - last_octet_count = (get_octet_count(*from_next)); - ++char_count; +{ + const char * from_next = from; + for (std::size_t char_count = 0u; char_count < max_limit && from_next < from_end; ++char_count) { + unsigned int octet_count = get_octet_count(*from_next); + // The buffer may represent incomplete characters, so terminate early if one is found + if (octet_count > static_cast<std::size_t>(from_end - from_next)) + break; + from_next += octet_count; } - return static_cast<int>(from_next-from); + + return static_cast<int>(from_next - from); } -unsigned int utf8_codecvt_facet::get_octet_count( +BOOST_UTF8_DECL unsigned int utf8_codecvt_facet::get_octet_count( unsigned char lead_octet -){ +) { // if the 0-bit (MSB) is 0, then 1 character if (lead_octet <= 0x7f) return 1; @@ -226,7 +232,7 @@ unsigned int utf8_codecvt_facet::get_octet_count( namespace detail { template<std::size_t s> -int get_cont_octet_out_count_impl(wchar_t word){ +inline int get_cont_octet_out_count_impl(wchar_t word) { if (word < 0x80) { return 0; } @@ -237,7 +243,7 @@ int get_cont_octet_out_count_impl(wchar_t word){ } template<> -int get_cont_octet_out_count_impl<4>(wchar_t word){ +inline int get_cont_octet_out_count_impl<4>(wchar_t word) { if (word < 0x80) { return 0; } @@ -249,7 +255,7 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){ // where wchar_t is defined as UCS2. The warnings are superfluous as the // specialization is never instantitiated with such compilers, but this // can cause problems if warnings are being treated as errors, so we guard - // against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do + // against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do // should be enough to get WCHAR_MAX defined. #if !defined(WCHAR_MAX) # error WCHAR_MAX not defined! @@ -258,8 +264,8 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){ #if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier return 2; #elif WCHAR_MAX > 0x10000 - - if (word < 0x10000) { + + if (word < 0x10000) { return 2; } if (word < 0x200000) { @@ -269,7 +275,7 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){ return 4; } return 5; - + #else return 2; #endif @@ -279,11 +285,12 @@ int get_cont_octet_out_count_impl<4>(wchar_t word){ // How many "continuing octets" will be needed for this word // == total octets - 1. -int utf8_codecvt_facet::get_cont_octet_out_count( +BOOST_UTF8_DECL int utf8_codecvt_facet::get_cont_octet_out_count( wchar_t word -) const { +) { return detail::get_cont_octet_out_count_impl<sizeof(wchar_t)>(word); } + BOOST_UTF8_END_NAMESPACE #endif diff --git a/contrib/restricted/boost/endian/README b/contrib/restricted/boost/endian/README deleted file mode 100644 index 2039ba9400d..00000000000 --- a/contrib/restricted/boost/endian/README +++ /dev/null @@ -1,29 +0,0 @@ -Boost Endian library - -The Endian library is included in Boost release 1.58.0 and later. - -See http://boostorg.github.io/endian to browse the documentation without having to -download the library or install Boost. - -To experiment with the Endian library, various other boost libraries must be -available. So you need to install Boost or clone a current version of boostorg/boost -if you have not already done so. - -Boost.Endian is a header-only library, so there is no need to run a build -for it, although you may need to do a "b2 headers". - -If your clone of boost is already in place, please remember to: - - cd boost - git pull - git submodule update --init - git submodule update - ./b2 headers - -On Windows, "./" is unnecessary. - ---------------------------- -Copyright Beman Dawes, 2013 - -Distributed under the Boost Software License, Version 1.0. -http://www.boost.org/LICENSE_1_0.txt
\ No newline at end of file diff --git a/contrib/restricted/boost/endian/README.md b/contrib/restricted/boost/endian/README.md new file mode 100644 index 00000000000..cbd15e22617 --- /dev/null +++ b/contrib/restricted/boost/endian/README.md @@ -0,0 +1,20 @@ +# Boost.Endian + +The Endian library provides facilities for dealing with +[endianness](https://en.wikipedia.org/wiki/Endianness). +It's part of Boost since release 1.58.0. See +[the documentation](http://boost.org/libs/endian) for more information. + +## Supported compilers + +* g++ 4.4 or later +* clang++ 3.3 or later +* Visual Studio 2008 or later + +Tested on [Travis](https://travis-ci.org/boostorg/endian/) and +[Appveyor](https://ci.appveyor.com/project/pdimov/endian/). + +## License + +Distributed under the +[Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt). |