diff options
author | thegeorg <thegeorg@yandex-team.com> | 2023-01-12 01:07:01 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2023-01-12 01:07:01 +0300 |
commit | faae92145dec56b0978b2c4c3f5cd6cc211a09b0 (patch) | |
tree | 3f52e6ad3e61db3cceaee369503f74d9191e51c6 | |
parent | 0d64589442041f41b093a1fa19d180fa68568fd3 (diff) | |
download | ydb-faae92145dec56b0978b2c4c3f5cd6cc211a09b0.tar.gz |
Update contrib/restricted/boost/container_hash to 1.81.0
32 files changed, 1606 insertions, 1792 deletions
diff --git a/contrib/restricted/boost/CMakeLists.darwin.txt b/contrib/restricted/boost/CMakeLists.darwin.txt index 24df71a5fe..e4950f30a9 100644 --- a/contrib/restricted/boost/CMakeLists.darwin.txt +++ b/contrib/restricted/boost/CMakeLists.darwin.txt @@ -26,6 +26,7 @@ add_subdirectory(core) add_subdirectory(coroutine) add_subdirectory(crc) add_subdirectory(date_time) +add_subdirectory(describe) add_subdirectory(detail) add_subdirectory(dynamic_bitset) add_subdirectory(endian) diff --git a/contrib/restricted/boost/CMakeLists.linux-aarch64.txt b/contrib/restricted/boost/CMakeLists.linux-aarch64.txt index 3a27c3b8eb..e1a8ada75b 100644 --- a/contrib/restricted/boost/CMakeLists.linux-aarch64.txt +++ b/contrib/restricted/boost/CMakeLists.linux-aarch64.txt @@ -25,6 +25,7 @@ add_subdirectory(core) add_subdirectory(coroutine) add_subdirectory(crc) add_subdirectory(date_time) +add_subdirectory(describe) add_subdirectory(detail) add_subdirectory(dynamic_bitset) add_subdirectory(endian) diff --git a/contrib/restricted/boost/CMakeLists.linux.txt b/contrib/restricted/boost/CMakeLists.linux.txt index 24df71a5fe..e4950f30a9 100644 --- a/contrib/restricted/boost/CMakeLists.linux.txt +++ b/contrib/restricted/boost/CMakeLists.linux.txt @@ -26,6 +26,7 @@ add_subdirectory(core) add_subdirectory(coroutine) add_subdirectory(crc) add_subdirectory(date_time) +add_subdirectory(describe) add_subdirectory(detail) add_subdirectory(dynamic_bitset) add_subdirectory(endian) diff --git a/contrib/restricted/boost/container_hash/CMakeLists.darwin.txt b/contrib/restricted/boost/container_hash/CMakeLists.darwin.txt index db84058b79..ec94da0d3a 100644 --- a/contrib/restricted/boost/container_hash/CMakeLists.darwin.txt +++ b/contrib/restricted/boost/container_hash/CMakeLists.darwin.txt @@ -13,11 +13,8 @@ target_include_directories(restricted-boost-container_hash INTERFACE ) target_link_libraries(restricted-boost-container_hash INTERFACE contrib-libs-cxxsupp - restricted-boost-assert restricted-boost-config - restricted-boost-core - restricted-boost-detail - restricted-boost-integer - restricted-boost-static_assert + restricted-boost-describe + restricted-boost-mp11 restricted-boost-type_traits ) diff --git a/contrib/restricted/boost/container_hash/CMakeLists.linux-aarch64.txt b/contrib/restricted/boost/container_hash/CMakeLists.linux-aarch64.txt index 1a5b71be18..12de24853b 100644 --- a/contrib/restricted/boost/container_hash/CMakeLists.linux-aarch64.txt +++ b/contrib/restricted/boost/container_hash/CMakeLists.linux-aarch64.txt @@ -14,11 +14,8 @@ target_include_directories(restricted-boost-container_hash INTERFACE target_link_libraries(restricted-boost-container_hash INTERFACE contrib-libs-linux-headers contrib-libs-cxxsupp - restricted-boost-assert restricted-boost-config - restricted-boost-core - restricted-boost-detail - restricted-boost-integer - restricted-boost-static_assert + restricted-boost-describe + restricted-boost-mp11 restricted-boost-type_traits ) diff --git a/contrib/restricted/boost/container_hash/CMakeLists.linux.txt b/contrib/restricted/boost/container_hash/CMakeLists.linux.txt index 1a5b71be18..12de24853b 100644 --- a/contrib/restricted/boost/container_hash/CMakeLists.linux.txt +++ b/contrib/restricted/boost/container_hash/CMakeLists.linux.txt @@ -14,11 +14,8 @@ target_include_directories(restricted-boost-container_hash INTERFACE target_link_libraries(restricted-boost-container_hash INTERFACE contrib-libs-linux-headers contrib-libs-cxxsupp - restricted-boost-assert restricted-boost-config - restricted-boost-core - restricted-boost-detail - restricted-boost-integer - restricted-boost-static_assert + restricted-boost-describe + restricted-boost-mp11 restricted-boost-type_traits ) diff --git a/contrib/restricted/boost/container_hash/README.md b/contrib/restricted/boost/container_hash/README.md new file mode 100644 index 0000000000..aaaf577be7 --- /dev/null +++ b/contrib/restricted/boost/container_hash/README.md @@ -0,0 +1,20 @@ +# Boost.ContainerHash + +The Boost.ContainerHash library, part of [Boost C++ Libraries](https://boost.org), +provides `boost::hash`, an enhanced implementation of the +[hash function](https://en.wikipedia.org/wiki/Hash_function) object specified +by C++11 as `std::hash`, and several support facilities (`hash_combine`, +`hash_range`, `hash_unordered_range`). + +`boost::hash` supports most standard types and some user-defined types out of +the box, and is extensible; it's possible for a user-defined type `X` to make +iself hashable via `boost::hash<X>` by defining an appropriate overload of the +function `hash_value`. + +See [the documentation of the library](https://www.boost.org/libs/container_hash) +for more information. + +## License + +Distributed under the +[Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/float_functions.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/float_functions.hpp deleted file mode 100644 index f3db52f9cc..0000000000 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/float_functions.hpp +++ /dev/null @@ -1,336 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP) -#define BOOST_FUNCTIONAL_HASH_DETAIL_FLOAT_FUNCTIONS_HPP - -#include <boost/config.hpp> -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - -#include <boost/config/no_tr1/cmath.hpp> - -// Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have -// sufficiently good floating point support to not require any -// workarounds. -// -// When set to 0, the library tries to automatically -// use the best available implementation. This normally works well, but -// breaks when ambiguities are created by odd namespacing of the functions. -// -// Note that if this is set to 0, the library should still take full -// advantage of the platform's floating point support. - -#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#elif defined(__LIBCOMO__) -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) -// Rogue Wave library: -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#elif defined(_LIBCPP_VERSION) -// libc++ -# define BOOST_HASH_CONFORMANT_FLOATS 1 -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -// GNU libstdc++ 3 -# if defined(__GNUC__) && __GNUC__ >= 4 -# define BOOST_HASH_CONFORMANT_FLOATS 1 -# else -# define BOOST_HASH_CONFORMANT_FLOATS 0 -# endif -#elif defined(__STL_CONFIG_H) -// generic SGI STL -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#elif defined(__MSL_CPP__) -// MSL standard lib: -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#elif defined(__IBMCPP__) -// VACPP std lib (probably conformant for much earlier version). -# if __IBMCPP__ >= 1210 -# define BOOST_HASH_CONFORMANT_FLOATS 1 -# else -# define BOOST_HASH_CONFORMANT_FLOATS 0 -# endif -#elif defined(MSIPL_COMPILE_H) -// Modena C++ standard library -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) -// Dinkumware Library (this has to appear after any possible replacement libraries): -# if _CPPLIB_VER >= 405 -# define BOOST_HASH_CONFORMANT_FLOATS 1 -# else -# define BOOST_HASH_CONFORMANT_FLOATS 0 -# endif -#else -# define BOOST_HASH_CONFORMANT_FLOATS 0 -#endif - -#if BOOST_HASH_CONFORMANT_FLOATS - -// The standard library is known to be compliant, so don't use the -// configuration mechanism. - -namespace boost { - namespace hash_detail { - template <typename Float> - struct call_ldexp { - typedef Float float_type; - inline Float operator()(Float x, int y) const { - return std::ldexp(x, y); - } - }; - - template <typename Float> - struct call_frexp { - typedef Float float_type; - inline Float operator()(Float x, int* y) const { - return std::frexp(x, y); - } - }; - - template <typename Float> - struct select_hash_type - { - typedef Float type; - }; - } -} - -#else // BOOST_HASH_CONFORMANT_FLOATS == 0 - -// The C++ standard requires that the C float functions are overloarded -// for float, double and long double in the std namespace, but some of the older -// library implementations don't support this. On some that don't, the C99 -// float functions (frexpf, frexpl, etc.) are available. -// -// The following tries to automatically detect which are available. - -namespace boost { - namespace hash_detail { - - // Returned by dummy versions of the float functions. - - struct not_found { - // Implicitly convertible to float and long double in order to avoid - // a compile error when the dummy float functions are used. - - inline operator float() const { return 0; } - inline operator long double() const { return 0; } - }; - - // A type for detecting the return type of functions. - - template <typename T> struct is; - template <> struct is<float> { char x[10]; }; - template <> struct is<double> { char x[20]; }; - template <> struct is<long double> { char x[30]; }; - template <> struct is<boost::hash_detail::not_found> { char x[40]; }; - - // Used to convert the return type of a function to a type for sizeof. - - template <typename T> is<T> float_type(T); - - // call_ldexp - // - // This will get specialized for float and long double - - template <typename Float> struct call_ldexp - { - typedef double float_type; - - inline double operator()(double a, int b) const - { - using namespace std; - return ldexp(a, b); - } - }; - - // call_frexp - // - // This will get specialized for float and long double - - template <typename Float> struct call_frexp - { - typedef double float_type; - - inline double operator()(double a, int* b) const - { - using namespace std; - return frexp(a, b); - } - }; - } -} - -// A namespace for dummy functions to detect when the actual function we want -// isn't available. ldexpl, ldexpf etc. might be added tby the macros below. -// -// AFAICT these have to be outside of the boost namespace, as if they're in -// the boost namespace they'll always be preferable to any other function -// (since the arguments are built in types, ADL can't be used). - -namespace boost_hash_detect_float_functions { - template <class Float> boost::hash_detail::not_found ldexp(Float, int); - template <class Float> boost::hash_detail::not_found frexp(Float, int*); -} - -// Macros for generating specializations of call_ldexp and call_frexp. -// -// check_cpp and check_c99 check if the C++ or C99 functions are available. -// -// Then the call_* functions select an appropriate implementation. -// -// I used c99_func in a few places just to get a unique name. -// -// Important: when using 'using namespace' at namespace level, include as -// little as possible in that namespace, as Visual C++ has an odd bug which -// can cause the namespace to be imported at the global level. This seems to -// happen mainly when there's a template in the same namesapce. - -#define BOOST_HASH_CALL_FLOAT_FUNC(cpp_func, c99_func, type1, type2) \ -namespace boost_hash_detect_float_functions { \ - template <class Float> \ - boost::hash_detail::not_found c99_func(Float, type2); \ -} \ - \ -namespace boost { \ - namespace hash_detail { \ - namespace c99_func##_detect { \ - using namespace std; \ - using namespace boost_hash_detect_float_functions; \ - \ - struct check { \ - static type1 x; \ - static type2 y; \ - BOOST_STATIC_CONSTANT(bool, cpp = \ - sizeof(float_type(cpp_func(x,y))) \ - == sizeof(is<type1>)); \ - BOOST_STATIC_CONSTANT(bool, c99 = \ - sizeof(float_type(c99_func(x,y))) \ - == sizeof(is<type1>)); \ - }; \ - } \ - \ - template <bool x> \ - struct call_c99_##c99_func : \ - boost::hash_detail::call_##cpp_func<double> {}; \ - \ - template <> \ - struct call_c99_##c99_func<true> { \ - typedef type1 float_type; \ - \ - template <typename T> \ - inline type1 operator()(type1 a, T b) const \ - { \ - using namespace std; \ - return c99_func(a, b); \ - } \ - }; \ - \ - template <bool x> \ - struct call_cpp_##c99_func : \ - call_c99_##c99_func< \ - ::boost::hash_detail::c99_func##_detect::check::c99 \ - > {}; \ - \ - template <> \ - struct call_cpp_##c99_func<true> { \ - typedef type1 float_type; \ - \ - template <typename T> \ - inline type1 operator()(type1 a, T b) const \ - { \ - using namespace std; \ - return cpp_func(a, b); \ - } \ - }; \ - \ - template <> \ - struct call_##cpp_func<type1> : \ - call_cpp_##c99_func< \ - ::boost::hash_detail::c99_func##_detect::check::cpp \ - > {}; \ - } \ -} - -#define BOOST_HASH_CALL_FLOAT_MACRO(cpp_func, c99_func, type1, type2) \ -namespace boost { \ - namespace hash_detail { \ - \ - template <> \ - struct call_##cpp_func<type1> { \ - typedef type1 float_type; \ - inline type1 operator()(type1 x, type2 y) const { \ - return c99_func(x, y); \ - } \ - }; \ - } \ -} - -#if defined(ldexpf) -BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpf, float, int) -#else -BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpf, float, int) -#endif - -#if defined(ldexpl) -BOOST_HASH_CALL_FLOAT_MACRO(ldexp, ldexpl, long double, int) -#else -BOOST_HASH_CALL_FLOAT_FUNC(ldexp, ldexpl, long double, int) -#endif - -#if defined(frexpf) -BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpf, float, int*) -#else -BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpf, float, int*) -#endif - -#if defined(frexpl) -BOOST_HASH_CALL_FLOAT_MACRO(frexp, frexpl, long double, int*) -#else -BOOST_HASH_CALL_FLOAT_FUNC(frexp, frexpl, long double, int*) -#endif - -#undef BOOST_HASH_CALL_FLOAT_MACRO -#undef BOOST_HASH_CALL_FLOAT_FUNC - - -namespace boost -{ - namespace hash_detail - { - template <typename Float1, typename Float2> - struct select_hash_type_impl { - typedef double type; - }; - - template <> - struct select_hash_type_impl<float, float> { - typedef float type; - }; - - template <> - struct select_hash_type_impl<long double, long double> { - typedef long double type; - }; - - - // select_hash_type - // - // If there is support for a particular floating point type, use that - // otherwise use double (there's always support for double). - - template <typename Float> - struct select_hash_type : select_hash_type_impl< - BOOST_DEDUCED_TYPENAME call_ldexp<Float>::float_type, - BOOST_DEDUCED_TYPENAME call_frexp<Float>::float_type - > {}; - } -} - -#endif // BOOST_HASH_CONFORMANT_FLOATS - -#endif diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_float.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_float.hpp deleted file mode 100644 index f763428508..0000000000 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_float.hpp +++ /dev/null @@ -1,271 +0,0 @@ - -// Copyright 2005-2012 Daniel James. -// 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) - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER) -#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_HEADER - -#include <boost/config.hpp> -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - -#include <boost/container_hash/detail/float_functions.hpp> -#include <boost/container_hash/detail/limits.hpp> -#include <boost/core/enable_if.hpp> -#include <boost/integer/static_log2.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> -#include <boost/limits.hpp> -#include <cstring> - -#if defined(BOOST_MSVC) -#pragma warning(push) -#if BOOST_MSVC >= 1400 -#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does - // not satisfy test. Loop body not executed -#endif -#endif - -// Can we use fpclassify? - -// STLport -#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -#define BOOST_HASH_USE_FPCLASSIFY 0 - -// GNU libstdc++ 3 -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -# if (defined(__USE_ISOC99) || defined(_GLIBCXX_USE_C99_MATH)) && \ - !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) -# define BOOST_HASH_USE_FPCLASSIFY 1 -# else -# define BOOST_HASH_USE_FPCLASSIFY 0 -# endif - -// Everything else -#else -# define BOOST_HASH_USE_FPCLASSIFY 0 -#endif - -namespace boost -{ - namespace hash_detail - { - inline void hash_float_combine(std::size_t& seed, std::size_t value) - { - seed ^= value + (seed<<6) + (seed>>2); - } - - //////////////////////////////////////////////////////////////////////// - // Binary hash function - // - // Only used for floats with known iec559 floats, and certain values in - // numeric_limits - - inline std::size_t hash_binary(char* ptr, std::size_t length) - { - std::size_t seed = 0; - - if (length >= sizeof(std::size_t)) { - std::memcpy(&seed, ptr, sizeof(std::size_t)); - length -= sizeof(std::size_t); - ptr += sizeof(std::size_t); - - while(length >= sizeof(std::size_t)) { - std::size_t buffer = 0; - std::memcpy(&buffer, ptr, sizeof(std::size_t)); - hash_float_combine(seed, buffer); - length -= sizeof(std::size_t); - ptr += sizeof(std::size_t); - } - } - - if (length > 0) { - std::size_t buffer = 0; - std::memcpy(&buffer, ptr, length); - hash_float_combine(seed, buffer); - } - - return seed; - } - - template <typename Float, unsigned digits, unsigned max_exponent> - struct enable_binary_hash - { - BOOST_STATIC_CONSTANT(bool, value = - std::numeric_limits<Float>::is_iec559 && - std::numeric_limits<Float>::digits == digits && - std::numeric_limits<Float>::radix == 2 && - std::numeric_limits<Float>::max_exponent == max_exponent); - }; - - template <typename Float> - inline std::size_t float_hash_impl(Float v, - BOOST_DEDUCED_TYPENAME boost::enable_if_c< - enable_binary_hash<Float, 24, 128>::value, - std::size_t>::type) - { - return hash_binary((char*) &v, 4); - } - - - template <typename Float> - inline std::size_t float_hash_impl(Float v, - BOOST_DEDUCED_TYPENAME boost::enable_if_c< - enable_binary_hash<Float, 53, 1024>::value, - std::size_t>::type) - { - return hash_binary((char*) &v, 8); - } - - template <typename Float> - inline std::size_t float_hash_impl(Float v, - BOOST_DEDUCED_TYPENAME boost::enable_if_c< - enable_binary_hash<Float, 64, 16384>::value, - std::size_t>::type) - { - return hash_binary((char*) &v, 10); - } - - template <typename Float> - inline std::size_t float_hash_impl(Float v, - BOOST_DEDUCED_TYPENAME boost::enable_if_c< - enable_binary_hash<Float, 113, 16384>::value, - std::size_t>::type) - { - return hash_binary((char*) &v, 16); - } - - //////////////////////////////////////////////////////////////////////// - // Portable hash function - // - // Used as a fallback when the binary hash function isn't supported. - - template <class T> - inline std::size_t float_hash_impl2(T v) - { - boost::hash_detail::call_frexp<T> frexp; - boost::hash_detail::call_ldexp<T> ldexp; - - int exp = 0; - - v = frexp(v, &exp); - - // A postive value is easier to hash, so combine the - // sign with the exponent and use the absolute value. - if(v < 0) { - v = -v; - exp += limits<T>::max_exponent - - limits<T>::min_exponent; - } - - v = ldexp(v, limits<std::size_t>::digits); - std::size_t seed = static_cast<std::size_t>(v); - v -= static_cast<T>(seed); - - // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; - std::size_t const length - = (limits<T>::digits * - boost::static_log2<limits<T>::radix>::value - + limits<std::size_t>::digits - 1) - / limits<std::size_t>::digits; - - for(std::size_t i = 0; i != length; ++i) - { - v = ldexp(v, limits<std::size_t>::digits); - std::size_t part = static_cast<std::size_t>(v); - v -= static_cast<T>(part); - hash_float_combine(seed, part); - } - - hash_float_combine(seed, static_cast<std::size_t>(exp)); - - return seed; - } - -#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC) - template <class T> - inline std::size_t float_hash_impl(T v, ...) - { - typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type; - return float_hash_impl2(static_cast<type>(v)); - } -#endif - } -} - -#if BOOST_HASH_USE_FPCLASSIFY - -#include <boost/config/no_tr1/cmath.hpp> - -namespace boost -{ - namespace hash_detail - { - template <class T> - inline std::size_t float_hash_value(T v) - { -#if defined(fpclassify) - switch (fpclassify(v)) -#elif BOOST_HASH_CONFORMANT_FLOATS - switch (std::fpclassify(v)) -#else - using namespace std; - switch (fpclassify(v)) -#endif - { - case FP_ZERO: - return 0; - case FP_INFINITE: - return (std::size_t)(v > 0 ? -1 : -2); - case FP_NAN: - return (std::size_t)(-3); - case FP_NORMAL: - case FP_SUBNORMAL: - return float_hash_impl(v, 0); - default: - BOOST_ASSERT(0); - return 0; - } - } - } -} - -#else // !BOOST_HASH_USE_FPCLASSIFY - -namespace boost -{ - namespace hash_detail - { - template <class T> - inline bool is_zero(T v) - { -#if !defined(__GNUC__) && !defined(__clang__) - return v == 0; -#else - // GCC's '-Wfloat-equal' will complain about comparing - // v to 0, but because it disables warnings for system - // headers it won't complain if you use std::equal_to to - // compare with 0. Resulting in this silliness: - return std::equal_to<T>()(v, 0); -#endif - } - - template <class T> - inline std::size_t float_hash_value(T v) - { - return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0); - } - } -} - -#endif // BOOST_HASH_USE_FPCLASSIFY - -#undef BOOST_HASH_USE_FPCLASSIFY - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - -#endif diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_mix.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_mix.hpp new file mode 100644 index 0000000000..327da9e51c --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_mix.hpp @@ -0,0 +1,113 @@ +// Copyright 2022 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_DETAIL_HASH_MIX_HPP +#define BOOST_HASH_DETAIL_HASH_MIX_HPP + +#include <boost/cstdint.hpp> +#include <cstddef> +#include <climits> + +namespace boost +{ +namespace hash_detail +{ + +template<std::size_t Bits> struct hash_mix_impl; + +// hash_mix for 64 bit size_t +// +// The general "xmxmx" form of state of the art 64 bit mixers originates +// from Murmur3 by Austin Appleby, which uses the following function as +// its "final mix": +// +// k ^= k >> 33; +// k *= 0xff51afd7ed558ccd; +// k ^= k >> 33; +// k *= 0xc4ceb9fe1a85ec53; +// k ^= k >> 33; +// +// (https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp) +// +// It has subsequently been improved multiple times by different authors +// by changing the constants. The most well known improvement is the +// so-called "variant 13" function by David Stafford: +// +// k ^= k >> 30; +// k *= 0xbf58476d1ce4e5b9; +// k ^= k >> 27; +// k *= 0x94d049bb133111eb; +// k ^= k >> 31; +// +// (https://zimbry.blogspot.com/2011/09/better-bit-mixing-improving-on.html) +// +// This mixing function is used in the splitmix64 RNG: +// http://xorshift.di.unimi.it/splitmix64.c +// +// We use Jon Maiga's implementation from +// http://jonkagstrom.com/mx3/mx3_rev2.html +// +// x ^= x >> 32; +// x *= 0xe9846af9b1a615d; +// x ^= x >> 32; +// x *= 0xe9846af9b1a615d; +// x ^= x >> 28; +// +// An equally good alternative is Pelle Evensen's Moremur: +// +// x ^= x >> 27; +// x *= 0x3C79AC492BA7B653; +// x ^= x >> 33; +// x *= 0x1C69B3F74AC4AE35; +// x ^= x >> 27; +// +// (https://mostlymangling.blogspot.com/2019/12/stronger-better-morer-moremur-better.html) + +template<> struct hash_mix_impl<64> +{ + inline static boost::uint64_t fn( boost::uint64_t x ) + { + boost::uint64_t const m = (boost::uint64_t(0xe9846af) << 32) + 0x9b1a615d; + + x ^= x >> 32; + x *= m; + x ^= x >> 32; + x *= m; + x ^= x >> 28; + + return x; + } +}; + +// hash_mix for 32 bit size_t +// +// We use the "best xmxmx" implementation from +// https://github.com/skeeto/hash-prospector/issues/19 + +template<> struct hash_mix_impl<32> +{ + inline static boost::uint32_t fn( boost::uint32_t x ) + { + boost::uint32_t const m1 = 0x21f0aaad; + boost::uint32_t const m2 = 0x735a2d97; + + x ^= x >> 16; + x *= m1; + x ^= x >> 15; + x *= m2; + x ^= x >> 15; + + return x; + } +}; + +inline std::size_t hash_mix( std::size_t v ) +{ + return hash_mix_impl<sizeof(std::size_t) * CHAR_BIT>::fn( v ); +} + +} // namespace hash_detail +} // namespace boost + +#endif // #ifndef BOOST_HASH_DETAIL_HASH_MIX_HPP diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_range.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_range.hpp new file mode 100644 index 0000000000..28fd239ea6 --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_range.hpp @@ -0,0 +1,173 @@ +// Copyright 2022 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_DETAIL_HASH_RANGE_HPP +#define BOOST_HASH_DETAIL_HASH_RANGE_HPP + +#include <boost/container_hash/hash_fwd.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/enable_if.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/cstdint.hpp> +#include <cstddef> +#include <climits> +#include <iterator> + +namespace boost +{ +namespace hash_detail +{ + +template<class T> struct is_char_type: public boost::false_type {}; + +#if CHAR_BIT == 8 + +template<> struct is_char_type<char>: public boost::true_type {}; +template<> struct is_char_type<signed char>: public boost::true_type {}; +template<> struct is_char_type<unsigned char>: public boost::true_type {}; + +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L +template<> struct is_char_type<char8_t>: public boost::true_type {}; +#endif + +#if defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603L +template<> struct is_char_type<std::byte>: public boost::true_type {}; +#endif + +#endif + +template<class It> +inline typename boost::enable_if_< + !is_char_type<typename std::iterator_traits<It>::value_type>::value, +std::size_t >::type + hash_range( std::size_t seed, It first, It last ) +{ + for( ; first != last; ++first ) + { + hash_combine<typename std::iterator_traits<It>::value_type>( seed, *first ); + } + + return seed; +} + +template<class It> +inline typename boost::enable_if_< + is_char_type<typename std::iterator_traits<It>::value_type>::value && + is_same<typename std::iterator_traits<It>::iterator_category, std::random_access_iterator_tag>::value, +std::size_t>::type + hash_range( std::size_t seed, It first, It last ) +{ + std::size_t n = static_cast<std::size_t>( last - first ); + + for( ; n >= 4; first += 4, n -= 4 ) + { + // clang 5+, gcc 5+ figure out this pattern and use a single mov on x86 + // gcc on s390x and power BE even knows how to use load-reverse + + boost::uint32_t w = + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[0] ) ) | + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[1] ) ) << 8 | + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[2] ) ) << 16 | + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[3] ) ) << 24; + + hash_combine( seed, w ); + } + + { + // add a trailing suffix byte of 0x01 because otherwise sequences of + // trailing zeroes are indistinguishable from end of string + + boost::uint32_t w = 0x01u; + + switch( n ) + { + case 1: + + w = + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[0] ) ) | + 0x0100u; + + break; + + case 2: + + w = + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[0] ) ) | + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[1] ) ) << 8 | + 0x010000u; + + break; + + case 3: + + w = + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[0] ) ) | + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[1] ) ) << 8 | + static_cast<boost::uint32_t>( static_cast<unsigned char>( first[2] ) ) << 16 | + 0x01000000u; + + break; + } + + hash_combine( seed, w ); + } + + return seed; +} + +template<class It> +inline typename boost::enable_if_< + is_char_type<typename std::iterator_traits<It>::value_type>::value && + !is_same<typename std::iterator_traits<It>::iterator_category, std::random_access_iterator_tag>::value, +std::size_t>::type + hash_range( std::size_t seed, It first, It last ) +{ + for( ;; ) + { + boost::uint32_t w = 0; + + if( first == last ) + { + hash_combine( seed, w | 0x01u ); + return seed; + } + + w |= static_cast<boost::uint32_t>( static_cast<unsigned char>( *first ) ); + ++first; + + if( first == last ) + { + hash_combine( seed, w | 0x0100u ); + return seed; + } + + w |= static_cast<boost::uint32_t>( static_cast<unsigned char>( *first ) ) << 8; + ++first; + + if( first == last ) + { + hash_combine( seed, w | 0x010000u ); + return seed; + } + + w |= static_cast<boost::uint32_t>( static_cast<unsigned char>( *first ) ) << 16; + ++first; + + if( first == last ) + { + hash_combine( seed, w | 0x01000000u ); + return seed; + } + + w |= static_cast<boost::uint32_t>( static_cast<unsigned char>( *first ) ) << 24; + ++first; + + hash_combine( seed, w ); + } +} + +} // namespace hash_detail +} // namespace boost + +#endif // #ifndef BOOST_HASH_DETAIL_HASH_RANGE_HPP diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_tuple.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_tuple.hpp new file mode 100644 index 0000000000..597cee9d9e --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/hash_tuple.hpp @@ -0,0 +1,133 @@ +// Copyright 2005-2009 Daniel James. +// Copyright 2021 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_DETAIL_HASH_TUPLE_LIKE_HPP +#define BOOST_HASH_DETAIL_HASH_TUPLE_LIKE_HPP + +#include <boost/container_hash/hash_fwd.hpp> +#include <boost/type_traits/enable_if.hpp> +#include <boost/config.hpp> + +#if defined(BOOST_NO_CXX11_HDR_TUPLE) + +// no support + +#else + +#include <tuple> + +namespace boost +{ +namespace hash_detail +{ + +template <std::size_t I, typename T> +inline typename boost::enable_if_<(I == std::tuple_size<T>::value), + void>::type + hash_combine_tuple(std::size_t&, T const&) +{ +} + +template <std::size_t I, typename T> +inline typename boost::enable_if_<(I < std::tuple_size<T>::value), + void>::type + hash_combine_tuple(std::size_t& seed, T const& v) +{ + boost::hash_combine(seed, std::get<I>(v)); + boost::hash_detail::hash_combine_tuple<I + 1>(seed, v); +} + +template <typename T> +inline std::size_t hash_tuple(T const& v) +{ + std::size_t seed = 0; + boost::hash_detail::hash_combine_tuple<0>(seed, v); + return seed; +} + +} // namespace hash_detail + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +template <typename... T> +inline std::size_t hash_value(std::tuple<T...> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +#else + +inline std::size_t hash_value(std::tuple<> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0> +inline std::size_t hash_value(std::tuple<A0> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1> +inline std::size_t hash_value(std::tuple<A0, A1> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2> +inline std::size_t hash_value(std::tuple<A0, A1, A2> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3, typename A4> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> +inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> const& v) +{ + return boost::hash_detail::hash_tuple(v); +} + +#endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +} // namespace boost + +#endif // #if defined(BOOST_NO_CXX11_HDR_TUPLE) + +#endif // #ifndef BOOST_HASH_DETAIL_HASH_TUPLE_LIKE_HPP diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/limits.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/limits.hpp deleted file mode 100644 index 4a971a6ac2..0000000000 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/detail/limits.hpp +++ /dev/null @@ -1,62 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) -// -// On some platforms std::limits gives incorrect values for long double. -// This tries to work around them. - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER) -#define BOOST_FUNCTIONAL_HASH_DETAIL_LIMITS_HEADER - -#include <boost/config.hpp> -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - -#include <boost/limits.hpp> - -// On OpenBSD, numeric_limits is not reliable for long doubles, but -// the macros defined in <float.h> are and support long double when STLport -// doesn't. - -#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) -#include <float.h> -#endif - -namespace boost -{ - namespace hash_detail - { - template <class T> - struct limits : std::numeric_limits<T> {}; - -#if defined(__OpenBSD__) || defined(_STLP_NO_LONG_DOUBLE) - template <> - struct limits<long double> - : std::numeric_limits<long double> - { - static long double epsilon() { - return LDBL_EPSILON; - } - - static long double (max)() { - return LDBL_MAX; - } - - static long double (min)() { - return LDBL_MIN; - } - - BOOST_STATIC_CONSTANT(int, digits = LDBL_MANT_DIG); - BOOST_STATIC_CONSTANT(int, max_exponent = LDBL_MAX_EXP); - BOOST_STATIC_CONSTANT(int, min_exponent = LDBL_MIN_EXP); -#if defined(_STLP_NO_LONG_DOUBLE) - BOOST_STATIC_CONSTANT(int, radix = FLT_RADIX); -#endif - }; -#endif // __OpenBSD__ - } -} - -#endif diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp deleted file mode 100644 index aa4f9cff8b..0000000000 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/extensions.hpp +++ /dev/null @@ -1,361 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. - -// This implements the extensions to the standard. -// It's undocumented, so you shouldn't use it.... - -#if !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) -#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP - -#include <boost/config.hpp> -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - -#include <boost/container_hash/hash.hpp> -#include <boost/detail/container_fwd.hpp> -#include <boost/core/enable_if.hpp> -#include <boost/static_assert.hpp> - -#if !defined(BOOST_NO_CXX11_HDR_ARRAY) -# include <array> -#endif - -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) -# include <tuple> -#endif - -#include <memory> - -#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) -#include <boost/type_traits/is_array.hpp> -#endif - -namespace boost -{ - template <class A, class B> - std::size_t hash_value(std::pair<A, B> const&); - template <class T, class A> - std::size_t hash_value(std::vector<T, A> const&); - template <class T, class A> - std::size_t hash_value(std::list<T, A> const& v); - template <class T, class A> - std::size_t hash_value(std::deque<T, A> const& v); - template <class K, class C, class A> - std::size_t hash_value(std::set<K, C, A> const& v); - template <class K, class C, class A> - std::size_t hash_value(std::multiset<K, C, A> const& v); - template <class K, class T, class C, class A> - std::size_t hash_value(std::map<K, T, C, A> const& v); - template <class K, class T, class C, class A> - std::size_t hash_value(std::multimap<K, T, C, A> const& v); - - template <class T> - std::size_t hash_value(std::complex<T> const&); - - template <class A, class B> - std::size_t hash_value(std::pair<A, B> const& v) - { - std::size_t seed = 0; - boost::hash_combine(seed, v.first); - boost::hash_combine(seed, v.second); - return seed; - } - - template <class T, class A> - std::size_t hash_value(std::vector<T, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class T, class A> - std::size_t hash_value(std::list<T, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class T, class A> - std::size_t hash_value(std::deque<T, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class K, class C, class A> - std::size_t hash_value(std::set<K, C, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class K, class C, class A> - std::size_t hash_value(std::multiset<K, C, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class K, class T, class C, class A> - std::size_t hash_value(std::map<K, T, C, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class K, class T, class C, class A> - std::size_t hash_value(std::multimap<K, T, C, A> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } - - template <class T> - std::size_t hash_value(std::complex<T> const& v) - { - boost::hash<T> hasher; - std::size_t seed = hasher(v.imag()); - seed ^= hasher(v.real()) + (seed<<6) + (seed>>2); - return seed; - } - -#if !defined(BOOST_NO_CXX11_HDR_ARRAY) - template <class T, std::size_t N> - std::size_t hash_value(std::array<T, N> const& v) - { - return boost::hash_range(v.begin(), v.end()); - } -#endif - -#if !defined(BOOST_NO_CXX11_HDR_TUPLE) - namespace hash_detail { - template <std::size_t I, typename T> - inline typename boost::enable_if_c<(I == std::tuple_size<T>::value), - void>::type - hash_combine_tuple(std::size_t&, T const&) - { - } - - template <std::size_t I, typename T> - inline typename boost::enable_if_c<(I < std::tuple_size<T>::value), - void>::type - hash_combine_tuple(std::size_t& seed, T const& v) - { - boost::hash_combine(seed, std::get<I>(v)); - boost::hash_detail::hash_combine_tuple<I + 1>(seed, v); - } - - template <typename T> - inline std::size_t hash_tuple(T const& v) - { - std::size_t seed = 0; - boost::hash_detail::hash_combine_tuple<0>(seed, v); - return seed; - } - } - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template <typename... T> - inline std::size_t hash_value(std::tuple<T...> const& v) - { - return boost::hash_detail::hash_tuple(v); - } -#else - - inline std::size_t hash_value(std::tuple<> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0> - inline std::size_t hash_value(std::tuple<A0> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1> - inline std::size_t hash_value(std::tuple<A0, A1> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2> - inline std::size_t hash_value(std::tuple<A0, A1, A2> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3, typename A4> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - - template<typename A0, typename A1, typename A2, typename A3, typename A4, typename A5, typename A6, typename A7, typename A8, typename A9> - inline std::size_t hash_value(std::tuple<A0, A1, A2, A3, A4, A5, A6, A7, A8, A9> const& v) - { - return boost::hash_detail::hash_tuple(v); - } - -#endif - -#endif - -#if !defined(BOOST_NO_CXX11_SMART_PTR) - template <typename T> - inline std::size_t hash_value(std::shared_ptr<T> const& x) { - return boost::hash_value(x.get()); - } - - template <typename T, typename Deleter> - inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) { - return boost::hash_value(x.get()); - } -#endif - - // - // call_hash_impl - // - - // On compilers without function template ordering, this deals with arrays. - -#if defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - namespace hash_detail - { - template <bool IsArray> - struct call_hash_impl - { - template <class T> - struct inner - { - static std::size_t call(T const& v) - { - using namespace boost; - return hash_value(v); - } - }; - }; - - template <> - struct call_hash_impl<true> - { - template <class Array> - struct inner - { - static std::size_t call(Array const& v) - { - const int size = sizeof(v) / sizeof(*v); - return boost::hash_range(v, v + size); - } - }; - }; - - template <class T> - struct call_hash - : public call_hash_impl<boost::is_array<T>::value> - ::BOOST_NESTED_TEMPLATE inner<T> - { - }; - } -#endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING - - // - // boost::hash - // - - -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - - template <class T> struct hash - : boost::hash_detail::hash_base<T> - { -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - std::size_t operator()(T const& val) const - { - return hash_value(val); - } -#else - std::size_t operator()(T const& val) const - { - return hash_detail::call_hash<T>::call(val); - } -#endif - }; - -#if BOOST_WORKAROUND(__DMC__, <= 0x848) - template <class T, unsigned int n> struct hash<T[n]> - : boost::hash_detail::hash_base<T[n]> - { - std::size_t operator()(const T* val) const - { - return boost::hash_range(val, val+n); - } - }; -#endif - -#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - - // On compilers without partial specialization, boost::hash<T> - // has already been declared to deal with pointers, so just - // need to supply the non-pointer version of hash_impl. - - namespace hash_detail - { - template <bool IsPointer> - struct hash_impl; - - template <> - struct hash_impl<false> - { - template <class T> - struct inner - : boost::hash_detail::hash_base<T> - { -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - std::size_t operator()(T const& val) const - { - return hash_value(val); - } -#else - std::size_t operator()(T const& val) const - { - return hash_detail::call_hash<T>::call(val); - } -#endif - }; - }; - } -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -} - -#endif diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp index 5ce09d4eb6..306c279164 100644 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash.hpp @@ -1,35 +1,50 @@ - // Copyright 2005-2014 Daniel James. -// 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) - -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. -// -// This also contains public domain code from MurmurHash. From the -// MurmurHash header: +// Copyright 2021, 2022 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt -// MurmurHash3 was written by Austin Appleby, and is placed in the public -// domain. The author hereby disclaims copyright to this source code. +// Based on Peter Dimov's proposal +// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf +// issue 6.18. -#if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) +#ifndef BOOST_FUNCTIONAL_HASH_HASH_HPP #define BOOST_FUNCTIONAL_HASH_HASH_HPP #include <boost/container_hash/hash_fwd.hpp> -#include <functional> -#include <iterator> -#include <boost/container_hash/detail/hash_float.hpp> -#include <string> -#include <boost/limits.hpp> +#include <boost/container_hash/is_range.hpp> +#include <boost/container_hash/is_contiguous_range.hpp> +#include <boost/container_hash/is_unordered_range.hpp> +#include <boost/container_hash/is_described_class.hpp> +#include <boost/container_hash/detail/hash_tuple.hpp> +#include <boost/container_hash/detail/hash_mix.hpp> +#include <boost/container_hash/detail/hash_range.hpp> #include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_integral.hpp> -#include <boost/core/enable_if.hpp> +#include <boost/type_traits/is_floating_point.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/type_traits/enable_if.hpp> +#include <boost/type_traits/conjunction.hpp> +#include <boost/type_traits/is_union.hpp> +#include <boost/describe/bases.hpp> +#include <boost/describe/members.hpp> #include <boost/cstdint.hpp> + +#if defined(BOOST_DESCRIBE_CXX14) +# include <boost/mp11/algorithm.hpp> +#endif + +#include <string> +#include <iterator> +#include <complex> +#include <utility> +#include <limits> #include <climits> +#include <cstring> -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -#include <boost/type_traits/is_pointer.hpp> +#if !defined(BOOST_NO_CXX11_SMART_PTR) +# include <memory> #endif #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) @@ -40,728 +55,608 @@ #include <system_error> #endif -#if defined(BOOST_MSVC) -#pragma warning(push) - -#if BOOST_MSVC >= 1400 -#pragma warning(disable:6295) // Ill-defined for-loop : 'unsigned int' values - // are always of range '0' to '4294967295'. - // Loop executes infinitely. -#endif - -#endif - -#if BOOST_WORKAROUND(__GNUC__, < 3) \ - && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) -#define BOOST_HASH_CHAR_TRAITS string_char_traits -#else -#define BOOST_HASH_CHAR_TRAITS char_traits -#endif - -#if defined(_MSC_VER) -# define BOOST_FUNCTIONAL_HASH_ROTL32(x, r) _rotl(x,r) -#else -# define BOOST_FUNCTIONAL_HASH_ROTL32(x, r) (x << r) | (x >> (32 - r)) -#endif - -// Detect whether standard library has C++17 headers - -#if !defined(BOOST_HASH_CXX17) -# if defined(BOOST_MSVC) -# if defined(_HAS_CXX17) && _HAS_CXX17 -# define BOOST_HASH_CXX17 1 -# endif -# elif defined(__cplusplus) && __cplusplus >= 201703 -# define BOOST_HASH_CXX17 1 -# endif -#endif - -#if !defined(BOOST_HASH_CXX17) -# define BOOST_HASH_CXX17 0 -#endif - -#if BOOST_HASH_CXX17 && defined(__has_include) -# if !defined(BOOST_HASH_HAS_STRING_VIEW) && __has_include(<string_view>) -# define BOOST_HASH_HAS_STRING_VIEW 1 -# endif -# if !defined(BOOST_HASH_HAS_OPTIONAL) && __has_include(<optional>) -# define BOOST_HASH_HAS_OPTIONAL 1 -# endif -# if !defined(BOOST_HASH_HAS_VARIANT) && __has_include(<variant>) -# define BOOST_HASH_HAS_VARIANT 1 -# endif -#endif - -#if !defined(BOOST_HASH_HAS_STRING_VIEW) -# define BOOST_HASH_HAS_STRING_VIEW 0 +#if !defined(BOOST_NO_CXX17_HDR_OPTIONAL) +#include <optional> #endif -#if !defined(BOOST_HASH_HAS_OPTIONAL) -# define BOOST_HASH_HAS_OPTIONAL 0 +#if !defined(BOOST_NO_CXX17_HDR_VARIANT) +#include <variant> #endif -#if !defined(BOOST_HASH_HAS_VARIANT) -# define BOOST_HASH_HAS_VARIANT 0 +#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) +# include <string_view> #endif -#if BOOST_HASH_HAS_STRING_VIEW -# include <string_view> -#endif +namespace boost +{ -#if BOOST_HASH_HAS_OPTIONAL -# include <optional> -#endif + // + // boost::hash_value + // -#if BOOST_HASH_HAS_VARIANT -# include <variant> -#endif + // integral types -namespace boost -{ namespace hash_detail { -#if defined(BOOST_NO_CXX98_FUNCTION_BASE) - template <typename T> - struct hash_base + template<class T, + bool bigger_than_size_t = (sizeof(T) > sizeof(std::size_t)), + bool is_unsigned = boost::is_unsigned<T>::value, + std::size_t size_t_bits = sizeof(std::size_t) * CHAR_BIT, + std::size_t type_bits = sizeof(T) * CHAR_BIT> + struct hash_integral_impl; + + template<class T, bool is_unsigned, std::size_t size_t_bits, std::size_t type_bits> struct hash_integral_impl<T, false, is_unsigned, size_t_bits, type_bits> { - typedef T argument_type; - typedef std::size_t result_type; + static std::size_t fn( T v ) + { + return static_cast<std::size_t>( v ); + } }; -#else - template <typename T> - struct hash_base : std::unary_function<T, std::size_t> {}; -#endif - struct enable_hash_value { typedef std::size_t type; }; - - template <typename T> struct basic_numbers {}; - template <typename T> struct long_numbers; - template <typename T> struct ulong_numbers; - template <typename T> struct float_numbers {}; - - template <> struct basic_numbers<bool> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<char> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<unsigned char> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<signed char> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<short> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<unsigned short> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<int> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<unsigned int> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<long> : - boost::hash_detail::enable_hash_value {}; - template <> struct basic_numbers<unsigned long> : - boost::hash_detail::enable_hash_value {}; - -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - template <> struct basic_numbers<wchar_t> : - boost::hash_detail::enable_hash_value {}; -#endif - -#if !defined(BOOST_NO_CXX11_CHAR16_T) - template <> struct basic_numbers<char16_t> : - boost::hash_detail::enable_hash_value {}; -#endif + template<class T, std::size_t size_t_bits, std::size_t type_bits> struct hash_integral_impl<T, true, false, size_t_bits, type_bits> + { + static std::size_t fn( T v ) + { + typedef typename boost::make_unsigned<T>::type U; -#if !defined(BOOST_NO_CXX11_CHAR32_T) - template <> struct basic_numbers<char32_t> : - boost::hash_detail::enable_hash_value {}; -#endif + if( v >= 0 ) + { + return hash_integral_impl<U>::fn( static_cast<U>( v ) ); + } + else + { + return ~hash_integral_impl<U>::fn( static_cast<U>( ~static_cast<U>( v ) ) ); + } + } + }; - // long_numbers is defined like this to allow for separate - // specialization for long_long and int128_type, in case - // they conflict. - template <typename T> struct long_numbers2 {}; - template <typename T> struct ulong_numbers2 {}; - template <typename T> struct long_numbers : long_numbers2<T> {}; - template <typename T> struct ulong_numbers : ulong_numbers2<T> {}; - -#if !defined(BOOST_NO_LONG_LONG) - template <> struct long_numbers<boost::long_long_type> : - boost::hash_detail::enable_hash_value {}; - template <> struct ulong_numbers<boost::ulong_long_type> : - boost::hash_detail::enable_hash_value {}; -#endif + template<class T> struct hash_integral_impl<T, true, true, 32, 64> + { + static std::size_t fn( T v ) + { + std::size_t seed = 0; -#if defined(BOOST_HAS_INT128) - template <> struct long_numbers2<boost::int128_type> : - boost::hash_detail::enable_hash_value {}; - template <> struct ulong_numbers2<boost::uint128_type> : - boost::hash_detail::enable_hash_value {}; -#endif + seed = static_cast<std::size_t>( v >> 32 ) + hash_detail::hash_mix( seed ); + seed = static_cast<std::size_t>( v ) + hash_detail::hash_mix( seed ); - template <> struct float_numbers<float> : - boost::hash_detail::enable_hash_value {}; - template <> struct float_numbers<double> : - boost::hash_detail::enable_hash_value {}; - template <> struct float_numbers<long double> : - boost::hash_detail::enable_hash_value {}; - } - - template <typename T> - typename boost::hash_detail::basic_numbers<T>::type hash_value(T); - template <typename T> - typename boost::hash_detail::long_numbers<T>::type hash_value(T); - template <typename T> - typename boost::hash_detail::ulong_numbers<T>::type hash_value(T); + return seed; + } + }; - template <typename T> - typename boost::enable_if<boost::is_enum<T>, std::size_t>::type - hash_value(T); + template<class T> struct hash_integral_impl<T, true, true, 32, 128> + { + static std::size_t fn( T v ) + { + std::size_t seed = 0; -#if !BOOST_WORKAROUND(__DMC__, <= 0x848) - template <class T> std::size_t hash_value(T* const&); -#else - template <class T> std::size_t hash_value(T*); -#endif + seed = static_cast<std::size_t>( v >> 96 ) + hash_detail::hash_mix( seed ); + seed = static_cast<std::size_t>( v >> 64 ) + hash_detail::hash_mix( seed ); + seed = static_cast<std::size_t>( v >> 32 ) + hash_detail::hash_mix( seed ); + seed = static_cast<std::size_t>( v ) + hash_detail::hash_mix( seed ); -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - template< class T, unsigned N > - std::size_t hash_value(const T (&x)[N]); + return seed; + } + }; - template< class T, unsigned N > - std::size_t hash_value(T (&x)[N]); -#endif + template<class T> struct hash_integral_impl<T, true, true, 64, 128> + { + static std::size_t fn( T v ) + { + std::size_t seed = 0; - template <class Ch, class A> - std::size_t hash_value( - std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&); + seed = static_cast<std::size_t>( v >> 64 ) + hash_detail::hash_mix( seed ); + seed = static_cast<std::size_t>( v ) + hash_detail::hash_mix( seed ); -#if BOOST_HASH_HAS_STRING_VIEW - template <class Ch> - std::size_t hash_value( - std::basic_string_view<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch> > const&); -#endif + return seed; + } + }; - template <typename T> - typename boost::hash_detail::float_numbers<T>::type hash_value(T); + } // namespace hash_detail -#if BOOST_HASH_HAS_OPTIONAL template <typename T> - std::size_t hash_value(std::optional<T> const&); -#endif - -#if BOOST_HASH_HAS_VARIANT - std::size_t hash_value(std::monostate); - template <typename... Types> - std::size_t hash_value(std::variant<Types...> const&); -#endif + typename boost::enable_if_<boost::is_integral<T>::value, std::size_t>::type + hash_value( T v ) + { + return hash_detail::hash_integral_impl<T>::fn( v ); + } -#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) - std::size_t hash_value(std::type_index); -#endif + // enumeration types -#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) - std::size_t hash_value(std::error_code const&); - std::size_t hash_value(std::error_condition const&); -#endif + template <typename T> + typename boost::enable_if_<boost::is_enum<T>::value, std::size_t>::type + hash_value( T v ) + { + // This should in principle return the equivalent of + // + // boost::hash_value( to_underlying(v) ); + // + // However, the C++03 implementation of underlying_type, + // + // conditional<is_signed<T>, make_signed<T>, make_unsigned<T>>::type::type + // + // generates a legitimate -Wconversion warning in is_signed, + // because -1 is not a valid enum value when all the enumerators + // are nonnegative. + // + // So the legacy implementation will have to do for now. + + return static_cast<std::size_t>( v ); + } - // Implementation + // floating point types namespace hash_detail { - template <class T> - inline std::size_t hash_value_signed(T val) - { - const unsigned int size_t_bits = std::numeric_limits<std::size_t>::digits; - // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1 - const int length = (std::numeric_limits<T>::digits - 1) - / static_cast<int>(size_t_bits); - - std::size_t seed = 0; - T positive = val < 0 ? -1 - val : val; - - // Hopefully, this loop can be unrolled. - for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) - { - seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2); - } - seed ^= (std::size_t) val + (seed<<6) + (seed>>2); - - return seed; - } + template<class T, + std::size_t Bits = sizeof(T) * CHAR_BIT, + int Digits = std::numeric_limits<T>::digits> + struct hash_float_impl; - template <class T> - inline std::size_t hash_value_unsigned(T val) + // float + template<class T, int Digits> struct hash_float_impl<T, 32, Digits> { - const unsigned int size_t_bits = std::numeric_limits<std::size_t>::digits; - // ceiling(std::numeric_limits<T>::digits / size_t_bits) - 1 - const int length = (std::numeric_limits<T>::digits - 1) - / static_cast<int>(size_t_bits); + static std::size_t fn( T v ) + { + boost::uint32_t w; + std::memcpy( &w, &v, sizeof( v ) ); - std::size_t seed = 0; + return w; + } + }; - // Hopefully, this loop can be unrolled. - for(unsigned int i = length * size_t_bits; i > 0; i -= size_t_bits) - { - seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2); - } - seed ^= (std::size_t) val + (seed<<6) + (seed>>2); + // double + template<class T, int Digits> struct hash_float_impl<T, 64, Digits> + { + static std::size_t fn( T v ) + { + boost::uint64_t w; + std::memcpy( &w, &v, sizeof( v ) ); - return seed; - } + return hash_value( w ); + } + }; - template<std::size_t Bits> struct hash_combine_impl + // 80 bit long double in 12 bytes + template<class T> struct hash_float_impl<T, 96, 64> { - template <typename SizeT> - inline static SizeT fn(SizeT seed, SizeT value) + static std::size_t fn( T v ) { - seed ^= value + 0x9e3779b9 + (seed<<6) + (seed>>2); + boost::uint64_t w[ 2 ] = {}; + std::memcpy( &w, &v, 80 / CHAR_BIT ); + + std::size_t seed = 0; + + seed = hash_value( w[0] ) + hash_detail::hash_mix( seed ); + seed = hash_value( w[1] ) + hash_detail::hash_mix( seed ); + return seed; } }; - template<> struct hash_combine_impl<32> + // 80 bit long double in 16 bytes + template<class T> struct hash_float_impl<T, 128, 64> { - inline static boost::uint32_t fn(boost::uint32_t h1, boost::uint32_t k1) + static std::size_t fn( T v ) { - const boost::uint32_t c1 = 0xcc9e2d51; - const boost::uint32_t c2 = 0x1b873593; + boost::uint64_t w[ 2 ] = {}; + std::memcpy( &w, &v, 80 / CHAR_BIT ); - k1 *= c1; - k1 = BOOST_FUNCTIONAL_HASH_ROTL32(k1,15); - k1 *= c2; + std::size_t seed = 0; - h1 ^= k1; - h1 = BOOST_FUNCTIONAL_HASH_ROTL32(h1,13); - h1 = h1*5+0xe6546b64; + seed = hash_value( w[0] ) + hash_detail::hash_mix( seed ); + seed = hash_value( w[1] ) + hash_detail::hash_mix( seed ); - return h1; + return seed; } }; - template<> struct hash_combine_impl<64> + // 128 bit long double + template<class T, int Digits> struct hash_float_impl<T, 128, Digits> { - inline static boost::uint64_t fn(boost::uint64_t h, boost::uint64_t k) + static std::size_t fn( T v ) { - const boost::uint64_t m = (boost::uint64_t(0xc6a4a793) << 32) + 0x5bd1e995; - const int r = 47; + boost::uint64_t w[ 2 ]; + std::memcpy( &w, &v, sizeof( v ) ); - k *= m; - k ^= k >> r; - k *= m; + std::size_t seed = 0; - h ^= k; - h *= m; +#if defined(__FLOAT_WORD_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && __FLOAT_WORD_ORDER__ == __ORDER_BIG_ENDIAN__ - // Completely arbitrary number, to prevent 0's - // from hashing to 0. - h += 0xe6546b64; + seed = hash_value( w[1] ) + hash_detail::hash_mix( seed ); + seed = hash_value( w[0] ) + hash_detail::hash_mix( seed ); - return h; +#else + + seed = hash_value( w[0] ) + hash_detail::hash_mix( seed ); + seed = hash_value( w[1] ) + hash_detail::hash_mix( seed ); + +#endif + return seed; } }; - } - template <typename T> - typename boost::hash_detail::basic_numbers<T>::type hash_value(T v) - { - return static_cast<std::size_t>(v); - } + } // namespace hash_detail template <typename T> - typename boost::hash_detail::long_numbers<T>::type hash_value(T v) + typename boost::enable_if_<boost::is_floating_point<T>::value, std::size_t>::type + hash_value( T v ) { - return hash_detail::hash_value_signed(v); + return boost::hash_detail::hash_float_impl<T>::fn( v + 0 ); } - template <typename T> - typename boost::hash_detail::ulong_numbers<T>::type hash_value(T v) + // pointer types + + // `x + (x >> 3)` adjustment by Alberto Barbati and Dave Harris. + template <class T> std::size_t hash_value( T* const& v ) { - return hash_detail::hash_value_unsigned(v); + boost::uintptr_t x = reinterpret_cast<boost::uintptr_t>( v ); + return boost::hash_value( x + (x >> 3) ); } - template <typename T> - typename boost::enable_if<boost::is_enum<T>, std::size_t>::type - hash_value(T v) + // array types + + template<class T, std::size_t N> + inline std::size_t hash_value( T const (&x)[ N ] ) { - return static_cast<std::size_t>(v); + return boost::hash_range( x, x + N ); } - // Implementation by Alberto Barbati and Dave Harris. -#if !BOOST_WORKAROUND(__DMC__, <= 0x848) - template <class T> std::size_t hash_value(T* const& v) -#else - template <class T> std::size_t hash_value(T* v) -#endif + template<class T, std::size_t N> + inline std::size_t hash_value( T (&x)[ N ] ) { -#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 - // for some reason ptrdiff_t on OpenVMS compiler with - // 64 bit is not 64 bit !!! - std::size_t x = static_cast<std::size_t>( - reinterpret_cast<long long int>(v)); -#else - std::size_t x = static_cast<std::size_t>( - reinterpret_cast<std::ptrdiff_t>(v)); -#endif - return x + (x >> 3); + return boost::hash_range( x, x + N ); } -#if defined(BOOST_MSVC) -#pragma warning(push) -#if BOOST_MSVC <= 1400 -#pragma warning(disable:4267) // 'argument' : conversion from 'size_t' to - // 'unsigned int', possible loss of data - // A misguided attempt to detect 64-bit - // incompatability. -#endif -#endif + // complex template <class T> - inline void hash_combine(std::size_t& seed, T const& v) + std::size_t hash_value( std::complex<T> const& v ) { - boost::hash<T> hasher; - seed = boost::hash_detail::hash_combine_impl<sizeof(std::size_t) * CHAR_BIT>::fn(seed, hasher(v)); + std::size_t re = boost::hash<T>()( v.real() ); + std::size_t im = boost::hash<T>()( v.imag() ); + + return re + hash_detail::hash_mix( im ); } -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif + // pair - template <class It> - inline std::size_t hash_range(It first, It last) + template <class A, class B> + std::size_t hash_value( std::pair<A, B> const& v ) { std::size_t seed = 0; - for(; first != last; ++first) - { - hash_combine<typename std::iterator_traits<It>::value_type>(seed, *first); - } + boost::hash_combine( seed, v.first ); + boost::hash_combine( seed, v.second ); return seed; } - template <class It> - inline void hash_range(std::size_t& seed, It first, It last) - { - for(; first != last; ++first) - { - hash_combine<typename std::iterator_traits<It>::value_type>(seed, *first); - } - } + // ranges (list, set, deque...) -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) - template <class T> - inline std::size_t hash_range(T* first, T* last) + template <typename T> + typename boost::enable_if_<container_hash::is_range<T>::value && !container_hash::is_contiguous_range<T>::value && !container_hash::is_unordered_range<T>::value, std::size_t>::type + hash_value( T const& v ) { - std::size_t seed = 0; + return boost::hash_range( v.begin(), v.end() ); + } - for(; first != last; ++first) - { - boost::hash<T> hasher; - seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); - } + // contiguous ranges (string, vector, array) - return seed; + template <typename T> + typename boost::enable_if_<container_hash::is_contiguous_range<T>::value, std::size_t>::type + hash_value( T const& v ) + { + return boost::hash_range( v.data(), v.data() + v.size() ); } - template <class T> - inline void hash_range(std::size_t& seed, T* first, T* last) + // unordered ranges (unordered_set, unordered_map) + + template <typename T> + typename boost::enable_if_<container_hash::is_unordered_range<T>::value, std::size_t>::type + hash_value( T const& v ) { - for(; first != last; ++first) - { - boost::hash<T> hasher; - seed ^= hasher(*first) + 0x9e3779b9 + (seed<<6) + (seed>>2); - } + return boost::hash_unordered_range( v.begin(), v.end() ); } -#endif -#if !defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING) - template< class T, unsigned N > - inline std::size_t hash_value(const T (&x)[N]) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && ( \ + ( defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142 ) || \ + ( !defined(_MSVC_STL_VERSION) && defined(_CPPLIB_VER) && _CPPLIB_VER >= 520 ) ) + + // resolve ambiguity with unconstrained stdext::hash_value in <xhash> :-/ + + template<template<class...> class L, class... T> + typename boost::enable_if_<container_hash::is_range<L<T...>>::value && !container_hash::is_contiguous_range<L<T...>>::value && !container_hash::is_unordered_range<L<T...>>::value, std::size_t>::type + hash_value( L<T...> const& v ) { - return hash_range(x, x + N); + return boost::hash_range( v.begin(), v.end() ); } - template< class T, unsigned N > - inline std::size_t hash_value(T (&x)[N]) + // contiguous ranges (string, vector, array) + + template<template<class...> class L, class... T> + typename boost::enable_if_<container_hash::is_contiguous_range<L<T...>>::value, std::size_t>::type + hash_value( L<T...> const& v ) { - return hash_range(x, x + N); + return boost::hash_range( v.data(), v.data() + v.size() ); } -#endif - template <class Ch, class A> - inline std::size_t hash_value( - std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const& v) + template<template<class, std::size_t> class L, class T, std::size_t N> + typename boost::enable_if_<container_hash::is_contiguous_range<L<T, N>>::value, std::size_t>::type + hash_value( L<T, N> const& v ) { - return hash_range(v.begin(), v.end()); + return boost::hash_range( v.data(), v.data() + v.size() ); } -#if BOOST_HASH_HAS_STRING_VIEW - template <class Ch> - inline std::size_t hash_value( - std::basic_string_view<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch> > const& v) + // unordered ranges (unordered_set, unordered_map) + + template<template<class...> class L, class... T> + typename boost::enable_if_<container_hash::is_unordered_range<L<T...>>::value, std::size_t>::type + hash_value( L<T...> const& v ) { - return hash_range(v.begin(), v.end()); + return boost::hash_unordered_range( v.begin(), v.end() ); } + +#endif + + // described classes + +#if defined(BOOST_DESCRIBE_CXX14) + +#if defined(_MSC_VER) && _MSC_VER == 1900 +# pragma warning(push) +# pragma warning(disable: 4100) // unreferenced formal parameter #endif template <typename T> - typename boost::hash_detail::float_numbers<T>::type hash_value(T v) + typename boost::enable_if_<container_hash::is_described_class<T>::value, std::size_t>::type + hash_value( T const& v ) { - return boost::hash_detail::float_hash_value(v); - } + static_assert( !boost::is_union<T>::value, "described unions are not supported" ); -#if BOOST_HASH_HAS_OPTIONAL - template <typename T> - inline std::size_t hash_value(std::optional<T> const& v) { - if (!v) { - // Arbitray value for empty optional. - return 0x12345678; - } else { - boost::hash<T> hf; - return hf(*v); - } + std::size_t r = 0; + + using Bd = describe::describe_bases<T, describe::mod_any_access>; + + mp11::mp_for_each<Bd>([&](auto D){ + + using B = typename decltype(D)::type; + boost::hash_combine( r, (B const&)v ); + + }); + + using Md = describe::describe_members<T, describe::mod_any_access>; + + mp11::mp_for_each<Md>([&](auto D){ + + boost::hash_combine( r, v.*D.pointer ); + + }); + + return r; } + +#if defined(_MSC_VER) && _MSC_VER == 1900 +# pragma warning(pop) #endif -#if BOOST_HASH_HAS_VARIANT - inline std::size_t hash_value(std::monostate) { - return 0x87654321; +#endif + + // std::unique_ptr, std::shared_ptr + +#if !defined(BOOST_NO_CXX11_SMART_PTR) + + template <typename T> + std::size_t hash_value( std::shared_ptr<T> const& x ) + { + return boost::hash_value( x.get() ); } - template <typename... Types> - inline std::size_t hash_value(std::variant<Types...> const& v) { - std::size_t seed = 0; - hash_combine(seed, v.index()); - std::visit([&seed](auto&& x) { hash_combine(seed, x); }, v); - return seed; + template <typename T, typename Deleter> + std::size_t hash_value( std::unique_ptr<T, Deleter> const& x ) + { + return boost::hash_value( x.get() ); } + #endif + // std::type_index #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) - inline std::size_t hash_value(std::type_index v) + + inline std::size_t hash_value( std::type_index const& v ) { return v.hash_code(); } + #endif + // std::error_code, std::error_condition + #if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) - inline std::size_t hash_value(std::error_code const& v) { + + inline std::size_t hash_value( std::error_code const& v ) + { std::size_t seed = 0; - hash_combine(seed, v.value()); - hash_combine(seed, &v.category()); + + boost::hash_combine( seed, v.value() ); + boost::hash_combine( seed, &v.category() ); + return seed; } - inline std::size_t hash_value(std::error_condition const& v) { + inline std::size_t hash_value( std::error_condition const& v ) + { + std::size_t seed = 0; + + boost::hash_combine( seed, v.value() ); + boost::hash_combine( seed, &v.category() ); + + return seed; + } + +#endif + + // std::optional + +#if !defined(BOOST_NO_CXX17_HDR_OPTIONAL) + + template <typename T> + std::size_t hash_value( std::optional<T> const& v ) + { + if( !v ) + { + // Arbitray value for empty optional. + return 0x12345678; + } + else + { + return boost::hash<T>()(*v); + } + } + +#endif + + // std::variant + +#if !defined(BOOST_NO_CXX17_HDR_VARIANT) + + inline std::size_t hash_value( std::monostate ) + { + return 0x87654321; + } + + template <typename... Types> + std::size_t hash_value( std::variant<Types...> const& v ) + { std::size_t seed = 0; - hash_combine(seed, v.value()); - hash_combine(seed, &v.category()); + + hash_combine( seed, v.index() ); + std::visit( [&seed](auto&& x) { hash_combine(seed, x); }, v ); + return seed; } + #endif // - // boost::hash + // boost::hash_combine // - // Define the specializations required by the standard. The general purpose - // boost::hash is defined later in extensions.hpp if - // BOOST_HASH_NO_EXTENSIONS is not defined. + template <class T> + inline void hash_combine( std::size_t& seed, T const& v ) + { + seed = boost::hash_detail::hash_mix( seed + 0x9e3779b9 + boost::hash<T>()( v ) ); + } - // BOOST_HASH_SPECIALIZE - define a specialization for a type which is - // passed by copy. // - // BOOST_HASH_SPECIALIZE_REF - define a specialization for a type which is - // passed by const reference. + // boost::hash_range // - // These are undefined later. - -#define BOOST_HASH_SPECIALIZE(type) \ - template <> struct hash<type> \ - : public boost::hash_detail::hash_base<type> \ - { \ - std::size_t operator()(type v) const \ - { \ - return boost::hash_value(v); \ - } \ - }; -#define BOOST_HASH_SPECIALIZE_REF(type) \ - template <> struct hash<type> \ - : public boost::hash_detail::hash_base<type> \ - { \ - std::size_t operator()(type const& v) const \ - { \ - return boost::hash_value(v); \ - } \ - }; + template <class It> + inline void hash_range( std::size_t& seed, It first, It last ) + { + seed = hash_detail::hash_range( seed, first, last ); + } -#define BOOST_HASH_SPECIALIZE_TEMPLATE_REF(type) \ - struct hash<type> \ - : public boost::hash_detail::hash_base<type> \ - { \ - std::size_t operator()(type const& v) const \ - { \ - return boost::hash_value(v); \ - } \ - }; + template <class It> + inline std::size_t hash_range( It first, It last ) + { + std::size_t seed = 0; - BOOST_HASH_SPECIALIZE(bool) - BOOST_HASH_SPECIALIZE(char) - BOOST_HASH_SPECIALIZE(signed char) - BOOST_HASH_SPECIALIZE(unsigned char) -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - BOOST_HASH_SPECIALIZE(wchar_t) -#endif -#if !defined(BOOST_NO_CXX11_CHAR16_T) - BOOST_HASH_SPECIALIZE(char16_t) -#endif -#if !defined(BOOST_NO_CXX11_CHAR32_T) - BOOST_HASH_SPECIALIZE(char32_t) -#endif - BOOST_HASH_SPECIALIZE(short) - BOOST_HASH_SPECIALIZE(unsigned short) - BOOST_HASH_SPECIALIZE(int) - BOOST_HASH_SPECIALIZE(unsigned int) - BOOST_HASH_SPECIALIZE(long) - BOOST_HASH_SPECIALIZE(unsigned long) - - BOOST_HASH_SPECIALIZE(float) - BOOST_HASH_SPECIALIZE(double) - BOOST_HASH_SPECIALIZE(long double) - - BOOST_HASH_SPECIALIZE_REF(std::string) -#if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - BOOST_HASH_SPECIALIZE_REF(std::wstring) -#endif -#if !defined(BOOST_NO_CXX11_CHAR16_T) - BOOST_HASH_SPECIALIZE_REF(std::basic_string<char16_t>) -#endif -#if !defined(BOOST_NO_CXX11_CHAR32_T) - BOOST_HASH_SPECIALIZE_REF(std::basic_string<char32_t>) -#endif + hash_range( seed, first, last ); -#if BOOST_HASH_HAS_STRING_VIEW - BOOST_HASH_SPECIALIZE_REF(std::string_view) -# if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - BOOST_HASH_SPECIALIZE_REF(std::wstring_view) -# endif -# if !defined(BOOST_NO_CXX11_CHAR16_T) - BOOST_HASH_SPECIALIZE_REF(std::basic_string_view<char16_t>) -# endif -# if !defined(BOOST_NO_CXX11_CHAR32_T) - BOOST_HASH_SPECIALIZE_REF(std::basic_string_view<char32_t>) -# endif -#endif + return seed; + } -#if !defined(BOOST_NO_LONG_LONG) - BOOST_HASH_SPECIALIZE(boost::long_long_type) - BOOST_HASH_SPECIALIZE(boost::ulong_long_type) -#endif + // + // boost::hash_unordered_range + // -#if defined(BOOST_HAS_INT128) - BOOST_HASH_SPECIALIZE(boost::int128_type) - BOOST_HASH_SPECIALIZE(boost::uint128_type) -#endif + template <class It> + inline void hash_unordered_range( std::size_t& seed, It first, It last ) + { + std::size_t r = 0; + std::size_t const s2( seed ); -#if BOOST_HASH_HAS_OPTIONAL - template <typename T> - BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::optional<T>) -#endif + for( ; first != last; ++first ) + { + std::size_t s3( s2 ); -#if !defined(BOOST_HASH_HAS_VARIANT) - template <typename... T> - BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::variant<T...>) - BOOST_HASH_SPECIALIZE(std::monostate) -#endif + hash_combine<typename std::iterator_traits<It>::value_type>( s3, *first ); -#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) - BOOST_HASH_SPECIALIZE(std::type_index) -#endif + r += s3; + } -#undef BOOST_HASH_SPECIALIZE -#undef BOOST_HASH_SPECIALIZE_REF -#undef BOOST_HASH_SPECIALIZE_TEMPLATE_REF + seed += r; + } -// Specializing boost::hash for pointers. + template <class It> + inline std::size_t hash_unordered_range( It first, It last ) + { + std::size_t seed = 0; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) + hash_unordered_range( seed, first, last ); - template <class T> - struct hash<T*> - : public boost::hash_detail::hash_base<T*> + return seed; + } + + // + // boost::hash + // + + template <class T> struct hash { - std::size_t operator()(T* v) const - { -#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) - return boost::hash_value(v); -#else - std::size_t x = static_cast<std::size_t>( - reinterpret_cast<std::ptrdiff_t>(v)); + typedef T argument_type; + typedef std::size_t result_type; - return x + (x >> 3); -#endif + std::size_t operator()( T const& val ) const + { + return hash_value( val ); } }; -#else +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && ( \ + ( defined(_MSVC_STL_VERSION) && _MSVC_STL_VERSION < 142 ) || \ + ( !defined(_MSVC_STL_VERSION) && defined(_CPPLIB_VER) && _CPPLIB_VER >= 520 ) ) - // For compilers without partial specialization, we define a - // boost::hash for all remaining types. But hash_impl is only defined - // for pointers in 'extensions.hpp' - so when BOOST_HASH_NO_EXTENSIONS - // is defined there will still be a compile error for types not supported - // in the standard. + // Dinkumware has stdext::hash_value for basic_string in <xhash> :-/ - namespace hash_detail + template<class E, class T, class A> struct hash< std::basic_string<E, T, A> > { - template <bool IsPointer> - struct hash_impl; + typedef std::basic_string<E, T, A> argument_type; + typedef std::size_t result_type; - template <> - struct hash_impl<true> + std::size_t operator()( std::basic_string<E, T, A> const& val ) const { - template <class T> - struct inner - : public boost::hash_detail::hash_base<T> - { - std::size_t operator()(T val) const - { -#if !BOOST_WORKAROUND(__SUNPRO_CC, <= 590) - return boost::hash_value(val); -#else - std::size_t x = static_cast<std::size_t>( - reinterpret_cast<std::ptrdiff_t>(val)); + return boost::hash_value( val ); + } + }; - return x + (x >> 3); #endif - } - }; - }; - } - template <class T> struct hash - : public boost::hash_detail::hash_impl<boost::is_pointer<T>::value> - ::BOOST_NESTED_TEMPLATE inner<T> + // boost::unordered::hash_is_avalanching + + namespace unordered { - }; + template<class T> struct hash_is_avalanching; + template<class Ch> struct hash_is_avalanching< boost::hash< std::basic_string<Ch> > >: boost::is_integral<Ch> {}; + // boost::is_integral<char8_t> is false, but should be true (https://github.com/boostorg/type_traits/issues/175) +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L + template<> struct hash_is_avalanching< boost::hash< std::basic_string<char8_t> > >: boost::true_type {}; #endif -} -#undef BOOST_HASH_CHAR_TRAITS -#undef BOOST_FUNCTIONAL_HASH_ROTL32 +#if !defined(BOOST_NO_CXX17_HDR_STRING_VIEW) + + template<class Ch> struct hash_is_avalanching< boost::hash< std::basic_string_view<Ch> > >: boost::is_integral<Ch> {}; -#if defined(BOOST_MSVC) -#pragma warning(pop) +#if defined(__cpp_char8_t) && __cpp_char8_t >= 201811L + template<> struct hash_is_avalanching< boost::hash< std::basic_string_view<char8_t> > >: boost::true_type {}; #endif -#endif // BOOST_FUNCTIONAL_HASH_HASH_HPP +#endif + } // namespace unordered -// Include this outside of the include guards in case the file is included -// twice - once with BOOST_HASH_NO_EXTENSIONS defined, and then with it -// undefined. +} // namespace boost -#if !defined(BOOST_HASH_NO_EXTENSIONS) \ - && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) -#include <boost/container_hash/extensions.hpp> -#endif +#endif // #ifndef BOOST_FUNCTIONAL_HASH_HASH_HPP diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp index 46340b3f4a..489fdd2314 100644 --- a/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/hash_fwd.hpp @@ -1,36 +1,36 @@ - // Copyright 2005-2009 Daniel James. -// 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) - -// Based on Peter Dimov's proposal -// http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// Copyright 2021, 2022 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt -#if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) +#ifndef BOOST_FUNCTIONAL_HASH_FWD_HPP #define BOOST_FUNCTIONAL_HASH_FWD_HPP -#include <boost/config/workaround.hpp> #include <cstddef> -#if defined(BOOST_HAS_PRAGMA_ONCE) -#pragma once -#endif - - namespace boost { - template <class T> struct hash; - template <class T> void hash_combine(std::size_t& seed, T const& v); +namespace container_hash +{ + +template<class T> struct is_range; +template<class T> struct is_contiguous_range; +template<class T> struct is_unordered_range; +template<class T> struct is_described_class; + +} // namespace container_hash + +template<class T> struct hash; + +template<class T> void hash_combine( std::size_t& seed, T const& v ); + +template<class It> void hash_range( std::size_t&, It, It ); +template<class It> std::size_t hash_range( It, It ); - template <class It> std::size_t hash_range(It, It); - template <class It> void hash_range(std::size_t&, It, It); +template<class It> void hash_unordered_range( std::size_t&, It, It ); +template<class It> std::size_t hash_unordered_range( It, It ); -#if BOOST_WORKAROUND(BOOST_BORLANDC, BOOST_TESTED_AT(0x551)) - template <class T> inline std::size_t hash_range(T*, T*); - template <class T> inline void hash_range(std::size_t&, T*, T*); -#endif -} +} // namespace boost -#endif +#endif // #ifndef BOOST_FUNCTIONAL_HASH_FWD_HPP diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/is_contiguous_range.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_contiguous_range.hpp new file mode 100644 index 0000000000..0e31c11085 --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_contiguous_range.hpp @@ -0,0 +1,91 @@ +// Copyright 2017, 2018 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED +#define BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED + +#include <boost/container_hash/is_range.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> + +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700) && !BOOST_WORKAROUND(BOOST_MSVC, < 1910) + +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_same.hpp> +#include <iterator> + +namespace boost +{ +namespace hash_detail +{ + +template<class It, class T, class S> + integral_constant< bool, is_same<typename std::iterator_traits<It>::value_type, T>::value && is_integral<S>::value > + is_contiguous_range_check( It first, It last, T const*, T const*, S ); + +template<class T> decltype( is_contiguous_range_check( declval<T const&>().begin(), declval<T const&>().end(), declval<T const&>().data(), declval<T const&>().data() + declval<T const&>().size(), declval<T const&>().size() ) ) is_contiguous_range_( int ); +template<class T> false_type is_contiguous_range_( ... ); + +template<class T> struct is_contiguous_range: decltype( hash_detail::is_contiguous_range_<T>( 0 ) ) +{ +}; + +} // namespace hash_detail + +namespace container_hash +{ + +template<class T> struct is_contiguous_range: integral_constant< bool, is_range<T>::value && hash_detail::is_contiguous_range<T>::value > +{ +}; + +} // namespace container_hash +} // namespace boost + +#else // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) + +#include <cstddef> +#include <vector> +#include <string> +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) +#include <array> +#endif + +namespace boost +{ +namespace container_hash +{ + +template<class T> struct is_contiguous_range: false_type +{ +}; + +template<class E, class T, class A> struct is_contiguous_range< std::basic_string<E, T, A> >: true_type +{ +}; + +template<class E, class T, class A> struct is_contiguous_range< std::basic_string<E, T, A> const >: true_type +{ +}; + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) + +template<class T, std::size_t N> struct is_contiguous_range< std::array<T, N> >: true_type +{ +}; + +template<class T, std::size_t N> struct is_contiguous_range< std::array<T, N> const >: true_type +{ +}; + +#endif + +} // namespace container_hash +} // namespace boost + +#endif // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) + +#endif // #ifndef BOOST_HASH_IS_CONTIGUOUS_RANGE_HPP_INCLUDED diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/is_described_class.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_described_class.hpp new file mode 100644 index 0000000000..cd2e1db4d0 --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_described_class.hpp @@ -0,0 +1,38 @@ +// Copyright 2022 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_IS_DESCRIBED_CLASS_HPP_INCLUDED +#define BOOST_HASH_IS_DESCRIBED_CLASS_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_union.hpp> +#include <boost/describe/bases.hpp> +#include <boost/describe/members.hpp> + +namespace boost +{ +namespace container_hash +{ + +#if defined(BOOST_DESCRIBE_CXX11) + +template<class T> struct is_described_class: boost::integral_constant<bool, + describe::has_describe_bases<T>::value && + describe::has_describe_members<T>::value && + !boost::is_union<T>::value> +{ +}; + +#else + +template<class T> struct is_described_class: boost::false_type +{ +}; + +#endif + +} // namespace container_hash +} // namespace boost + +#endif // #ifndef BOOST_HASH_IS_DESCRIBED_CLASS_HPP_INCLUDED diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/is_range.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_range.hpp new file mode 100644 index 0000000000..56fbd2e794 --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_range.hpp @@ -0,0 +1,73 @@ +// Copyright 2017 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED +#define BOOST_HASH_IS_RANGE_HPP_INCLUDED + +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/declval.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/config.hpp> +#include <boost/config/workaround.hpp> +#include <iterator> + +namespace boost +{ +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) && !BOOST_WORKAROUND(BOOST_GCC, < 40700) + +namespace hash_detail +{ + +template<class T, class It> + integral_constant< bool, !is_same<typename remove_cv<T>::type, typename std::iterator_traits<It>::value_type>::value > + is_range_check( It first, It last ); + +template<class T> decltype( is_range_check<T>( declval<T const&>().begin(), declval<T const&>().end() ) ) is_range_( int ); +template<class T> false_type is_range_( ... ); + +} // namespace hash_detail + +namespace container_hash +{ + +template<class T> struct is_range: decltype( hash_detail::is_range_<T>( 0 ) ) +{ +}; + +} // namespace container_hash + +#else + +namespace hash_detail +{ + +template<class T, class E = true_type> struct is_range_: false_type +{ +}; + +template<class T> struct is_range_< T, integral_constant< bool, + is_same<typename T::value_type, typename std::iterator_traits<typename T::const_iterator>::value_type>::value && + is_integral<typename T::size_type>::value + > >: true_type +{ +}; + +} // namespace hash_detail + +namespace container_hash +{ + +template<class T> struct is_range: hash_detail::is_range_<T> +{ +}; + +} // namespace container_hash + +#endif // !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_SFINAE_EXPR) + +} // namespace boost + +#endif // #ifndef BOOST_HASH_IS_RANGE_HPP_INCLUDED diff --git a/contrib/restricted/boost/container_hash/include/boost/container_hash/is_unordered_range.hpp b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_unordered_range.hpp new file mode 100644 index 0000000000..11ee386cd2 --- /dev/null +++ b/contrib/restricted/boost/container_hash/include/boost/container_hash/is_unordered_range.hpp @@ -0,0 +1,39 @@ +// Copyright 2017 Peter Dimov. +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_HASH_IS_UNORDERED_RANGE_HPP_INCLUDED +#define BOOST_HASH_IS_UNORDERED_RANGE_HPP_INCLUDED + +#include <boost/container_hash/is_range.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_same.hpp> + +namespace boost +{ +namespace hash_detail +{ + +template<class T, class E = true_type> struct has_hasher_: false_type +{ +}; + +template<class T> struct has_hasher_< T, integral_constant< bool, + is_same<typename T::hasher, typename T::hasher>::value + > >: true_type +{ +}; + +} // namespace hash_detail + +namespace container_hash +{ + +template<class T> struct is_unordered_range: integral_constant< bool, is_range<T>::value && hash_detail::has_hasher_<T>::value > +{ +}; + +} // namespace container_hash +} // namespace boost + +#endif // #ifndef BOOST_HASH_IS_UNORDERED_RANGE_HPP_INCLUDED diff --git a/contrib/restricted/boost/describe/CMakeLists.darwin.txt b/contrib/restricted/boost/describe/CMakeLists.darwin.txt new file mode 100644 index 0000000000..29ab4ad0c0 --- /dev/null +++ b/contrib/restricted/boost/describe/CMakeLists.darwin.txt @@ -0,0 +1,17 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-describe INTERFACE) +target_include_directories(restricted-boost-describe INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/describe/include +) +target_link_libraries(restricted-boost-describe INTERFACE + contrib-libs-cxxsupp + restricted-boost-mp11 +) diff --git a/contrib/restricted/boost/describe/CMakeLists.linux-aarch64.txt b/contrib/restricted/boost/describe/CMakeLists.linux-aarch64.txt new file mode 100644 index 0000000000..9a0d0c63f3 --- /dev/null +++ b/contrib/restricted/boost/describe/CMakeLists.linux-aarch64.txt @@ -0,0 +1,18 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-describe INTERFACE) +target_include_directories(restricted-boost-describe INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/describe/include +) +target_link_libraries(restricted-boost-describe INTERFACE + contrib-libs-linux-headers + contrib-libs-cxxsupp + restricted-boost-mp11 +) diff --git a/contrib/restricted/boost/describe/CMakeLists.linux.txt b/contrib/restricted/boost/describe/CMakeLists.linux.txt new file mode 100644 index 0000000000..9a0d0c63f3 --- /dev/null +++ b/contrib/restricted/boost/describe/CMakeLists.linux.txt @@ -0,0 +1,18 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-describe INTERFACE) +target_include_directories(restricted-boost-describe INTERFACE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/describe/include +) +target_link_libraries(restricted-boost-describe INTERFACE + contrib-libs-linux-headers + contrib-libs-cxxsupp + restricted-boost-mp11 +) diff --git a/contrib/restricted/boost/describe/CMakeLists.txt b/contrib/restricted/boost/describe/CMakeLists.txt new file mode 100644 index 0000000000..3e0811fb22 --- /dev/null +++ b/contrib/restricted/boost/describe/CMakeLists.txt @@ -0,0 +1,15 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + +if (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64" AND UNIX AND NOT APPLE AND NOT ANDROID) + include(CMakeLists.linux-aarch64.txt) +elseif (APPLE) + include(CMakeLists.darwin.txt) +elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" AND UNIX AND NOT APPLE AND NOT ANDROID) + include(CMakeLists.linux.txt) +endif() diff --git a/contrib/restricted/boost/describe/README.md b/contrib/restricted/boost/describe/README.md new file mode 100644 index 0000000000..228acc95a6 --- /dev/null +++ b/contrib/restricted/boost/describe/README.md @@ -0,0 +1,20 @@ +# Describe + +A C++14 reflection library. Provides macros for describing enumerators and +struct/class members, and primitives for querying this information. See +[the documentation](https://www.boost.org/doc/libs/develop/libs/describe/) +for more information and usage examples. + +## Supported Compilers + +* GCC 5 or later with `-std=c++14` or above +* Clang 3.9 or later with `-std=c++14` or above +* Visual Studio 2015 or later + +Tested on [Github Actions](https://github.com/boostorg/describe/actions) and +[Appveyor](https://ci.appveyor.com/project/pdimov/describe). + +## License + +Distributed under the +[Boost Software License, Version 1.0](http://boost.org/LICENSE_1_0.txt). diff --git a/contrib/restricted/boost/describe/include/boost/describe/bases.hpp b/contrib/restricted/boost/describe/include/boost/describe/bases.hpp new file mode 100644 index 0000000000..b01313e046 --- /dev/null +++ b/contrib/restricted/boost/describe/include/boost/describe/bases.hpp @@ -0,0 +1,50 @@ +#ifndef BOOST_DESCRIBE_BASES_HPP_INCLUDED +#define BOOST_DESCRIBE_BASES_HPP_INCLUDED + +// Copyright 2020, 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/describe/modifiers.hpp> +#include <boost/describe/detail/void_t.hpp> +#include <boost/describe/detail/config.hpp> + +#if defined(BOOST_DESCRIBE_CXX11) + +#include <boost/mp11/algorithm.hpp> +#include <type_traits> + +namespace boost +{ +namespace describe +{ +namespace detail +{ + +template<class T> using _describe_bases = decltype( boost_base_descriptor_fn( static_cast<T**>(0) ) ); + +template<unsigned M> struct base_filter +{ + template<class T> using fn = mp11::mp_bool< ( M & mod_any_access & T::modifiers ) != 0 >; +}; + +template<class T, class En = void> struct has_describe_bases: std::false_type +{ +}; + +template<class T> struct has_describe_bases<T, void_t<_describe_bases<T>>>: std::true_type +{ +}; + +} // namespace detail + +template<class T, unsigned M> using describe_bases = mp11::mp_copy_if_q<detail::_describe_bases<T>, detail::base_filter<M>>; + +template<class T> using has_describe_bases = detail::has_describe_bases<T>; + +} // namespace describe +} // namespace boost + +#endif // !defined(BOOST_DESCRIBE_CXX11) + +#endif // #ifndef BOOST_DESCRIBE_BASES_HPP_INCLUDED diff --git a/contrib/restricted/boost/describe/include/boost/describe/detail/config.hpp b/contrib/restricted/boost/describe/include/boost/describe/detail/config.hpp new file mode 100644 index 0000000000..c24a070e32 --- /dev/null +++ b/contrib/restricted/boost/describe/include/boost/describe/detail/config.hpp @@ -0,0 +1,40 @@ +#ifndef BOOST_DESCRIBE_DETAIL_CONFIG_HPP_INCLUDED +#define BOOST_DESCRIBE_DETAIL_CONFIG_HPP_INCLUDED + +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#if __cplusplus >= 201402L + +# define BOOST_DESCRIBE_CXX14 +# define BOOST_DESCRIBE_CXX11 + +#elif defined(_MSC_VER) && _MSC_VER >= 1900 + +# define BOOST_DESCRIBE_CXX14 +# define BOOST_DESCRIBE_CXX11 + +#elif __cplusplus >= 201103L + +# define BOOST_DESCRIBE_CXX11 + +# if defined(__GNUC__) && __GNUC__ == 4 && __GNUC_MINOR__ == 7 +# undef BOOST_DESCRIBE_CXX11 +# endif + +#endif + +#if defined(BOOST_DESCRIBE_CXX11) +# define BOOST_DESCRIBE_CONSTEXPR_OR_CONST constexpr +#else +# define BOOST_DESCRIBE_CONSTEXPR_OR_CONST const +#endif + +#if defined(__clang__) +# define BOOST_DESCRIBE_MAYBE_UNUSED __attribute__((unused)) +#else +# define BOOST_DESCRIBE_MAYBE_UNUSED +#endif + +#endif // #ifndef BOOST_DESCRIBE_DETAIL_CONFIG_HPP_INCLUDED diff --git a/contrib/restricted/boost/describe/include/boost/describe/detail/cx_streq.hpp b/contrib/restricted/boost/describe/include/boost/describe/detail/cx_streq.hpp new file mode 100644 index 0000000000..15e87dc270 --- /dev/null +++ b/contrib/restricted/boost/describe/include/boost/describe/detail/cx_streq.hpp @@ -0,0 +1,30 @@ +#ifndef BOOST_DESCRIBE_DETAIL_CX_STREQ_HPP_INCLUDED +#define BOOST_DESCRIBE_DETAIL_CX_STREQ_HPP_INCLUDED + +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/describe/detail/config.hpp> + +#if defined(BOOST_DESCRIBE_CXX11) + +namespace boost +{ +namespace describe +{ +namespace detail +{ + +constexpr bool cx_streq( char const * s1, char const * s2 ) +{ + return s1[0] == s2[0] && ( s1[0] == 0 || cx_streq( s1 + 1, s2 + 1 ) ); +} + +} // namespace detail +} // namespace describe +} // namespace boost + +#endif // defined(BOOST_DESCRIBE_CXX11) + +#endif // #ifndef BOOST_DESCRIBE_DETAIL_CX_STREQ_HPP_INCLUDED diff --git a/contrib/restricted/boost/describe/include/boost/describe/detail/void_t.hpp b/contrib/restricted/boost/describe/include/boost/describe/detail/void_t.hpp new file mode 100644 index 0000000000..f304250d85 --- /dev/null +++ b/contrib/restricted/boost/describe/include/boost/describe/detail/void_t.hpp @@ -0,0 +1,32 @@ +#ifndef BOOST_DESCRIBE_DETAIL_VOID_T_HPP_INCLUDED +#define BOOST_DESCRIBE_DETAIL_VOID_T_HPP_INCLUDED + +// Copyright 2021 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/describe/detail/config.hpp> + +#if defined(BOOST_DESCRIBE_CXX11) + +namespace boost +{ +namespace describe +{ +namespace detail +{ + +template<class...> struct make_void +{ + using type = void; +}; + +template<class... T> using void_t = typename make_void<T...>::type; + +} // namespace detail +} // namespace describe +} // namespace boost + +#endif // defined(BOOST_DESCRIBE_CXX11) + +#endif // #ifndef BOOST_DESCRIBE_DETAIL_VOID_T_HPP_INCLUDED diff --git a/contrib/restricted/boost/describe/include/boost/describe/members.hpp b/contrib/restricted/boost/describe/include/boost/describe/members.hpp new file mode 100644 index 0000000000..bce49db77d --- /dev/null +++ b/contrib/restricted/boost/describe/include/boost/describe/members.hpp @@ -0,0 +1,159 @@ +#ifndef BOOST_DESCRIBE_DATA_MEMBERS_HPP_INCLUDED +#define BOOST_DESCRIBE_DATA_MEMBERS_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/describe/modifiers.hpp> +#include <boost/describe/bases.hpp> +#include <boost/describe/detail/void_t.hpp> +#include <boost/describe/detail/cx_streq.hpp> +#include <boost/describe/detail/config.hpp> + +#if defined(BOOST_DESCRIBE_CXX11) + +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/mp11/integral.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/bind.hpp> +#include <type_traits> + +namespace boost +{ +namespace describe +{ +namespace detail +{ + +// _describe_members<T> + +template<class T> using _describe_public_members = decltype( boost_public_member_descriptor_fn( static_cast<T**>(0) ) ); +template<class T> using _describe_protected_members = decltype( boost_protected_member_descriptor_fn( static_cast<T**>(0) ) ); +template<class T> using _describe_private_members = decltype( boost_private_member_descriptor_fn( static_cast<T**>(0) ) ); + +template<class T> using _describe_members = mp11::mp_append<_describe_public_members<T>, _describe_protected_members<T>, _describe_private_members<T>>; + +// describe_inherited_members<T> + +// T: type +// V: list of virtual bases visited so far +template<class T, class V> struct describe_inherited_members_impl; +template<class T, class V> using describe_inherited_members = typename describe_inherited_members_impl<T, V>::type; + +// L: list of base class descriptors +// T: derived type +// V: list of virtual bases visited so far +template<class L, class T, class V> struct describe_inherited_members2_impl; +template<class L, class T, class V> using describe_inherited_members2 = typename describe_inherited_members2_impl<L, T, V>::type; + +template<class T, class V> struct describe_inherited_members_impl +{ + using R1 = describe_inherited_members2<describe_bases<T, mod_any_access>, T, V>; + using R2 = _describe_members<T>; + + using type = mp11::mp_append<R1, R2>; +}; + +template<template<class...> class L, class T, class V> struct describe_inherited_members2_impl<L<>, T, V> +{ + using type = L<>; +}; + +template<class D1, class D2> using name_matches = mp11::mp_bool< cx_streq( D1::name, D2::name ) >; + +template<class D, class L> using name_is_hidden = mp11::mp_any_of_q<L, mp11::mp_bind_front<name_matches, D>>; + +constexpr unsigned cx_max( unsigned m1, unsigned m2 ) +{ + return m1 > m2? m1: m2; +} + +template<class T, unsigned Bm> struct update_modifiers +{ + template<class D> struct fn + { + using L = _describe_members<T>; + static constexpr unsigned hidden = name_is_hidden<D, L>::value? mod_hidden: 0; + + static constexpr unsigned mods = D::modifiers; + static constexpr unsigned access = cx_max( mods & mod_any_access, Bm & mod_any_access ); + + static constexpr decltype(D::pointer) pointer = D::pointer; + static constexpr decltype(D::name) name = D::name; + static constexpr unsigned modifiers = ( mods & ~mod_any_access ) | access | mod_inherited | hidden; + }; +}; + +template<class T, unsigned Bm> template<class D> constexpr decltype(D::pointer) update_modifiers<T, Bm>::fn<D>::pointer; +template<class T, unsigned Bm> template<class D> constexpr decltype(D::name) update_modifiers<T, Bm>::fn<D>::name; +template<class T, unsigned Bm> template<class D> constexpr unsigned update_modifiers<T, Bm>::fn<D>::modifiers; + +template<class D> struct gather_virtual_bases_impl; +template<class D> using gather_virtual_bases = typename gather_virtual_bases_impl<D>::type; + +template<class D> struct gather_virtual_bases_impl +{ + using B = typename D::type; + static constexpr unsigned M = D::modifiers; + + using R1 = mp11::mp_transform<gather_virtual_bases, describe_bases<B, mod_any_access>>; + using R2 = mp11::mp_apply<mp11::mp_append, R1>; + + using type = mp11::mp_if_c<(M & mod_virtual) != 0, mp11::mp_push_front<R2, B>, R2>; +}; + +template<template<class...> class L, class D1, class... D, class T, class V> struct describe_inherited_members2_impl<L<D1, D...>, T, V> +{ + using B = typename D1::type; + static constexpr unsigned M = D1::modifiers; + + using R1 = mp11::mp_if_c<(M & mod_virtual) && mp11::mp_contains<V, B>::value, L<>, describe_inherited_members<B, V>>; + + using R2 = mp11::mp_transform_q<update_modifiers<T, M>, R1>; + + using V2 = mp11::mp_append<V, gather_virtual_bases<D1>>; + using R3 = describe_inherited_members2<L<D...>, T, V2>; + + using type = mp11::mp_append<R2, R3>; +}; + +// describe_members<T, M> + +template<class T, unsigned M> using describe_members = mp11::mp_eval_if_c<(M & mod_inherited) == 0, _describe_members<T>, describe_inherited_members, T, mp11::mp_list<>>; + +// member_filter + +template<unsigned M> struct member_filter +{ + template<class T> using fn = mp11::mp_bool< + (M & mod_any_access & T::modifiers) != 0 && + ( (M & mod_any_member) != 0 || (M & mod_static) == (T::modifiers & mod_static) ) && + ( (M & mod_any_member) != 0 || (M & mod_function) == (T::modifiers & mod_function) ) && + (M & mod_hidden) >= (T::modifiers & mod_hidden) + >; +}; + +// has_describe_members + +template<class T, class En = void> struct has_describe_members: std::false_type +{ +}; + +template<class T> struct has_describe_members<T, void_t<_describe_members<T>>>: std::true_type +{ +}; + +} // namespace detail + +template<class T, unsigned M> using describe_members = mp11::mp_copy_if_q<detail::describe_members<T, M>, detail::member_filter<M>>; + +template<class T> using has_describe_members = detail::has_describe_members<T>; + +} // namespace describe +} // namespace boost + +#endif // !defined(BOOST_DESCRIBE_CXX11) + +#endif // #ifndef BOOST_DESCRIBE_DATA_MEMBERS_HPP_INCLUDED diff --git a/contrib/restricted/boost/describe/include/boost/describe/modifiers.hpp b/contrib/restricted/boost/describe/include/boost/describe/modifiers.hpp new file mode 100644 index 0000000000..06650ea1d3 --- /dev/null +++ b/contrib/restricted/boost/describe/include/boost/describe/modifiers.hpp @@ -0,0 +1,33 @@ +#ifndef BOOST_DESCRIBE_MODIFIERS_HPP_INCLUDED +#define BOOST_DESCRIBE_MODIFIERS_HPP_INCLUDED + +// Copyright 2020 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt + +#include <boost/describe/detail/config.hpp> + +namespace boost +{ +namespace describe +{ + +enum modifiers +{ + mod_public = 1, + mod_protected = 2, + mod_private = 4, + mod_virtual = 8, + mod_static = 16, + mod_function = 32, + mod_any_member = 64, + mod_inherited = 128, + mod_hidden = 256 +}; + +BOOST_DESCRIBE_CONSTEXPR_OR_CONST modifiers mod_any_access = static_cast<modifiers>( mod_public | mod_protected | mod_private ); + +} // namespace describe +} // namespace boost + +#endif // #ifndef BOOST_DESCRIBE_MODIFIERS_HPP_INCLUDED diff --git a/contrib/restricted/boost/detail/include/boost/detail/container_fwd.hpp b/contrib/restricted/boost/detail/include/boost/detail/container_fwd.hpp deleted file mode 100644 index 04ce972738..0000000000 --- a/contrib/restricted/boost/detail/include/boost/detail/container_fwd.hpp +++ /dev/null @@ -1,157 +0,0 @@ - -// Copyright 2005-2011 Daniel James. -// 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) - -// Note: if you change this include guard, you also need to change -// container_fwd_compile_fail.cpp -#if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) -#define BOOST_DETAIL_CONTAINER_FWD_HPP - -#if defined(_MSC_VER) && \ - !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) -# pragma once -#endif - -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -//////////////////////////////////////////////////////////////////////////////// -// // -// Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to // -// forward declare standard containers. // -// // -// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it // -// normally doesn't. // -// // -// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD. // -// // -//////////////////////////////////////////////////////////////////////////////// - -#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD) -# if defined(BOOST_DETAIL_CONTAINER_FWD) - // Force forward declarations. -# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) - // STLport -# define BOOST_DETAIL_NO_CONTAINER_FWD -# elif defined(__LIBCOMO__) - // Comeau STL: -# define BOOST_DETAIL_NO_CONTAINER_FWD -# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) - // Rogue Wave library: -# define BOOST_DETAIL_NO_CONTAINER_FWD -# elif defined(_LIBCPP_VERSION) - // libc++ -# define BOOST_DETAIL_NO_CONTAINER_FWD -# elif defined(__GLIBCPP__) || defined(__GLIBCXX__) - // GNU libstdc++ 3 - // - // Disable forwarding for all recent versions, as the library has a - // versioned namespace mode, and I don't know how to detect it. -# if __GLIBCXX__ >= 20070513 \ - || defined(_GLIBCXX_DEBUG) \ - || defined(_GLIBCXX_PARALLEL) \ - || defined(_GLIBCXX_PROFILE) -# define BOOST_DETAIL_NO_CONTAINER_FWD -# else -# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20040530 -# define BOOST_CONTAINER_FWD_COMPLEX_STRUCT -# endif -# endif -# elif defined(__STL_CONFIG_H) - // generic SGI STL - // - // Forward declaration seems to be okay, but it has a couple of odd - // implementations. -# define BOOST_CONTAINER_FWD_BAD_BITSET -# if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) -# define BOOST_CONTAINER_FWD_BAD_DEQUE -# endif -# elif defined(__MSL_CPP__) - // MSL standard lib: -# define BOOST_DETAIL_NO_CONTAINER_FWD -# elif defined(__IBMCPP__) - // The default VACPP std lib, forward declaration seems to be fine. -# elif defined(MSIPL_COMPILE_H) - // Modena C++ standard library -# define BOOST_DETAIL_NO_CONTAINER_FWD -# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) - // Dinkumware Library (this has to appear after any possible replacement - // libraries) -# else -# define BOOST_DETAIL_NO_CONTAINER_FWD -# endif -#endif - -#if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) - -#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \ - !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD) - -#include <deque> -#include <list> -#include <vector> -#include <map> -#include <set> -#include <bitset> -#include <string> -#include <complex> - -#else - -#include <cstddef> - -#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE) -#include <deque> -#endif - -#if defined(BOOST_CONTAINER_FWD_BAD_BITSET) -#include <bitset> -#endif - -#if defined(BOOST_MSVC) -#pragma warning(push) -#pragma warning(disable:4099) // struct/class mismatch in fwd declarations -#endif - -namespace std -{ - template <class T> class allocator; - template <class charT, class traits, class Allocator> class basic_string; - - template <class charT> struct char_traits; - -#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) - template <class T> struct complex; -#else - template <class T> class complex; -#endif - -#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE) - template <class T, class Allocator> class deque; -#endif - - template <class T, class Allocator> class list; - template <class T, class Allocator> class vector; - template <class Key, class T, class Compare, class Allocator> class map; - template <class Key, class T, class Compare, class Allocator> - class multimap; - template <class Key, class Compare, class Allocator> class set; - template <class Key, class Compare, class Allocator> class multiset; - -#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET) - template <size_t N> class bitset; -#endif - template <class T1, class T2> struct pair; -} - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - -#endif // BOOST_DETAIL_NO_CONTAINER_FWD && - // !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD) - -#endif // BOOST_DETAIL_TEST_CONFIG_ONLY - -#endif |