diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2023-05-05 00:26:13 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2023-05-05 00:26:13 +0300 |
commit | b9c7f31e3e9529babeec5bdc94f9b5405f0bfd74 (patch) | |
tree | d87274967f20354c3a019f7e3f48679abc07f452 | |
parent | 39dbe897485c57a12a6c8027ed787d70f9d31433 (diff) | |
download | ydb-b9c7f31e3e9529babeec5bdc94f9b5405f0bfd74.tar.gz |
Update contrib/restricted/boost/type_traits to 1.82.0
5 files changed, 170 insertions, 24 deletions
diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits.hpp index a1c882e03b8..f661baa449c 100644 --- a/contrib/restricted/boost/type_traits/include/boost/type_traits.hpp +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits.hpp @@ -131,6 +131,7 @@ #include <boost/type_traits/is_scoped_enum.hpp> #include <boost/type_traits/is_signed.hpp> #include <boost/type_traits/is_stateless.hpp> +#include <boost/type_traits/is_swappable.hpp> #include <boost/type_traits/is_trivially_copyable.hpp> #include <boost/type_traits/is_union.hpp> #include <boost/type_traits/is_unscoped_enum.hpp> diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/detail/is_swappable_cxx_11.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/detail/is_swappable_cxx_11.hpp new file mode 100644 index 00000000000..390253ca323 --- /dev/null +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits/detail/is_swappable_cxx_11.hpp @@ -0,0 +1,70 @@ +#ifndef BOOST_TYPE_TRAITS_DETAIL_IS_SWAPPABLE_CXX_11_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_DETAIL_IS_SWAPPABLE_CXX_11_HPP_INCLUDED + +// Copyright 2017 Peter Dimov +// Copyright 2023 Andrey Semashev +// +// 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 + +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/integral_constant.hpp> +#if __cplusplus >= 201103L || defined(BOOST_DINKUMWARE_STDLIB) +#include <utility> // for std::swap (C++11) +#else +#include <algorithm> // for std::swap (C++98) +#endif + +// Intentionally not within boost namespace to avoid implicitly pulling in boost::swap overloads other than through ADL +namespace boost_type_traits_swappable_detail +{ + +using std::swap; + +template<class T, class U, class = decltype(swap(boost::declval<T>(), boost::declval<U>()))> boost::true_type is_swappable_with_impl( int ); +template<class T, class U> boost::false_type is_swappable_with_impl( ... ); +template<class T, class U> +struct is_swappable_with_helper { typedef decltype( boost_type_traits_swappable_detail::is_swappable_with_impl<T, U>(0) ) type; }; + +template<class T, class = decltype(swap(boost::declval<T&>(), boost::declval<T&>()))> boost::true_type is_swappable_impl( int ); +template<class T> boost::false_type is_swappable_impl( ... ); +template<class T> +struct is_swappable_helper { typedef decltype( boost_type_traits_swappable_detail::is_swappable_impl<T>(0) ) type; }; + +#if !defined(BOOST_NO_CXX11_NOEXCEPT) + +#if BOOST_WORKAROUND(BOOST_GCC, < 40700) + +// gcc 4.6 ICEs when noexcept operator is used on an invalid expression +template<class T, class U, bool = is_swappable_with_helper<T, U>::type::value> +struct is_nothrow_swappable_with_helper { typedef boost::false_type type; }; +template<class T, class U> +struct is_nothrow_swappable_with_helper<T, U, true> { typedef boost::integral_constant<bool, noexcept(swap(boost::declval<T>(), boost::declval<U>()))> type; }; + +template<class T, bool = is_swappable_helper<T>::type::value> +struct is_nothrow_swappable_helper { typedef boost::false_type type; }; +template<class T> +struct is_nothrow_swappable_helper<T, true> { typedef boost::integral_constant<bool, noexcept(swap(boost::declval<T&>(), boost::declval<T&>()))> type; }; + +#else // BOOST_WORKAROUND(BOOST_GCC, < 40700) + +template<class T, class U, bool B = noexcept(swap(boost::declval<T>(), boost::declval<U>()))> boost::integral_constant<bool, B> is_nothrow_swappable_with_impl( int ); +template<class T, class U> boost::false_type is_nothrow_swappable_with_impl( ... ); +template<class T, class U> +struct is_nothrow_swappable_with_helper { typedef decltype( boost_type_traits_swappable_detail::is_nothrow_swappable_with_impl<T, U>(0) ) type; }; + +template<class T, bool B = noexcept(swap(boost::declval<T&>(), boost::declval<T&>()))> boost::integral_constant<bool, B> is_nothrow_swappable_impl( int ); +template<class T> boost::false_type is_nothrow_swappable_impl( ... ); +template<class T> +struct is_nothrow_swappable_helper { typedef decltype( boost_type_traits_swappable_detail::is_nothrow_swappable_impl<T>(0) ) type; }; + +#endif // BOOST_WORKAROUND(BOOST_GCC, < 40700) + +#endif // !defined(BOOST_NO_CXX11_NOEXCEPT) + +} // namespace boost_type_traits_swappable_detail + +#endif // #ifndef BOOST_TYPE_TRAITS_DETAIL_IS_SWAPPABLE_CXX_11_HPP_INCLUDED diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_integral.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_integral.hpp index 6c6e239c31f..97e5aba37fe 100644 --- a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_integral.hpp +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_integral.hpp @@ -81,6 +81,9 @@ template<> struct is_integral<char16_t> : public true_type{}; #ifndef BOOST_NO_CXX11_CHAR32_T template<> struct is_integral<char32_t> : public true_type{}; #endif +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L +template<> struct is_integral<char8_t> : public true_type{}; +#endif #endif // non-CodeGear implementation diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_nothrow_swappable.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_nothrow_swappable.hpp index 10ad9239a92..1ab3dcd1492 100644 --- a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_nothrow_swappable.hpp +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_nothrow_swappable.hpp @@ -8,10 +8,9 @@ // http://www.boost.org/LICENSE_1_0.txt #include <boost/config.hpp> -#include <boost/config/workaround.hpp> #if defined(BOOST_NO_SFINAE_EXPR) || defined(BOOST_NO_CXX11_NOEXCEPT) || defined(BOOST_NO_CXX11_DECLTYPE) \ - || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) || BOOST_WORKAROUND(BOOST_GCC, < 40700) + || defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) #include <boost/type_traits/is_scalar.hpp> #include <boost/type_traits/is_const.hpp> @@ -28,35 +27,16 @@ template <class T> struct is_nothrow_swappable_with<T, T> : is_nothrow_swappable #else -#include <boost/type_traits/declval.hpp> -#include <boost/type_traits/integral_constant.hpp> -#include <algorithm> +#include <boost/type_traits/detail/is_swappable_cxx_11.hpp> namespace boost { -namespace type_traits_swappable_detail -{ - -using std::swap; - -template<class T, class U, bool B = noexcept(swap(declval<T>(), declval<U>()))> integral_constant<bool, B> is_nothrow_swappable_with_impl( int ); -template<class T, class U> false_type is_nothrow_swappable_with_impl( ... ); -template<class T, class U> -struct is_nothrow_swappable_with_helper { typedef decltype( type_traits_swappable_detail::is_nothrow_swappable_with_impl<T, U>(0) ) type; }; - -template<class T, bool B = noexcept(swap(declval<T&>(), declval<T&>()))> integral_constant<bool, B> is_nothrow_swappable_impl( int ); -template<class T> false_type is_nothrow_swappable_impl( ... ); -template<class T> -struct is_nothrow_swappable_helper { typedef decltype( type_traits_swappable_detail::is_nothrow_swappable_impl<T>(0) ) type; }; - -} // namespace type_traits_swappable_detail - -template<class T, class U> struct is_nothrow_swappable_with: type_traits_swappable_detail::is_nothrow_swappable_with_helper<T, U>::type +template<class T, class U> struct is_nothrow_swappable_with: boost_type_traits_swappable_detail::is_nothrow_swappable_with_helper<T, U>::type { }; -template<class T> struct is_nothrow_swappable: type_traits_swappable_detail::is_nothrow_swappable_helper<T>::type +template<class T> struct is_nothrow_swappable: boost_type_traits_swappable_detail::is_nothrow_swappable_helper<T>::type { }; diff --git a/contrib/restricted/boost/type_traits/include/boost/type_traits/is_swappable.hpp b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_swappable.hpp new file mode 100644 index 00000000000..ca0442fdabb --- /dev/null +++ b/contrib/restricted/boost/type_traits/include/boost/type_traits/is_swappable.hpp @@ -0,0 +1,92 @@ +#ifndef BOOST_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED +#define BOOST_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED + +// Copyright 2023 Andrey Semashev +// +// 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 + +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> + +#if !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && \ + !(defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_CXX_VERSION < 201703L)) + +#include <boost/type_traits/detail/is_swappable_cxx_11.hpp> + +namespace boost +{ + +template<class T, class U> struct is_swappable_with : boost_type_traits_swappable_detail::is_swappable_with_helper<T, U>::type +{ +}; + +template<class T> struct is_swappable : boost_type_traits_swappable_detail::is_swappable_helper<T>::type +{ +}; + +} // namespace boost + +#elif defined(BOOST_DINKUMWARE_STDLIB) && (BOOST_CXX_VERSION < 201703L) && \ + !defined(BOOST_NO_SFINAE_EXPR) && !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !BOOST_WORKAROUND(BOOST_MSVC, < 1800) // these are required for is_constructible and is_assignable + +// MSVC standard library has SFINAE-unfriendly std::swap in C++ modes prior to C++17, +// so we have to reproduce the restrictions on std::swap that are in effect in C++17 mode. + +#include <cstddef> +#include <boost/type_traits/negation.hpp> +#include <boost/type_traits/conjunction.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_constructible.hpp> +#include <boost/type_traits/is_assignable.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/detail/is_swappable_cxx_11.hpp> + +namespace boost +{ + +template<class T> struct is_swappable + : boost::conjunction< + boost::negation< boost::is_const<T> >, + boost::is_constructible<T, T&&>, + boost::is_assignable<T&, T&&> + >::type {}; + +template<> struct is_swappable<void> : false_type {}; +template<> struct is_swappable<const void> : false_type {}; +template<> struct is_swappable<volatile void> : false_type {}; +template<> struct is_swappable<const volatile void> : false_type {}; +template<class T> struct is_swappable<T[]> : false_type {}; +template<class T> struct is_swappable<T(&)[]> : false_type {}; +template<class T, std::size_t N> struct is_swappable<T[N]> : is_swappable<T> {}; +template<class T, std::size_t N> struct is_swappable<T(&)[N]> : is_swappable<T> {}; + +template<class T, class U> struct is_swappable_with : boost_type_traits_swappable_detail::is_swappable_with_helper<T, U>::type +{ +}; + +template<class T> struct is_swappable_with<T, T> : is_swappable<T> {}; + +} // namespace boost + +#else + +#include <boost/type_traits/is_scalar.hpp> +#include <boost/type_traits/integral_constant.hpp> + +namespace boost +{ + +template<class T> struct is_swappable : boost::is_scalar<T> {}; +template<class T> struct is_swappable<const T> : false_type {}; + +template<class T, class U> struct is_swappable_with : false_type {}; +template<class T> struct is_swappable_with<T, T> : is_swappable<T> {}; + +} // namespace boost + +#endif + +#endif // #ifndef BOOST_TYPE_TRAITS_IS_SWAPPABLE_HPP_INCLUDED |