diff --git a/ThirdParty/ThirdParty.dox b/ThirdParty/ThirdParty.dox index 064fc5635562e30ce6731f392ef145c1aec6f919..7db1a1513de18d77dac8e67f8adceef7e3472819 100644 --- a/ThirdParty/ThirdParty.dox +++ b/ThirdParty/ThirdParty.dox @@ -49,7 +49,7 @@ License: BSL-1.0 (https://www.boost.org/LICENSE_1_0.txt) The subset was generated with the bcp tool: -https://www.boost.org/doc/libs/1_70_0/tools/bcp/doc/html/index.html +https://www.boost.org/doc/libs/1_73_0/tools/bcp/doc/html/index.html Instructions on how to update Boost with this tool: @@ -58,7 +58,7 @@ Unpack source code somewhere, go to into the folder. Run these commands: ./bootstrap && ./b2 tools/bcp - ./dist/bin/bcp mp11 iterator core format interval optional type_index ./dist + ./dist/bin/bcp mp11 iterator core format interval optional type_index histogram ./dist mv ./dist/boost <CORSIKA-path>/ThirdParty/boost */ diff --git a/ThirdParty/boost/algorithm/cxx11/all_of.hpp b/ThirdParty/boost/algorithm/cxx11/all_of.hpp index 527bbd50fae909a159ab6a1e545b00bab6abc52a..f7ee311b28e7f4648e25ec2d5de59f26314ab7f5 100644 --- a/ThirdParty/boost/algorithm/cxx11/all_of.hpp +++ b/ThirdParty/boost/algorithm/cxx11/all_of.hpp @@ -12,6 +12,7 @@ #ifndef BOOST_ALGORITHM_ALL_OF_HPP #define BOOST_ALGORITHM_ALL_OF_HPP +#include <boost/config.hpp> #include <boost/range/begin.hpp> #include <boost/range/end.hpp> diff --git a/ThirdParty/boost/algorithm/string/iter_find.hpp b/ThirdParty/boost/algorithm/string/iter_find.hpp index 10424abc749ebcb9e14f88ac437be3bbcc964c35..d76a819896e8cdc735203efca6621f6c31fde68d 100644 --- a/ThirdParty/boost/algorithm/string/iter_find.hpp +++ b/ThirdParty/boost/algorithm/string/iter_find.hpp @@ -71,7 +71,11 @@ namespace boost { inline SequenceSequenceT& iter_find( SequenceSequenceT& Result, +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + RangeT&& Input, +#else RangeT& Input, +#endif FinderT Finder ) { BOOST_CONCEPT_ASSERT(( @@ -142,7 +146,11 @@ namespace boost { inline SequenceSequenceT& iter_split( SequenceSequenceT& Result, +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + RangeT&& Input, +#else RangeT& Input, +#endif FinderT Finder ) { BOOST_CONCEPT_ASSERT(( diff --git a/ThirdParty/boost/algorithm/string/split.hpp b/ThirdParty/boost/algorithm/string/split.hpp index cae712c07fa59d27da566a1df148f0808799e2ce..e0b30fb35349eeb4aea4cebe7b529afbff648a9a 100644 --- a/ThirdParty/boost/algorithm/string/split.hpp +++ b/ThirdParty/boost/algorithm/string/split.hpp @@ -61,7 +61,11 @@ namespace boost { template< typename SequenceSequenceT, typename Range1T, typename Range2T > inline SequenceSequenceT& find_all( SequenceSequenceT& Result, +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + Range1T&& Input, +#else Range1T& Input, +#endif const Range2T& Search) { return ::boost::algorithm::iter_find( @@ -96,7 +100,11 @@ namespace boost { template< typename SequenceSequenceT, typename Range1T, typename Range2T > inline SequenceSequenceT& ifind_all( SequenceSequenceT& Result, +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + Range1T&& Input, +#else Range1T& Input, +#endif const Range2T& Search, const std::locale& Loc=std::locale() ) { @@ -139,7 +147,11 @@ namespace boost { template< typename SequenceSequenceT, typename RangeT, typename PredicateT > inline SequenceSequenceT& split( SequenceSequenceT& Result, +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + RangeT&& Input, +#else RangeT& Input, +#endif PredicateT Pred, token_compress_mode_type eCompress=token_compress_off ) { diff --git a/ThirdParty/boost/any.hpp b/ThirdParty/boost/any.hpp index f161b3ff17ddf5e85f907b160ac35036f66fb124..cb0cb259338f47c40bb249d4c54b77c65c12eec2 100644 --- a/ThirdParty/boost/any.hpp +++ b/ThirdParty/boost/any.hpp @@ -12,9 +12,7 @@ // with features contributed and bugs found by // Antony Polukhin, Ed Brey, Mark Rodgers, // Peter Dimov, and James Curran -// when: July 2001, April 2013 - 2019 - -#include <algorithm> +// when: July 2001, April 2013 - 2020 #include <boost/config.hpp> #include <boost/type_index.hpp> @@ -38,7 +36,7 @@ namespace boost { public: // structors - any() BOOST_NOEXCEPT + BOOST_CONSTEXPR any() BOOST_NOEXCEPT : content(0) { } @@ -83,7 +81,9 @@ namespace boost any & swap(any & rhs) BOOST_NOEXCEPT { - std::swap(content, rhs.content); + placeholder* tmp = content; + content = rhs.content; + rhs.content = tmp; return *this; } @@ -98,7 +98,7 @@ namespace boost any & operator=(any rhs) { - any(rhs).swap(*this); + rhs.swap(*this); return *this; } @@ -166,7 +166,11 @@ namespace boost }; template<typename ValueType> - class holder : public placeholder + class holder +#ifndef BOOST_NO_CXX11_FINAL + final +#endif + : public placeholder { public: // structors @@ -329,7 +333,7 @@ namespace boost } // Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved. -// Copyright Antony Polukhin, 2013-2019. +// Copyright Antony Polukhin, 2013-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/assert/source_location.hpp b/ThirdParty/boost/assert/source_location.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a85e6795260ae3fbdab2431d7dbdfdcb47dceabf --- /dev/null +++ b/ThirdParty/boost/assert/source_location.hpp @@ -0,0 +1,93 @@ +#ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED +#define BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED + +// http://www.boost.org/libs/assert +// +// Copyright 2019 Peter Dimov +// Distributed under the Boost Software License, Version 1.0. +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/current_function.hpp> +#include <boost/config.hpp> +#include <boost/cstdint.hpp> +#include <iosfwd> + +namespace boost +{ + +struct source_location +{ +private: + + char const * file_; + char const * function_; + boost::uint_least32_t line_; + boost::uint_least32_t column_; + +public: + + BOOST_CONSTEXPR source_location() BOOST_NOEXCEPT: file_( "(unknown)" ), function_( "(unknown)" ), line_( 0 ), column_( 0 ) + { + } + + BOOST_CONSTEXPR source_location( char const * file, boost::uint_least32_t ln, char const * function, boost::uint_least32_t col = 0 ) BOOST_NOEXCEPT: file_( file ), function_( function ), line_( ln ), column_( col ) + { + } + + BOOST_CONSTEXPR char const * file_name() const BOOST_NOEXCEPT + { + return file_; + } + + BOOST_CONSTEXPR char const * function_name() const BOOST_NOEXCEPT + { + return function_; + } + + BOOST_CONSTEXPR boost::uint_least32_t line() const BOOST_NOEXCEPT + { + return line_; + } + + BOOST_CONSTEXPR boost::uint_least32_t column() const BOOST_NOEXCEPT + { + return column_; + } +}; + +template<class E, class T> std::basic_ostream<E, T> & operator<<( std::basic_ostream<E, T> & os, source_location const & loc ) +{ + os.width( 0 ); + + if( loc.line() == 0 ) + { + os << "(unknown source location)"; + } + else + { + os << loc.file_name() << ':' << loc.line(); + + if( loc.column() ) + { + os << ':' << loc.column(); + } + + os << ": in function '" << loc.function_name() << '\''; + } + + return os; +} + +} // namespace boost + +#if defined( BOOST_DISABLE_CURRENT_LOCATION ) + +# define BOOST_CURRENT_LOCATION ::boost::source_location() + +#else + +# define BOOST_CURRENT_LOCATION ::boost::source_location(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION) + +#endif + +#endif // #ifndef BOOST_ASSERT_SOURCE_LOCATION_HPP_INCLUDED diff --git a/ThirdParty/boost/bind.hpp b/ThirdParty/boost/bind.hpp index 450120c7a7a34731ac55f7991fe881157a781390..48cc4094cfee0e6f68200822d40d3f5869acfb0a 100644 --- a/ThirdParty/boost/bind.hpp +++ b/ThirdParty/boost/bind.hpp @@ -7,7 +7,6 @@ # pragma once #endif -// // bind.hpp - binds function objects to arguments // // Copyright (c) 2009, 2015 Peter Dimov @@ -18,11 +17,31 @@ // // See http://www.boost.org/libs/bind/bind.html for documentation. // +// For backward compatibility, this header includes +// <boost/bind/bind.hpp> and then imports the placeholders _1, _2, +// _3, ... into the global namespace. Definitions in the global +// namespace are not a good practice and this use is deprecated. +// Please switch to including <boost/bind/bind.hpp> directly, +// adding the using directive locally where appropriate. +// Alternatively, the existing behavior may be preserved by defining +// the macro BOOST_BIND_GLOBAL_PLACEHOLDERS. #include <boost/bind/bind.hpp> +#include <boost/config/pragma_message.hpp> #ifndef BOOST_BIND_NO_PLACEHOLDERS +#if !defined(BOOST_BIND_GLOBAL_PLACEHOLDERS) + +BOOST_PRAGMA_MESSAGE( + "The practice of declaring the Bind placeholders (_1, _2, ...) " + "in the global namespace is deprecated. Please use " + "<boost/bind/bind.hpp> + using namespace boost::placeholders, " + "or define BOOST_BIND_GLOBAL_PLACEHOLDERS to retain the current behavior." +) + +#endif + #if defined(BOOST_CLANG) # pragma clang diagnostic push # if __has_warning("-Wheader-hygiene") diff --git a/ThirdParty/boost/bind/bind.hpp b/ThirdParty/boost/bind/bind.hpp index 4cedc5e9a4e4e53dc0d21898c479cfb00ce6e153..711e0001e4f5bbb525a115152c0fe1e84eae1058 100644 --- a/ThirdParty/boost/bind/bind.hpp +++ b/ThirdParty/boost/bind/bind.hpp @@ -2136,7 +2136,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl #undef BOOST_BIND_ST #undef BOOST_BIND_NOEXCEPT -#ifdef BOOST_BIND_ENABLE_STDCALL +#if defined(BOOST_BIND_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_BIND_CC __stdcall #define BOOST_BIND_ST @@ -2150,7 +2150,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl #endif -#ifdef BOOST_BIND_ENABLE_FASTCALL +#if defined(BOOST_BIND_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_BIND_CC __fastcall #define BOOST_BIND_ST @@ -2197,7 +2197,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl #undef BOOST_BIND_MF_CC #undef BOOST_BIND_MF_NOEXCEPT -#ifdef BOOST_MEM_FN_ENABLE_CDECL +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_BIND_MF_NAME(X) X##_cdecl #define BOOST_BIND_MF_CC __cdecl @@ -2212,7 +2212,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl #endif -#ifdef BOOST_MEM_FN_ENABLE_STDCALL +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_BIND_MF_NAME(X) X##_stdcall #define BOOST_BIND_MF_CC __stdcall @@ -2227,7 +2227,7 @@ template<class F, class A1, class A2, class A3, class A4, class A5, class A6, cl #endif -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_BIND_MF_NAME(X) X##_fastcall #define BOOST_BIND_MF_CC __fastcall diff --git a/ThirdParty/boost/bind/mem_fn.hpp b/ThirdParty/boost/bind/mem_fn.hpp index 956e7d88853c6c30ab700086a1df487dec42e8ee..5afb0a1a89a74c122c8a887ad9b8999b57518611 100644 --- a/ThirdParty/boost/bind/mem_fn.hpp +++ b/ThirdParty/boost/bind/mem_fn.hpp @@ -49,7 +49,7 @@ template<class V> struct mf #undef BOOST_MEM_FN_CC #undef BOOST_MEM_FN_NAME -#ifdef BOOST_MEM_FN_ENABLE_CDECL +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl #define BOOST_MEM_FN_CC __cdecl @@ -61,7 +61,7 @@ template<class V> struct mf #endif -#ifdef BOOST_MEM_FN_ENABLE_STDCALL +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) inner_##X##_stdcall #define BOOST_MEM_FN_CC __stdcall @@ -73,7 +73,7 @@ template<class V> struct mf #endif -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) inner_##X##_fastcall #define BOOST_MEM_FN_CC __fastcall @@ -102,7 +102,7 @@ template<> struct mf<void> #undef BOOST_MEM_FN_CC #undef BOOST_MEM_FN_NAME -#ifdef BOOST_MEM_FN_ENABLE_CDECL +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) inner_##X##_cdecl #define BOOST_MEM_FN_CC __cdecl @@ -155,7 +155,7 @@ template<> struct mf<void> #undef BOOST_MEM_FN_NAME2 #undef BOOST_MEM_FN_CC -#ifdef BOOST_MEM_FN_ENABLE_CDECL +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_cdecl #define BOOST_MEM_FN_NAME2(X) inner_##X##_cdecl @@ -217,7 +217,7 @@ namespace _mfi #undef BOOST_MEM_FN_CC #undef BOOST_MEM_FN_NAME -#ifdef BOOST_MEM_FN_ENABLE_CDECL +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_cdecl #define BOOST_MEM_FN_CC __cdecl @@ -229,7 +229,7 @@ namespace _mfi #endif -#ifdef BOOST_MEM_FN_ENABLE_STDCALL +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_stdcall #define BOOST_MEM_FN_CC __stdcall @@ -241,7 +241,7 @@ namespace _mfi #endif -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_fastcall #define BOOST_MEM_FN_CC __fastcall @@ -264,45 +264,59 @@ namespace _mfi #define BOOST_MEM_FN_NAME(X) X #define BOOST_MEM_FN_CC +#define BOOST_MEM_FN_NOEXCEPT #include <boost/bind/mem_fn_cc.hpp> +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) +# undef BOOST_MEM_FN_NOEXCEPT +# define BOOST_MEM_FN_NOEXCEPT noexcept +# include <boost/bind/mem_fn_cc.hpp> +#endif + #undef BOOST_MEM_FN_NAME #undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT -#ifdef BOOST_MEM_FN_ENABLE_CDECL +#if defined(BOOST_MEM_FN_ENABLE_CDECL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_cdecl #define BOOST_MEM_FN_CC __cdecl +#define BOOST_MEM_FN_NOEXCEPT #include <boost/bind/mem_fn_cc.hpp> #undef BOOST_MEM_FN_NAME #undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT #endif -#ifdef BOOST_MEM_FN_ENABLE_STDCALL +#if defined(BOOST_MEM_FN_ENABLE_STDCALL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_stdcall #define BOOST_MEM_FN_CC __stdcall +#define BOOST_MEM_FN_NOEXCEPT #include <boost/bind/mem_fn_cc.hpp> #undef BOOST_MEM_FN_NAME #undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT #endif -#ifdef BOOST_MEM_FN_ENABLE_FASTCALL +#if defined(BOOST_MEM_FN_ENABLE_FASTCALL) && !defined(_M_X64) #define BOOST_MEM_FN_NAME(X) X##_fastcall #define BOOST_MEM_FN_CC __fastcall +#define BOOST_MEM_FN_NOEXCEPT #include <boost/bind/mem_fn_cc.hpp> #undef BOOST_MEM_FN_NAME #undef BOOST_MEM_FN_CC +#undef BOOST_MEM_FN_NOEXCEPT #endif diff --git a/ThirdParty/boost/bind/mem_fn_cc.hpp b/ThirdParty/boost/bind/mem_fn_cc.hpp index 8b6ea0ba13dcaebd946c2e109e19dd3857f96498..03e38300a5620fae912f33f26eb67f0d864505e9 100644 --- a/ThirdParty/boost/bind/mem_fn_cc.hpp +++ b/ThirdParty/boost/bind/mem_fn_cc.hpp @@ -12,92 +12,92 @@ // See http://www.boost.org/libs/bind/mem_fn.html for documentation. // -template<class R, class T> _mfi::BOOST_MEM_FN_NAME(mf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) ()) +template<class R, class T> _mfi::BOOST_MEM_FN_NAME(mf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf0)<R, T>(f); } -template<class R, class T> _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () const) +template<class R, class T> _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T> mem_fn(R (BOOST_MEM_FN_CC T::*f) () const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf0)<R, T>(f); } -template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1)) +template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf1)<R, T, A1>(f); } -template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const) +template<class R, class T, class A1> _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf1)<R, T, A1>(f); } -template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2)) +template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf2)<R, T, A1, A2>(f); } -template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const) +template<class R, class T, class A1, class A2> _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf2)<R, T, A1, A2>(f); } -template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3)) +template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf3)<R, T, A1, A2, A3>(f); } -template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const) +template<class R, class T, class A1, class A2, class A3> _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf3)<R, T, A1, A2, A3>(f); } -template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4)) +template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf4)<R, T, A1, A2, A3, A4>(f); } -template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const) +template<class R, class T, class A1, class A2, class A3, class A4> _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf4)<R, T, A1, A2, A3, A4>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5)) +template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf5)<R, T, A1, A2, A3, A4, A5>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const) +template<class R, class T, class A1, class A2, class A3, class A4, class A5> _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf5)<R, T, A1, A2, A3, A4, A5>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6)) +template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf6)<R, T, A1, A2, A3, A4, A5, A6>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const) +template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6> _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf6)<R, T, A1, A2, A3, A4, A5, A6>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7)) +template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const) +template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7> _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf7)<R, T, A1, A2, A3, A4, A5, A6, A7>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8)) +template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(mf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f); } -template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const) +template<class R, class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8> mem_fn(R (BOOST_MEM_FN_CC T::*f) (A1, A2, A3, A4, A5, A6, A7, A8) const BOOST_MEM_FN_NOEXCEPT) { return _mfi::BOOST_MEM_FN_NAME(cmf8)<R, T, A1, A2, A3, A4, A5, A6, A7, A8>(f); } diff --git a/ThirdParty/boost/chrono/detail/inlined/win/chrono.hpp b/ThirdParty/boost/chrono/detail/inlined/win/chrono.hpp index 570dc02a15b6bf4d1ccf52fa2a807558b2d82ef0..5c753f5e2884f3ae2335e8f4de309362db856029 100644 --- a/ThirdParty/boost/chrono/detail/inlined/win/chrono.hpp +++ b/ThirdParty/boost/chrono/detail/inlined/win/chrono.hpp @@ -15,6 +15,7 @@ #include <boost/winapi/time.hpp> #include <boost/winapi/timers.hpp> #include <boost/winapi/get_last_error.hpp> +#include <boost/winapi/error_codes.hpp> #include <boost/assert.hpp> namespace boost @@ -70,7 +71,7 @@ namespace chrono_detail { boost::winapi::DWORD_ cause = ((nanosecs_per_tic <= 0.0L) - ? ERROR_NOT_SUPPORTED + ? boost::winapi::ERROR_NOT_SUPPORTED_ : boost::winapi::GetLastError()); if (::boost::chrono::is_throws(ec)) { boost::throw_exception( diff --git a/ThirdParty/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp b/ThirdParty/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp index a3a838a5ceec62753e7fdef5305d37e69b5c49a1..87b5d4af199feceb9e155974e0f2a552d086335c 100644 --- a/ThirdParty/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp +++ b/ThirdParty/boost/chrono/detail/inlined/win/process_cpu_clocks.hpp @@ -19,10 +19,10 @@ #include <time.h> #include <boost/assert.hpp> -#include <boost/detail/winapi/get_last_error.hpp> -#include <boost/detail/winapi/get_current_process.hpp> +#include <boost/winapi/get_last_error.hpp> +#include <boost/winapi/get_current_process.hpp> #if BOOST_PLAT_WINDOWS_DESKTOP -#include <boost/detail/winapi/get_process_times.hpp> +#include <boost/winapi/get_process_times.hpp> #endif namespace boost @@ -72,10 +72,10 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now() BOOST_NOEXCEPT { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetProcessTimes( - boost::detail::winapi::GetCurrentProcess(), &creation, &exit, + if ( boost::winapi::GetProcessTimes( + boost::winapi::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) { return time_point(duration( @@ -97,10 +97,10 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetProcessTimes( - boost::detail::winapi::GetCurrentProcess(), &creation, &exit, + if ( boost::winapi::GetProcessTimes( + boost::winapi::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) { if (!::boost::chrono::is_throws(ec)) @@ -114,7 +114,7 @@ process_user_cpu_clock::time_point process_user_cpu_clock::now( } else { - boost::detail::winapi::DWORD_ cause = boost::detail::winapi::GetLastError(); + boost::winapi::DWORD_ cause = boost::winapi::GetLastError(); if (::boost::chrono::is_throws(ec)) { boost::throw_exception( @@ -137,10 +137,10 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now() BOOST_NOEXC { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetProcessTimes( - boost::detail::winapi::GetCurrentProcess(), &creation, &exit, + if ( boost::winapi::GetProcessTimes( + boost::winapi::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) { return time_point(duration( @@ -162,10 +162,10 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now( { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetProcessTimes( - boost::detail::winapi::GetCurrentProcess(), &creation, &exit, + if ( boost::winapi::GetProcessTimes( + boost::winapi::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) { if (!::boost::chrono::is_throws(ec)) @@ -179,7 +179,7 @@ process_system_cpu_clock::time_point process_system_cpu_clock::now( } else { - boost::detail::winapi::DWORD_ cause = boost::detail::winapi::GetLastError(); + boost::winapi::DWORD_ cause = boost::winapi::GetLastError(); if (::boost::chrono::is_throws(ec)) { boost::throw_exception( @@ -202,10 +202,10 @@ process_cpu_clock::time_point process_cpu_clock::now() BOOST_NOEXCEPT { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetProcessTimes( - boost::detail::winapi::GetCurrentProcess(), &creation, &exit, + if ( boost::winapi::GetProcessTimes( + boost::winapi::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) { time_point::rep r(process_real_cpu_clock::now().time_since_epoch().count() @@ -233,10 +233,10 @@ process_cpu_clock::time_point process_cpu_clock::now( { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetProcessTimes( - boost::detail::winapi::GetCurrentProcess(), &creation, &exit, + if ( boost::winapi::GetProcessTimes( + boost::winapi::GetCurrentProcess(), &creation, &exit, &system_time, &user_time ) ) { if (!::boost::chrono::is_throws(ec)) @@ -256,7 +256,7 @@ process_cpu_clock::time_point process_cpu_clock::now( } else { - boost::detail::winapi::DWORD_ cause = boost::detail::winapi::GetLastError(); + boost::winapi::DWORD_ cause = boost::winapi::GetLastError(); if (::boost::chrono::is_throws(ec)) { boost::throw_exception( diff --git a/ThirdParty/boost/chrono/detail/inlined/win/thread_clock.hpp b/ThirdParty/boost/chrono/detail/inlined/win/thread_clock.hpp index 776e5b4cd0cdcfaf00084f58a54c683a0e2f26fe..9c9490d0ba39a72837f1739098161b05e3db417f 100644 --- a/ThirdParty/boost/chrono/detail/inlined/win/thread_clock.hpp +++ b/ThirdParty/boost/chrono/detail/inlined/win/thread_clock.hpp @@ -16,9 +16,9 @@ #include <cassert> #include <boost/assert.hpp> -#include <boost/detail/winapi/get_last_error.hpp> -#include <boost/detail/winapi/get_current_thread.hpp> -#include <boost/detail/winapi/get_thread_times.hpp> +#include <boost/winapi/get_last_error.hpp> +#include <boost/winapi/get_current_thread.hpp> +#include <boost/winapi/get_thread_times.hpp> namespace boost { @@ -29,10 +29,10 @@ namespace chrono thread_clock::time_point thread_clock::now( system::error_code & ec ) { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetThreadTimes( - boost::detail::winapi::GetCurrentThread (), &creation, &exit, + if ( boost::winapi::GetThreadTimes( + boost::winapi::GetCurrentThread (), &creation, &exit, &system_time, &user_time ) ) { duration user = duration( @@ -56,13 +56,13 @@ thread_clock::time_point thread_clock::now( system::error_code & ec ) { boost::throw_exception( system::system_error( - boost::detail::winapi::GetLastError(), + boost::winapi::GetLastError(), ::boost::system::system_category(), "chrono::thread_clock" )); } else { - ec.assign( boost::detail::winapi::GetLastError(), ::boost::system::system_category() ); + ec.assign( boost::winapi::GetLastError(), ::boost::system::system_category() ); return thread_clock::time_point(duration(0)); } } @@ -73,10 +73,10 @@ thread_clock::time_point thread_clock::now() BOOST_NOEXCEPT { // note that Windows uses 100 nanosecond ticks for FILETIME - boost::detail::winapi::FILETIME_ creation, exit, user_time, system_time; + boost::winapi::FILETIME_ creation, exit, user_time, system_time; - if ( boost::detail::winapi::GetThreadTimes( - boost::detail::winapi::GetCurrentThread (), &creation, &exit, + if ( boost::winapi::GetThreadTimes( + boost::winapi::GetCurrentThread (), &creation, &exit, &system_time, &user_time ) ) { duration user = duration( diff --git a/ThirdParty/boost/config/auto_link.hpp b/ThirdParty/boost/config/auto_link.hpp index d0079d9bc27f5d9bfce70e75ce8dc7c78f554c8e..e74f3c10e96ed8031ebf6b58b584db62c607f9bd 100644 --- a/ThirdParty/boost/config/auto_link.hpp +++ b/ThirdParty/boost/config/auto_link.hpp @@ -99,7 +99,8 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. #if defined(BOOST_MSVC) \ || defined(__BORLANDC__) \ || (defined(__MWERKS__) && defined(_WIN32) && (__MWERKS__ >= 0x3000)) \ - || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) + || (defined(__ICL) && defined(_MSC_EXTENSIONS) && (_MSC_VER >= 1200)) \ + || (defined(BOOST_CLANG) && defined(BOOST_WINDOWS) && defined(_MSC_VER) && (__clang_major__ >= 4)) #ifndef BOOST_VERSION_HPP # include <boost/version.hpp> @@ -203,6 +204,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // Metrowerks CodeWarrior 9.x # define BOOST_LIB_TOOLSET "cw9" +# elif defined(BOOST_CLANG) && defined(BOOST_WINDOWS) && defined(_MSC_VER) && (__clang_major__ >= 4) + + // Clang on Windows +# define BOOST_LIB_TOOLSET "clangw" BOOST_STRINGIZE(__clang_major__) + # endif #endif // BOOST_LIB_TOOLSET diff --git a/ThirdParty/boost/config/compiler/borland.hpp b/ThirdParty/boost/config/compiler/borland.hpp index beec94621f303554821740a63851d937106a5d3d..cd4710abcdcd4d423d4f26b05b8ae190360ea717 100644 --- a/ThirdParty/boost/config/compiler/borland.hpp +++ b/ThirdParty/boost/config/compiler/borland.hpp @@ -199,6 +199,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/clang.hpp b/ThirdParty/boost/config/compiler/clang.hpp index 52b23d9d020cb23e896f05c6e77e18ae63c7deee..1a15f6b0559bb72bccd50fbda27849252fc6e3bf 100644 --- a/ThirdParty/boost/config/compiler/clang.hpp +++ b/ThirdParty/boost/config/compiler/clang.hpp @@ -252,6 +252,10 @@ # define BOOST_NO_CXX11_FINAL #endif +#if !__has_feature(cxx_unrestricted_unions) +# define BOOST_NO_CXX11_UNRESTRICTED_UNION +#endif + #if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__)) # define BOOST_NO_CXX14_BINARY_LITERALS #endif diff --git a/ThirdParty/boost/config/compiler/codegear.hpp b/ThirdParty/boost/config/compiler/codegear.hpp index 52531d2f08c7e26597fede1644675f2b72925d9b..91f40a92c820e03724e9944fa09dd352ade7a96c 100644 --- a/ThirdParty/boost/config/compiler/codegear.hpp +++ b/ThirdParty/boost/config/compiler/codegear.hpp @@ -124,6 +124,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/common_edg.hpp b/ThirdParty/boost/config/compiler/common_edg.hpp index 88aba9ac8f45518d87be977e28ef3dfc46df669e..1cb3c98edd62837d96affcac5aa992df621d1273 100644 --- a/ThirdParty/boost/config/compiler/common_edg.hpp +++ b/ThirdParty/boost/config/compiler/common_edg.hpp @@ -108,6 +108,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/cray.hpp b/ThirdParty/boost/config/compiler/cray.hpp index 412ef9efa5aa19ca0a2b864f69d6b4e600512286..4c73e9ac377eb6b31ab776481059baa93c5681e1 100644 --- a/ThirdParty/boost/config/compiler/cray.hpp +++ b/ThirdParty/boost/config/compiler/cray.hpp @@ -220,6 +220,7 @@ #define BOOST_NO_CXX11_USER_DEFINED_LITERALS #define BOOST_NO_CXX11_VARIADIC_MACROS #define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNRESTRICTED_UNION #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -293,6 +294,7 @@ #undef BOOST_NO_CXX11_USER_DEFINED_LITERALS #undef BOOST_NO_CXX11_VARIADIC_MACROS #undef BOOST_NO_CXX11_VARIADIC_TEMPLATES +#undef BOOST_NO_CXX11_UNRESTRICTED_UNION #undef BOOST_NO_SFINAE_EXPR #undef BOOST_NO_TWO_PHASE_NAME_LOOKUP #undef BOOST_MATH_DISABLE_STD_FPCLASSIFY diff --git a/ThirdParty/boost/config/compiler/digitalmars.hpp b/ThirdParty/boost/config/compiler/digitalmars.hpp index 1466373191ae35413c90d00427dce0dfcbb9d4d0..82029f902eabfbfe8276580f255f51bea30472b8 100644 --- a/ThirdParty/boost/config/compiler/digitalmars.hpp +++ b/ThirdParty/boost/config/compiler/digitalmars.hpp @@ -84,6 +84,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/gcc.hpp b/ThirdParty/boost/config/compiler/gcc.hpp index 9ae6072ee0e4073c55f668dc299cef3d7e37592a..78f1ae398ea3897b1a4d39e5b73e9381f9309d3b 100644 --- a/ThirdParty/boost/config/compiler/gcc.hpp +++ b/ThirdParty/boost/config/compiler/gcc.hpp @@ -267,6 +267,12 @@ # define BOOST_NO_CXX14_BINARY_LITERALS #endif +// C++0x features in 5.1 and later +// +#if (BOOST_GCC_VERSION < 50100) || !defined(BOOST_GCC_CXX11) +# define BOOST_NO_CXX11_UNRESTRICTED_UNION +#endif + // C++14 features in 4.9.0 and later // #if (BOOST_GCC_VERSION < 40900) || (__cplusplus < 201300) @@ -309,8 +315,8 @@ # define BOOST_FALLTHROUGH __attribute__((fallthrough)) #endif -#ifdef __MINGW32__ -// Currently (June 2017) thread_local is broken on mingw for all current compiler releases, see +#if defined(__MINGW32__) && !defined(__MINGW64__) +// Currently (March 2019) thread_local is broken on mingw for all current 32bit compiler releases, see // https://sourceforge.net/p/mingw-w64/bugs/527/ // Not setting this causes program termination on thread exit. #define BOOST_NO_CXX11_THREAD_LOCAL @@ -327,7 +333,7 @@ // // __builtin_unreachable: -#if BOOST_GCC_VERSION >= 40800 +#if BOOST_GCC_VERSION >= 40500 #define BOOST_UNREACHABLE_RETURN(x) __builtin_unreachable(); #endif diff --git a/ThirdParty/boost/config/compiler/gcc_xml.hpp b/ThirdParty/boost/config/compiler/gcc_xml.hpp index bdba4ed092bfc6a07cbde3205ad39d27350ee0ba..4d14b42af76440c3e12f16e20655e1f9d1d23b55 100644 --- a/ThirdParty/boost/config/compiler/gcc_xml.hpp +++ b/ThirdParty/boost/config/compiler/gcc_xml.hpp @@ -62,6 +62,7 @@ # define BOOST_NO_CXX11_REF_QUALIFIERS # define BOOST_NO_CXX11_FINAL # define BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/hp_acc.hpp b/ThirdParty/boost/config/compiler/hp_acc.hpp index 49d676fa2b24017ac8dda27a350d251dadd7f8b2..cf5667b5200dcdc009efba30b8bed222f9746e7c 100644 --- a/ThirdParty/boost/config/compiler/hp_acc.hpp +++ b/ThirdParty/boost/config/compiler/hp_acc.hpp @@ -125,6 +125,7 @@ #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION /* See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and diff --git a/ThirdParty/boost/config/compiler/intel.hpp b/ThirdParty/boost/config/compiler/intel.hpp index f56807dbbcb58b887fa55cc3b1947a758d3f58f9..2247bc713cd8285cf966a24f00d5cecdc91adfa6 100644 --- a/ThirdParty/boost/config/compiler/intel.hpp +++ b/ThirdParty/boost/config/compiler/intel.hpp @@ -505,6 +505,11 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; # undef BOOST_NO_CXX11_FINAL #endif +// BOOST_NO_CXX11_UNRESTRICTED_UNION +#if (BOOST_INTEL_CXX_VERSION >= 1400) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 50100)) && (!defined(_MSC_VER)) +# undef BOOST_NO_CXX11_UNRESTRICTED_UNION +#endif + #endif // defined(BOOST_INTEL_STDCXX0X) // diff --git a/ThirdParty/boost/config/compiler/metrowerks.hpp b/ThirdParty/boost/config/compiler/metrowerks.hpp index 0e18e1809e7d540961499bcec69d86bbc83e3c33..2e6cf70b60fdc3cb495e8f8b9f8c95a140177b3e 100644 --- a/ThirdParty/boost/config/compiler/metrowerks.hpp +++ b/ThirdParty/boost/config/compiler/metrowerks.hpp @@ -127,6 +127,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/mpw.hpp b/ThirdParty/boost/config/compiler/mpw.hpp index 05c066efbc58b2ccc8a068ddad47de3889a09a00..8d7e8c2808e6ae0ca3151cba0cbef93c0dbbf7c8 100644 --- a/ThirdParty/boost/config/compiler/mpw.hpp +++ b/ThirdParty/boost/config/compiler/mpw.hpp @@ -76,6 +76,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/pathscale.hpp b/ThirdParty/boost/config/compiler/pathscale.hpp index 1318d275ade49fa9e6c3720759081173a5721432..ec6bfd5eee12294ff77d88b515c85adb0eec53cf 100644 --- a/ThirdParty/boost/config/compiler/pathscale.hpp +++ b/ThirdParty/boost/config/compiler/pathscale.hpp @@ -89,6 +89,7 @@ # define BOOST_NO_CXX11_REF_QUALIFIERS # define BOOST_NO_CXX11_FINAL # define BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/sunpro_cc.hpp b/ThirdParty/boost/config/compiler/sunpro_cc.hpp index 41b7bcade6edd26b9f5b6373ecc64dd867ddc6dd..7d838fc99edd04c94585eb05169cabacb824c677 100644 --- a/ThirdParty/boost/config/compiler/sunpro_cc.hpp +++ b/ThirdParty/boost/config/compiler/sunpro_cc.hpp @@ -123,6 +123,7 @@ #define BOOST_NO_CXX11_TRAILING_RESULT_TYPES #define BOOST_NO_CXX11_INLINE_NAMESPACES #define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION #endif #if (__SUNPRO_CC < 0x5140) || (__cplusplus < 201103) diff --git a/ThirdParty/boost/config/compiler/vacpp.hpp b/ThirdParty/boost/config/compiler/vacpp.hpp index 8e26449968129bc84dc283cb344098fea405b941..2c4e2c9609b5d9b5b3174ec54b03926ee7b457f0 100644 --- a/ThirdParty/boost/config/compiler/vacpp.hpp +++ b/ThirdParty/boost/config/compiler/vacpp.hpp @@ -138,6 +138,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_THREAD_LOCAL +#define BOOST_NO_CXX11_UNRESTRICTED_UNION // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/ThirdParty/boost/config/compiler/visualc.hpp b/ThirdParty/boost/config/compiler/visualc.hpp index 29642473cd1e692727139bcbad366b4a85fbac86..4c47b1209b9b68bbb2ba0ee72541ffa0793d08c8 100644 --- a/ThirdParty/boost/config/compiler/visualc.hpp +++ b/ThirdParty/boost/config/compiler/visualc.hpp @@ -43,6 +43,9 @@ # error "Compiler not supported or configured - please reconfigure" #endif +// VS2005 (VC8) docs: __assume has been in Visual C++ for multiple releases +#define BOOST_UNREACHABLE_RETURN(x) __assume(0); + #if _MSC_FULL_VER < 180020827 # define BOOST_NO_FENV_H #endif @@ -108,8 +111,8 @@ // TR1 features: // #if (_MSC_VER >= 1700) && defined(_HAS_CXX17) && (_HAS_CXX17 > 0) -// # define BOOST_HAS_TR1_HASH // don't know if this is true yet. -// # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet. +// # define BOOST_HAS_TR1_HASH // don't know if this is true yet. +// # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet. # define BOOST_HAS_TR1_UNORDERED_MAP # define BOOST_HAS_TR1_UNORDERED_SET #endif @@ -182,6 +185,7 @@ # define BOOST_NO_CXX14_GENERIC_LAMBDAS # define BOOST_NO_CXX14_DIGIT_SEPARATORS # define BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_UNRESTRICTED_UNION #endif // C++11 features supported by VC++ 14 update 3 (aka 2015) // @@ -202,8 +206,9 @@ #if (_MSC_VER < 1911) || (_MSVC_LANG < 201703) # define BOOST_NO_CXX17_STRUCTURED_BINDINGS # define BOOST_NO_CXX17_IF_CONSTEXPR -# define BOOST_NO_CXX17_HDR_OPTIONAL -# define BOOST_NO_CXX17_HDR_STRING_VIEW +// Let the defaults handle these now: +//# define BOOST_NO_CXX17_HDR_OPTIONAL +//# define BOOST_NO_CXX17_HDR_STRING_VIEW #endif // MSVC including version 14 has not yet completely @@ -313,7 +318,7 @@ # endif # else # if _MSC_VER < 1200 - // Note: Versions up to 7.0 aren't supported. + // Note: Versions up to 10.0 aren't supported. # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 @@ -335,6 +340,8 @@ # define BOOST_COMPILER_VERSION 14.0 # elif _MSC_VER < 1920 # define BOOST_COMPILER_VERSION 14.1 +# elif _MSC_VER < 1930 +# define BOOST_COMPILER_VERSION 14.2 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif @@ -346,8 +353,8 @@ #include <boost/config/pragma_message.hpp> // -// last known and checked version is 19.12.25830.2 (VC++ 2017.3): -#if (_MSC_VER > 1912) +// last known and checked version is 19.20.27508 (VC++ 2019 RC3): +#if (_MSC_VER > 1920) # if defined(BOOST_ASSERT_CONFIG) # error "Boost.Config is older than your current compiler version." # elif !defined(BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE) diff --git a/ThirdParty/boost/config/compiler/xlcpp.hpp b/ThirdParty/boost/config/compiler/xlcpp.hpp index ee7aa1253ada495b055bca3ed3dbc5c01b90230e..95f5e1d943e014113e72eaf9cd5aa3c5c96d6b11 100644 --- a/ThirdParty/boost/config/compiler/xlcpp.hpp +++ b/ThirdParty/boost/config/compiler/xlcpp.hpp @@ -196,6 +196,10 @@ # define BOOST_NO_CXX11_FINAL #endif +#if !__has_feature(cxx_unrestricted_unions) +# define BOOST_NO_CXX11_UNRESTRICTED_UNION +#endif + #if !(__has_feature(__cxx_binary_literals__) || __has_extension(__cxx_binary_literals__)) # define BOOST_NO_CXX14_BINARY_LITERALS #endif diff --git a/ThirdParty/boost/config/compiler/xlcpp_zos.hpp b/ThirdParty/boost/config/compiler/xlcpp_zos.hpp index eb1bf2e992301f77f43e53e26144732068a20bf7..b62bd9a7658a5e0bdb09739834f2d31619b15f6e 100644 --- a/ThirdParty/boost/config/compiler/xlcpp_zos.hpp +++ b/ThirdParty/boost/config/compiler/xlcpp_zos.hpp @@ -141,6 +141,7 @@ #define BOOST_NO_CXX11_REF_QUALIFIERS #define BOOST_NO_CXX11_FINAL #define BOOST_NO_CXX11_ALIGNAS +#define BOOST_NO_CXX11_UNRESTRICTED_UNION #define BOOST_NO_CXX14_VARIABLE_TEMPLATES #define BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION #define BOOST_NO_CXX14_AGGREGATE_NSDMI diff --git a/ThirdParty/boost/config/detail/select_stdlib_config.hpp b/ThirdParty/boost/config/detail/select_stdlib_config.hpp index 8db778c86bac0de0260c79e2db6b2060a73dac2b..1a09dda1261d973d0d50aff89e30ea1dccd22214 100644 --- a/ThirdParty/boost/config/detail/select_stdlib_config.hpp +++ b/ThirdParty/boost/config/detail/select_stdlib_config.hpp @@ -11,10 +11,21 @@ // locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: -// First include <cstddef> to determine if some version of STLport is in use as the std lib +// First, check if __has_include is available and <version> include can be located, +// otherwise include <cstddef> to determine if some version of STLport is in use as the std lib // (do not rely on this header being included since users can short-circuit this header // if they know whose std lib they are using.) -#ifdef __cplusplus +#if defined(__cplusplus) && defined(__has_include) +# if __has_include(<version>) +// It should be safe to include `<version>` when it is present without checking +// the actual C++ language version as it consists solely of macro definitions. +// [version.syn] p1: The header <version> supplies implementation-dependent +// information about the C++ standard library (e.g., version number and release date). +# include <version> +# else +# include <cstddef> +# endif +#elif defined(__cplusplus) # include <cstddef> #else # include <stddef.h> diff --git a/ThirdParty/boost/config/detail/suffix.hpp b/ThirdParty/boost/config/detail/suffix.hpp index cee9647b6bf58c93a6778540b73c3a684286913f..d3c4e083c5aed4beb88cc869dfd22ae74a51b461 100644 --- a/ThirdParty/boost/config/detail/suffix.hpp +++ b/ThirdParty/boost/config/detail/suffix.hpp @@ -943,6 +943,14 @@ namespace std{ using ::type_info; } // ------------------ End of deprecated macros for 1.51 --------------------------- +// +// Helper macro for marking types and methods final +// +#if !defined(BOOST_NO_CXX11_FINAL) +# define BOOST_FINAL final +#else +# define BOOST_FINAL +#endif // // Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR @@ -986,12 +994,56 @@ namespace std{ using ::type_info; } #define BOOST_CXX14_CONSTEXPR constexpr #endif +// +// C++17 inline variables +// +#if !defined(BOOST_NO_CXX17_INLINE_VARIABLES) +#define BOOST_INLINE_VARIABLE inline +#else +#define BOOST_INLINE_VARIABLE +#endif +// +// C++17 if constexpr +// +#if !defined(BOOST_NO_CXX17_IF_CONSTEXPR) +# define BOOST_IF_CONSTEXPR if constexpr +#else +# define BOOST_IF_CONSTEXPR if +#endif + +#define BOOST_INLINE_CONSTEXPR BOOST_INLINE_VARIABLE BOOST_CONSTEXPR_OR_CONST + // // Unused variable/typedef workarounds: // #ifndef BOOST_ATTRIBUTE_UNUSED # define BOOST_ATTRIBUTE_UNUSED #endif +// +// [[nodiscard]]: +// +#if defined(__has_attribute) && defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x5130) +#if __has_attribute(nodiscard) +# define BOOST_ATTRIBUTE_NODISCARD [[nodiscard]] +#endif +#if __has_attribute(no_unique_address) +# define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS [[no_unique_address]] +#endif +#elif defined(__has_cpp_attribute) +// clang-6 accepts [[nodiscard]] with -std=c++14, but warns about it -pedantic +#if __has_cpp_attribute(nodiscard) && !(defined(__clang__) && (__cplusplus < 201703L)) +# define BOOST_ATTRIBUTE_NODISCARD [[nodiscard]] +#endif +#if __has_cpp_attribute(no_unique_address) && !(defined(__GNUC__) && (__cplusplus < 201100)) +# define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS [[no_unique_address]] +#endif +#endif +#ifndef BOOST_ATTRIBUTE_NODISCARD +# define BOOST_ATTRIBUTE_NODISCARD +#endif +#ifndef BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS +# define BOOST_ATTRIBUTE_NO_UNIQUE_ADDRESS +#endif #define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST @@ -1024,9 +1076,11 @@ namespace std{ using ::type_info; } #endif // This is a catch all case for obsolete compilers / std libs: -#if !defined(__has_include) +#if !defined(_YVALS) && !defined(_CPPLIB_VER) // msvc std lib already configured +#if (!defined(__has_include) || (__cplusplus < 201700)) # define BOOST_NO_CXX17_HDR_OPTIONAL # define BOOST_NO_CXX17_HDR_STRING_VIEW +# define BOOST_NO_CXX17_HDR_VARIANT #else #if !__has_include(<optional>) # define BOOST_NO_CXX17_HDR_OPTIONAL @@ -1034,6 +1088,10 @@ namespace std{ using ::type_info; } #if !__has_include(<string_view>) # define BOOST_NO_CXX17_HDR_STRING_VIEW #endif +#if !__has_include(<variant>) +# define BOOST_NO_CXX17_HDR_VARIANT +#endif +#endif #endif // diff --git a/ThirdParty/boost/config/platform/vxworks.hpp b/ThirdParty/boost/config/platform/vxworks.hpp index a91e4ab439d82d2f2319898b0f3af7d218c73b20..0564b9443f84ad710271ae0f1c4ab718b7ce1470 100644 --- a/ThirdParty/boost/config/platform/vxworks.hpp +++ b/ThirdParty/boost/config/platform/vxworks.hpp @@ -12,40 +12,17 @@ // like (GCC 2.96) . Do not even think of getting this to work, // a miserable failure will be guaranteed! // -// Equally, this file has been tested for RTPs (Real Time Processes) -// only, not for DKMs (Downloadable Kernel Modules). These two types -// of executables differ largely in the available functionality of -// the C-library, STL, and so on. A DKM uses a C89 library with no -// wide character support and no guarantee of ANSI C. The same Dinkum +// VxWorks supports C++ linkage in the kernel with +// DKMs (Downloadable Kernel Modules). But, until recently +// the kernel used a C89 library with no +// wide character support and no guarantee of ANSI C. +// Regardless of the C library the same Dinkum // STL library is used in both contexts. // // Similarly the Dinkum abridged STL that supports the loosely specified // embedded C++ standard has not been tested and is unlikely to work // on anything but the simplest library. // ==================================================================== -// -// Additional Configuration -// ------------------------------------------------------------------- -// -// Because of the ordering of include files and other issues the following -// additional definitions worked better outside this file. -// -// When building the log library add the following to the b2 invocation -// define=BOOST_LOG_WITHOUT_IPC -// and -// -DBOOST_LOG_WITHOUT_DEFAULT_FACTORIES -// to your compile options. -// -// When building the test library add -// -DBOOST_TEST_LIMITED_SIGNAL_DETAILS -// to your compile options -// -// When building containers library add -// -DHAVE_MORECORE=0 -// to your c compile options so dlmalloc heap library is compiled -// without brk() calls -// -// ==================================================================== // // Some important information regarding the usage of POSIX semaphores: // ------------------------------------------------------------------- @@ -112,30 +89,20 @@ // -------------------------------- #define BOOST_PLATFORM "vxWorks" -// Special behaviour for DKMs: -#ifdef _WRS_KERNEL - // DKMs do not have the <cwchar>-header, - // but apparently they do have an intrinsic wchar_t meanwhile! -# define BOOST_NO_CWCHAR - - // Lots of wide-functions and -headers are unavailable for DKMs as well: -# define BOOST_NO_CWCTYPE -# define BOOST_NO_SWPRINTF -# define BOOST_NO_STD_WSTRING -# define BOOST_NO_STD_WSTREAMBUF -#endif // Generally available headers: #define BOOST_HAS_UNISTD_H #define BOOST_HAS_STDINT_H #define BOOST_HAS_DIRENT_H -#define BOOST_HAS_SLIST +//#define BOOST_HAS_SLIST // vxWorks does not have installed an iconv-library by default, // so unfortunately no Unicode support from scratch is available! // Thus, instead it is suggested to switch to ICU, as this seems // to be the most complete and portable option... -#define BOOST_LOCALE_WITH_ICU +#ifndef BOOST_LOCALE_WITH_ICU + #define BOOST_LOCALE_WITH_ICU +#endif // Generally available functionality: #define BOOST_HAS_THREADS @@ -170,16 +137,18 @@ # ifndef _POSIX_THREADS # define _POSIX_THREADS 1 # endif +// no sysconf( _SC_PAGESIZE) in kernel +# define BOOST_THREAD_USES_GETPAGESIZE #endif #if (_WRS_VXWORKS_MAJOR < 7) // vxWorks-around: <time.h> #defines CLOCKS_PER_SEC as sysClkRateGet() but // miserably fails to #include the required <sysLib.h> to make // sysClkRateGet() available! So we manually include it here. -#ifdef __RTP__ -# include <time.h> -# include <sysLib.h> -#endif +# ifdef __RTP__ +# include <time.h> +# include <sysLib.h> +# endif // vxWorks-around: In <stdint.h> the macros INT32_C(), UINT32_C(), INT64_C() and // UINT64_C() are defined erroneously, yielding not a signed/ @@ -188,30 +157,47 @@ // when trying to define several constants which do not fit into a // long type! We correct them here by redefining. -#include <cstdint> +# include <cstdint> + +// Special behaviour for DKMs: // Some macro-magic to do the job -#define VX_JOIN(X, Y) VX_DO_JOIN(X, Y) -#define VX_DO_JOIN(X, Y) VX_DO_JOIN2(X, Y) -#define VX_DO_JOIN2(X, Y) X##Y +# define VX_JOIN(X, Y) VX_DO_JOIN(X, Y) +# define VX_DO_JOIN(X, Y) VX_DO_JOIN2(X, Y) +# define VX_DO_JOIN2(X, Y) X##Y // Correctly setup the macros -#undef INT32_C -#undef UINT32_C -#undef INT64_C -#undef UINT64_C -#define INT32_C(x) VX_JOIN(x, L) -#define UINT32_C(x) VX_JOIN(x, UL) -#define INT64_C(x) VX_JOIN(x, LL) -#define UINT64_C(x) VX_JOIN(x, ULL) +# undef INT32_C +# undef UINT32_C +# undef INT64_C +# undef UINT64_C +# define INT32_C(x) VX_JOIN(x, L) +# define UINT32_C(x) VX_JOIN(x, UL) +# define INT64_C(x) VX_JOIN(x, LL) +# define UINT64_C(x) VX_JOIN(x, ULL) // #include Libraries required for the following function adaption -#include <sys/time.h> +# include <sys/time.h> #endif // _WRS_VXWORKS_MAJOR < 7 #include <ioLib.h> #include <tickLib.h> +#if defined(_WRS_KERNEL) && (_CPPLIB_VER < 700) + // recent kernels use Dinkum clib v7.00+ + // with widechar but older kernels + // do not have the <cwchar>-header, + // but apparently they do have an intrinsic wchar_t meanwhile! +# define BOOST_NO_CWCHAR + + // Lots of wide-functions and -headers are unavailable for DKMs as well: +# define BOOST_NO_CWCTYPE +# define BOOST_NO_SWPRINTF +# define BOOST_NO_STD_WSTRING +# define BOOST_NO_STD_WSTREAMBUF +#endif + + // Use C-linkage for the following helper functions #ifdef __cplusplus extern "C" { @@ -253,9 +239,9 @@ inline int truncate(const char *p, off_t l){ } #ifdef __GNUC__ -#define ___unused __attribute__((unused)) +# define ___unused __attribute__((unused)) #else -#define ___unused +# define ___unused #endif // Fake symlink handling by dummy functions: @@ -291,7 +277,7 @@ inline int gettimeofday(struct timeval *tv, void * /*tzv*/) { * to avoid conflict with MPL operator times */ #if (_WRS_VXWORKS_MAJOR < 7) -#ifdef __cplusplus +# ifdef __cplusplus // vxWorks provides neither struct tms nor function times()! // We implement an empty dummy-function, simply setting the user @@ -327,25 +313,25 @@ struct tms{ namespace std { using ::times; } -#endif // __cplusplus +# endif // __cplusplus #endif // _WRS_VXWORKS_MAJOR < 7 #ifdef __cplusplus -extern "C" void bzero (void *, size_t); // FD_ZERO uses bzero() but doesn't include strings.h +extern "C" void bzero (void *, size_t); // FD_ZERO uses bzero() but doesn't include strings.h // Put the selfmade functions into the std-namespace, just in case namespace std { -# ifdef __RTP__ +# ifdef __RTP__ using ::getrlimit; using ::setrlimit; -# endif +# endif using ::truncate; using ::symlink; using ::readlink; -#if (_WRS_VXWORKS_MAJOR < 7) +# if (_WRS_VXWORKS_MAJOR < 7) using ::gettimeofday; -#endif +# endif } #endif // __cplusplus @@ -355,10 +341,12 @@ namespace std { // Include signal.h which might contain a typo to be corrected here #include <signal.h> + #if (_WRS_VXWORKS_MAJOR < 7) -#define getpagesize() sysconf(_SC_PAGESIZE) // getpagesize is deprecated anyway! +# define getpagesize() sysconf(_SC_PAGESIZE) // getpagesize is deprecated anyway! inline int lstat(p, b) { return stat(p, b); } // lstat() == stat(), as vxWorks has no symlinks! #endif + #ifndef S_ISSOCK # define S_ISSOCK(mode) ((mode & S_IFMT) == S_IFSOCK) // Is file a socket? #endif @@ -379,7 +367,7 @@ typedef int locale_t; // locale_t is a POSIX-ex // vxWorks 7 adds C++11 support // however it is optional, and does not match exactly the support determined // by examining the Dinkum STL version and GCC version (or ICC and DCC) -#ifndef _WRS_CONFIG_LANG_LIB_CPLUS_CPLUS_USER_2011 +#if !( defined( _WRS_CONFIG_LANG_LIB_CPLUS_CPLUS_USER_2011) || defined(_WRS_CONFIG_LIBCPLUS_STD)) # define BOOST_NO_CXX11_ADDRESSOF // C11 addressof operator on memory location # define BOOST_NO_CXX11_ALLOCATOR # define BOOST_NO_CXX11_ATOMIC_SMART_PTR @@ -408,9 +396,9 @@ typedef int locale_t; // locale_t is a POSIX-ex # define BOOST_NO_CXX11_HDR_UNORDERED_MAP # define BOOST_NO_CXX11_HDR_UNORDERED_SET #else -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED // workaround link error in spirit -#endif +# ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED // workaround link error in spirit +# endif #endif @@ -418,6 +406,8 @@ typedef int locale_t; // locale_t is a POSIX-ex #undef NONE // restrict is an iostreams class #undef restrict +// affects some typeof tests +#undef V7 // use fake poll() from Unix layer in ASIO to get full functionality // most libraries will use select() but this define allows 'iostream' functionality @@ -430,4 +420,3 @@ typedef int locale_t; // locale_t is a POSIX-ex # define BOOST_ASIO_DISABLE_SERIAL_PORT #endif - diff --git a/ThirdParty/boost/config/stdlib/dinkumware.hpp b/ThirdParty/boost/config/stdlib/dinkumware.hpp index e829f08e5112949cd57d90af5d0d911c3f23809b..109804204704f706fe256c56a4bcfb7730bc6afa 100644 --- a/ThirdParty/boost/config/stdlib/dinkumware.hpp +++ b/ThirdParty/boost/config/stdlib/dinkumware.hpp @@ -86,6 +86,7 @@ # define BOOST_NO_STD_LOCALE #endif +#if BOOST_MSVC < 1800 // Fix for VC++ 8.0 on up ( I do not have a previous version to test ) // or clang-cl. If exceptions are off you must manually include the // <exception> header before including the <typeinfo> header. Admittedly @@ -97,9 +98,10 @@ #endif #include <typeinfo> #if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (defined(__ghs__) && !_HAS_NAMESPACE) ) && !defined(__TI_COMPILER_VERSION__) && !defined(__VISUALDSPVERSION__) \ - && !defined(__VXWORKS__) + && !defined(__VXWORKS__) # define BOOST_NO_STD_TYPEINFO #endif +#endif // C++0x headers implemented in 520 (as shipped by Microsoft) // @@ -136,6 +138,7 @@ # define BOOST_NO_CXX11_HDR_RATIO # define BOOST_NO_CXX11_HDR_THREAD # define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_HDR_EXCEPTION #endif // C++0x headers implemented in 610 (as shipped by Microsoft) @@ -174,6 +177,9 @@ #if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(BOOST_MSVC) || (BOOST_MSVC < 1910) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_ITERATOR_TRAITS +# define BOOST_NO_CXX17_HDR_STRING_VIEW +# define BOOST_NO_CXX17_HDR_OPTIONAL +# define BOOST_NO_CXX17_HDR_VARIANT #endif #if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0) || !defined(_MSVC_STL_UPDATE) || (_MSVC_STL_UPDATE < 201709) # define BOOST_NO_CXX17_STD_INVOKE diff --git a/ThirdParty/boost/config/stdlib/libcomo.hpp b/ThirdParty/boost/config/stdlib/libcomo.hpp index 75ac2bb76a211662f359ba214276e9fdd2f43932..6a8a1619625453b0ef6018b2b06ad70cc32f7053 100644 --- a/ThirdParty/boost/config/stdlib/libcomo.hpp +++ b/ThirdParty/boost/config/stdlib/libcomo.hpp @@ -39,6 +39,7 @@ # define BOOST_NO_CXX11_HDR_CHRONO # define BOOST_NO_CXX11_HDR_CODECVT # define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_EXCEPTION # define BOOST_NO_CXX11_HDR_FORWARD_LIST # define BOOST_NO_CXX11_HDR_FUTURE # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST diff --git a/ThirdParty/boost/config/stdlib/libcpp.hpp b/ThirdParty/boost/config/stdlib/libcpp.hpp index ffe2f2a0f5976b1d025c6754931a14d2ee53801c..e8eea9117c1062280c21173cda3142958ac55d18 100644 --- a/ThirdParty/boost/config/stdlib/libcpp.hpp +++ b/ThirdParty/boost/config/stdlib/libcpp.hpp @@ -41,6 +41,7 @@ # define BOOST_NO_CXX11_HDR_CODECVT # define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_EXCEPTION # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST # define BOOST_NO_CXX11_HDR_MUTEX # define BOOST_NO_CXX11_HDR_RANDOM @@ -91,6 +92,7 @@ # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_HDR_OPTIONAL # define BOOST_NO_CXX17_HDR_STRING_VIEW +# define BOOST_NO_CXX17_HDR_VARIANT #endif #if (_LIBCPP_VERSION > 4000) && (__cplusplus > 201402L) && !defined(_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR) # define BOOST_NO_AUTO_PTR diff --git a/ThirdParty/boost/config/stdlib/libstdcpp3.hpp b/ThirdParty/boost/config/stdlib/libstdcpp3.hpp index 38209ddd4531f3ff8a6a07a16117eaba467c1d64..c4c999602659082f0700cf2f44b7b77cb809febe 100644 --- a/ThirdParty/boost/config/stdlib/libstdcpp3.hpp +++ b/ThirdParty/boost/config/stdlib/libstdcpp3.hpp @@ -125,7 +125,13 @@ // #ifdef __clang__ -#if __has_include(<experimental/memory_resource>) +#if __has_include(<memory_resource>) +# define BOOST_LIBSTDCXX_VERSION 90100 +#elif __has_include(<charconv>) +# define BOOST_LIBSTDCXX_VERSION 80100 +#elif __has_include(<variant>) +# define BOOST_LIBSTDCXX_VERSION 70100 +#elif __has_include(<experimental/memory_resource>) # define BOOST_LIBSTDCXX_VERSION 60100 #elif __has_include(<experimental/any>) # define BOOST_LIBSTDCXX_VERSION 50100 @@ -231,6 +237,7 @@ extern "C" char *gets (char *__s); # define BOOST_NO_CXX11_HDR_RATIO # define BOOST_NO_CXX11_HDR_SYSTEM_ERROR # define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_EXCEPTION #else # define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG # define BOOST_HAS_TR1_COMPLEX_OVERLOADS @@ -301,6 +308,7 @@ extern "C" char *gets (char *__s); # define BOOST_NO_CXX17_STD_APPLY # define BOOST_NO_CXX17_HDR_OPTIONAL # define BOOST_NO_CXX17_HDR_STRING_VIEW +# define BOOST_NO_CXX17_HDR_VARIANT #endif #if defined(__has_include) diff --git a/ThirdParty/boost/config/stdlib/modena.hpp b/ThirdParty/boost/config/stdlib/modena.hpp index 81919e01801038daad803a836183f047a0236c2c..31a26c856a2cf93cc32ee7bc6bbf4acd160ce372 100644 --- a/ThirdParty/boost/config/stdlib/modena.hpp +++ b/ThirdParty/boost/config/stdlib/modena.hpp @@ -51,6 +51,7 @@ # define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX11_HDR_EXCEPTION #if defined(__has_include) #if !__has_include(<shared_mutex>) diff --git a/ThirdParty/boost/config/stdlib/msl.hpp b/ThirdParty/boost/config/stdlib/msl.hpp index 0e2e2afee8b1eb60e518f2c43ae1ca04ce9712d4..f2f825983be0282d2b578c35e2125bb614d58548 100644 --- a/ThirdParty/boost/config/stdlib/msl.hpp +++ b/ThirdParty/boost/config/stdlib/msl.hpp @@ -75,6 +75,7 @@ # define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX11_HDR_EXCEPTION #if defined(__has_include) #if !__has_include(<shared_mutex>) diff --git a/ThirdParty/boost/config/stdlib/roguewave.hpp b/ThirdParty/boost/config/stdlib/roguewave.hpp index df6021551a34f6147cee9650b750f5813133b0bc..0c5c113ea3a71b0656bf1679ca81acd9fca11336 100644 --- a/ThirdParty/boost/config/stdlib/roguewave.hpp +++ b/ThirdParty/boost/config/stdlib/roguewave.hpp @@ -187,6 +187,7 @@ # define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX11_HDR_EXCEPTION #if defined(__has_include) #if !__has_include(<shared_mutex>) diff --git a/ThirdParty/boost/config/stdlib/sgi.hpp b/ThirdParty/boost/config/stdlib/sgi.hpp index 0c8ab2e4c10048e933bfeb4c702c36329377db38..c49957cef8b02a7f7bbbe9cef7c815dd82d35dff 100644 --- a/ThirdParty/boost/config/stdlib/sgi.hpp +++ b/ThirdParty/boost/config/stdlib/sgi.hpp @@ -145,6 +145,7 @@ # define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX11_HDR_EXCEPTION #if defined(__has_include) #if !__has_include(<shared_mutex>) diff --git a/ThirdParty/boost/config/stdlib/stlport.hpp b/ThirdParty/boost/config/stdlib/stlport.hpp index 2e304e2b94542b3586f7ac38fb97fbad4627cb37..094e27bb74459755727237f12f33834c8e78ee1f 100644 --- a/ThirdParty/boost/config/stdlib/stlport.hpp +++ b/ThirdParty/boost/config/stdlib/stlport.hpp @@ -235,6 +235,7 @@ namespace boost { using std::min; using std::max; } # define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX11_HDR_EXCEPTION #if defined(__has_include) #if !__has_include(<shared_mutex>) diff --git a/ThirdParty/boost/config/stdlib/vacpp.hpp b/ThirdParty/boost/config/stdlib/vacpp.hpp index c4e1fb1847e3e66511575c5a3264a6ac79619e84..b14dd65576ea312f7b08231bffb20a07cf707c74 100644 --- a/ThirdParty/boost/config/stdlib/vacpp.hpp +++ b/ThirdParty/boost/config/stdlib/vacpp.hpp @@ -51,6 +51,7 @@ # define BOOST_NO_CXX11_HDR_ATOMIC # define BOOST_NO_CXX11_STD_ALIGN # define BOOST_NO_CXX11_ADDRESSOF +# define BOOST_NO_CXX11_HDR_EXCEPTION #if defined(__has_include) #if !__has_include(<shared_mutex>) diff --git a/ThirdParty/boost/config/stdlib/xlcpp_zos.hpp b/ThirdParty/boost/config/stdlib/xlcpp_zos.hpp index 4d5beb185523648d7a73c38e76ec065afc98e89b..a5e02fd8b83be8a89b1993d919629d5bcda3252c 100644 --- a/ThirdParty/boost/config/stdlib/xlcpp_zos.hpp +++ b/ThirdParty/boost/config/stdlib/xlcpp_zos.hpp @@ -50,6 +50,7 @@ #define BOOST_NO_CXX11_HDR_CHRONO #define BOOST_NO_CXX11_HDR_ATOMIC #define BOOST_NO_CXX11_HDR_ARRAY +#define BOOST_NO_CXX11_HDR_EXCEPTION #define BOOST_NO_CXX11_STD_ALIGN #define BOOST_NO_CXX14_STD_EXCHANGE diff --git a/ThirdParty/boost/config/user.hpp b/ThirdParty/boost/config/user.hpp index 28e7476afd372dcad2854dcff2b5aabf2715a873..8160fcae25c777ad86c5e6df90236f0376e29bff 100644 --- a/ThirdParty/boost/config/user.hpp +++ b/ThirdParty/boost/config/user.hpp @@ -1,8 +1,8 @@ // boost/config/user.hpp ---------------------------------------------------// // (C) Copyright John Maddock 2001. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// Use, modification and distribution are subject to the +// Boost Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // Do not check in modified versions of this file, diff --git a/ThirdParty/boost/container/allocator_traits.hpp b/ThirdParty/boost/container/allocator_traits.hpp index 8cfb0378bc8d2fe23ad2119cffcaf1579c90449d..72d90d1b435bac1338c8b9a149be1212ff828bd5 100644 --- a/ThirdParty/boost/container/allocator_traits.hpp +++ b/ThirdParty/boost/container/allocator_traits.hpp @@ -77,7 +77,7 @@ namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -template<class T, class VoidAllocator> +template<class T, class VoidAllocator, class Options> class small_vector_allocator; namespace allocator_traits_detail { @@ -99,8 +99,8 @@ template<class T> struct is_std_allocator< std::allocator<T> > { static const bool value = true; }; -template<class T> -struct is_std_allocator< small_vector_allocator<T, std::allocator<T> > > +template<class T, class Options> +struct is_std_allocator< small_vector_allocator<T, std::allocator<T>, Options > > { static const bool value = true; }; template<class Allocator> diff --git a/ThirdParty/boost/container/container_fwd.hpp b/ThirdParty/boost/container/container_fwd.hpp index b7591cd25632d5d478c1f659bb7ebc6fa3ea1f51..2cfb20a540eae634758bfab1bd7f4a1fec2cf797 100644 --- a/ThirdParty/boost/container/container_fwd.hpp +++ b/ThirdParty/boost/container/container_fwd.hpp @@ -24,6 +24,7 @@ //! - boost::container::vector //! - boost::container::stable_vector //! - boost::container::static_vector +//! - boost::container::small_vector_base //! - boost::container::small_vector //! - boost::container::slist //! - boost::container::list @@ -105,15 +106,25 @@ template <class T ,class Allocator = void > class stable_vector; -template <class T, std::size_t Capacity> +template < class T + , std::size_t Capacity + , class Options = void> class static_vector; -template < class T, std::size_t N - , class Allocator = void > +template < class T + , class Allocator = void + , class Options = void > +class small_vector_base; + +template < class T + , std::size_t N + , class Allocator = void + , class Options = void > class small_vector; template <class T - ,class Allocator = void > + ,class Allocator = void + ,class Options = void> class deque; template <class T diff --git a/ThirdParty/boost/container/detail/mpl.hpp b/ThirdParty/boost/container/detail/mpl.hpp index 4706c58022b1bd6bea3877d03ccb0a0651c40d4a..ffae180c859a001637384d6af15543c0e0b22987 100644 --- a/ThirdParty/boost/container/detail/mpl.hpp +++ b/ThirdParty/boost/container/detail/mpl.hpp @@ -69,11 +69,11 @@ struct select1st typedef FirstType type; template<class T> - const type& operator()(const T& x) const + BOOST_CONTAINER_FORCEINLINE const type& operator()(const T& x) const { return x.first; } template<class T> - type& operator()(T& x) + BOOST_CONTAINER_FORCEINLINE type& operator()(T& x) { return const_cast<type&>(x.first); } }; diff --git a/ThirdParty/boost/container/detail/version_type.hpp b/ThirdParty/boost/container/detail/version_type.hpp index 58e9da6aae528f74274c5b75a6bc532c8745707d..389606a56706aff7b7de633502cd226ee1e8b7c3 100644 --- a/ThirdParty/boost/container/detail/version_type.hpp +++ b/ThirdParty/boost/container/detail/version_type.hpp @@ -45,8 +45,9 @@ namespace impl{ template <class T> struct extract_version - : T::version -{}; +{ + typedef typename T::version type; +}; template <class T> struct has_version @@ -69,7 +70,7 @@ struct version template <class T> struct version<T, true> { - static const unsigned value = extract_version<T>::value; + static const unsigned value = extract_version<T>::type::value; }; } //namespace impl diff --git a/ThirdParty/boost/container/new_allocator.hpp b/ThirdParty/boost/container/new_allocator.hpp index 51065efa73a3085c99c864c6ed1e980d43e28247..4801f708262dc4b0ca347a7df0e28b58f2cd549d 100644 --- a/ThirdParty/boost/container/new_allocator.hpp +++ b/ThirdParty/boost/container/new_allocator.hpp @@ -72,6 +72,13 @@ class new_allocator<void> new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW {} + //!Copy assignment operator from other new_allocator. + //!Never throws + new_allocator& operator=(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + { + return *this; + } + //!Constructor from related new_allocator. //!Never throws template<class T2> @@ -130,6 +137,13 @@ class new_allocator new_allocator(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW {} + //!Copy assignment operator from other new_allocator. + //!Never throws + new_allocator& operator=(const new_allocator &) BOOST_NOEXCEPT_OR_NOTHROW + { + return *this; + } + //!Constructor from related new_allocator. //!Never throws template<class T2> @@ -140,7 +154,8 @@ class new_allocator //!Throws std::bad_alloc if there is no enough memory pointer allocate(size_type count) { - if(BOOST_UNLIKELY(count > this->max_size())) + const std::size_t max_count = std::size_t(-1)/(2*sizeof(T)); + if(BOOST_UNLIKELY(count > max_count)) throw_bad_alloc(); return static_cast<T*>(::operator new(count*sizeof(T))); } @@ -153,7 +168,7 @@ class new_allocator //!Returns the maximum number of elements that could be allocated. //!Never throws size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return size_type(-1)/sizeof(T); } + { return std::size_t(-1)/(2*sizeof(T)); } //!Swaps two allocators, does nothing //!because this new_allocator is stateless diff --git a/ThirdParty/boost/container/slist.hpp b/ThirdParty/boost/container/slist.hpp index a37851decd1d12906c8312b6f60d8e17c398df57..d10cf5748f2781724d8ff6a9631abbd5b91be12a 100644 --- a/ThirdParty/boost/container/slist.hpp +++ b/ThirdParty/boost/container/slist.hpp @@ -81,7 +81,7 @@ struct slist_node typedef T internal_type; typedef typename slist_hook<VoidPointer>::type hook_type; - typedef typename aligned_storage<sizeof(T), alignment_of<T>::value>::type storage_t; + typedef typename dtl::aligned_storage<sizeof(T), dtl::alignment_of<T>::value>::type storage_t; storage_t m_storage; #if defined(BOOST_GCC) && (BOOST_GCC >= 40600) && (BOOST_GCC < 80000) @@ -395,7 +395,7 @@ class slist //! <b>Complexity</b>: Linear to the number of elements in x. slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x) { - if (&x != this){ + if (BOOST_LIKELY(this != &x)) { NodeAlloc &this_alloc = this->node_alloc(); const NodeAlloc &x_alloc = x.node_alloc(); dtl::bool_<allocator_traits_type:: @@ -424,26 +424,27 @@ class slist BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) { - BOOST_ASSERT(this != &x); - NodeAlloc &this_alloc = this->node_alloc(); - NodeAlloc &x_alloc = x.node_alloc(); - const bool propagate_alloc = allocator_traits_type:: - propagate_on_container_move_assignment::value; - const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(propagate_alloc || allocators_equal){ - //Destroy - this->clear(); - //Move allocator if needed - this->AllocHolder::move_assign_alloc(x); - //Obtain resources - this->icont() = boost::move(x.icont()); - } - //Else do a one by one move - else{ - this->assign( boost::make_move_iterator(x.begin()) - , boost::make_move_iterator(x.end())); + if (BOOST_LIKELY(this != &x)) { + NodeAlloc &this_alloc = this->node_alloc(); + NodeAlloc &x_alloc = x.node_alloc(); + const bool propagate_alloc = allocator_traits_type:: + propagate_on_container_move_assignment::value; + const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; + //Resources can be transferred if both allocators are + //going to be equal after this function (either propagated or already equal) + if(propagate_alloc || allocators_equal){ + //Destroy + this->clear(); + //Move allocator if needed + this->AllocHolder::move_assign_alloc(x); + //Obtain resources + this->icont() = boost::move(x.icont()); + } + //Else do a one by one move + else{ + this->assign( boost::make_move_iterator(x.begin()) + , boost::make_move_iterator(x.end())); + } } return *this; } @@ -1695,8 +1696,9 @@ namespace boost { template <class T, class Allocator> struct has_trivial_destructor_after_move<boost::container::slist<T, Allocator> > { - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && + typedef typename boost::container::slist<T, Allocator>::allocator_type allocator_type; + typedef typename ::boost::container::allocator_traits<allocator_type>::pointer pointer; + static const bool value = ::boost::has_trivial_destructor_after_move<allocator_type>::value && ::boost::has_trivial_destructor_after_move<pointer>::value; }; diff --git a/ThirdParty/boost/container_hash/extensions.hpp b/ThirdParty/boost/container_hash/extensions.hpp index 4eebb4bc93c9e535967a97eac2a34f25cc6483de..393b7020ef7ec8ea78a8fb1f64b6eba85e538779 100644 --- a/ThirdParty/boost/container_hash/extensions.hpp +++ b/ThirdParty/boost/container_hash/extensions.hpp @@ -22,7 +22,6 @@ #include <boost/detail/container_fwd.hpp> #include <boost/core/enable_if.hpp> #include <boost/static_assert.hpp> -#include <vector> #if !defined(BOOST_NO_CXX11_HDR_ARRAY) # include <array> @@ -71,56 +70,6 @@ namespace boost return seed; } - inline std::size_t hash_range( - std::vector<bool>::iterator first, - std::vector<bool>::iterator last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - - return seed; - } - - inline std::size_t hash_range( - std::vector<bool>::const_iterator first, - std::vector<bool>::const_iterator last) - { - std::size_t seed = 0; - - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - - return seed; - } - - inline void hash_range( - std::size_t& seed, - std::vector<bool>::iterator first, - std::vector<bool>::iterator last) - { - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - } - - inline void hash_range( - std::size_t& seed, - std::vector<bool>::const_iterator first, - std::vector<bool>::const_iterator last) - { - for(; first != last; ++first) - { - hash_combine<bool>(seed, *first); - } - } - template <class T, class A> std::size_t hash_value(std::vector<T, A> const& v) { diff --git a/ThirdParty/boost/container_hash/hash.hpp b/ThirdParty/boost/container_hash/hash.hpp index 76de7939eb077dfd2c776491740c838e91502b9f..7aac2fab67eaacab9987840c0e2f630d6659e1bb 100644 --- a/ThirdParty/boost/container_hash/hash.hpp +++ b/ThirdParty/boost/container_hash/hash.hpp @@ -18,6 +18,7 @@ #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> @@ -118,7 +119,7 @@ namespace boost { namespace hash_detail { -#if defined(_HAS_AUTO_PTR_ETC) && !_HAS_AUTO_PTR_ETC +#if defined(BOOST_NO_CXX98_FUNCTION_BASE) template <typename T> struct hash_base { @@ -426,7 +427,7 @@ namespace boost for(; first != last; ++first) { - hash_combine(seed, *first); + hash_combine<typename std::iterator_traits<It>::value_type>(seed, *first); } return seed; @@ -437,7 +438,7 @@ namespace boost { for(; first != last; ++first) { - hash_combine(seed, *first); + hash_combine<typename std::iterator_traits<It>::value_type>(seed, *first); } } diff --git a/ThirdParty/boost/core/alloc_construct.hpp b/ThirdParty/boost/core/alloc_construct.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7b87525449c3af2e7d1f119e3759f2cf5c8050cd --- /dev/null +++ b/ThirdParty/boost/core/alloc_construct.hpp @@ -0,0 +1,245 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_ALLOC_CONSTRUCT_HPP +#define BOOST_CORE_ALLOC_CONSTRUCT_HPP + +#include <boost/core/noinit_adaptor.hpp> + +namespace boost { + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A, class T> +inline void +alloc_destroy(A& a, T* p) +{ + std::allocator_traits<A>::destroy(a, p); +} + +template<class A, class T> +inline void +alloc_destroy_n(A& a, T* p, std::size_t n) +{ + while (n > 0) { + std::allocator_traits<A>::destroy(a, p + --n); + } +} +#else +template<class A, class T> +inline void +alloc_destroy(A&, T* p) +{ + p->~T(); +} + +template<class A, class T> +inline void +alloc_destroy_n(A&, T* p, std::size_t n) +{ + while (n > 0) { + p[--n].~T(); + } +} +#endif + +namespace detail { + +template<class A, class T> +class alloc_destroyer { +public: + alloc_destroyer(A& a, T* p) BOOST_NOEXCEPT + : a_(a), + p_(p), + n_(0) { } + + ~alloc_destroyer() { + boost::alloc_destroy_n(a_, p_, n_); + } + + std::size_t& size() BOOST_NOEXCEPT { + return n_; + } + +private: + alloc_destroyer(const alloc_destroyer&); + alloc_destroyer& operator=(const alloc_destroyer&); + + A& a_; + T* p_; + std::size_t n_; +}; + +} /* detail */ + +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +template<class A, class T> +inline void +alloc_construct(A& a, T* p) +{ + std::allocator_traits<A>::construct(a, p); +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template<class A, class T, class U, class... V> +inline void +alloc_construct(A& a, T* p, U&& u, V&&... v) +{ + std::allocator_traits<A>::construct(a, p, std::forward<U>(u), + std::forward<V>(v)...); +} +#else +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, U&& u) +{ + std::allocator_traits<A>::construct(a, p, std::forward<U>(u)); +} +#endif +#else +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, const U& u) +{ + std::allocator_traits<A>::construct(a, p, u); +} + +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, U& u) +{ + std::allocator_traits<A>::construct(a, p, u); +} +#endif + +template<class A, class T> +inline void +alloc_construct_n(A& a, T* p, std::size_t n) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + std::allocator_traits<A>::construct(a, p + i); + } + hold.size() = 0; +} + +template<class A, class T> +inline void +alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + std::allocator_traits<A>::construct(a, p + i, l[i % m]); + } + hold.size() = 0; +} + +template<class A, class T, class I> +inline void +alloc_construct_n(A& a, T* p, std::size_t n, I b) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; void(++i), void(++b)) { + std::allocator_traits<A>::construct(a, p + i, *b); + } + hold.size() = 0; +} +#else +template<class A, class T> +inline void +alloc_construct(A&, T* p) +{ + ::new(static_cast<void*>(p)) T(); +} + +template<class A, class T> +inline void +alloc_construct(noinit_adaptor<A>&, T* p) +{ + ::new(static_cast<void*>(p)) T; +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template<class A, class T, class U, class... V> +inline void +alloc_construct(A&, T* p, U&& u, V&&... v) +{ + ::new(static_cast<void*>(p)) T(std::forward<U>(u), std::forward<V>(v)...); +} +#else +template<class A, class T, class U> +inline void +alloc_construct(A& a, T* p, U&& u) +{ + ::new(static_cast<void*>(p)) T(std::forward<U>(u)); +} +#endif +#else +template<class A, class T, class U> +inline void +alloc_construct(A&, T* p, const U& u) +{ + ::new(static_cast<void*>(p)) T(u); +} + +template<class A, class T, class U> +inline void +alloc_construct(A&, T* p, U& u) +{ + ::new(static_cast<void*>(p)) T(u); +} +#endif + +template<class A, class T> +inline void +alloc_construct_n(A& a, T* p, std::size_t n) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + ::new(static_cast<void*>(p + i)) T(); + } + hold.size() = 0; +} + +template<class A, class T> +inline void +alloc_construct_n(noinit_adaptor<A>& a, T* p, std::size_t n) +{ + detail::alloc_destroyer<noinit_adaptor<A>, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + ::new(static_cast<void*>(p + i)) T; + } + hold.size() = 0; +} + +template<class A, class T> +inline void +alloc_construct_n(A& a, T* p, std::size_t n, const T* l, std::size_t m) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; ++i) { + ::new(static_cast<void*>(p + i)) T(l[i % m]); + } + hold.size() = 0; +} + +template<class A, class T, class I> +inline void +alloc_construct_n(A& a, T* p, std::size_t n, I b) +{ + detail::alloc_destroyer<A, T> hold(a, p); + for (std::size_t& i = hold.size(); i < n; void(++i), void(++b)) { + ::new(static_cast<void*>(p + i)) T(*b); + } + hold.size() = 0; +} +#endif + +} /* boost */ + +#endif diff --git a/ThirdParty/boost/core/default_allocator.hpp b/ThirdParty/boost/core/default_allocator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9fc3ea2604a5084e0a19105ae65c4171c2c97c5d --- /dev/null +++ b/ThirdParty/boost/core/default_allocator.hpp @@ -0,0 +1,158 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_DEFAULT_ALLOCATOR_HPP +#define BOOST_CORE_DEFAULT_ALLOCATOR_HPP + +#include <boost/config.hpp> +#include <new> +#include <climits> + +#if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 60000 +#define BOOST_CORE_NO_CXX11_ALLOCATOR +#endif + +namespace boost { + +#if defined(BOOST_NO_EXCEPTIONS) +BOOST_NORETURN void throw_exception(const std::exception&); +#endif + +namespace default_ { + +struct true_type { + typedef bool value_type; + typedef true_type type; + + BOOST_STATIC_CONSTANT(bool, value = true); + + BOOST_CONSTEXPR operator bool() const BOOST_NOEXCEPT { + return true; + } + + BOOST_CONSTEXPR bool operator()() const BOOST_NOEXCEPT { + return true; + } +}; + +template<class T> +struct add_reference { + typedef T& type; +}; + +template<> +struct add_reference<void> { + typedef void type; +}; + +template<> +struct add_reference<const void> { + typedef const void type; +}; + +template<class T> +struct default_allocator { + typedef T value_type; + typedef T* pointer; + typedef const T* const_pointer; + typedef typename add_reference<T>::type reference; + typedef typename add_reference<const T>::type const_reference; + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + typedef true_type propagate_on_container_move_assignment; + typedef true_type is_always_equal; + + template<class U> + struct rebind { + typedef default_allocator<U> other; + }; + +#if !defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) + default_allocator() = default; +#else + BOOST_CONSTEXPR default_allocator() BOOST_NOEXCEPT { } +#endif + + template<class U> + BOOST_CONSTEXPR default_allocator(const default_allocator<U>&) + BOOST_NOEXCEPT { } + +#if defined(PTRDIFF_MAX) && defined(SIZE_MAX) + BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { + return PTRDIFF_MAX < SIZE_MAX / sizeof(T) + ? PTRDIFF_MAX : SIZE_MAX / sizeof(T); + } +#else + BOOST_CONSTEXPR std::size_t max_size() const BOOST_NOEXCEPT { + return ~static_cast<std::size_t>(0) / sizeof(T); + } +#endif + +#if !defined(BOOST_NO_EXCEPTIONS) + T* allocate(std::size_t n) { + if (n > max_size()) { + throw std::bad_alloc(); + } + return static_cast<T*>(::operator new(sizeof(T) * n)); + } + + void deallocate(T* p, std::size_t) { + ::operator delete(p); + } +#else + T* allocate(std::size_t n) { + if (n > max_size()) { + boost::throw_exception(std::bad_alloc()); + } + void* p = ::operator new(sizeof(T) * n, std::nothrow); + if (!p) { + boost::throw_exception(std::bad_alloc()); + } + return static_cast<T*>(p); + } + + void deallocate(T* p, std::size_t) { + ::operator delete(p, std::nothrow); + } +#endif + +#if defined(BOOST_NO_CXX11_ALLOCATOR) || defined(BOOST_CORE_NO_CXX11_ALLOCATOR) + template<class U, class V> + void construct(U* p, const V& v) { + ::new(p) U(v); + } + + template<class U> + void destroy(U* p) { + p->~U(); + } +#endif +}; + +template<class T, class U> +BOOST_CONSTEXPR inline bool +operator==(const default_allocator<T>&, + const default_allocator<U>&) BOOST_NOEXCEPT +{ + return true; +} + +template<class T, class U> +BOOST_CONSTEXPR inline bool +operator!=(const default_allocator<T>&, + const default_allocator<U>&) BOOST_NOEXCEPT +{ + return false; +} + +} /* default_ */ + +using default_::default_allocator; + +} /* boost */ + +#endif diff --git a/ThirdParty/boost/core/empty_value.hpp b/ThirdParty/boost/core/empty_value.hpp index 9265f05d3a749f181c53656abb85f8a8b64b1b95..289b05bca655652ca4312fd1d54c7e4a300451cd 100644 --- a/ThirdParty/boost/core/empty_value.hpp +++ b/ThirdParty/boost/core/empty_value.hpp @@ -71,6 +71,10 @@ public: template<class U> empty_value(boost::empty_init_t, const U& value) : value_(value) { } + + template<class U> + empty_value(boost::empty_init_t, U& value) + : value_(value) { } #endif const T& get() const BOOST_NOEXCEPT { @@ -115,6 +119,10 @@ public: template<class U> empty_value(boost::empty_init_t, const U& value) : T(value) { } + + template<class U> + empty_value(boost::empty_init_t, U& value) + : T(value) { } #endif const T& get() const BOOST_NOEXCEPT { @@ -131,6 +139,8 @@ public: using empty_::empty_value; +BOOST_INLINE_CONSTEXPR empty_init_t empty_init = empty_init_t(); + } /* boost */ #endif diff --git a/ThirdParty/boost/core/first_scalar.hpp b/ThirdParty/boost/core/first_scalar.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5373542e028d933aed699c3c37f3978b47613308 --- /dev/null +++ b/ThirdParty/boost/core/first_scalar.hpp @@ -0,0 +1,45 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_FIRST_SCALAR_HPP +#define BOOST_CORE_FIRST_SCALAR_HPP + +#include <boost/config.hpp> +#include <cstddef> + +namespace boost { +namespace detail { + +template<class T> +struct make_scalar { + typedef T type; +}; + +template<class T, std::size_t N> +struct make_scalar<T[N]> { + typedef typename make_scalar<T>::type type; +}; + +} /* detail */ + +template<class T> +BOOST_CONSTEXPR inline T* +first_scalar(T* p) BOOST_NOEXCEPT +{ + return p; +} + +template<class T, std::size_t N> +BOOST_CONSTEXPR inline typename detail::make_scalar<T>::type* +first_scalar(T (*p)[N]) BOOST_NOEXCEPT +{ + return boost::first_scalar(&(*p)[0]); +} + +} /* boost */ + +#endif diff --git a/ThirdParty/boost/core/lightweight_test.hpp b/ThirdParty/boost/core/lightweight_test.hpp index 45736cb733d0279b1c26128fd4dcc66f9d368e34..49ff6267ed25aacc49bab1fe1e508b0d3dd94574 100644 --- a/ThirdParty/boost/core/lightweight_test.hpp +++ b/ThirdParty/boost/core/lightweight_test.hpp @@ -22,14 +22,18 @@ // http://www.boost.org/LICENSE_1_0.txt // -#include <boost/core/no_exceptions_support.hpp> #include <boost/current_function.hpp> +#include <boost/config.hpp> #include <iostream> #include <iterator> #include <cstdlib> #include <cstring> #include <cstddef> +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) +# include <crtdbg.h> +#endif + // IDE's like Visual Studio perform better if output goes to std::cout or // some other stream, so allow user to configure output stream: #ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM @@ -48,7 +52,13 @@ public: : report_(false) , errors_(0) { #if defined(_MSC_VER) && (_MSC_VER > 1310) + // disable message boxes on assert(), abort() ::_set_abort_behavior(0, _WRITE_ABORT_MSG | _CALL_REPORTFAULT); +#endif +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && defined(_DEBUG) + // disable message boxes on iterator debugging violations + _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); + _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDERR ); #endif } @@ -83,12 +93,21 @@ inline int& test_errors() return test_results().errors(); } -inline void test_failed_impl(char const * expr, char const * file, int line, char const * function) +inline bool test_impl(char const * expr, char const * file, int line, char const * function, bool v) { - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << file << "(" << line << "): test '" << expr << "' failed in function '" - << function << "'" << std::endl; - ++test_results().errors(); + if( v ) + { + test_results(); + return true; + } + else + { + BOOST_LIGHTWEIGHT_TEST_OSTREAM + << file << "(" << line << "): test '" << expr << "' failed in function '" + << function << "'" << std::endl; + ++test_results().errors(); + return false; + } } inline void error_impl(char const * msg, char const * file, int line, char const * function) @@ -110,14 +129,14 @@ inline void throw_failed_impl(char const * excep, char const * file, int line, c // In the comparisons below, it is possible that T and U are signed and unsigned integer types, which generates warnings in some compilers. // A cleaner fix would require common_type trait or some meta-programming, which would introduce a dependency on Boost.TypeTraits. To avoid // the dependency we just disable the warnings. -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable: 4389) -#elif defined(__clang__) && defined(__has_warning) +#if defined(__clang__) && defined(__has_warning) # if __has_warning("-Wsign-compare") # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wsign-compare" # endif +#elif defined(_MSC_VER) +# pragma warning(push) +# pragma warning(disable: 4389) #elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wsign-compare" @@ -174,13 +193,14 @@ struct lw_test_ge { }; template<class BinaryPredicate, class T, class U> -inline void test_with_impl(BinaryPredicate pred, char const * expr1, char const * expr2, +inline bool test_with_impl(BinaryPredicate pred, char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u) { if( pred(t, u) ) { test_results(); + return true; } else { @@ -189,15 +209,17 @@ inline void test_with_impl(BinaryPredicate pred, char const * expr1, char const << "' ('" << test_output_impl(t) << "' " << pred.op() << " '" << test_output_impl(u) << "') failed in function '" << function << "'" << std::endl; ++test_results().errors(); + return false; } } -inline void test_cstr_eq_impl( char const * expr1, char const * expr2, +inline bool test_cstr_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, char const * const t, char const * const u ) { if( std::strcmp(t, u) == 0 ) { test_results(); + return true; } else { @@ -205,15 +227,17 @@ inline void test_cstr_eq_impl( char const * expr1, char const * expr2, << file << "(" << line << "): test '" << expr1 << " == " << expr2 << "' ('" << t << "' == '" << u << "') failed in function '" << function << "'" << std::endl; ++test_results().errors(); + return false; } } -inline void test_cstr_ne_impl( char const * expr1, char const * expr2, +inline bool test_cstr_ne_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, char const * const t, char const * const u ) { if( std::strcmp(t, u) != 0 ) { test_results(); + return true; } else { @@ -221,11 +245,12 @@ inline void test_cstr_ne_impl( char const * expr1, char const * expr2, << file << "(" << line << "): test '" << expr1 << " != " << expr2 << "' ('" << t << "' != '" << u << "') failed in function '" << function << "'" << std::endl; ++test_results().errors(); + return false; } } template<class FormattedOutputFunction, class InputIterator1, class InputIterator2> -void test_all_eq_impl(FormattedOutputFunction& output, +bool test_all_eq_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, InputIterator1 first_begin, InputIterator1 first_end, InputIterator2 second_begin, InputIterator2 second_end) @@ -284,16 +309,18 @@ void test_all_eq_impl(FormattedOutputFunction& output, if (error_count == 0) { test_results(); + return true; } else { output << std::endl; ++test_results().errors(); + return false; } } template<class FormattedOutputFunction, class InputIterator1, class InputIterator2, typename BinaryPredicate> -void test_all_with_impl(FormattedOutputFunction& output, +bool test_all_with_impl(FormattedOutputFunction& output, char const * file, int line, char const * function, InputIterator1 first_begin, InputIterator1 first_end, InputIterator2 second_begin, InputIterator2 second_end, @@ -353,20 +380,22 @@ void test_all_with_impl(FormattedOutputFunction& output, if (error_count == 0) { test_results(); + return true; } else { output << std::endl; ++test_results().errors(); + return false; } } -#if defined(_MSC_VER) -# pragma warning(pop) -#elif defined(__clang__) && defined(__has_warning) +#if defined(__clang__) && defined(__has_warning) # if __has_warning("-Wsign-compare") # pragma clang diagnostic pop # endif +#elif defined(_MSC_VER) +# pragma warning(pop) #elif defined(__GNUC__) && !(defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC)) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406 # pragma GCC diagnostic pop #endif @@ -379,23 +408,25 @@ inline int report_errors() result.done(); int errors = result.errors(); + if( errors == 0 ) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "No errors detected." << std::endl; - return 0; } else { BOOST_LIGHTWEIGHT_TEST_OSTREAM << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl; - return 1; } + + // `return report_errors();` from main only supports 8 bit exit codes + return errors < 256? errors: 255; } } // namespace boost -#define BOOST_TEST(expr) ((expr)? (void)::boost::detail::test_results(): ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)) +#define BOOST_TEST(expr) ( ::boost::detail::test_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, (expr)? true: false) ) #define BOOST_TEST_NOT(expr) BOOST_TEST(!(expr)) #define BOOST_ERROR(msg) ( ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) ) diff --git a/ThirdParty/boost/core/lightweight_test_trait.hpp b/ThirdParty/boost/core/lightweight_test_trait.hpp index 73770f4e1566e8d7d061dcff298546d031ac69a0..26042c619da4706f4f57a1152de97d11e4aa417a 100644 --- a/ThirdParty/boost/core/lightweight_test_trait.hpp +++ b/ThirdParty/boost/core/lightweight_test_trait.hpp @@ -13,6 +13,9 @@ // // Copyright 2014 Peter Dimov // +// Copyright 2019 Glen Joseph Fernandes +// (glenjofe@gmail.com) +// // 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 @@ -20,6 +23,7 @@ #include <boost/core/lightweight_test.hpp> #include <boost/core/typeinfo.hpp> #include <boost/core/is_same.hpp> +#include <boost/config.hpp> namespace boost { @@ -27,6 +31,50 @@ namespace boost namespace detail { +template<class, int = 0> struct test_print { }; + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<T, 2>) +{ + return o << boost::core::demangled_name(BOOST_CORE_TYPEID(T)); +} + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<T, 1>) +{ + return o << test_print<T, 2>(); +} + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<const T, 1>) +{ + return o << test_print<T, 2>() << " const"; +} + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<volatile T, 1>) +{ + return o << test_print<T, 2>() << " volatile"; +} + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<const volatile T, 1>) +{ + return o << test_print<T, 2>() << " const volatile"; +} + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<T>) +{ + return o << test_print<T, 1>(); +} + +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<T&>) +{ + return o << test_print<T, 1>() << " &"; +} + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +template<class T> inline std::ostream& operator<<(std::ostream& o, test_print<T&&>) +{ + return o << test_print<T, 1>() << " &&"; +} +#endif + template< class T > inline void test_trait_impl( char const * trait, void (*)( T ), bool expected, char const * file, int line, char const * function ) { @@ -64,8 +112,8 @@ template<class T1, class T2> inline void test_trait_same_impl( char const * type BOOST_LIGHTWEIGHT_TEST_OSTREAM << file << "(" << line << "): test 'is_same<" << types << ">'" << " failed in function '" << function - << "' ('" << boost::core::demangled_name( BOOST_CORE_TYPEID(T1) ) - << "' != '" << boost::core::demangled_name( BOOST_CORE_TYPEID(T2) ) << "')" + << "' ('" << test_print<T1>() + << "' != '" << test_print<T2>() << "')" << std::endl; ++test_results().errors(); diff --git a/ThirdParty/boost/core/no_exceptions_support.hpp b/ThirdParty/boost/core/no_exceptions_support.hpp index e2453d084ba5e1e8f2786e9a65c5fee28ac7664f..6fd76b241a631d35d43df4488b15b858036d31bb 100644 --- a/ThirdParty/boost/core/no_exceptions_support.hpp +++ b/ThirdParty/boost/core/no_exceptions_support.hpp @@ -32,9 +32,21 @@ # if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) # define BOOST_TRY { if ("") # define BOOST_CATCH(x) else if (!"") -# else +# elif !defined(BOOST_MSVC) || BOOST_MSVC >= 1900 # define BOOST_TRY { if (true) # define BOOST_CATCH(x) else if (false) +# else + // warning C4127: conditional expression is constant +# define BOOST_TRY { \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4127)) \ + if (true) \ + __pragma(warning(pop)) +# define BOOST_CATCH(x) else \ + __pragma(warning(push)) \ + __pragma(warning(disable: 4127)) \ + if (false) \ + __pragma(warning(pop)) # endif # define BOOST_RETHROW # define BOOST_CATCH_END } diff --git a/ThirdParty/boost/core/noinit_adaptor.hpp b/ThirdParty/boost/core/noinit_adaptor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..22c9aaba4e2ca3f0317af7ae3e175f324efa2013 --- /dev/null +++ b/ThirdParty/boost/core/noinit_adaptor.hpp @@ -0,0 +1,112 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_NOINIT_ADAPTOR_HPP +#define BOOST_CORE_NOINIT_ADAPTOR_HPP + +#include <boost/config.hpp> +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +#include <memory> +#endif +#include <new> +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#include <utility> +#endif + +namespace boost { + +template<class A> +struct noinit_adaptor + : A { + template<class U> + struct rebind { +#if !defined(BOOST_NO_CXX11_ALLOCATOR) + typedef noinit_adaptor<typename std::allocator_traits<A>::template + rebind_alloc<U> > other; +#else + typedef noinit_adaptor<typename A::template rebind<U>::other> other; +#endif + }; + + noinit_adaptor() + : A() { } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template<class U> + noinit_adaptor(U&& u) BOOST_NOEXCEPT + : A(std::forward<U>(u)) { } +#else + template<class U> + noinit_adaptor(const U& u) BOOST_NOEXCEPT + : A(u) { } +#endif + + template<class U> + noinit_adaptor(const noinit_adaptor<U>& u) BOOST_NOEXCEPT + : A(static_cast<const U&>(u)) { } + + template<class U> + void construct(U* p) { + ::new((void*)p) U; + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template<class U, class V, class... Args> + void construct(U* p, V&& v, Args&&... args) { + ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...); + } +#else + template<class U, class V> + void construct(U* p, V&& v) { + ::new((void*)p) U(std::forward<V>(v)); + } +#endif +#else + template<class U, class V> + void construct(U* p, const V& v) { + ::new((void*)p) U(v); + } + + template<class U, class V> + void construct(U* p, V& v) { + ::new((void*)p) U(v); + } +#endif + + template<class U> + void destroy(U* p) { + p->~U(); + } +}; + +template<class T, class U> +inline bool +operator==(const noinit_adaptor<T>& lhs, + const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT +{ + return static_cast<const T&>(lhs) == static_cast<const U&>(rhs); +} + +template<class T, class U> +inline bool +operator!=(const noinit_adaptor<T>& lhs, + const noinit_adaptor<U>& rhs) BOOST_NOEXCEPT +{ + return !(lhs == rhs); +} + +template<class A> +inline noinit_adaptor<A> +noinit_adapt(const A& a) BOOST_NOEXCEPT +{ + return noinit_adaptor<A>(a); +} + +} /* boost */ + +#endif diff --git a/ThirdParty/boost/core/nvp.hpp b/ThirdParty/boost/core/nvp.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8826a5929e8d37d1aa10abea8e4b2c41dd83e2d0 --- /dev/null +++ b/ThirdParty/boost/core/nvp.hpp @@ -0,0 +1,57 @@ +/* +Copyright 2019 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_CORE_NVP_HPP +#define BOOST_CORE_NVP_HPP + +#include <boost/core/addressof.hpp> +#include <boost/config.hpp> + +namespace boost { +namespace serialization { + +template<class T> +class nvp { +public: + nvp(const char* n, T& v) BOOST_NOEXCEPT + : n_(n) + , v_(boost::addressof(v)) { } + + const char* name() const BOOST_NOEXCEPT { + return n_; + } + + T& value() const BOOST_NOEXCEPT { + return *v_; + } + + const T& const_value() const BOOST_NOEXCEPT { + return *v_; + } + +private: + const char* n_; + T* v_; +}; + +template<class T> +inline const nvp<T> +make_nvp(const char* n, T& v) BOOST_NOEXCEPT +{ + return nvp<T>(n, v); +} + +} /* serialization */ + +using serialization::nvp; +using serialization::make_nvp; + +} /* boost */ + +#define BOOST_NVP(v) boost::make_nvp(BOOST_STRINGIZE(v), v) + +#endif diff --git a/ThirdParty/boost/core/pointer_traits.hpp b/ThirdParty/boost/core/pointer_traits.hpp index e0ebfb0769d1223374a66033d44039acd47d3a82..e66194d603d598e103a1e223c4fa6bcb27fa3362 100644 --- a/ThirdParty/boost/core/pointer_traits.hpp +++ b/ThirdParty/boost/core/pointer_traits.hpp @@ -13,6 +13,7 @@ Distributed under the Boost Software License, Version 1.0. #include <memory> #else #include <boost/core/addressof.hpp> +#include <cstddef> #endif namespace boost { diff --git a/ThirdParty/boost/core/quick_exit.hpp b/ThirdParty/boost/core/quick_exit.hpp index aa557f440c82240e7d6d2a732e659c3865068328..40ead1d491b492e8c3def73357f4c4cca4feefa0 100644 --- a/ThirdParty/boost/core/quick_exit.hpp +++ b/ThirdParty/boost/core/quick_exit.hpp @@ -16,7 +16,7 @@ // http://www.boost.org/LICENSE_1_0.txt) #include <boost/config.hpp> -#include <cstdlib> +#include <stdlib.h> #if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR) diff --git a/ThirdParty/boost/core/swap.hpp b/ThirdParty/boost/core/swap.hpp index eff6b978df434c0802a1ba93970d558b689e9a74..73a454cea9c57f8b7032d3c6fcf381e0f8e937f7 100644 --- a/ThirdParty/boost/core/swap.hpp +++ b/ThirdParty/boost/core/swap.hpp @@ -23,8 +23,11 @@ #include <boost/core/enable_if.hpp> #include <boost/config.hpp> +#if __cplusplus >= 201103L || defined(BOOST_MSVC) #include <utility> //for std::swap (C++11) +#else #include <algorithm> //for std::swap (C++98) +#endif #include <cstddef> //for std::size_t namespace boost_swap_impl diff --git a/ThirdParty/boost/core/typeinfo.hpp b/ThirdParty/boost/core/typeinfo.hpp index a272596a82ca499143d154e4c1ebabc6b282e7f5..d33d29ba6885662ae4644ee580fc277853251ad6 100644 --- a/ThirdParty/boost/core/typeinfo.hpp +++ b/ThirdParty/boost/core/typeinfo.hpp @@ -47,7 +47,7 @@ public: bool operator==( typeinfo const& rhs ) const { -#if ( defined(_WIN32) || defined(__CYGWIN__) ) && defined(__GNUC__) && !defined(BOOST_DISABLE_CURRENT_FUNCTION) +#if ( defined(_WIN32) || defined(__CYGWIN__) ) && ( defined(__GNUC__) || defined(__clang__) ) && !defined(BOOST_DISABLE_CURRENT_FUNCTION) return lib_id_ == rhs.lib_id_? this == &rhs: std::strcmp( name_, rhs.name_ ) == 0; @@ -65,7 +65,7 @@ public: bool before( typeinfo const& rhs ) const { -#if ( defined(_WIN32) || defined(__CYGWIN__) ) && defined(__GNUC__) && !defined(BOOST_DISABLE_CURRENT_FUNCTION) +#if ( defined(_WIN32) || defined(__CYGWIN__) ) && ( defined(__GNUC__) || defined(__clang__) ) && !defined(BOOST_DISABLE_CURRENT_FUNCTION) return lib_id_ == rhs.lib_id_? std::less< typeinfo const* >()( this, &rhs ): std::strcmp( name_, rhs.name_ ) < 0; diff --git a/ThirdParty/boost/core/uncaught_exceptions.hpp b/ThirdParty/boost/core/uncaught_exceptions.hpp index 29b1c7ae79ecd08db66eb3ff291c5ea545c36e93..27e2491bda840e6ed47a74ff9021dd11c1b071c1 100644 --- a/ThirdParty/boost/core/uncaught_exceptions.hpp +++ b/ThirdParty/boost/core/uncaught_exceptions.hpp @@ -9,7 +9,7 @@ * \author Andrey Semashev * \date 2018-11-10 * - * \brief This header provides an `uncaught_exception` function implementation, which was introduced in C++17. + * \brief This header provides an `uncaught_exceptions` function implementation, which was introduced in C++17. * * The code in this file is based on the implementation by Evgeny Panasyuk: * @@ -56,10 +56,15 @@ // On Linux with clang and libc++ and on OS X, there is a version of cxxabi.h from libc++abi that doesn't declare __cxa_get_globals, but provides __cxa_uncaught_exceptions. // The function only appeared in version _LIBCPPABI_VERSION >= 1002 of the library. Unfortunately, there are linking errors about undefined reference to __cxa_uncaught_exceptions // on Ubuntu Trusty and OS X, so we avoid using it and forward-declare __cxa_get_globals instead. +// On QNX SDP 7.0 (QCC 5.4.0), there are multiple cxxabi.h, one from glibcxx from gcc and another from libc++abi from LLVM. Which one is included will be determined by the qcc +// command line arguments (-V and/or -Y; http://www.qnx.com/developers/docs/7.0.0/#com.qnx.doc.neutrino.utilities/topic/q/qcc.html). The LLVM libc++abi is missing the declaration +// of __cxa_get_globals but it is also patched by QNX developers to not define _LIBCPPABI_VERSION. Older QNX SDP versions, up to and including 6.6, don't provide LLVM and libc++abi. +// See https://github.com/boostorg/core/issues/59. #if !defined(__FreeBSD__) && \ ( \ (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) < 407) || \ defined(__OpenBSD__) || \ + (defined(__QNXNTO__) && !defined(__GLIBCXX__) && !defined(__GLIBCPP__)) || \ defined(_LIBCPPABI_VERSION) \ ) namespace __cxxabiv1 { diff --git a/ThirdParty/boost/cstdint.hpp b/ThirdParty/boost/cstdint.hpp index c8474c4623ac4022512c0d870e737a4bab6027cb..9c88d13b84ff2d3decabd6f730acc1c2196ba60c 100644 --- a/ThirdParty/boost/cstdint.hpp +++ b/ThirdParty/boost/cstdint.hpp @@ -52,9 +52,9 @@ // so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG. // See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990 // -#if defined(BOOST_HAS_STDINT_H) \ - && (!defined(__GLIBC__) \ - || defined(__GLIBC_HAVE_LONG_LONG) \ +#if defined(BOOST_HAS_STDINT_H) \ + && (!defined(__GLIBC__) \ + || defined(__GLIBC_HAVE_LONG_LONG) \ || (defined(__GLIBC__) && ((__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 17))))) // The following #include is an implementation artifact; not part of interface. diff --git a/ThirdParty/boost/detail/sp_typeinfo.hpp b/ThirdParty/boost/detail/sp_typeinfo.hpp index 4e4de55b05c9b1ee4e70925d4feddd6bd935b94d..bec228f57d0e3097bbd0afbb7fd73caa793abb2c 100644 --- a/ThirdParty/boost/detail/sp_typeinfo.hpp +++ b/ThirdParty/boost/detail/sp_typeinfo.hpp @@ -18,6 +18,9 @@ // http://www.boost.org/LICENSE_1_0.txt) #include <boost/core/typeinfo.hpp> +#include <boost/config/header_deprecated.hpp> + +BOOST_HEADER_DEPRECATED( "<boost/core/typeinfo.hpp>" ) namespace boost { diff --git a/ThirdParty/boost/detail/winapi/detail/deprecated_namespace.hpp b/ThirdParty/boost/detail/winapi/detail/deprecated_namespace.hpp deleted file mode 100644 index 40c9152704b5e28db5a8ecfd099b0f0fe925d8fc..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/detail/winapi/detail/deprecated_namespace.hpp +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - * - * This header is deprecated, it provides the deprecated namespace for backward compatibility. - */ - -#ifndef BOOST_DETAIL_WINAPI_DETAIL_DEPRECATED_NAMESPACE_HPP_INCLUDED_ -#define BOOST_DETAIL_WINAPI_DETAIL_DEPRECATED_NAMESPACE_HPP_INCLUDED_ - -#include <boost/config.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -namespace boost { -namespace winapi {} -namespace detail { -namespace winapi { -using namespace boost::winapi; -} // namespace winapi -} // namespace detail -} // namespace boost - -#endif // BOOST_DETAIL_WINAPI_DETAIL_DEPRECATED_NAMESPACE_HPP_INCLUDED_ diff --git a/ThirdParty/boost/detail/winapi/get_current_process.hpp b/ThirdParty/boost/detail/winapi/get_current_process.hpp deleted file mode 100644 index b6a79150281a200158c23d4fa6552f3f5c28ec46..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/detail/winapi/get_current_process.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - * - * This header is deprecated, use boost/winapi/get_current_process.hpp instead. - */ - -#ifndef BOOST_DETAIL_WINAPI_GET_CURRENT_PROCESS_HPP -#define BOOST_DETAIL_WINAPI_GET_CURRENT_PROCESS_HPP - -#include <boost/winapi/get_current_process.hpp> -#include <boost/detail/winapi/detail/deprecated_namespace.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#endif // BOOST_DETAIL_WINAPI_GET_CURRENT_PROCESS_HPP diff --git a/ThirdParty/boost/detail/winapi/get_current_thread.hpp b/ThirdParty/boost/detail/winapi/get_current_thread.hpp deleted file mode 100644 index f9a27c3e6ec18287db50051aafec4705b942e0ae..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/detail/winapi/get_current_thread.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - * - * This header is deprecated, use boost/winapi/get_current_thread.hpp instead. - */ - -#ifndef BOOST_DETAIL_WINAPI_GET_CURRENT_THREAD_HPP -#define BOOST_DETAIL_WINAPI_GET_CURRENT_THREAD_HPP - -#include <boost/winapi/get_current_thread.hpp> -#include <boost/detail/winapi/detail/deprecated_namespace.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#endif // BOOST_DETAIL_WINAPI_GET_CURRENT_THREAD_HPP diff --git a/ThirdParty/boost/detail/winapi/get_last_error.hpp b/ThirdParty/boost/detail/winapi/get_last_error.hpp deleted file mode 100644 index f76a008e0807e5f1a2e0f50b08b0303ed25a87ce..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/detail/winapi/get_last_error.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - * - * This header is deprecated, use boost/winapi/get_last_error.hpp instead. - */ - -#ifndef BOOST_DETAIL_WINAPI_GET_LAST_ERROR_HPP -#define BOOST_DETAIL_WINAPI_GET_LAST_ERROR_HPP - -#include <boost/winapi/get_last_error.hpp> -#include <boost/detail/winapi/detail/deprecated_namespace.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#endif // BOOST_DETAIL_WINAPI_GET_LAST_ERROR_HPP diff --git a/ThirdParty/boost/detail/winapi/get_process_times.hpp b/ThirdParty/boost/detail/winapi/get_process_times.hpp deleted file mode 100644 index 6babb3919d8578f211e8a45a8185577669813688..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/detail/winapi/get_process_times.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - * - * This header is deprecated, use boost/winapi/get_process_times.hpp instead. - */ - -#ifndef BOOST_DETAIL_WINAPI_GET_PROCESS_TIMES_HPP -#define BOOST_DETAIL_WINAPI_GET_PROCESS_TIMES_HPP - -#include <boost/winapi/get_process_times.hpp> -#include <boost/detail/winapi/detail/deprecated_namespace.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#endif // BOOST_DETAIL_WINAPI_GET_PROCESS_TIMES_HPP diff --git a/ThirdParty/boost/detail/winapi/get_thread_times.hpp b/ThirdParty/boost/detail/winapi/get_thread_times.hpp deleted file mode 100644 index 96f1fac8f374f18a9fda29f2ce62ad0ab762c446..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/detail/winapi/get_thread_times.hpp +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2017 Andrey Semashev - * - * Distributed under the Boost Software License, Version 1.0. - * See http://www.boost.org/LICENSE_1_0.txt - * - * This header is deprecated, use boost/winapi/get_thread_times.hpp instead. - */ - -#ifndef BOOST_DETAIL_WINAPI_GET_THREAD_TIMES_HPP -#define BOOST_DETAIL_WINAPI_GET_THREAD_TIMES_HPP - -#include <boost/winapi/get_thread_times.hpp> -#include <boost/detail/winapi/detail/deprecated_namespace.hpp> - -#ifdef BOOST_HAS_PRAGMA_ONCE -#pragma once -#endif - -#endif // BOOST_DETAIL_WINAPI_GET_THREAD_TIMES_HPP diff --git a/ThirdParty/boost/exception/current_exception_cast.hpp b/ThirdParty/boost/exception/current_exception_cast.hpp index 5d81f00b00b24b529a7194d56c2d3afc2c09c507..950eeff17198ba99f8b1d8062f02a7eafb2fb3f8 100644 --- a/ThirdParty/boost/exception/current_exception_cast.hpp +++ b/ThirdParty/boost/exception/current_exception_cast.hpp @@ -3,14 +3,20 @@ //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) -#ifndef UUID_7E83C166200811DE885E826156D89593 -#define UUID_7E83C166200811DE885E826156D89593 -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_7E83C166200811DE885E826156D89593 +#define BOOST_EXCEPTION_7E83C166200811DE885E826156D89593 + +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/exception/detail/error_info_impl.hpp b/ThirdParty/boost/exception/detail/error_info_impl.hpp index 6c48d61ab35dcf9f673c2ce2953c4f5d4df27f29..30ccffd1481d0b13ed3617491a6097173de3ed73 100644 --- a/ThirdParty/boost/exception/detail/error_info_impl.hpp +++ b/ThirdParty/boost/exception/detail/error_info_impl.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_CE6983AC753411DDA764247956D89593 -#define UUID_CE6983AC753411DDA764247956D89593 +#ifndef BOOST_EXCEPTION_CE6983AC753411DDA764247956D89593 +#define BOOST_EXCEPTION_CE6983AC753411DDA764247956D89593 #include <boost/config.hpp> #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES @@ -13,12 +13,17 @@ #include <utility> #include <string> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost @@ -35,7 +40,7 @@ boost virtual error_info_base * clone() const = 0; virtual - ~error_info_base() throw() + ~error_info_base() BOOST_NOEXCEPT_OR_NOTHROW { } }; @@ -46,7 +51,7 @@ boost error_info: public exception_detail::error_info_base { - error_info_base * + exception_detail::error_info_base * clone() const { return new error_info<Tag,T>(*this); @@ -73,7 +78,7 @@ boost } #endif #endif - ~error_info() throw() + ~error_info() BOOST_NOEXCEPT_OR_NOTHROW { } value_type const & diff --git a/ThirdParty/boost/exception/detail/is_output_streamable.hpp b/ThirdParty/boost/exception/detail/is_output_streamable.hpp index 10e5c5163ee1eecaef4c03cc3205ef7c614cfa76..a61f986bc9fed978f59cd361771dae8b5bec8d67 100644 --- a/ThirdParty/boost/exception/detail/is_output_streamable.hpp +++ b/ThirdParty/boost/exception/detail/is_output_streamable.hpp @@ -3,17 +3,22 @@ //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) -#ifndef UUID_898984B4076411DD973EDFA055D89593 -#define UUID_898984B4076411DD973EDFA055D89593 +#ifndef BOOST_EXCEPTION_898984B4076411DD973EDFA055D89593 +#define BOOST_EXCEPTION_898984B4076411DD973EDFA055D89593 #include <ostream> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/exception/detail/object_hex_dump.hpp b/ThirdParty/boost/exception/detail/object_hex_dump.hpp index 267bf0bf3e16ce8a4de8879dde6048d6f4bdb09e..c195de50d91fe6403532b1664174e406f5fa47ee 100644 --- a/ThirdParty/boost/exception/detail/object_hex_dump.hpp +++ b/ThirdParty/boost/exception/detail/object_hex_dump.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_6F463AC838DF11DDA3E6909F56D89593 -#define UUID_6F463AC838DF11DDA3E6909F56D89593 +#ifndef BOOST_EXCEPTION_6F463AC838DF11DDA3E6909F56D89593 +#define BOOST_EXCEPTION_6F463AC838DF11DDA3E6909F56D89593 #include <boost/exception/detail/type_info.hpp> #include <iomanip> @@ -13,12 +13,17 @@ #include <sstream> #include <cstdlib> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/exception/detail/shared_ptr.hpp b/ThirdParty/boost/exception/detail/shared_ptr.hpp index 51febe8c8fb538b06a1407aba179830737d8cf50..24dd16d7b1b8b3c235b936897a557e48af3e62f2 100644 --- a/ThirdParty/boost/exception/detail/shared_ptr.hpp +++ b/ThirdParty/boost/exception/detail/shared_ptr.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_837060E885AF11E68DA91D15E31AC075 -#define UUID_837060E885AF11E68DA91D15E31AC075 +#ifndef BOOST_EXCEPTION_837060E885AF11E68DA91D15E31AC075 +#define BOOST_EXCEPTION_837060E885AF11E68DA91D15E31AC075 #ifdef BOOST_EXCEPTION_MINI_BOOST #include <memory> diff --git a/ThirdParty/boost/exception/detail/type_info.hpp b/ThirdParty/boost/exception/detail/type_info.hpp index 739ac5748e290f1ac774e94deb619311484f82b3..94cca7f0f782b662e71528f983d4b4bb7b12ba06 100644 --- a/ThirdParty/boost/exception/detail/type_info.hpp +++ b/ThirdParty/boost/exception/detail/type_info.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_C3E1741C754311DDB2834CCA55D89593 -#define UUID_C3E1741C754311DDB2834CCA55D89593 +#ifndef BOOST_EXCEPTION_C3E1741C754311DDB2834CCA55D89593 +#define BOOST_EXCEPTION_C3E1741C754311DDB2834CCA55D89593 #include <boost/config.hpp> #include <boost/core/typeinfo.hpp> @@ -12,12 +12,17 @@ #include <boost/current_function.hpp> #include <string> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/exception/diagnostic_information.hpp b/ThirdParty/boost/exception/diagnostic_information.hpp index 48f06a0fb9829512c2247ede9e58f5e772e60801..b5496d32ec5f3134ba1b513beb9d907da0dc37c3 100644 --- a/ThirdParty/boost/exception/diagnostic_information.hpp +++ b/ThirdParty/boost/exception/diagnostic_information.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_0552D49838DD11DD90146B8956D89593 -#define UUID_0552D49838DD11DD90146B8956D89593 +#ifndef BOOST_EXCEPTION_0552D49838DD11DD90146B8956D89593 +#define BOOST_EXCEPTION_0552D49838DD11DD90146B8956D89593 #include <boost/config.hpp> #include <boost/exception/get_error_info.hpp> @@ -20,12 +20,17 @@ #include <boost/exception/current_exception_cast.hpp> #endif -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif #ifndef BOOST_NO_EXCEPTIONS namespace @@ -45,6 +50,10 @@ boost std::exception const * se=current_exception_cast<std::exception const>(); if( be || se ) return exception_detail::diagnostic_information_impl(be,se,true,verbose); +#if defined(__GLIBCXX__) && __cplusplus >= 201103L && !defined(BOOST_NO_RTTI) + else if (auto* p=std::current_exception().__cxa_exception_type()) + return "Dynamic exception type: "+boost::core::demangle(p->name()); +#endif else return "No diagnostic information available."; } @@ -157,7 +166,7 @@ boost core::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n'; #endif if( with_what && se && verbose ) - tmp << "std::exception::what: " << wh << '\n'; + tmp << "std::exception::what: " << (wh ? wh : "(null)") << '\n'; if( be ) if( char const * s=exception_detail::get_diagnostic_information(*be,tmp.str().c_str()) ) if( *s ) @@ -175,7 +184,7 @@ boost inline char const * - diagnostic_information_what( exception const & e, bool verbose=true ) throw() + diagnostic_information_what( exception const & e, bool verbose=true ) BOOST_NOEXCEPT_OR_NOTHROW { char const * w=0; #ifndef BOOST_NO_EXCEPTIONS diff --git a/ThirdParty/boost/exception/exception.hpp b/ThirdParty/boost/exception/exception.hpp index d5c22c4ca2306410417a9df667c037fa0c5621bf..37a582c2e309c26ea8e3298490937b48df36f9e6 100644 --- a/ThirdParty/boost/exception/exception.hpp +++ b/ThirdParty/boost/exception/exception.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_274DA366004E11DCB1DDFE2E56D89593 -#define UUID_274DA366004E11DCB1DDFE2E56D89593 +#ifndef BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 +#define BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 #include <boost/config.hpp> @@ -16,11 +16,17 @@ namespace boost { template <class T> class shared_ptr; } namespace boost { namespace exception_detail { using boost::shared_ptr; } } #endif -#if defined(__GNUC__) && (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#if !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) +#pragma warning(disable: 4265) +#endif #endif namespace @@ -165,7 +171,7 @@ boost protected: - ~error_info_container() throw() + ~error_info_container() BOOST_NOEXCEPT_OR_NOTHROW { } }; @@ -233,7 +239,7 @@ boost #ifdef __HP_aCC //On HP aCC, this protected copy constructor prevents throwing boost::exception. //On all other platforms, the same effect is achieved by the pure virtual destructor. - exception( exception const & x ) throw(): + exception( exception const & x ) BOOST_NOEXCEPT_OR_NOTHROW: data_(x.data_), throw_function_(x.throw_function_), throw_file_(x.throw_file_), @@ -242,7 +248,7 @@ boost } #endif - virtual ~exception() throw() + virtual ~exception() BOOST_NOEXCEPT_OR_NOTHROW #ifndef __HP_aCC = 0 //Workaround for HP aCC, =0 incorrectly leads to link errors. #endif @@ -287,7 +293,7 @@ boost inline exception:: - ~exception() throw() + ~exception() BOOST_NOEXCEPT_OR_NOTHROW { } @@ -337,7 +343,7 @@ boost { } - ~error_info_injector() throw() + ~error_info_injector() BOOST_NOEXCEPT_OR_NOTHROW { } }; @@ -398,7 +404,7 @@ boost virtual void rethrow() const = 0; virtual - ~clone_base() throw() + ~clone_base() BOOST_NOEXCEPT_OR_NOTHROW { } }; @@ -445,7 +451,7 @@ boost copy_boost_exception(this,&x); } - ~clone_impl() throw() + ~clone_impl() BOOST_NOEXCEPT_OR_NOTHROW { } @@ -472,54 +478,10 @@ boost { return exception_detail::clone_impl<T>(x); } - - template <class T> - struct - BOOST_SYMBOL_VISIBLE - wrapexcept: - public exception_detail::clone_impl<typename exception_detail::enable_error_info_return_type<T>::type> - { - typedef exception_detail::clone_impl<typename exception_detail::enable_error_info_return_type<T>::type> base_type; - public: - explicit - wrapexcept( typename exception_detail::enable_error_info_return_type<T>::type const & x ): - base_type( x ) - { - } - - ~wrapexcept() throw() - { - } - }; - - namespace - exception_detail - { - template <class T> - struct - remove_error_info_injector - { - typedef T type; - }; - - template <class T> - struct - remove_error_info_injector< error_info_injector<T> > - { - typedef T type; - }; - - template <class T> - inline - wrapexcept<typename remove_error_info_injector<T>::type> - enable_both( T const & x ) - { - return wrapexcept<typename remove_error_info_injector<T>::type>( enable_error_info( x ) ); - } - } } #if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) #pragma warning(pop) #endif -#endif + +#endif // #ifndef BOOST_EXCEPTION_274DA366004E11DCB1DDFE2E56D89593 diff --git a/ThirdParty/boost/exception/get_error_info.hpp b/ThirdParty/boost/exception/get_error_info.hpp index 831717df5963000fdf94804edf6cc7c4922038ba..09a224aa532afe3d24e893f1b95f8f1a4a25183d 100644 --- a/ThirdParty/boost/exception/get_error_info.hpp +++ b/ThirdParty/boost/exception/get_error_info.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_1A590226753311DD9E4CCF6156D89593 -#define UUID_1A590226753311DD9E4CCF6156D89593 +#ifndef BOOST_EXCEPTION_1A590226753311DD9E4CCF6156D89593 +#define BOOST_EXCEPTION_1A590226753311DD9E4CCF6156D89593 #include <boost/config.hpp> #include <boost/exception/exception.hpp> @@ -13,12 +13,17 @@ #include <boost/exception/detail/shared_ptr.hpp> #include <boost/assert.hpp> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/exception/info.hpp b/ThirdParty/boost/exception/info.hpp index f7ac50ecfcd87c0ab3cf4f6a6f4a4767a80ab02a..a877cbd7d9eced65183633b7c201d76a1fc894b4 100644 --- a/ThirdParty/boost/exception/info.hpp +++ b/ThirdParty/boost/exception/info.hpp @@ -3,8 +3,8 @@ //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) -#ifndef UUID_8D22C4CA9CC811DCAA9133D256D89593 -#define UUID_8D22C4CA9CC811DCAA9133D256D89593 +#ifndef BOOST_EXCEPTION_8D22C4CA9CC811DCAA9133D256D89593 +#define BOOST_EXCEPTION_8D22C4CA9CC811DCAA9133D256D89593 #include <boost/config.hpp> #include <boost/exception/exception.hpp> @@ -13,12 +13,17 @@ #include <boost/exception/detail/shared_ptr.hpp> #include <map> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost @@ -62,7 +67,7 @@ boost { } - ~error_info_container_impl() throw() + ~error_info_container_impl() BOOST_NOEXCEPT_OR_NOTHROW { } diff --git a/ThirdParty/boost/exception/to_string.hpp b/ThirdParty/boost/exception/to_string.hpp index 51425b10d1646e5244032569474575c354688629..9a2c05794c4fb422821f03377afea22ff59534ce 100644 --- a/ThirdParty/boost/exception/to_string.hpp +++ b/ThirdParty/boost/exception/to_string.hpp @@ -3,19 +3,24 @@ //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) -#ifndef UUID_7E48761AD92811DC9011477D56D89593 -#define UUID_7E48761AD92811DC9011477D56D89593 +#ifndef BOOST_EXCEPTION_7E48761AD92811DC9011477D56D89593 +#define BOOST_EXCEPTION_7E48761AD92811DC9011477D56D89593 #include <boost/utility/enable_if.hpp> #include <boost/exception/detail/is_output_streamable.hpp> #include <sstream> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/exception/to_string_stub.hpp b/ThirdParty/boost/exception/to_string_stub.hpp index 8ff5e47fd63a7d5c021fe395838830f44ab1a3bf..5fbfba7ec21047f17784bcf451059198cc6b9dc8 100644 --- a/ThirdParty/boost/exception/to_string_stub.hpp +++ b/ThirdParty/boost/exception/to_string_stub.hpp @@ -3,19 +3,24 @@ //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) -#ifndef UUID_E788439ED9F011DCB181F25B55D89593 -#define UUID_E788439ED9F011DCB181F25B55D89593 +#ifndef BOOST_EXCEPTION_E788439ED9F011DCB181F25B55D89593 +#define BOOST_EXCEPTION_E788439ED9F011DCB181F25B55D89593 #include <boost/exception/to_string.hpp> #include <boost/exception/detail/object_hex_dump.hpp> #include <boost/assert.hpp> -#if (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifndef BOOST_EXCEPTION_ENABLE_WARNINGS +#if __GNUC__*100+__GNUC_MINOR__>301 #pragma GCC system_header #endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#ifdef __clang__ +#pragma clang system_header +#endif +#ifdef _MSC_VER #pragma warning(push,1) #endif +#endif namespace boost diff --git a/ThirdParty/boost/filesystem.hpp b/ThirdParty/boost/filesystem.hpp index 86d23ac65dd46cb04a14dfe268f919c07e6cf909..0bf4c6442ab5f3c0ad2fb846281939cff54b8f03 100644 --- a/ThirdParty/boost/filesystem.hpp +++ b/ThirdParty/boost/filesystem.hpp @@ -14,7 +14,10 @@ # include <boost/filesystem/config.hpp> # include <boost/filesystem/path.hpp> +# include <boost/filesystem/exception.hpp> +# include <boost/filesystem/directory.hpp> # include <boost/filesystem/operations.hpp> +# include <boost/filesystem/file_status.hpp> # include <boost/filesystem/convenience.hpp> # include <boost/filesystem/string_file.hpp> diff --git a/ThirdParty/boost/filesystem/directory.hpp b/ThirdParty/boost/filesystem/directory.hpp new file mode 100644 index 0000000000000000000000000000000000000000..90dcaa885bf486a3aaecbbfdef65e02e9e78fe2d --- /dev/null +++ b/ThirdParty/boost/filesystem/directory.hpp @@ -0,0 +1,620 @@ +// boost/filesystem/directory.hpp ---------------------------------------------------// + +// Copyright Beman Dawes 2002-2009 +// Copyright Jan Langer 2002 +// Copyright Dietmar Kuehl 2001 +// Copyright Vladimir Prus 2002 +// Copyright Andrey Semashev 2019 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM3_DIRECTORY_HPP +#define BOOST_FILESYSTEM3_DIRECTORY_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/filesystem/file_status.hpp> + +#include <string> +#include <vector> +#include <utility> // std::move + +#include <boost/assert.hpp> +#include <boost/core/scoped_enum.hpp> +#include <boost/detail/bitmask.hpp> +#include <boost/system/error_code.hpp> +#include <boost/smart_ptr/intrusive_ptr.hpp> +#include <boost/smart_ptr/intrusive_ref_counter.hpp> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/iterator/iterator_categories.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +//--------------------------------------------------------------------------------------// + +namespace boost { +namespace filesystem { + +//--------------------------------------------------------------------------------------// +// // +// directory_entry // +// // +//--------------------------------------------------------------------------------------// + +// GCC has a problem with a member function named path within a namespace or +// sub-namespace that also has a class named path. The workaround is to always +// fully qualify the name path when it refers to the class name. + +class directory_entry +{ +public: + typedef boost::filesystem::path::value_type value_type; // enables class path ctor taking directory_entry + + directory_entry() BOOST_NOEXCEPT {} + explicit directory_entry(const boost::filesystem::path& p) : + m_path(p), m_status(file_status()), m_symlink_status(file_status()) + { + } + directory_entry(const boost::filesystem::path& p, + file_status st, file_status symlink_st = file_status()) : + m_path(p), m_status(st), m_symlink_status(symlink_st) + { + } + + directory_entry(const directory_entry& rhs) : + m_path(rhs.m_path), m_status(rhs.m_status), m_symlink_status(rhs.m_symlink_status) + { + } + + directory_entry& operator=(const directory_entry& rhs) + { + m_path = rhs.m_path; + m_status = rhs.m_status; + m_symlink_status = rhs.m_symlink_status; + return *this; + } + + // As of October 2015 the interaction between noexcept and =default is so troublesome + // for VC++, GCC, and probably other compilers, that =default is not used with noexcept + // functions. GCC is not even consistent for the same release on different platforms. + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + directory_entry(directory_entry&& rhs) BOOST_NOEXCEPT : + m_path(std::move(rhs.m_path)), m_status(std::move(rhs.m_status)), m_symlink_status(std::move(rhs.m_symlink_status)) + { + } + directory_entry& operator=(directory_entry&& rhs) BOOST_NOEXCEPT + { + m_path = std::move(rhs.m_path); + m_status = std::move(rhs.m_status); + m_symlink_status = std::move(rhs.m_symlink_status); + return *this; + } +#endif + + void assign(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st = file_status()) + { + m_path = p; + m_status = st; + m_symlink_status = symlink_st; + } + + void replace_filename(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st = file_status()) + { + m_path.remove_filename(); + m_path /= p; + m_status = st; + m_symlink_status = symlink_st; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + void replace_leaf(const boost::filesystem::path& p, file_status st, file_status symlink_st) + { + replace_filename(p, st, symlink_st); + } +# endif + + const boost::filesystem::path& path() const BOOST_NOEXCEPT { return m_path; } + operator const boost::filesystem::path&() const BOOST_NOEXCEPT { return m_path; } + file_status status() const { return get_status(); } + file_status status(system::error_code& ec) const BOOST_NOEXCEPT { return get_status(&ec); } + file_status symlink_status() const { return get_symlink_status(); } + file_status symlink_status(system::error_code& ec) const BOOST_NOEXCEPT { return get_symlink_status(&ec); } + + bool operator==(const directory_entry& rhs) const BOOST_NOEXCEPT { return m_path == rhs.m_path; } + bool operator!=(const directory_entry& rhs) const BOOST_NOEXCEPT { return m_path != rhs.m_path; } + bool operator< (const directory_entry& rhs) const BOOST_NOEXCEPT { return m_path < rhs.m_path; } + bool operator<=(const directory_entry& rhs) const BOOST_NOEXCEPT { return m_path <= rhs.m_path; } + bool operator> (const directory_entry& rhs) const BOOST_NOEXCEPT { return m_path > rhs.m_path; } + bool operator>=(const directory_entry& rhs) const BOOST_NOEXCEPT { return m_path >= rhs.m_path; } + +private: + BOOST_FILESYSTEM_DECL file_status get_status(system::error_code* ec=0) const; + BOOST_FILESYSTEM_DECL file_status get_symlink_status(system::error_code* ec=0) const; + +private: + boost::filesystem::path m_path; + mutable file_status m_status; // stat()-like + mutable file_status m_symlink_status; // lstat()-like +}; // directory_entry + + +//--------------------------------------------------------------------------------------// +// // +// directory_entry overloads // +// // +//--------------------------------------------------------------------------------------// + +// Without these functions, calling (for example) 'is_directory' with a 'directory_entry' results in: +// - a conversion to 'path' using 'operator const boost::filesystem::path&()', +// - then a call to 'is_directory(const path& p)' which recomputes the status with 'detail::status(p)'. +// +// These functions avoid a costly recomputation of the status if one calls 'is_directory(e)' instead of 'is_directory(e.status)' + +inline file_status status (const directory_entry& e) BOOST_NOEXCEPT { return e.status(); } +inline bool type_present (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::type_present(e.status()); } +inline bool status_known (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::status_known(e.status()); } +inline bool exists (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::exists(e.status()); } +inline bool is_regular_file(const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_regular_file(e.status()); } +inline bool is_directory (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_directory(e.status()); } +inline bool is_symlink (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_symlink(e.status()); } +inline bool is_other (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_other(e.status()); } +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +inline bool is_regular (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_regular(e.status()); } +#endif + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator helpers // +// // +//--------------------------------------------------------------------------------------// + +BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(directory_options, unsigned int) +{ + none = 0u, + skip_permission_denied = 1u, // if a directory cannot be opened because of insufficient permissions, pretend that the directory is empty + follow_directory_symlink = 1u << 1, // recursive_directory_iterator: follow directory symlinks + skip_dangling_symlinks = 1u << 2, // non-standard extension for recursive_directory_iterator: don't follow dangling directory symlinks, + pop_on_error = 1u << 3, // non-standard extension for recursive_directory_iterator: instead of producing an end iterator on errors, + // repeatedly invoke pop() until it succeeds or the iterator becomes equal to end iterator + _detail_no_push = 1u << 4 // internal use only +} +BOOST_SCOPED_ENUM_DECLARE_END(directory_options) + +BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(directory_options)) + +class directory_iterator; + +namespace detail { + +BOOST_FILESYSTEM_DECL +system::error_code dir_itr_close(// never throws() + void*& handle +#if defined(BOOST_POSIX_API) + , void*& buffer +#endif +) BOOST_NOEXCEPT; + +struct dir_itr_imp : + public boost::intrusive_ref_counter< dir_itr_imp > +{ + directory_entry dir_entry; + void* handle; + +#if defined(BOOST_POSIX_API) + void* buffer; // see dir_itr_increment implementation +#endif + + dir_itr_imp() BOOST_NOEXCEPT : + handle(0) +#if defined(BOOST_POSIX_API) + , buffer(0) +#endif + { + } + + ~dir_itr_imp() BOOST_NOEXCEPT + { + dir_itr_close(handle +#if defined(BOOST_POSIX_API) + , buffer +#endif + ); + } +}; + +// see path::iterator: comment below +BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, const path& p, unsigned int opts, system::error_code* ec); +BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, system::error_code* ec); + +} // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator // +// // +//--------------------------------------------------------------------------------------// + +class directory_iterator : + public boost::iterator_facade< + directory_iterator, + directory_entry, + boost::single_pass_traversal_tag + > +{ + friend class boost::iterator_core_access; + + friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, const path& p, unsigned int opts, system::error_code* ec); + friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, system::error_code* ec); + +public: + directory_iterator() BOOST_NOEXCEPT {} // creates the "end" iterator + + // iterator_facade derived classes don't seem to like implementations in + // separate translation unit dll's, so forward to detail functions + explicit directory_iterator(const path& p, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts = directory_options::none) + { + detail::directory_iterator_construct(*this, p, static_cast< unsigned int >(opts), 0); + } + + directory_iterator(const path& p, system::error_code& ec) BOOST_NOEXCEPT + { + detail::directory_iterator_construct(*this, p, static_cast< unsigned int >(directory_options::none), &ec); + } + + directory_iterator(const path& p, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts, system::error_code& ec) BOOST_NOEXCEPT + { + detail::directory_iterator_construct(*this, p, static_cast< unsigned int >(opts), &ec); + } + + BOOST_DEFAULTED_FUNCTION(directory_iterator(directory_iterator const& that), : m_imp(that.m_imp) {}) + BOOST_DEFAULTED_FUNCTION(directory_iterator& operator= (directory_iterator const& that), { m_imp = that.m_imp; return *this; }) + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + directory_iterator(directory_iterator&& that) BOOST_NOEXCEPT : + m_imp(std::move(that.m_imp)) + { + } + + directory_iterator& operator= (directory_iterator&& that) BOOST_NOEXCEPT + { + m_imp = std::move(that.m_imp); + return *this; + } +#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + directory_iterator& increment(system::error_code& ec) BOOST_NOEXCEPT + { + detail::directory_iterator_increment(*this, &ec); + return *this; + } + +private: + boost::iterator_facade< + directory_iterator, + directory_entry, + boost::single_pass_traversal_tag + >::reference dereference() const + { + BOOST_ASSERT_MSG(!is_end(), "attempt to dereference end directory iterator"); + return m_imp->dir_entry; + } + + void increment() { detail::directory_iterator_increment(*this, 0); } + + bool equal(const directory_iterator& rhs) const BOOST_NOEXCEPT + { + return m_imp == rhs.m_imp || (is_end() && rhs.is_end()); + } + + bool is_end() const BOOST_NOEXCEPT + { + // Note: The check for handle is needed because the iterator can be copied and the copy + // can be incremented to end while the original iterator still refers to the same dir_itr_imp. + return !m_imp || !m_imp->handle; + } + +private: + // intrusive_ptr provides the shallow-copy semantics required for single pass iterators + // (i.e. InputIterators). The end iterator is indicated by is_end(). + boost::intrusive_ptr< detail::dir_itr_imp > m_imp; +}; + +// enable directory_iterator C++11 range-based for statement use --------------------// + +// begin() and end() are only used by a range-based for statement in the context of +// auto - thus the top-level const is stripped - so returning const is harmless and +// emphasizes begin() is just a pass through. +inline const directory_iterator& begin(const directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline directory_iterator end(const directory_iterator&) BOOST_NOEXCEPT { return directory_iterator(); } + +// enable C++14 generic accessors for range const iterators +inline const directory_iterator& cbegin(const directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline directory_iterator cend(const directory_iterator&) BOOST_NOEXCEPT { return directory_iterator(); } + +// enable directory_iterator BOOST_FOREACH -----------------------------------------// + +inline directory_iterator& range_begin(directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline directory_iterator range_begin(const directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline directory_iterator range_end(directory_iterator&) BOOST_NOEXCEPT { return directory_iterator(); } +inline directory_iterator range_end(const directory_iterator&) BOOST_NOEXCEPT { return directory_iterator(); } + +} // namespace filesystem + +// namespace boost template specializations +template<typename C, typename Enabler> +struct range_mutable_iterator; + +template<> +struct range_mutable_iterator<boost::filesystem::directory_iterator, void> +{ + typedef boost::filesystem::directory_iterator type; +}; + +template<typename C, typename Enabler> +struct range_const_iterator; + +template<> +struct range_const_iterator<boost::filesystem::directory_iterator, void> +{ + typedef boost::filesystem::directory_iterator type; +}; + +namespace filesystem { + +//--------------------------------------------------------------------------------------// +// // +// recursive_directory_iterator helpers // +// // +//--------------------------------------------------------------------------------------// + +#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) +// Deprecated enum, use directory_options instead +BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(symlink_option, unsigned int) +{ + none = static_cast< unsigned int >(directory_options::none), + no_recurse = none, // don't follow directory symlinks (default behavior) + recurse = static_cast< unsigned int >(directory_options::follow_directory_symlink), // follow directory symlinks + _detail_no_push = static_cast< unsigned int >(directory_options::_detail_no_push) // internal use only +} +BOOST_SCOPED_ENUM_DECLARE_END(symlink_option) + +BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(symlink_option)) +#endif // BOOST_FILESYSTEM_NO_DEPRECATED + +class recursive_directory_iterator; + +namespace detail { + +struct recur_dir_itr_imp : + public boost::intrusive_ref_counter< recur_dir_itr_imp > +{ + typedef directory_iterator element_type; + std::vector< element_type > m_stack; + // directory_options values, declared as unsigned int for ABI compatibility + unsigned int m_options; + + explicit recur_dir_itr_imp(unsigned int opts) BOOST_NOEXCEPT : m_options(opts) {} +}; + +BOOST_FILESYSTEM_DECL void recursive_directory_iterator_construct(recursive_directory_iterator& it, const path& dir_path, unsigned int opts, system::error_code* ec); +BOOST_FILESYSTEM_DECL void recursive_directory_iterator_increment(recursive_directory_iterator& it, system::error_code* ec); +BOOST_FILESYSTEM_DECL void recursive_directory_iterator_pop(recursive_directory_iterator& it, system::error_code* ec); + +} // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// recursive_directory_iterator // +// // +//--------------------------------------------------------------------------------------// + +class recursive_directory_iterator : + public boost::iterator_facade< + recursive_directory_iterator, + directory_entry, + boost::single_pass_traversal_tag + > +{ + friend class boost::iterator_core_access; + + friend BOOST_FILESYSTEM_DECL void detail::recursive_directory_iterator_construct(recursive_directory_iterator& it, const path& dir_path, unsigned int opts, system::error_code* ec); + friend BOOST_FILESYSTEM_DECL void detail::recursive_directory_iterator_increment(recursive_directory_iterator& it, system::error_code* ec); + friend BOOST_FILESYSTEM_DECL void detail::recursive_directory_iterator_pop(recursive_directory_iterator& it, system::error_code* ec); + +public: + recursive_directory_iterator() BOOST_NOEXCEPT {} // creates the "end" iterator + + explicit recursive_directory_iterator(const path& dir_path) + { + detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(directory_options::none), 0); + } + + recursive_directory_iterator(const path& dir_path, system::error_code& ec) + { + detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(directory_options::none), &ec); + } + + recursive_directory_iterator(const path& dir_path, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts) + { + detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), 0); + } + + recursive_directory_iterator(const path& dir_path, BOOST_SCOPED_ENUM_NATIVE(directory_options) opts, system::error_code& ec) + { + detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), &ec); + } + +#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) + // Deprecated constructors + recursive_directory_iterator(const path& dir_path, BOOST_SCOPED_ENUM_NATIVE(symlink_option) opts) + { + detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), 0); + } + + recursive_directory_iterator(const path& dir_path, BOOST_SCOPED_ENUM_NATIVE(symlink_option) opts, system::error_code& ec) BOOST_NOEXCEPT + { + detail::recursive_directory_iterator_construct(*this, dir_path, static_cast< unsigned int >(opts), &ec); + } +#endif // BOOST_FILESYSTEM_NO_DEPRECATED + + BOOST_DEFAULTED_FUNCTION(recursive_directory_iterator(recursive_directory_iterator const& that), : m_imp(that.m_imp) {}) + BOOST_DEFAULTED_FUNCTION(recursive_directory_iterator& operator= (recursive_directory_iterator const& that), { m_imp = that.m_imp; return *this; }) + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + recursive_directory_iterator(recursive_directory_iterator&& that) BOOST_NOEXCEPT : + m_imp(std::move(that.m_imp)) + { + } + + recursive_directory_iterator& operator= (recursive_directory_iterator&& that) BOOST_NOEXCEPT + { + m_imp = std::move(that.m_imp); + return *this; + } +#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + + recursive_directory_iterator& increment(system::error_code& ec) BOOST_NOEXCEPT + { + detail::recursive_directory_iterator_increment(*this, &ec); + return *this; + } + + int depth() const BOOST_NOEXCEPT + { + BOOST_ASSERT_MSG(!is_end(), "depth() on end recursive_directory_iterator"); + return static_cast< int >(m_imp->m_stack.size() - 1u); + } + + bool recursion_pending() const BOOST_NOEXCEPT + { + BOOST_ASSERT_MSG(!is_end(), "recursion_pending() on end recursive_directory_iterator"); + return (m_imp->m_options & static_cast< unsigned int >(directory_options::_detail_no_push)) == 0u; + } + +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED + int level() const BOOST_NOEXCEPT { return depth(); } + bool no_push_pending() const BOOST_NOEXCEPT { return !recursion_pending(); } + bool no_push_request() const BOOST_NOEXCEPT { return !recursion_pending(); } +#endif + + void pop() + { + detail::recursive_directory_iterator_pop(*this, 0); + } + + void pop(system::error_code& ec) BOOST_NOEXCEPT + { + detail::recursive_directory_iterator_pop(*this, &ec); + } + + void disable_recursion_pending(bool value = true) BOOST_NOEXCEPT + { + BOOST_ASSERT_MSG(!is_end(), "disable_recursion_pending() on end recursive_directory_iterator"); + if (value) + m_imp->m_options |= static_cast< unsigned int >(directory_options::_detail_no_push); + else + m_imp->m_options &= ~static_cast< unsigned int >(directory_options::_detail_no_push); + } + +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED + void no_push(bool value = true) BOOST_NOEXCEPT { disable_recursion_pending(value); } +#endif + + file_status status() const + { + BOOST_ASSERT_MSG(!is_end(), "status() on end recursive_directory_iterator"); + return m_imp->m_stack.back()->status(); + } + + file_status symlink_status() const + { + BOOST_ASSERT_MSG(!is_end(), "symlink_status() on end recursive_directory_iterator"); + return m_imp->m_stack.back()->symlink_status(); + } + +private: + boost::iterator_facade< + recursive_directory_iterator, + directory_entry, + boost::single_pass_traversal_tag + >::reference dereference() const + { + BOOST_ASSERT_MSG(!is_end(), "dereference of end recursive_directory_iterator"); + return *m_imp->m_stack.back(); + } + + void increment() { detail::recursive_directory_iterator_increment(*this, 0); } + + bool equal(const recursive_directory_iterator& rhs) const BOOST_NOEXCEPT + { + return m_imp == rhs.m_imp || (is_end() && rhs.is_end()); + } + + bool is_end() const BOOST_NOEXCEPT + { + // Note: The check for m_stack.empty() is needed because the iterator can be copied and the copy + // can be incremented to end while the original iterator still refers to the same recur_dir_itr_imp. + return !m_imp || m_imp->m_stack.empty(); + } + +private: + // intrusive_ptr provides the shallow-copy semantics required for single pass iterators + // (i.e. InputIterators). The end iterator is indicated by is_end(). + boost::intrusive_ptr< detail::recur_dir_itr_imp > m_imp; +}; + +#if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) +typedef recursive_directory_iterator wrecursive_directory_iterator; +#endif + +// enable recursive directory iterator C++11 range-base for statement use ----------// + +// begin() and end() are only used by a range-based for statement in the context of +// auto - thus the top-level const is stripped - so returning const is harmless and +// emphasizes begin() is just a pass through. +inline const recursive_directory_iterator& begin(const recursive_directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline recursive_directory_iterator end(const recursive_directory_iterator&) BOOST_NOEXCEPT { return recursive_directory_iterator(); } + +// enable C++14 generic accessors for range const iterators +inline const recursive_directory_iterator& cbegin(const recursive_directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline recursive_directory_iterator cend(const recursive_directory_iterator&) BOOST_NOEXCEPT { return recursive_directory_iterator(); } + +// enable recursive directory iterator BOOST_FOREACH -------------------------------// + +inline recursive_directory_iterator& range_begin(recursive_directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline recursive_directory_iterator range_begin(const recursive_directory_iterator& iter) BOOST_NOEXCEPT { return iter; } +inline recursive_directory_iterator range_end(recursive_directory_iterator&) BOOST_NOEXCEPT { return recursive_directory_iterator(); } +inline recursive_directory_iterator range_end(const recursive_directory_iterator&) BOOST_NOEXCEPT { return recursive_directory_iterator(); } + +} // namespace filesystem + +// namespace boost template specializations +template<> +struct range_mutable_iterator<boost::filesystem::recursive_directory_iterator, void> +{ + typedef boost::filesystem::recursive_directory_iterator type; +}; +template<> +struct range_const_iterator<boost::filesystem::recursive_directory_iterator, void> +{ + typedef boost::filesystem::recursive_directory_iterator type; +}; + +} // namespace boost + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_DIRECTORY_HPP diff --git a/ThirdParty/boost/filesystem/exception.hpp b/ThirdParty/boost/filesystem/exception.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0560f686cd1b6c6f5101053d93e74bdbc4f51678 --- /dev/null +++ b/ThirdParty/boost/filesystem/exception.hpp @@ -0,0 +1,100 @@ +// boost/filesystem/exception.hpp -----------------------------------------------------// + +// Copyright Beman Dawes 2003 +// Copyright Andrey Semashev 2019 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#ifndef BOOST_FILESYSTEM3_EXCEPTION_HPP +#define BOOST_FILESYSTEM3_EXCEPTION_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> + +#include <string> +#include <boost/system/error_code.hpp> +#include <boost/system/system_error.hpp> +#include <boost/smart_ptr/intrusive_ptr.hpp> +#include <boost/smart_ptr/intrusive_ref_counter.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +#if defined(BOOST_MSVC) +#pragma warning(push) +// 'm_A' : class 'A' needs to have dll-interface to be used by clients of class 'B' +#pragma warning(disable: 4251) +// non dll-interface class 'A' used as base for dll-interface class 'B' +#pragma warning(disable: 4275) +#endif + +namespace boost { +namespace filesystem { + +//--------------------------------------------------------------------------------------// +// // +// class filesystem_error // +// // +//--------------------------------------------------------------------------------------// + +class BOOST_FILESYSTEM_DECL filesystem_error : + public system::system_error +{ + // see http://www.boost.org/more/error_handling.html for design rationale + +public: + filesystem_error(const std::string& what_arg, system::error_code ec); + filesystem_error(const std::string& what_arg, const path& path1_arg, system::error_code ec); + filesystem_error(const std::string& what_arg, const path& path1_arg, const path& path2_arg, system::error_code ec); + + filesystem_error(filesystem_error const& that); + filesystem_error& operator= (filesystem_error const& that); + + ~filesystem_error() BOOST_NOEXCEPT_OR_NOTHROW; + + const path& path1() const BOOST_NOEXCEPT + { + return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path(); + } + const path& path2() const BOOST_NOEXCEPT + { + return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path(); + } + + const char* what() const BOOST_NOEXCEPT_OR_NOTHROW; + +private: + static const path& get_empty_path() BOOST_NOEXCEPT; + +private: + struct impl : + public boost::intrusive_ref_counter< impl > + { + path m_path1; // may be empty() + path m_path2; // may be empty() + std::string m_what; // not built until needed + + BOOST_DEFAULTED_FUNCTION(impl(), {}) + explicit impl(path const& path1) : m_path1(path1) {} + impl(path const& path1, path const& path2) : m_path1(path1), m_path2(path2) {} + }; + boost::intrusive_ptr< impl > m_imp_ptr; +}; + +} // namespace filesystem +} // namespace boost + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_EXCEPTION_HPP diff --git a/ThirdParty/boost/filesystem/file_status.hpp b/ThirdParty/boost/filesystem/file_status.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7e4f0b4d20946196da4570cfe5f21f66f6d4e5c1 --- /dev/null +++ b/ThirdParty/boost/filesystem/file_status.hpp @@ -0,0 +1,237 @@ +// boost/filesystem/file_status.hpp --------------------------------------------------// + +// Copyright Beman Dawes 2002-2009 +// Copyright Jan Langer 2002 +// Copyright Dietmar Kuehl 2001 +// Copyright Vladimir Prus 2002 +// Copyright Andrey Semashev 2019 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM3_FILE_STATUS_HPP +#define BOOST_FILESYSTEM3_FILE_STATUS_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/config.hpp> + +#include <boost/detail/bitmask.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +//--------------------------------------------------------------------------------------// + +namespace boost { +namespace filesystem { + +//--------------------------------------------------------------------------------------// +// file_type // +//--------------------------------------------------------------------------------------// + +enum file_type +{ + status_error, +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + status_unknown = status_error, +# endif + file_not_found, + regular_file, + directory_file, + // the following may not apply to some operating systems or file systems + symlink_file, + block_file, + character_file, + fifo_file, + socket_file, + reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink + type_unknown, // file does exist, but isn't one of the above types or + // we don't have strong enough permission to find its type + + _detail_directory_symlink // internal use only; never exposed to users +}; + +//--------------------------------------------------------------------------------------// +// perms // +//--------------------------------------------------------------------------------------// + +enum perms +{ + no_perms = 0, // file_not_found is no_perms rather than perms_not_known + + // POSIX equivalent macros given in comments. + // Values are from POSIX and are given in octal per the POSIX standard. + + // permission bits + + owner_read = 0400, // S_IRUSR, Read permission, owner + owner_write = 0200, // S_IWUSR, Write permission, owner + owner_exe = 0100, // S_IXUSR, Execute/search permission, owner + owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner + + group_read = 040, // S_IRGRP, Read permission, group + group_write = 020, // S_IWGRP, Write permission, group + group_exe = 010, // S_IXGRP, Execute/search permission, group + group_all = 070, // S_IRWXG, Read, write, execute/search by group + + others_read = 04, // S_IROTH, Read permission, others + others_write = 02, // S_IWOTH, Write permission, others + others_exe = 01, // S_IXOTH, Execute/search permission, others + others_all = 07, // S_IRWXO, Read, write, execute/search by others + + all_all = 0777, // owner_all|group_all|others_all + + // other POSIX bits + + set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution + set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution + sticky_bit = 01000, // S_ISVTX, + // (POSIX XSI) On directories, restricted deletion flag + // (V7) 'sticky bit': save swapped text even after use + // (SunOS) On non-directories: don't cache this file + // (SVID-v4.2) On directories: restricted deletion flag + // Also see http://en.wikipedia.org/wiki/Sticky_bit + + perms_mask = 07777, // all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit + + perms_not_known = 0xFFFF, // present when directory_entry cache not loaded + + // options for permissions() function + + add_perms = 0x1000, // adds the given permission bits to the current bits + remove_perms = 0x2000, // removes the given permission bits from the current bits; + // choose add_perms or remove_perms, not both; if neither add_perms + // nor remove_perms is given, replace the current bits with + // the given bits. + + symlink_perms = 0x4000, // on POSIX, don't resolve symlinks; implied on Windows + + // BOOST_BITMASK op~ casts to int32_least_t, producing invalid enum values + _detail_extend_perms_32_1 = 0x7fffffff, + _detail_extend_perms_32_2 = -0x7fffffff-1 +}; + +BOOST_BITMASK(perms) + +//--------------------------------------------------------------------------------------// +// file_status // +//--------------------------------------------------------------------------------------// + +class file_status +{ +public: + BOOST_CONSTEXPR file_status() BOOST_NOEXCEPT : + m_value(status_error), m_perms(perms_not_known) + { + } + explicit BOOST_CONSTEXPR file_status(file_type v) BOOST_NOEXCEPT : + m_value(v), m_perms(perms_not_known) + { + } + BOOST_CONSTEXPR file_status(file_type v, perms prms) BOOST_NOEXCEPT : + m_value(v), m_perms(prms) + { + } + + // As of October 2015 the interaction between noexcept and =default is so troublesome + // for VC++, GCC, and probably other compilers, that =default is not used with noexcept + // functions. GCC is not even consistent for the same release on different platforms. + + BOOST_CONSTEXPR file_status(const file_status& rhs) BOOST_NOEXCEPT : + m_value(rhs.m_value), m_perms(rhs.m_perms) + { + } + BOOST_CXX14_CONSTEXPR file_status& operator=(const file_status& rhs) BOOST_NOEXCEPT + { + m_value = rhs.m_value; + m_perms = rhs.m_perms; + return *this; + } + +# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + // Note: std::move is not constexpr in C++11, that's why we're not using it here + BOOST_CONSTEXPR file_status(file_status&& rhs) BOOST_NOEXCEPT : + m_value(static_cast< file_type&& >(rhs.m_value)), m_perms(static_cast< enum perms&& >(rhs.m_perms)) + { + } + BOOST_CXX14_CONSTEXPR file_status& operator=(file_status&& rhs) BOOST_NOEXCEPT + { + m_value = static_cast< file_type&& >(rhs.m_value); + m_perms = static_cast< enum perms&& >(rhs.m_perms); + return *this; + } +# endif + + // observers + BOOST_CONSTEXPR file_type type() const BOOST_NOEXCEPT { return m_value; } + BOOST_CONSTEXPR perms permissions() const BOOST_NOEXCEPT { return m_perms; } + + // modifiers + BOOST_CXX14_CONSTEXPR void type(file_type v) BOOST_NOEXCEPT { m_value = v; } + BOOST_CXX14_CONSTEXPR void permissions(perms prms) BOOST_NOEXCEPT { m_perms = prms; } + + BOOST_CONSTEXPR bool operator==(const file_status& rhs) const BOOST_NOEXCEPT + { + return type() == rhs.type() && permissions() == rhs.permissions(); + } + BOOST_CONSTEXPR bool operator!=(const file_status& rhs) const BOOST_NOEXCEPT + { + return !(*this == rhs); + } + +private: + file_type m_value; + enum perms m_perms; +}; + +inline BOOST_CONSTEXPR bool type_present(file_status f) BOOST_NOEXCEPT +{ + return f.type() != status_error; +} +inline BOOST_CONSTEXPR bool permissions_present(file_status f) BOOST_NOEXCEPT +{ + return f.permissions() != perms_not_known; +} +inline BOOST_CONSTEXPR bool status_known(file_status f) BOOST_NOEXCEPT +{ + return filesystem::type_present(f) && filesystem::permissions_present(f); +} +inline BOOST_CONSTEXPR bool exists(file_status f) BOOST_NOEXCEPT +{ + return f.type() != status_error && f.type() != file_not_found; +} +inline BOOST_CONSTEXPR bool is_regular_file(file_status f) BOOST_NOEXCEPT +{ + return f.type() == regular_file; +} +inline BOOST_CONSTEXPR bool is_directory(file_status f) BOOST_NOEXCEPT +{ + return f.type() == directory_file; +} +inline BOOST_CONSTEXPR bool is_symlink(file_status f) BOOST_NOEXCEPT +{ + return f.type() == symlink_file; +} +inline BOOST_CONSTEXPR bool is_other(file_status f) BOOST_NOEXCEPT +{ + return filesystem::exists(f) && !filesystem::is_regular_file(f) + && !filesystem::is_directory(f) && !filesystem::is_symlink(f); +} + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED +inline bool is_regular(file_status f) BOOST_NOEXCEPT { return filesystem::is_regular_file(f); } +# endif + +} // namespace filesystem +} // namespace boost + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_FILE_STATUS_HPP diff --git a/ThirdParty/boost/filesystem/operations.hpp b/ThirdParty/boost/filesystem/operations.hpp index 74e47edbb8fd3e6b72e81d77bc0835f4ec5069f8..2838343cbe9e4b1c6d2597ea089d1ff949d42ea1 100644 --- a/ThirdParty/boost/filesystem/operations.hpp +++ b/ThirdParty/boost/filesystem/operations.hpp @@ -23,425 +23,121 @@ #include <boost/filesystem/config.hpp> #include <boost/filesystem/path.hpp> +#include <boost/filesystem/file_status.hpp> + +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +// These includes are left for backward compatibility and should be included directly by users, as needed +#include <boost/filesystem/exception.hpp> +#include <boost/filesystem/directory.hpp> +#endif #include <boost/core/scoped_enum.hpp> -#include <boost/detail/bitmask.hpp> #include <boost/system/error_code.hpp> -#include <boost/system/system_error.hpp> -#include <boost/smart_ptr/intrusive_ptr.hpp> -#include <boost/smart_ptr/intrusive_ref_counter.hpp> -#include <boost/type_traits/is_same.hpp> #include <boost/cstdint.hpp> -#include <boost/assert.hpp> #include <string> -#include <utility> // std::move #include <ctime> -#include <vector> -#include <stack> -#include <new> // std::nothrow, std::bad_alloc - -#ifdef BOOST_WINDOWS_API -# include <fstream> -#endif #include <boost/config/abi_prefix.hpp> // must be the last #include //--------------------------------------------------------------------------------------// -namespace boost -{ - namespace filesystem - { - - //--------------------------------------------------------------------------------------// - // // - // class filesystem_error // - // // - //--------------------------------------------------------------------------------------// - - class BOOST_SYMBOL_VISIBLE filesystem_error : - public system::system_error - { - // see http://www.boost.org/more/error_handling.html for design rationale - - // all functions are inline to avoid issues with crossing dll boundaries - - // functions previously throw() are now BOOST_NOEXCEPT_OR_NOTHROW - // functions previously without throw() are now BOOST_NOEXCEPT - - public: - // compiler generates copy constructor and copy assignment - - filesystem_error( - const std::string & what_arg, system::error_code ec) BOOST_NOEXCEPT : - system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new impl()); - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error( - const std::string & what_arg, const path& path1_arg, - system::error_code ec) BOOST_NOEXCEPT : - system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new impl(path1_arg)); - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error( - const std::string & what_arg, const path& path1_arg, - const path& path2_arg, system::error_code ec) BOOST_NOEXCEPT : - system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new impl(path1_arg, path2_arg)); - } - catch (...) { m_imp_ptr.reset(); } - } - - ~filesystem_error() BOOST_NOEXCEPT_OR_NOTHROW {} - - const path& path1() const BOOST_NOEXCEPT - { - static const path empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path; - } - const path& path2() const BOOST_NOEXCEPT - { - static const path empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path; - } - - const char* what() const BOOST_NOEXCEPT_OR_NOTHROW - { - if (!m_imp_ptr.get()) - return system::system_error::what(); - - try - { - if (m_imp_ptr->m_what.empty()) - { - m_imp_ptr->m_what = system::system_error::what(); - if (!m_imp_ptr->m_path1.empty()) - { - m_imp_ptr->m_what += ": \""; - m_imp_ptr->m_what += m_imp_ptr->m_path1.string(); - m_imp_ptr->m_what += "\""; - } - if (!m_imp_ptr->m_path2.empty()) - { - m_imp_ptr->m_what += ", \""; - m_imp_ptr->m_what += m_imp_ptr->m_path2.string(); - m_imp_ptr->m_what += "\""; - } - } - return m_imp_ptr->m_what.c_str(); - } - catch (...) - { - return system::system_error::what(); - } - } - - private: - struct impl : - public boost::intrusive_ref_counter< impl > - { - path m_path1; // may be empty() - path m_path2; // may be empty() - std::string m_what; // not built until needed - - BOOST_DEFAULTED_FUNCTION(impl(), {}) - explicit impl(path const& path1) : m_path1(path1) {} - impl(path const& path1, path const& path2) : m_path1(path1), m_path2(path2) {} - }; - boost::intrusive_ptr< impl > m_imp_ptr; - }; - -//--------------------------------------------------------------------------------------// -// file_type // -//--------------------------------------------------------------------------------------// - - enum file_type - { - status_error, -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - status_unknown = status_error, -# endif - file_not_found, - regular_file, - directory_file, - // the following may not apply to some operating systems or file systems - symlink_file, - block_file, - character_file, - fifo_file, - socket_file, - reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink - type_unknown, // file does exist, but isn't one of the above types or - // we don't have strong enough permission to find its type - - _detail_directory_symlink // internal use only; never exposed to users - }; - -//--------------------------------------------------------------------------------------// -// perms // -//--------------------------------------------------------------------------------------// - - enum perms - { - no_perms = 0, // file_not_found is no_perms rather than perms_not_known - - // POSIX equivalent macros given in comments. - // Values are from POSIX and are given in octal per the POSIX standard. - - // permission bits - - owner_read = 0400, // S_IRUSR, Read permission, owner - owner_write = 0200, // S_IWUSR, Write permission, owner - owner_exe = 0100, // S_IXUSR, Execute/search permission, owner - owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner - - group_read = 040, // S_IRGRP, Read permission, group - group_write = 020, // S_IWGRP, Write permission, group - group_exe = 010, // S_IXGRP, Execute/search permission, group - group_all = 070, // S_IRWXG, Read, write, execute/search by group - - others_read = 04, // S_IROTH, Read permission, others - others_write = 02, // S_IWOTH, Write permission, others - others_exe = 01, // S_IXOTH, Execute/search permission, others - others_all = 07, // S_IRWXO, Read, write, execute/search by others - - all_all = 0777, // owner_all|group_all|others_all - - // other POSIX bits - - set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution - set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution - sticky_bit = 01000, // S_ISVTX, - // (POSIX XSI) On directories, restricted deletion flag - // (V7) 'sticky bit': save swapped text even after use - // (SunOS) On non-directories: don't cache this file - // (SVID-v4.2) On directories: restricted deletion flag - // Also see http://en.wikipedia.org/wiki/Sticky_bit - - perms_mask = 07777, // all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit - - perms_not_known = 0xFFFF, // present when directory_entry cache not loaded - - // options for permissions() function - - add_perms = 0x1000, // adds the given permission bits to the current bits - remove_perms = 0x2000, // removes the given permission bits from the current bits; - // choose add_perms or remove_perms, not both; if neither add_perms - // nor remove_perms is given, replace the current bits with - // the given bits. - - symlink_perms = 0x4000, // on POSIX, don't resolve symlinks; implied on Windows - - // BOOST_BITMASK op~ casts to int32_least_t, producing invalid enum values - _detail_extend_perms_32_1 = 0x7fffffff, - _detail_extend_perms_32_2 = -0x7fffffff-1 - }; - - BOOST_BITMASK(perms) - -//--------------------------------------------------------------------------------------// -// file_status // -//--------------------------------------------------------------------------------------// - - class file_status - { - public: - BOOST_CONSTEXPR file_status() BOOST_NOEXCEPT : - m_value(status_error), m_perms(perms_not_known) - { - } - explicit BOOST_CONSTEXPR file_status(file_type v) BOOST_NOEXCEPT : - m_value(v), m_perms(perms_not_known) - { - } - BOOST_CONSTEXPR file_status(file_type v, perms prms) BOOST_NOEXCEPT : - m_value(v), m_perms(prms) - { - } - - // As of October 2015 the interaction between noexcept and =default is so troublesome - // for VC++, GCC, and probably other compilers, that =default is not used with noexcept - // functions. GCC is not even consistent for the same release on different platforms. - - BOOST_CONSTEXPR file_status(const file_status& rhs) BOOST_NOEXCEPT : - m_value(rhs.m_value), m_perms(rhs.m_perms) - { - } - BOOST_CXX14_CONSTEXPR file_status& operator=(const file_status& rhs) BOOST_NOEXCEPT - { - m_value = rhs.m_value; - m_perms = rhs.m_perms; - return *this; - } - -# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - // Note: std::move is not constexpr in C++11, that's why we're not using it here - BOOST_CONSTEXPR file_status(file_status&& rhs) BOOST_NOEXCEPT : - m_value(static_cast< file_type&& >(rhs.m_value)), m_perms(static_cast< enum perms&& >(rhs.m_perms)) - { - } - BOOST_CXX14_CONSTEXPR file_status& operator=(file_status&& rhs) BOOST_NOEXCEPT - { - m_value = std::move(rhs.m_value); - m_perms = std::move(rhs.m_perms); - return *this; - } -# endif +namespace boost { +namespace filesystem { - // observers - BOOST_CONSTEXPR file_type type() const BOOST_NOEXCEPT { return m_value; } - BOOST_CONSTEXPR perms permissions() const BOOST_NOEXCEPT { return m_perms; } - - // modifiers - BOOST_CXX14_CONSTEXPR void type(file_type v) BOOST_NOEXCEPT { m_value = v; } - BOOST_CXX14_CONSTEXPR void permissions(perms prms) BOOST_NOEXCEPT { m_perms = prms; } - - BOOST_CONSTEXPR bool operator==(const file_status& rhs) const BOOST_NOEXCEPT - { - return type() == rhs.type() && - permissions() == rhs.permissions(); - } - BOOST_CONSTEXPR bool operator!=(const file_status& rhs) const BOOST_NOEXCEPT - { - return !(*this == rhs); - } - - private: - file_type m_value; - enum perms m_perms; - }; - - inline BOOST_CONSTEXPR bool type_present(file_status f) BOOST_NOEXCEPT - { return f.type() != status_error; } - inline BOOST_CONSTEXPR bool permissions_present(file_status f) BOOST_NOEXCEPT - {return f.permissions() != perms_not_known;} - inline BOOST_CONSTEXPR bool status_known(file_status f) BOOST_NOEXCEPT - { return filesystem::type_present(f) && filesystem::permissions_present(f); } - inline BOOST_CONSTEXPR bool exists(file_status f) BOOST_NOEXCEPT - { return f.type() != status_error - && f.type() != file_not_found; } - inline BOOST_CONSTEXPR bool is_regular_file(file_status f) BOOST_NOEXCEPT - { return f.type() == regular_file; } - inline BOOST_CONSTEXPR bool is_directory(file_status f) BOOST_NOEXCEPT - { return f.type() == directory_file; } - inline BOOST_CONSTEXPR bool is_symlink(file_status f) BOOST_NOEXCEPT - { return f.type() == symlink_file; } - inline BOOST_CONSTEXPR bool is_other(file_status f) BOOST_NOEXCEPT - { return filesystem::exists(f) && !filesystem::is_regular_file(f) - && !filesystem::is_directory(f) && !filesystem::is_symlink(f); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular(file_status f) BOOST_NOEXCEPT { return f.type() == regular_file; } -# endif - - struct space_info - { - // all values are byte counts - boost::uintmax_t capacity; - boost::uintmax_t free; // <= capacity - boost::uintmax_t available; // <= free - }; +struct space_info +{ + // all values are byte counts + boost::uintmax_t capacity; + boost::uintmax_t free; // <= capacity + boost::uintmax_t available; // <= free +}; - BOOST_SCOPED_ENUM_DECLARE_BEGIN(copy_option) - {none=0, fail_if_exists = none, overwrite_if_exists} - BOOST_SCOPED_ENUM_DECLARE_END(copy_option) +BOOST_SCOPED_ENUM_DECLARE_BEGIN(copy_option) + {none=0, fail_if_exists = none, overwrite_if_exists} +BOOST_SCOPED_ENUM_DECLARE_END(copy_option) //--------------------------------------------------------------------------------------// // implementation details // //--------------------------------------------------------------------------------------// - namespace detail - { - // We cannot pass a BOOST_SCOPED_ENUM to a compled function because it will result - // in an undefined reference if the library is compled with -std=c++0x but the use - // is compiled in C++03 mode, or vice versa. See tickets 6124, 6779, 10038. - enum copy_option {none=0, fail_if_exists = none, overwrite_if_exists}; - - BOOST_FILESYSTEM_DECL - file_status status(const path&p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - file_status symlink_status(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool is_empty(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path initial_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path canonical(const path& p, const path& base, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy(const path& from, const path& to, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_directory(const path& from, const path& to, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_file(const path& from, const path& to, // See ticket #2925 - detail::copy_option option, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool create_directories(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool create_directory(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_directory_symlink(const path& to, const path& from, - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_hard_link(const path& to, const path& from, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_symlink(const path& to, const path& from, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path current_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void current_path(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool equivalent(const path& p1, const path& p2, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t file_size(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - std::time_t last_write_time(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void last_write_time(const path& p, const std::time_t new_time, - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void permissions(const path& p, perms prms, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path read_symlink(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path relative(const path& p, const path& base, system::error_code* ec = 0); - BOOST_FILESYSTEM_DECL - bool remove(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t remove_all(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void rename(const path& old_p, const path& new_p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void resize_file(const path& p, uintmax_t size, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - space_info space(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path system_complete(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path temp_directory_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path unique_path(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path weakly_canonical(const path& p, system::error_code* ec = 0); - } // namespace detail +namespace detail { + +// We cannot pass a BOOST_SCOPED_ENUM to a compled function because it will result +// in an undefined reference if the library is compled with -std=c++0x but the use +// is compiled in C++03 mode, or vice versa. See tickets 6124, 6779, 10038. +enum copy_option {none=0, fail_if_exists = none, overwrite_if_exists}; + +BOOST_FILESYSTEM_DECL +file_status status(const path&p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +file_status symlink_status(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +bool is_empty(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path initial_path(system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path canonical(const path& p, const path& base, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void copy(const path& from, const path& to, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void copy_directory(const path& from, const path& to, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void copy_file(const path& from, const path& to, // See ticket #2925 + detail::copy_option option, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +bool create_directories(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +bool create_directory(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void create_directory_symlink(const path& to, const path& from, + system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void create_hard_link(const path& to, const path& from, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void create_symlink(const path& to, const path& from, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path current_path(system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void current_path(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +bool equivalent(const path& p1, const path& p2, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +boost::uintmax_t file_size(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +std::time_t last_write_time(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void last_write_time(const path& p, const std::time_t new_time, + system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void permissions(const path& p, perms prms, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path read_symlink(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path relative(const path& p, const path& base, system::error_code* ec = 0); +BOOST_FILESYSTEM_DECL +bool remove(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +boost::uintmax_t remove_all(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void rename(const path& old_p, const path& new_p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +void resize_file(const path& p, uintmax_t size, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +space_info space(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path system_complete(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path temp_directory_path(system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path unique_path(const path& p, system::error_code* ec=0); +BOOST_FILESYSTEM_DECL +path weakly_canonical(const path& p, system::error_code* ec = 0); + +} // namespace detail //--------------------------------------------------------------------------------------// // // @@ -449,54 +145,54 @@ namespace boost // // //--------------------------------------------------------------------------------------// - inline - file_status status(const path& p) {return detail::status(p);} - inline - file_status status(const path& p, system::error_code& ec) - {return detail::status(p, &ec);} - inline - file_status symlink_status(const path& p) {return detail::symlink_status(p);} - inline - file_status symlink_status(const path& p, system::error_code& ec) - {return detail::symlink_status(p, &ec);} - inline - bool exists(const path& p) {return exists(detail::status(p));} - inline - bool exists(const path& p, system::error_code& ec) - {return exists(detail::status(p, &ec));} - inline - bool is_directory(const path& p) {return is_directory(detail::status(p));} - inline - bool is_directory(const path& p, system::error_code& ec) - {return is_directory(detail::status(p, &ec));} - inline - bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));} - inline - bool is_regular_file(const path& p, system::error_code& ec) - {return is_regular_file(detail::status(p, &ec));} - inline - bool is_other(const path& p) {return is_other(detail::status(p));} - inline - bool is_other(const path& p, system::error_code& ec) - {return is_other(detail::status(p, &ec));} - inline - bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));} - inline - bool is_symlink(const path& p, system::error_code& ec) - {return is_symlink(detail::symlink_status(p, &ec));} -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline - bool is_regular(const path& p) {return is_regular(detail::status(p));} - inline - bool is_regular(const path& p, system::error_code& ec) - {return is_regular(detail::status(p, &ec));} -# endif +inline +file_status status(const path& p) {return detail::status(p);} +inline +file_status status(const path& p, system::error_code& ec) + {return detail::status(p, &ec);} +inline +file_status symlink_status(const path& p) {return detail::symlink_status(p);} +inline +file_status symlink_status(const path& p, system::error_code& ec) + {return detail::symlink_status(p, &ec);} +inline +bool exists(const path& p) {return exists(detail::status(p));} +inline +bool exists(const path& p, system::error_code& ec) + {return exists(detail::status(p, &ec));} +inline +bool is_directory(const path& p) {return is_directory(detail::status(p));} +inline +bool is_directory(const path& p, system::error_code& ec) + {return is_directory(detail::status(p, &ec));} +inline +bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));} +inline +bool is_regular_file(const path& p, system::error_code& ec) + {return is_regular_file(detail::status(p, &ec));} +inline +bool is_other(const path& p) {return is_other(detail::status(p));} +inline +bool is_other(const path& p, system::error_code& ec) + {return is_other(detail::status(p, &ec));} +inline +bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));} +inline +bool is_symlink(const path& p, system::error_code& ec) + {return is_symlink(detail::symlink_status(p, &ec));} +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +inline +bool is_regular(const path& p) {return is_regular(detail::status(p));} +inline +bool is_regular(const path& p, system::error_code& ec) + {return is_regular(detail::status(p, &ec));} +#endif - inline - bool is_empty(const path& p) {return detail::is_empty(p);} - inline - bool is_empty(const path& p, system::error_code& ec) - {return detail::is_empty(p, &ec);} +inline +bool is_empty(const path& p) {return detail::is_empty(p);} +inline +bool is_empty(const path& p, system::error_code& ec) + {return detail::is_empty(p, &ec);} //--------------------------------------------------------------------------------------// // // @@ -505,908 +201,248 @@ namespace boost // // //--------------------------------------------------------------------------------------// - // forward declarations - path current_path(); // fwd declaration - path initial_path(); - - BOOST_FILESYSTEM_DECL - path absolute(const path& p, const path& base=current_path()); - // If base.is_absolute(), throws nothing. Thus no need for ec argument - - inline - path canonical(const path& p, const path& base=current_path()) - {return detail::canonical(p, base);} - inline - path canonical(const path& p, system::error_code& ec) - {return detail::canonical(p, current_path(), &ec);} - inline - path canonical(const path& p, const path& base, system::error_code& ec) - {return detail::canonical(p, base, &ec);} - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline - path complete(const path& p) - { - return absolute(p, initial_path()); - } - - inline - path complete(const path& p, const path& base) - { - return absolute(p, base); - } -# endif +// forward declarations +path current_path(); // fwd declaration +path initial_path(); - inline - void copy(const path& from, const path& to) {detail::copy(from, to);} - - inline - void copy(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT - {detail::copy(from, to, &ec);} - inline - void copy_directory(const path& from, const path& to) - {detail::copy_directory(from, to);} - inline - void copy_directory(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT - {detail::copy_directory(from, to, &ec);} - inline - void copy_file(const path& from, const path& to, // See ticket #2925 - BOOST_SCOPED_ENUM_NATIVE(copy_option) option) - { - detail::copy_file(from, to, static_cast<detail::copy_option>(option)); - } - inline - void copy_file(const path& from, const path& to) - { - detail::copy_file(from, to, detail::fail_if_exists); - } - inline - void copy_file(const path& from, const path& to, // See ticket #2925 - BOOST_SCOPED_ENUM_NATIVE(copy_option) option, system::error_code& ec) BOOST_NOEXCEPT - { - detail::copy_file(from, to, static_cast<detail::copy_option>(option), &ec); - } - inline - void copy_file(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT - { - detail::copy_file(from, to, detail::fail_if_exists, &ec); - } - inline - void copy_symlink(const path& existing_symlink, - const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} - - inline - void copy_symlink(const path& existing_symlink, const path& new_symlink, - system::error_code& ec) BOOST_NOEXCEPT - {detail::copy_symlink(existing_symlink, new_symlink, &ec);} - inline - bool create_directories(const path& p) {return detail::create_directories(p);} - - inline - bool create_directories(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::create_directories(p, &ec);} - inline - bool create_directory(const path& p) {return detail::create_directory(p);} - - inline - bool create_directory(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::create_directory(p, &ec);} - inline - void create_directory_symlink(const path& to, const path& from) - {detail::create_directory_symlink(to, from);} - inline - void create_directory_symlink(const path& to, const path& from, system::error_code& ec) BOOST_NOEXCEPT - {detail::create_directory_symlink(to, from, &ec);} - inline - void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);} - - inline - void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) BOOST_NOEXCEPT - {detail::create_hard_link(to, new_hard_link, &ec);} - inline - void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);} - - inline - void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) BOOST_NOEXCEPT - {detail::create_symlink(to, new_symlink, &ec);} - inline - path current_path() {return detail::current_path();} - - inline - path current_path(system::error_code& ec) BOOST_NOEXCEPT {return detail::current_path(&ec);} - - inline - void current_path(const path& p) {detail::current_path(p);} - - inline - void current_path(const path& p, system::error_code& ec) BOOST_NOEXCEPT {detail::current_path(p, &ec);} - - inline - bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);} - - inline - bool equivalent(const path& p1, const path& p2, system::error_code& ec) BOOST_NOEXCEPT - {return detail::equivalent(p1, p2, &ec);} - inline - boost::uintmax_t file_size(const path& p) {return detail::file_size(p);} - - inline - boost::uintmax_t file_size(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::file_size(p, &ec);} - inline - boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);} - - inline - boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::hard_link_count(p, &ec);} - inline - path initial_path() {return detail::initial_path();} - - inline - path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} - - template <class Path> - path initial_path() {return initial_path();} - template <class Path> - path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} - - inline - std::time_t last_write_time(const path& p) {return detail::last_write_time(p);} - - inline - std::time_t last_write_time(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::last_write_time(p, &ec);} - inline - void last_write_time(const path& p, const std::time_t new_time) - {detail::last_write_time(p, new_time);} - inline - void last_write_time(const path& p, const std::time_t new_time, - system::error_code& ec) BOOST_NOEXCEPT - {detail::last_write_time(p, new_time, &ec);} - inline - void permissions(const path& p, perms prms) - {detail::permissions(p, prms);} - inline - void permissions(const path& p, perms prms, system::error_code& ec) BOOST_NOEXCEPT - {detail::permissions(p, prms, &ec);} - - inline - path read_symlink(const path& p) {return detail::read_symlink(p);} - - inline - path read_symlink(const path& p, system::error_code& ec) - {return detail::read_symlink(p, &ec);} - inline - // For standardization, if the committee doesn't like "remove", consider "eliminate" - bool remove(const path& p) {return detail::remove(p);} - - inline - bool remove(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::remove(p, &ec);} - - inline - boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);} - - inline - boost::uintmax_t remove_all(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::remove_all(p, &ec);} - inline - void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);} - - inline - void rename(const path& old_p, const path& new_p, system::error_code& ec) BOOST_NOEXCEPT - {detail::rename(old_p, new_p, &ec);} - inline // name suggested by Scott McMurray - void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);} - - inline - void resize_file(const path& p, uintmax_t size, system::error_code& ec) BOOST_NOEXCEPT - {detail::resize_file(p, size, &ec);} - inline - path relative(const path& p, const path& base=current_path()) - {return detail::relative(p, base);} - inline - path relative(const path& p, system::error_code& ec) - {return detail::relative(p, current_path(), &ec);} - inline - path relative(const path& p, const path& base, system::error_code& ec) - {return detail::relative(p, base, &ec);} - inline - space_info space(const path& p) {return detail::space(p);} - - inline - space_info space(const path& p, system::error_code& ec) BOOST_NOEXCEPT - {return detail::space(p, &ec);} - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool symbolic_link_exists(const path& p) - { return is_symlink(filesystem::symlink_status(p)); } -# endif - - inline - path system_complete(const path& p) {return detail::system_complete(p);} - - inline - path system_complete(const path& p, system::error_code& ec) - {return detail::system_complete(p, &ec);} - inline - path temp_directory_path() {return detail::temp_directory_path();} - - inline - path temp_directory_path(system::error_code& ec) - {return detail::temp_directory_path(&ec);} - inline - path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%") - {return detail::unique_path(p);} - inline - path unique_path(const path& p, system::error_code& ec) - {return detail::unique_path(p, &ec);} - inline - path weakly_canonical(const path& p) {return detail::weakly_canonical(p);} - - inline - path weakly_canonical(const path& p, system::error_code& ec) - {return detail::weakly_canonical(p, &ec);} - -//--------------------------------------------------------------------------------------// -// // -// directory_entry // -// // -//--------------------------------------------------------------------------------------// +BOOST_FILESYSTEM_DECL +path absolute(const path& p, const path& base=current_path()); +// If base.is_absolute(), throws nothing. Thus no need for ec argument -// GCC has a problem with a member function named path within a namespace or -// sub-namespace that also has a class named path. The workaround is to always -// fully qualify the name path when it refers to the class name. +inline +path canonical(const path& p, const path& base=current_path()) + {return detail::canonical(p, base);} +inline +path canonical(const path& p, system::error_code& ec) + {return detail::canonical(p, current_path(), &ec);} +inline +path canonical(const path& p, const path& base, system::error_code& ec) + {return detail::canonical(p, base, &ec);} -class directory_entry +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +inline +path complete(const path& p) { -public: - typedef boost::filesystem::path::value_type value_type; // enables class path ctor taking directory_entry - - directory_entry() BOOST_NOEXCEPT {} - explicit directory_entry(const boost::filesystem::path& p) : - m_path(p), m_status(file_status()), m_symlink_status(file_status()) - { - } - directory_entry(const boost::filesystem::path& p, - file_status st, file_status symlink_st = file_status()) : - m_path(p), m_status(st), m_symlink_status(symlink_st) - { - } - - directory_entry(const directory_entry& rhs) : - m_path(rhs.m_path), m_status(rhs.m_status), m_symlink_status(rhs.m_symlink_status) - { - } - - directory_entry& operator=(const directory_entry& rhs) - { - m_path = rhs.m_path; - m_status = rhs.m_status; - m_symlink_status = rhs.m_symlink_status; - return *this; - } - - // As of October 2015 the interaction between noexcept and =default is so troublesome - // for VC++, GCC, and probably other compilers, that =default is not used with noexcept - // functions. GCC is not even consistent for the same release on different platforms. - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - directory_entry(directory_entry&& rhs) BOOST_NOEXCEPT : - m_path(std::move(rhs.m_path)), m_status(std::move(rhs.m_status)), m_symlink_status(std::move(rhs.m_symlink_status)) - { - } - directory_entry& operator=(directory_entry&& rhs) BOOST_NOEXCEPT - { - m_path = std::move(rhs.m_path); - m_status = std::move(rhs.m_status); - m_symlink_status = std::move(rhs.m_symlink_status); - return *this; - } -#endif - - void assign(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st = file_status()) - { - m_path = p; - m_status = st; - m_symlink_status = symlink_st; - } - - void replace_filename(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st = file_status()) - { - m_path.remove_filename(); - m_path /= p; - m_status = st; - m_symlink_status = symlink_st; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - void replace_leaf(const boost::filesystem::path& p, - file_status st, file_status symlink_st) - { replace_filename(p, st, symlink_st); } -# endif + return absolute(p, initial_path()); +} - const boost::filesystem::path& path() const BOOST_NOEXCEPT {return m_path;} - operator const boost::filesystem::path&() const BOOST_NOEXCEPT - {return m_path;} - file_status status() const {return m_get_status();} - file_status status(system::error_code& ec) const BOOST_NOEXCEPT - {return m_get_status(&ec); } - file_status symlink_status() const {return m_get_symlink_status();} - file_status symlink_status(system::error_code& ec) const BOOST_NOEXCEPT - {return m_get_symlink_status(&ec); } - - bool operator==(const directory_entry& rhs) const BOOST_NOEXCEPT {return m_path == rhs.m_path; } - bool operator!=(const directory_entry& rhs) const BOOST_NOEXCEPT {return m_path != rhs.m_path;} - bool operator< (const directory_entry& rhs) const BOOST_NOEXCEPT {return m_path < rhs.m_path;} - bool operator<=(const directory_entry& rhs) const BOOST_NOEXCEPT {return m_path <= rhs.m_path;} - bool operator> (const directory_entry& rhs) const BOOST_NOEXCEPT {return m_path > rhs.m_path;} - bool operator>=(const directory_entry& rhs) const BOOST_NOEXCEPT {return m_path >= rhs.m_path;} - -private: - BOOST_FILESYSTEM_DECL file_status m_get_status(system::error_code* ec=0) const; - BOOST_FILESYSTEM_DECL file_status m_get_symlink_status(system::error_code* ec=0) const; - -private: - boost::filesystem::path m_path; - mutable file_status m_status; // stat()-like - mutable file_status m_symlink_status; // lstat()-like -}; // directory_entry - - -//--------------------------------------------------------------------------------------// -// // -// directory_entry overloads // -// // -//--------------------------------------------------------------------------------------// - -// Without these functions, calling (for example) 'is_directory' with a 'directory_entry' results in: -// - a conversion to 'path' using 'operator const boost::filesystem::path&()', -// - then a call to 'is_directory(const path& p)' which recomputes the status with 'detail::status(p)'. -// -// These functions avoid a costly recomputation of the status if one calls 'is_directory(e)' instead of 'is_directory(e.status)' - -inline file_status status (const directory_entry& e) BOOST_NOEXCEPT { return e.status(); } -inline bool type_present (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::type_present(e.status()); } -inline bool status_known (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::status_known(e.status()); } -inline bool exists (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::exists(e.status()); } -inline bool is_regular_file(const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_regular_file(e.status()); } -inline bool is_directory (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_directory(e.status()); } -inline bool is_symlink (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_symlink(e.status()); } -inline bool is_other (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_other(e.status()); } -#ifndef BOOST_FILESYSTEM_NO_DEPRECATED -inline bool is_regular (const directory_entry& e) BOOST_NOEXCEPT { return filesystem::is_regular(e.status()); } +inline +path complete(const path& p, const path& base) +{ + return absolute(p, base); +} #endif -//--------------------------------------------------------------------------------------// -// // -// directory_iterator helpers // -// // -//--------------------------------------------------------------------------------------// - -class directory_iterator; - -namespace detail +inline +void copy(const path& from, const path& to) {detail::copy(from, to);} + +inline +void copy(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT + {detail::copy(from, to, &ec);} +inline +void copy_directory(const path& from, const path& to) + {detail::copy_directory(from, to);} +inline +void copy_directory(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT + {detail::copy_directory(from, to, &ec);} +inline +void copy_file(const path& from, const path& to, // See ticket #2925 + BOOST_SCOPED_ENUM_NATIVE(copy_option) option) { - BOOST_FILESYSTEM_DECL - system::error_code dir_itr_close(// never throws() - void *& handle -# if defined(BOOST_POSIX_API) - , void *& buffer -# endif - ); - - struct dir_itr_imp : - public boost::intrusive_ref_counter< dir_itr_imp > - { - directory_entry dir_entry; - void* handle; - -# ifdef BOOST_POSIX_API - void* buffer; // see dir_itr_increment implementation -# endif - - dir_itr_imp() BOOST_NOEXCEPT : handle(0) -# ifdef BOOST_POSIX_API - , buffer(0) -# endif - {} - - ~dir_itr_imp() BOOST_NOEXCEPT - { - dir_itr_close(handle -# if defined(BOOST_POSIX_API) - , buffer -# endif - ); - } - }; - - // see path::iterator: comment below - BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec); - BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, - system::error_code* ec); - -} // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// directory_iterator // -// // -//--------------------------------------------------------------------------------------// - - class directory_iterator : - public boost::iterator_facade< - directory_iterator, - directory_entry, - boost::single_pass_traversal_tag - > - { - public: - - directory_iterator() BOOST_NOEXCEPT {} // creates the "end" iterator - - // iterator_facade derived classes don't seem to like implementations in - // separate translation unit dll's, so forward to detail functions - explicit directory_iterator(const path& p) : - m_imp(new detail::dir_itr_imp()) - { - detail::directory_iterator_construct(*this, p, 0); - } - - directory_iterator(const path& p, system::error_code& ec) BOOST_NOEXCEPT : - m_imp(new (std::nothrow) detail::dir_itr_imp()) - { - if (BOOST_UNLIKELY(!m_imp)) - { - ec = make_error_code(system::errc::not_enough_memory); - return; - } - - detail::directory_iterator_construct(*this, p, &ec); - } - - BOOST_DEFAULTED_FUNCTION(directory_iterator(directory_iterator const& that), : m_imp(that.m_imp) {}) - BOOST_DEFAULTED_FUNCTION(directory_iterator& operator= (directory_iterator const& that), { m_imp = that.m_imp; return *this; }) - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - directory_iterator(directory_iterator&& that) BOOST_NOEXCEPT : - m_imp(std::move(that.m_imp)) - { - } - - directory_iterator& operator= (directory_iterator&& that) BOOST_NOEXCEPT - { - m_imp = std::move(that.m_imp); - return *this; - } -#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - - directory_iterator& increment(system::error_code& ec) BOOST_NOEXCEPT - { - detail::directory_iterator_increment(*this, &ec); - return *this; - } - - private: - friend struct detail::dir_itr_imp; - friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec); - friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, - system::error_code* ec); - - // intrusive_ptr provides the shallow-copy semantics required for single pass iterators - // (i.e. InputIterators). The end iterator is indicated by !m_imp || !m_imp->handle - boost::intrusive_ptr< detail::dir_itr_imp > m_imp; - - friend class boost::iterator_core_access; - - boost::iterator_facade< - directory_iterator, - directory_entry, - boost::single_pass_traversal_tag - >::reference dereference() const - { - BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator"); - return m_imp->dir_entry; - } - - void increment() { detail::directory_iterator_increment(*this, 0); } - - bool equal(const directory_iterator& rhs) const - { - return m_imp == rhs.m_imp - || (!m_imp && rhs.m_imp && !rhs.m_imp->handle) - || (!rhs.m_imp && m_imp && !m_imp->handle); - } - }; // directory_iterator - - // enable directory_iterator C++11 range-based for statement use --------------------// - - // begin() and end() are only used by a range-based for statement in the context of - // auto - thus the top-level const is stripped - so returning const is harmless and - // emphasizes begin() is just a pass through. - inline - const directory_iterator& begin(const directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - directory_iterator end(const directory_iterator&) BOOST_NOEXCEPT - {return directory_iterator();} - - // enable C++14 generic accessors for range const iterators - inline - const directory_iterator& cbegin(const directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - directory_iterator cend(const directory_iterator&) BOOST_NOEXCEPT - {return directory_iterator();} - - // enable directory_iterator BOOST_FOREACH -----------------------------------------// - - inline - directory_iterator& range_begin(directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - directory_iterator range_begin(const directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - directory_iterator range_end(directory_iterator&) BOOST_NOEXCEPT - {return directory_iterator();} - inline - directory_iterator range_end(const directory_iterator&) BOOST_NOEXCEPT - {return directory_iterator();} - } // namespace filesystem - - // namespace boost template specializations - template<typename C, typename Enabler> - struct range_mutable_iterator; - - template<> - struct range_mutable_iterator<boost::filesystem::directory_iterator, void> - { typedef boost::filesystem::directory_iterator type; }; - - template<typename C, typename Enabler> - struct range_const_iterator; - - template<> - struct range_const_iterator<boost::filesystem::directory_iterator, void> - { typedef boost::filesystem::directory_iterator type; }; - -namespace filesystem + detail::copy_file(from, to, static_cast<detail::copy_option>(option)); +} +inline +void copy_file(const path& from, const path& to) { + detail::copy_file(from, to, detail::fail_if_exists); +} +inline +void copy_file(const path& from, const path& to, // See ticket #2925 + BOOST_SCOPED_ENUM_NATIVE(copy_option) option, system::error_code& ec) BOOST_NOEXCEPT +{ + detail::copy_file(from, to, static_cast<detail::copy_option>(option), &ec); +} +inline +void copy_file(const path& from, const path& to, system::error_code& ec) BOOST_NOEXCEPT +{ + detail::copy_file(from, to, detail::fail_if_exists, &ec); +} +inline +void copy_symlink(const path& existing_symlink, + const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} + +inline +void copy_symlink(const path& existing_symlink, const path& new_symlink, + system::error_code& ec) BOOST_NOEXCEPT + {detail::copy_symlink(existing_symlink, new_symlink, &ec);} +inline +bool create_directories(const path& p) {return detail::create_directories(p);} + +inline +bool create_directories(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::create_directories(p, &ec);} +inline +bool create_directory(const path& p) {return detail::create_directory(p);} + +inline +bool create_directory(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::create_directory(p, &ec);} +inline +void create_directory_symlink(const path& to, const path& from) + {detail::create_directory_symlink(to, from);} +inline +void create_directory_symlink(const path& to, const path& from, system::error_code& ec) BOOST_NOEXCEPT + {detail::create_directory_symlink(to, from, &ec);} +inline +void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);} + +inline +void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) BOOST_NOEXCEPT + {detail::create_hard_link(to, new_hard_link, &ec);} +inline +void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);} + +inline +void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) BOOST_NOEXCEPT + {detail::create_symlink(to, new_symlink, &ec);} +inline +path current_path() {return detail::current_path();} + +inline +path current_path(system::error_code& ec) {return detail::current_path(&ec);} + +inline +void current_path(const path& p) {detail::current_path(p);} + +inline +void current_path(const path& p, system::error_code& ec) BOOST_NOEXCEPT {detail::current_path(p, &ec);} + +inline +bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);} + +inline +bool equivalent(const path& p1, const path& p2, system::error_code& ec) BOOST_NOEXCEPT + {return detail::equivalent(p1, p2, &ec);} +inline +boost::uintmax_t file_size(const path& p) {return detail::file_size(p);} + +inline +boost::uintmax_t file_size(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::file_size(p, &ec);} +inline +boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);} + +inline +boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::hard_link_count(p, &ec);} +inline +path initial_path() {return detail::initial_path();} + +inline +path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} + +template <class Path> +path initial_path() {return initial_path();} +template <class Path> +path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} + +inline +std::time_t last_write_time(const path& p) {return detail::last_write_time(p);} + +inline +std::time_t last_write_time(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::last_write_time(p, &ec);} +inline +void last_write_time(const path& p, const std::time_t new_time) + {detail::last_write_time(p, new_time);} +inline +void last_write_time(const path& p, const std::time_t new_time, + system::error_code& ec) BOOST_NOEXCEPT + {detail::last_write_time(p, new_time, &ec);} +inline +void permissions(const path& p, perms prms) + {detail::permissions(p, prms);} +inline +void permissions(const path& p, perms prms, system::error_code& ec) BOOST_NOEXCEPT + {detail::permissions(p, prms, &ec);} + +inline +path read_symlink(const path& p) {return detail::read_symlink(p);} + +inline +path read_symlink(const path& p, system::error_code& ec) + {return detail::read_symlink(p, &ec);} + +inline +bool remove(const path& p) {return detail::remove(p);} + +inline +bool remove(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::remove(p, &ec);} + +inline +boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);} + +inline +boost::uintmax_t remove_all(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::remove_all(p, &ec);} +inline +void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);} + +inline +void rename(const path& old_p, const path& new_p, system::error_code& ec) BOOST_NOEXCEPT + {detail::rename(old_p, new_p, &ec);} +inline // name suggested by Scott McMurray +void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);} + +inline +void resize_file(const path& p, uintmax_t size, system::error_code& ec) BOOST_NOEXCEPT + {detail::resize_file(p, size, &ec);} +inline +path relative(const path& p, const path& base=current_path()) + {return detail::relative(p, base);} +inline +path relative(const path& p, system::error_code& ec) + {return detail::relative(p, current_path(), &ec);} +inline +path relative(const path& p, const path& base, system::error_code& ec) + {return detail::relative(p, base, &ec);} +inline +space_info space(const path& p) {return detail::space(p);} + +inline +space_info space(const path& p, system::error_code& ec) BOOST_NOEXCEPT + {return detail::space(p, &ec);} -//--------------------------------------------------------------------------------------// -// // -// recursive_directory_iterator helpers // -// // -//--------------------------------------------------------------------------------------// - - BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(symlink_option, unsigned int) - { - none, - no_recurse = none, // don't follow directory symlinks (default behavior) - recurse, // follow directory symlinks - _detail_no_push = recurse << 1 // internal use only - } - BOOST_SCOPED_ENUM_DECLARE_END(symlink_option) - - BOOST_BITMASK(BOOST_SCOPED_ENUM_NATIVE(symlink_option)) - - namespace detail - { - struct recur_dir_itr_imp : - public boost::intrusive_ref_counter< recur_dir_itr_imp > - { - typedef directory_iterator element_type; - std::stack< element_type, std::vector< element_type > > m_stack; - int m_level; - // symlink_option values, declared as unsigned int for ABI compatibility - unsigned int m_options; - - recur_dir_itr_imp() BOOST_NOEXCEPT : m_level(0), m_options(static_cast< unsigned int >(symlink_option::none)) {} - explicit recur_dir_itr_imp(BOOST_SCOPED_ENUM_NATIVE(symlink_option) opt) BOOST_NOEXCEPT : m_level(0), m_options(static_cast< unsigned int >(opt)) {} - - // ec == 0 means throw on error - // - // Invariant: On return, the top of the iterator stack is the next valid (possibly - // end) iterator, regardless of whether or not an error is reported, and regardless of - // whether any error is reported by exception or error code. In other words, progress - // is always made so a loop on the iterator will always eventually terminate - // regardless of errors. - BOOST_FILESYSTEM_DECL void increment(system::error_code* ec); - - // Returns: true if push occurs, otherwise false. Always returns false on error. - BOOST_FILESYSTEM_DECL bool push_directory(system::error_code& ec) BOOST_NOEXCEPT; - - // ec == 0 means throw on error - BOOST_FILESYSTEM_DECL void pop(system::error_code* ec); - }; - - } // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// recursive_directory_iterator // -// // -//--------------------------------------------------------------------------------------// - - class recursive_directory_iterator : - public boost::iterator_facade< - recursive_directory_iterator, - directory_entry, - boost::single_pass_traversal_tag - > - { - public: - - recursive_directory_iterator() BOOST_NOEXCEPT {} // creates the "end" iterator - - explicit recursive_directory_iterator(const path& dir_path) : // throws if !exists() - m_imp(new detail::recur_dir_itr_imp()) - { - m_imp->m_stack.push(directory_iterator(dir_path)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset(); } - } - - recursive_directory_iterator(const path& dir_path, - BOOST_SCOPED_ENUM_NATIVE(symlink_option) opt) : // throws if !exists() - m_imp(new detail::recur_dir_itr_imp(opt)) - { - m_imp->m_stack.push(directory_iterator(dir_path)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator(const path& dir_path, - BOOST_SCOPED_ENUM_NATIVE(symlink_option) opt, - system::error_code & ec) BOOST_NOEXCEPT : - m_imp(new (std::nothrow) detail::recur_dir_itr_imp(opt)) - { - if (BOOST_UNLIKELY(!m_imp)) - { - ec = make_error_code(system::errc::not_enough_memory); - return; - } - - directory_iterator it(dir_path, ec); - if (ec || it == directory_iterator()) - { - m_imp.reset(); - return; - } - - try - { -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - m_imp->m_stack.push(std::move(it)); -#else - m_imp->m_stack.push(it); -#endif - } - catch (std::bad_alloc&) - { - ec = make_error_code(system::errc::not_enough_memory); - m_imp.reset(); - } - } - - recursive_directory_iterator(const path& dir_path, - system::error_code & ec) BOOST_NOEXCEPT : - m_imp(new (std::nothrow) detail::recur_dir_itr_imp()) - { - if (BOOST_UNLIKELY(!m_imp)) - { - ec = make_error_code(system::errc::not_enough_memory); - return; - } - - directory_iterator it(dir_path, ec); - if (ec || it == directory_iterator()) - { - m_imp.reset(); - return; - } - - try - { -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - m_imp->m_stack.push(std::move(it)); -#else - m_imp->m_stack.push(it); +#ifndef BOOST_FILESYSTEM_NO_DEPRECATED +inline bool symbolic_link_exists(const path& p) + { return is_symlink(filesystem::symlink_status(p)); } #endif - } - catch (std::bad_alloc&) - { - ec = make_error_code(system::errc::not_enough_memory); - m_imp.reset(); - } - } - - BOOST_DEFAULTED_FUNCTION(recursive_directory_iterator(recursive_directory_iterator const& that), : m_imp(that.m_imp) {}) - BOOST_DEFAULTED_FUNCTION(recursive_directory_iterator& operator= (recursive_directory_iterator const& that), { m_imp = that.m_imp; return *this; }) - -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - recursive_directory_iterator(recursive_directory_iterator&& that) BOOST_NOEXCEPT : - m_imp(std::move(that.m_imp)) - { - } - - recursive_directory_iterator& operator= (recursive_directory_iterator&& that) BOOST_NOEXCEPT - { - m_imp = std::move(that.m_imp); - return *this; - } -#endif // !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - - recursive_directory_iterator& increment(system::error_code& ec) BOOST_NOEXCEPT - { - BOOST_ASSERT_MSG(m_imp.get(), - "increment() on end recursive_directory_iterator"); - m_imp->increment(&ec); - if (m_imp->m_stack.empty()) - m_imp.reset(); // done, so make end iterator - return *this; - } - - int depth() const BOOST_NOEXCEPT - { - BOOST_ASSERT_MSG(m_imp.get(), - "depth() on end recursive_directory_iterator"); - return m_imp->m_level; - } - - int level() const BOOST_NOEXCEPT { return depth(); } - - bool recursion_pending() const BOOST_NOEXCEPT - { - BOOST_ASSERT_MSG(m_imp.get(), - "is_no_push_requested() on end recursive_directory_iterator"); - return (m_imp->m_options & static_cast< unsigned int >(symlink_option::_detail_no_push)) - == static_cast< unsigned int >(symlink_option::_detail_no_push); - } - - bool no_push_pending() const BOOST_NOEXCEPT { return recursion_pending(); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - bool no_push_request() const BOOST_NOEXCEPT { return no_push_pending(); } -# endif - - void pop() - { - BOOST_ASSERT_MSG(m_imp.get(), - "pop() on end recursive_directory_iterator"); - m_imp->pop(0); - if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator - } - - void pop(system::error_code& ec) BOOST_NOEXCEPT - { - BOOST_ASSERT_MSG(m_imp.get(), - "pop() on end recursive_directory_iterator"); - m_imp->pop(&ec); - if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator - } - - void disable_recursion_pending(bool value=true) BOOST_NOEXCEPT - { - BOOST_ASSERT_MSG(m_imp.get(), - "no_push() on end recursive_directory_iterator"); - if (value) - m_imp->m_options |= static_cast< unsigned int >(symlink_option::_detail_no_push); - else - m_imp->m_options &= ~static_cast< unsigned int >(symlink_option::_detail_no_push); - } - - void no_push(bool value=true) BOOST_NOEXCEPT { disable_recursion_pending(value); } - - file_status status() const - { - BOOST_ASSERT_MSG(m_imp.get(), - "status() on end recursive_directory_iterator"); - return m_imp->m_stack.top()->status(); - } - - file_status symlink_status() const - { - BOOST_ASSERT_MSG(m_imp.get(), - "symlink_status() on end recursive_directory_iterator"); - return m_imp->m_stack.top()->symlink_status(); - } - - private: - - // intrusive_ptr provides the shallow-copy semantics required for single pass iterators - // (i.e. InputIterators). - // The end iterator is indicated by !m_imp || m_imp->m_stack.empty() - boost::intrusive_ptr< detail::recur_dir_itr_imp > m_imp; - - friend class boost::iterator_core_access; - - boost::iterator_facade< - recursive_directory_iterator, - directory_entry, - boost::single_pass_traversal_tag >::reference - dereference() const - { - BOOST_ASSERT_MSG(m_imp.get(), - "dereference of end recursive_directory_iterator"); - return *m_imp->m_stack.top(); - } - - void increment() - { - BOOST_ASSERT_MSG(m_imp.get(), - "increment of end recursive_directory_iterator"); - m_imp->increment(0); - if (m_imp->m_stack.empty()) - m_imp.reset(); // done, so make end iterator - } - - bool equal(const recursive_directory_iterator& rhs) const - { - return m_imp == rhs.m_imp - || (!m_imp && rhs.m_imp && rhs.m_imp->m_stack.empty()) - || (!rhs.m_imp && m_imp && m_imp->m_stack.empty()) ; - } - }; // recursive directory iterator - - // enable recursive directory iterator C++11 range-base for statement use ----------// - - // begin() and end() are only used by a range-based for statement in the context of - // auto - thus the top-level const is stripped - so returning const is harmless and - // emphasizes begin() is just a pass through. - inline - const recursive_directory_iterator& - begin(const recursive_directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - recursive_directory_iterator end(const recursive_directory_iterator&) BOOST_NOEXCEPT - {return recursive_directory_iterator();} - - // enable C++14 generic accessors for range const iterators - inline - const recursive_directory_iterator& cbegin(const recursive_directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - recursive_directory_iterator cend(const recursive_directory_iterator&) BOOST_NOEXCEPT - {return recursive_directory_iterator();} - - // enable recursive directory iterator BOOST_FOREACH -------------------------------// - - inline - recursive_directory_iterator& - range_begin(recursive_directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - recursive_directory_iterator - range_begin(const recursive_directory_iterator& iter) BOOST_NOEXCEPT - {return iter;} - inline - recursive_directory_iterator range_end(recursive_directory_iterator&) BOOST_NOEXCEPT - {return recursive_directory_iterator();} - inline - recursive_directory_iterator range_end(const recursive_directory_iterator&) BOOST_NOEXCEPT - {return recursive_directory_iterator();} - } // namespace filesystem - - // namespace boost template specializations - template<> - struct range_mutable_iterator<boost::filesystem::recursive_directory_iterator, void> - { typedef boost::filesystem::recursive_directory_iterator type; }; - template<> - struct range_const_iterator<boost::filesystem::recursive_directory_iterator, void> - { typedef boost::filesystem::recursive_directory_iterator type; }; - -namespace filesystem -{ -# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - typedef recursive_directory_iterator wrecursive_directory_iterator; -# endif +inline +path system_complete(const path& p) {return detail::system_complete(p);} + +inline +path system_complete(const path& p, system::error_code& ec) + {return detail::system_complete(p, &ec);} +inline +path temp_directory_path() {return detail::temp_directory_path();} + +inline +path temp_directory_path(system::error_code& ec) + {return detail::temp_directory_path(&ec);} +inline +path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%") + {return detail::unique_path(p);} +inline +path unique_path(const path& p, system::error_code& ec) + {return detail::unique_path(p, &ec);} +inline +path weakly_canonical(const path& p) {return detail::weakly_canonical(p);} + +inline +path weakly_canonical(const path& p, system::error_code& ec) + {return detail::weakly_canonical(p, &ec);} // test helper -----------------------------------------------------------------------// @@ -1414,12 +450,13 @@ namespace filesystem // there is no law that says that an OS that has large stat.st_size // actually supports large file sizes. - namespace detail - { - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); - } +namespace detail { + +BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); + +} // namespace detail - } // namespace filesystem +} // namespace filesystem } // namespace boost #include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas diff --git a/ThirdParty/boost/filesystem/path.hpp b/ThirdParty/boost/filesystem/path.hpp index d0cf9a11ca30ecb6bb5d260a640d30941df5cb7a..d8fe2039300d8551737a4e36a699c69a950e5579 100644 --- a/ThirdParty/boost/filesystem/path.hpp +++ b/ThirdParty/boost/filesystem/path.hpp @@ -27,8 +27,9 @@ #include <boost/system/error_code.hpp> #include <boost/system/system_error.hpp> #include <boost/iterator/iterator_facade.hpp> +#include <boost/iterator/iterator_categories.hpp> #include <boost/core/enable_if.hpp> -#include <boost/io/detail/quoted_manip.hpp> +#include <boost/io/quoted.hpp> #include <boost/functional/hash_fwd.hpp> #include <boost/type_traits/is_integral.hpp> #include <string> @@ -59,6 +60,7 @@ namespace path_detail // intentionally don't use filesystem::detail to not bring static BOOST_CONSTEXPR_OR_CONST value_type dot = Dot; }; +#if defined(BOOST_NO_CXX17_INLINE_VARIABLES) template< typename Char, Char Separator, Char PreferredSeparator, Char Dot > BOOST_CONSTEXPR_OR_CONST typename path_constants< Char, Separator, PreferredSeparator, Dot >::value_type path_constants< Char, Separator, PreferredSeparator, Dot >::separator; @@ -68,6 +70,7 @@ namespace path_detail // intentionally don't use filesystem::detail to not bring template< typename Char, Char Separator, Char PreferredSeparator, Char Dot > BOOST_CONSTEXPR_OR_CONST typename path_constants< Char, Separator, PreferredSeparator, Dot >::value_type path_constants< Char, Separator, PreferredSeparator, Dot >::dot; +#endif } // namespace path_detail @@ -536,7 +539,8 @@ namespace path_detail // intentionally don't use filesystem::detail to not bring bool is_relative() const { return !is_absolute(); } bool is_absolute() const { -# ifdef BOOST_WINDOWS_API + // Windows CE has no root name (aka drive letters) +# if defined(BOOST_WINDOWS_API) && !defined(UNDER_CE) return has_root_name() && has_root_directory(); # else return has_root_directory(); @@ -783,7 +787,7 @@ namespace path_detail // intentionally don't use filesystem::detail to not bring inline bool operator> (const path& lhs, const path& rhs) {return rhs < lhs;} inline bool operator>=(const path& lhs, const path& rhs) {return !(lhs < rhs);} - inline std::size_t hash_value(const path& x) + inline std::size_t hash_value(const path& x) BOOST_NOEXCEPT { # ifdef BOOST_WINDOWS_API std::size_t seed = 0; @@ -797,9 +801,18 @@ namespace path_detail // intentionally don't use filesystem::detail to not bring inline void swap(path& lhs, path& rhs) BOOST_NOEXCEPT { lhs.swap(rhs); } - inline path operator/(const path& lhs, const path& rhs) { return path(lhs) /= rhs; } + inline path operator/(const path& lhs, const path& rhs) + { + path p = lhs; + p /= rhs; + return p; + } # if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - inline path&& operator/(path&& lhs, const path& rhs) { lhs /= rhs; return std::move(lhs); } + inline path operator/(path&& lhs, const path& rhs) + { + lhs /= rhs; + return std::move(lhs); + } # endif // inserters and extractors diff --git a/ThirdParty/boost/function/function_base.hpp b/ThirdParty/boost/function/function_base.hpp index 4db31c4fbcb1de3f59f058e7b988c4c5fed750b3..bd0e548bdff74b08f5f5d1914a363265ce9b86c9 100644 --- a/ThirdParty/boost/function/function_base.hpp +++ b/ThirdParty/boost/function/function_base.hpp @@ -396,16 +396,12 @@ namespace boost { functor_manager_operation_type op) { typedef typename get_function_tag<functor_type>::type tag_type; - switch (op) { - case get_functor_type_tag: + if (op == get_functor_type_tag) { out_buffer.members.type.type = &boost::typeindex::type_id<functor_type>().type_info(); out_buffer.members.type.const_qualified = false; out_buffer.members.type.volatile_qualified = false; - return; - - default: + } else { manager(in_buffer, out_buffer, op, tag_type()); - return; } } }; @@ -510,16 +506,12 @@ namespace boost { functor_manager_operation_type op) { typedef typename get_function_tag<functor_type>::type tag_type; - switch (op) { - case get_functor_type_tag: + if (op == get_functor_type_tag) { out_buffer.members.type.type = &boost::typeindex::type_id<functor_type>().type_info(); out_buffer.members.type.const_qualified = false; out_buffer.members.type.volatile_qualified = false; - return; - - default: + } else { manager(in_buffer, out_buffer, op, tag_type()); - return; } } }; diff --git a/ThirdParty/boost/function/function_template.hpp b/ThirdParty/boost/function/function_template.hpp index 56f6bb491a78f00e8422413674c17646914ab358..26f1d67d03b575469c33284880d1438ed20afe57 100644 --- a/ThirdParty/boost/function/function_template.hpp +++ b/ThirdParty/boost/function/function_template.hpp @@ -898,11 +898,20 @@ namespace boost { { if (!f.empty()) { this->vtable = f.vtable; - if (this->has_trivial_copy_and_destroy()) + if (this->has_trivial_copy_and_destroy()) { // Don't operate on storage directly since union type doesn't relax // strict aliasing rules, despite of having member char type. +# if defined(BOOST_GCC) && (BOOST_GCC >= 40700) +# pragma GCC diagnostic push + // This warning is technically correct, but we don't want to pay the price for initializing + // just to silence a warning: https://github.com/boostorg/function/issues/27 +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +# endif std::memcpy(this->functor.data, f.functor.data, sizeof(boost::detail::function::function_buffer)); - else +# if defined(BOOST_GCC) && (BOOST_GCC >= 40700) +# pragma GCC diagnostic pop +# endif + } else get_vtable()->base.manager(f.functor, this->functor, boost::detail::function::clone_functor_tag); } @@ -987,11 +996,20 @@ namespace boost { BOOST_TRY { if (!f.empty()) { this->vtable = f.vtable; - if (this->has_trivial_copy_and_destroy()) + if (this->has_trivial_copy_and_destroy()) { // Don't operate on storage directly since union type doesn't relax // strict aliasing rules, despite of having member char type. +# if defined(BOOST_GCC) && (BOOST_GCC >= 40700) +# pragma GCC diagnostic push + // This warning is technically correct, but we don't want to pay the price for initializing + // just to silence a warning: https://github.com/boostorg/function/issues/27 +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +# endif std::memcpy(this->functor.data, f.functor.data, sizeof(this->functor.data)); - else +# if defined(BOOST_GCC) && (BOOST_GCC >= 40700) +# pragma GCC diagnostic pop +# endif + } else get_vtable()->base.manager(f.functor, this->functor, boost::detail::function::move_functor_tag); f.vtable = 0; diff --git a/ThirdParty/boost/function_types/property_tags.hpp b/ThirdParty/boost/function_types/property_tags.hpp index c2158d352d35ad230bf008ca8749b6e1e1d5696e..3760a8b174552ae87a04a34326bed869bc1a931b 100644 --- a/ThirdParty/boost/function_types/property_tags.hpp +++ b/ThirdParty/boost/function_types/property_tags.hpp @@ -12,6 +12,7 @@ #include <cstddef> #include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_same.hpp> #include <boost/mpl/bitxor.hpp> @@ -134,6 +135,20 @@ template<class Tag, class QueryTag> struct extract > mask; }; +/* + + The following is a metafunction which checks whether a + property tag is in a possibly compounded tag type. + + Here both the possibly compounded tag type and a property tag + is given. + +*/ + +template<class Tag, class PropertyTag> struct has_property_tag + : detail::represents_impl<Tag, PropertyTag> +{ }; + } } // namespace ::boost::function_types #include <boost/function_types/detail/pp_tags/preprocessed.hpp> @@ -141,6 +156,43 @@ template<class Tag, class QueryTag> struct extract namespace boost { namespace function_types { #define BOOST_FT_cc_file <boost/function_types/detail/pp_tags/cc_tag.hpp> #include <boost/function_types/detail/pp_loop.hpp> + +/* + + The following are metafunctions which check whether the + specific property tag is in a possibly compounded tag type. + Here only the possibly compounded tag type is given. + +*/ + +template<class Tag> struct has_property_tag<Tag,null_tag> + : ::boost::is_same<Tag, null_tag> +{ }; + +template<class Tag> struct has_variadic_property_tag + : has_property_tag<Tag, variadic> +{ }; + +template<class Tag> struct has_default_cc_property_tag + : has_property_tag<Tag, default_cc> +{ }; + +template<class Tag> struct has_const_property_tag + : has_property_tag<Tag, const_qualified> +{ }; + +template<class Tag> struct has_volatile_property_tag + : has_property_tag<Tag, volatile_qualified> +{ }; + +template<class Tag> struct has_cv_property_tag + : has_property_tag<Tag, cv_qualified> +{ }; + +template<class Tag> struct has_null_property_tag + : has_property_tag<Tag, null_tag> +{ }; + } } // namespace boost::function_types #endif diff --git a/ThirdParty/boost/functional/hash.hpp b/ThirdParty/boost/functional/hash.hpp new file mode 100644 index 0000000000000000000000000000000000000000..327a3ecae7675f085e52c735d798d18f75c38d6d --- /dev/null +++ b/ThirdParty/boost/functional/hash.hpp @@ -0,0 +1,6 @@ + +// 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) + +#include <boost/container_hash/hash.hpp> diff --git a/ThirdParty/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp b/ThirdParty/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp index 850eef5fa760dd3ff8fef82c1e901562f092bb64..ea30cb55c18bb5b0c4e147a9303735ae67b6c2d9 100644 --- a/ThirdParty/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp +++ b/ThirdParty/boost/fusion/adapted/boost_tuple/boost_tuple_iterator.hpp @@ -144,9 +144,8 @@ namespace boost { namespace fusion : is_same<typename I1::identity, typename I2::identity> {}; - private: // silence MSVC warning C4512: assignment operator could not be generated - boost_tuple_iterator& operator= (boost_tuple_iterator const&); + BOOST_DELETED_FUNCTION(boost_tuple_iterator& operator= (boost_tuple_iterator const&)) }; template <typename Null> diff --git a/ThirdParty/boost/fusion/container/deque/deque_iterator.hpp b/ThirdParty/boost/fusion/container/deque/deque_iterator.hpp index c2203796f8273c053a3dfe7de37da2d7d9f2a566..b0335e5f2bd98f80a77e55245c3a4b8d868eab7d 100644 --- a/ThirdParty/boost/fusion/container/deque/deque_iterator.hpp +++ b/ThirdParty/boost/fusion/container/deque/deque_iterator.hpp @@ -111,9 +111,8 @@ namespace boost { namespace fusion { Seq& seq_; - private: // silence MSVC warning C4512: assignment operator could not be generated - deque_iterator& operator= (deque_iterator const&); + BOOST_DELETED_FUNCTION(deque_iterator& operator= (deque_iterator const&)) }; }} diff --git a/ThirdParty/boost/fusion/container/list/cons_iterator.hpp b/ThirdParty/boost/fusion/container/list/cons_iterator.hpp index 58b7fd9e360eded1cb377db412e7f1f9958fa6d8..5c0491dbc8bab6eb46891af7c3336912838a9a59 100644 --- a/ThirdParty/boost/fusion/container/list/cons_iterator.hpp +++ b/ThirdParty/boost/fusion/container/list/cons_iterator.hpp @@ -42,9 +42,8 @@ namespace boost { namespace fusion cons_type& cons; - private: // silence MSVC warning C4512: assignment operator could not be generated - cons_iterator& operator= (cons_iterator const&); + BOOST_DELETED_FUNCTION(cons_iterator& operator= (cons_iterator const&)) }; struct nil_iterator : iterator_base<nil_iterator> diff --git a/ThirdParty/boost/fusion/container/vector/vector_iterator.hpp b/ThirdParty/boost/fusion/container/vector/vector_iterator.hpp index 150530d14d5f5f625d4f1ff5e56e331a8f73088d..6f8033e6f85b0a260684b5e963ef4b31a42bc2b1 100644 --- a/ThirdParty/boost/fusion/container/vector/vector_iterator.hpp +++ b/ThirdParty/boost/fusion/container/vector/vector_iterator.hpp @@ -43,9 +43,8 @@ namespace boost { namespace fusion Vector& vec; - private: // silence MSVC warning C4512: assignment operator could not be generated - vector_iterator& operator= (vector_iterator const&); + BOOST_DELETED_FUNCTION(vector_iterator& operator= (vector_iterator const&)) }; }} diff --git a/ThirdParty/boost/fusion/sequence/comparison/enable_comparison.hpp b/ThirdParty/boost/fusion/sequence/comparison/enable_comparison.hpp index 12794177142ae53122d0476f81e876da43af4da7..b65c75529fc1853416eb5d01dd81a8c2ab973985 100644 --- a/ThirdParty/boost/fusion/sequence/comparison/enable_comparison.hpp +++ b/ThirdParty/boost/fusion/sequence/comparison/enable_comparison.hpp @@ -20,13 +20,13 @@ namespace boost { namespace fusion { namespace traits { template <typename Seq1, typename Seq2, typename Enable = void> struct enable_equality - : mpl::or_<traits::is_sequence<Seq1>, traits::is_sequence<Seq2> > + : mpl::and_<traits::is_sequence<Seq1>, traits::is_sequence<Seq2> > {}; template <typename Seq1, typename Seq2, typename Enable = void> struct enable_comparison : mpl::and_< - mpl::or_<traits::is_sequence<Seq1>, traits::is_sequence<Seq2> > + traits::is_sequence<Seq1>, traits::is_sequence<Seq2> , mpl::equal_to<result_of::size<Seq1>, result_of::size<Seq2> > > {}; diff --git a/ThirdParty/boost/fusion/sequence/intrinsic/at.hpp b/ThirdParty/boost/fusion/sequence/intrinsic/at.hpp index a103e078a2fd02b3795221142378e259b565fdf8..348a2e5fd7074d183fb8690fadd9a2f951996030 100644 --- a/ThirdParty/boost/fusion/sequence/intrinsic/at.hpp +++ b/ThirdParty/boost/fusion/sequence/intrinsic/at.hpp @@ -118,7 +118,7 @@ namespace boost { namespace fusion >::type at_c(Sequence& seq) { - return fusion::at<mpl::int_<N> >(seq); + return result_of::at_c<Sequence, N>::call(seq); } template <int N, typename Sequence> @@ -126,7 +126,7 @@ namespace boost { namespace fusion inline typename result_of::at_c<Sequence const, N>::type at_c(Sequence const& seq) { - return fusion::at<mpl::int_<N> >(seq); + return result_of::at_c<Sequence const, N>::call(seq); } }} diff --git a/ThirdParty/boost/fusion/view/joint_view/joint_view.hpp b/ThirdParty/boost/fusion/view/joint_view/joint_view.hpp index 676cbc54dd3fb1b73713f634956f5a04e26b290c..03e38d694cb4240c67459fafe1b86eae1daee16c 100644 --- a/ThirdParty/boost/fusion/view/joint_view/joint_view.hpp +++ b/ThirdParty/boost/fusion/view/joint_view/joint_view.hpp @@ -69,10 +69,10 @@ namespace boost { namespace fusion BOOST_CONSTEXPR BOOST_FUSION_GPU_ENABLED concat_last_type concat_last() const { return fusion::end(seq2); } - private: // silence MSVC warning C4512: assignment operator could not be generated - joint_view& operator= (joint_view const&); + BOOST_DELETED_FUNCTION(joint_view& operator= (joint_view const&)) + private: typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1; typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2; }; diff --git a/ThirdParty/boost/fusion/view/joint_view/joint_view_iterator.hpp b/ThirdParty/boost/fusion/view/joint_view/joint_view_iterator.hpp index ddd1341ee1ec49b5ddf486ef4543e85a784f62fe..f6db30915e25264f58ace59342dc4bac56ad810f 100644 --- a/ThirdParty/boost/fusion/view/joint_view/joint_view_iterator.hpp +++ b/ThirdParty/boost/fusion/view/joint_view/joint_view_iterator.hpp @@ -50,9 +50,8 @@ namespace boost { namespace fusion first_type first; concat_type concat; - private: // silence MSVC warning C4512: assignment operator could not be generated - joint_view_iterator& operator= (joint_view_iterator const&); + BOOST_DELETED_FUNCTION(joint_view_iterator& operator= (joint_view_iterator const&)) }; }} diff --git a/ThirdParty/boost/fusion/view/transform_view/transform_view.hpp b/ThirdParty/boost/fusion/view/transform_view/transform_view.hpp index 4a6fc5b18c59ff27574c254f741bf0165d163197..f0633018ee8379cc27e76d3af3f0e7ea69290e68 100644 --- a/ThirdParty/boost/fusion/view/transform_view/transform_view.hpp +++ b/ThirdParty/boost/fusion/view/transform_view/transform_view.hpp @@ -76,9 +76,8 @@ namespace boost { namespace fusion typename mpl::if_<traits::is_view<Sequence1>, Sequence1, Sequence1&>::type seq1; typename mpl::if_<traits::is_view<Sequence2>, Sequence2, Sequence2&>::type seq2; - private: // silence MSVC warning C4512: assignment operator could not be generated - transform_view& operator= (transform_view const&); + BOOST_DELETED_FUNCTION(transform_view& operator= (transform_view const&)) }; // Unary Version @@ -113,9 +112,8 @@ namespace boost { namespace fusion typename mpl::if_<traits::is_view<Sequence>, Sequence, Sequence&>::type seq; transform_type f; - private: // silence MSVC warning C4512: assignment operator could not be generated - transform_view& operator= (transform_view const&); + BOOST_DELETED_FUNCTION(transform_view& operator= (transform_view const&)) }; }} diff --git a/ThirdParty/boost/fusion/view/transform_view/transform_view_iterator.hpp b/ThirdParty/boost/fusion/view/transform_view/transform_view_iterator.hpp index ab40bd748f626a8b1f5e0a78b9e106c66afec625..2689ae8aabe6d00fc657f3385016cf1b49a8ea0f 100644 --- a/ThirdParty/boost/fusion/view/transform_view/transform_view_iterator.hpp +++ b/ThirdParty/boost/fusion/view/transform_view/transform_view_iterator.hpp @@ -42,9 +42,8 @@ namespace boost { namespace fusion first_type first; transform_type f; - private: // silence MSVC warning C4512: assignment operator could not be generated - transform_view_iterator& operator= (transform_view_iterator const&); + BOOST_DELETED_FUNCTION(transform_view_iterator& operator= (transform_view_iterator const&)) }; // Binary Version @@ -70,9 +69,8 @@ namespace boost { namespace fusion first2_type first2; transform_type f; - private: // silence MSVC warning C4512: assignment operator could not be generated - transform_view_iterator2& operator= (transform_view_iterator2 const&); + BOOST_DELETED_FUNCTION(transform_view_iterator2& operator= (transform_view_iterator2 const&)) }; }} diff --git a/ThirdParty/boost/histogram.hpp b/ThirdParty/boost/histogram.hpp new file mode 100644 index 0000000000000000000000000000000000000000..8b91ce27487ced792f9cdd72fbb769830d028da2 --- /dev/null +++ b/ThirdParty/boost/histogram.hpp @@ -0,0 +1,37 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_HPP +#define BOOST_HISTOGRAM_HPP + +/** + \file boost/histogram.hpp + Includes all standard headers of the Boost.Histogram library. + + Extra headers not automatically included are: + - [boost/histogram/ostream.hpp][1] + - [boost/histogram/axis/ostream.hpp][2] + - [boost/histogram/accumulators/ostream.hpp][3] + - [boost/histogram/serialization.hpp][4] + + [1]: histogram/reference.html#header.boost.histogram.ostream_hpp + [2]: histogram/reference.html#header.boost.histogram.axis.ostream_hpp + [3]: histogram/reference.html#header.boost.histogram.accumulators.ostream_hpp + [4]: histogram/reference.html#header.boost.histogram.serialization_hpp +*/ + +#include <boost/histogram/accumulators.hpp> +#include <boost/histogram/algorithm.hpp> +#include <boost/histogram/axis.hpp> +#include <boost/histogram/histogram.hpp> +#include <boost/histogram/indexed.hpp> +#include <boost/histogram/literals.hpp> +#include <boost/histogram/make_histogram.hpp> +#include <boost/histogram/make_profile.hpp> +#include <boost/histogram/storage_adaptor.hpp> +#include <boost/histogram/unlimited_storage.hpp> + +#endif diff --git a/ThirdParty/boost/histogram/accumulators.hpp b/ThirdParty/boost/histogram/accumulators.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fec479d3c75397c06c1a1953981beb250ba3c27d --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators.hpp @@ -0,0 +1,27 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_HPP + +/** + \file boost/histogram/accumulators.hpp + Includes all accumulator headers of the Boost.Histogram library. + + Extra header not automatically included: + - [boost/histogram/accumulators/ostream.hpp][1] + + [1]: histogram/reference.html#header.boost.histogram.accumulators.ostream_hpp +*/ + +#include <boost/histogram/accumulators/count.hpp> +#include <boost/histogram/accumulators/mean.hpp> +#include <boost/histogram/accumulators/sum.hpp> +#include <boost/histogram/accumulators/thread_safe.hpp> +#include <boost/histogram/accumulators/weighted_mean.hpp> +#include <boost/histogram/accumulators/weighted_sum.hpp> + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/count.hpp b/ThirdParty/boost/histogram/accumulators/count.hpp new file mode 100644 index 0000000000000000000000000000000000000000..2fe1dbfbe80ea9f2ad7e65417cfe868662ca6f58 --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/count.hpp @@ -0,0 +1,137 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_NUMBER_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_NUMBER_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/fwd.hpp> // for count<> +#include <type_traits> // for std::common_type + +namespace boost { +namespace histogram { +namespace accumulators { + +/** + Uses a C++ builtin arithmetic type to accumulate a count. + + This wrapper class may be used as a base class by users who want to add custom metadata + to each bin of a histogram. Otherwise, arithmetic types should be used directly as + accumulators in storages for simplicity. In other words, prefer `dense_storage<double>` + over `dense_storage<count<double>>`, both are functionally equivalent. + + When weighted data is accumulated and high precision is required, use + `accumulators::sum` instead. If a local variance estimate for the weight distribution + should be computed as well (generally needed for a detailed statistical analysis), use + `accumulators::weighted_sum`. +*/ +template <class ValueType> +class count { +public: + using value_type = ValueType; + using const_reference = const value_type&; + + count() = default; + + /// Initialize count to value and allow implicit conversion + count(const_reference value) noexcept : value_(value) {} + + /// Allow implicit conversion from other count + template <class T> + count(const count<T>& c) noexcept : count(c.value()) {} + + /// Increment count by one + count& operator++() noexcept { + ++value_; + return *this; + } + + /// Increment count by value + count& operator+=(const_reference value) noexcept { + value_ += value; + return *this; + } + + /// Add another count + count& operator+=(const count& s) noexcept { + value_ += s.value_; + return *this; + } + + /// Scale by value + count& operator*=(const_reference value) noexcept { + value_ *= value; + return *this; + } + + bool operator==(const count& rhs) const noexcept { return value_ == rhs.value_; } + + bool operator!=(const count& rhs) const noexcept { return !operator==(rhs); } + + /// Return count + const_reference value() const noexcept { return value_; } + + // conversion to value_type must be explicit + explicit operator value_type() const noexcept { return value_; } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("value", value_); + } + + // begin: extra operators to make count behave like a regular number + + count& operator*=(const count& rhs) noexcept { + value_ *= rhs.value_; + return *this; + } + + count operator*(const count& rhs) const noexcept { + count x = *this; + x *= rhs; + return x; + } + + count& operator/=(const count& rhs) noexcept { + value_ /= rhs.value_; + return *this; + } + + count operator/(const count& rhs) const noexcept { + count x = *this; + x /= rhs; + return x; + } + + bool operator<(const count& rhs) const noexcept { return value_ < rhs.value_; } + + bool operator>(const count& rhs) const noexcept { return value_ > rhs.value_; } + + bool operator<=(const count& rhs) const noexcept { return value_ <= rhs.value_; } + + bool operator>=(const count& rhs) const noexcept { return value_ >= rhs.value_; } + + // end: extra operators + +private: + value_type value_{}; +}; + +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +namespace std { +template <class T, class U> +struct common_type<boost::histogram::accumulators::count<T>, + boost::histogram::accumulators::count<U>> { + using type = boost::histogram::accumulators::count<common_type_t<T, U>>; +}; +} // namespace std +#endif + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/mean.hpp b/ThirdParty/boost/histogram/accumulators/mean.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6bdc27f7a02957f5f2151477c621fde7c9e8bd9a --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/mean.hpp @@ -0,0 +1,147 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_MEAN_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_MEAN_HPP + +#include <boost/assert.hpp> +#include <boost/core/nvp.hpp> +#include <boost/histogram/fwd.hpp> // for mean<> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace accumulators { + +/** Calculates mean and variance of sample. + + Uses Welfords's incremental algorithm to improve the numerical + stability of mean and variance computation. +*/ +template <class ValueType> +class mean { +public: + using value_type = ValueType; + using const_reference = const value_type&; + + mean() = default; + + /// Allow implicit conversion from mean<T> + template <class T> + mean(const mean<T>& o) noexcept + : sum_{o.sum_}, mean_{o.mean_}, sum_of_deltas_squared_{o.sum_of_deltas_squared_} {} + + /// Initialize to external count, mean, and variance + mean(const_reference n, const_reference mean, const_reference variance) noexcept + : sum_(n), mean_(mean), sum_of_deltas_squared_(variance * (n - 1)) {} + + /// Insert sample x + void operator()(const_reference x) noexcept { + sum_ += static_cast<value_type>(1); + const auto delta = x - mean_; + mean_ += delta / sum_; + sum_of_deltas_squared_ += delta * (x - mean_); + } + + /// Insert sample x with weight w + void operator()(const weight_type<value_type>& w, const_reference x) noexcept { + sum_ += w.value; + const auto delta = x - mean_; + mean_ += w.value * delta / sum_; + sum_of_deltas_squared_ += w.value * delta * (x - mean_); + } + + /// Add another mean accumulator + mean& operator+=(const mean& rhs) noexcept { + if (sum_ != 0 || rhs.sum_ != 0) { + const auto tmp = mean_ * sum_ + rhs.mean_ * rhs.sum_; + sum_ += rhs.sum_; + mean_ = tmp / sum_; + } + sum_of_deltas_squared_ += rhs.sum_of_deltas_squared_; + return *this; + } + + /** Scale by value + + This acts as if all samples were scaled by the value. + */ + mean& operator*=(const_reference s) noexcept { + mean_ *= s; + sum_of_deltas_squared_ *= s * s; + return *this; + } + + bool operator==(const mean& rhs) const noexcept { + return sum_ == rhs.sum_ && mean_ == rhs.mean_ && + sum_of_deltas_squared_ == rhs.sum_of_deltas_squared_; + } + + bool operator!=(const mean& rhs) const noexcept { return !operator==(rhs); } + + /// Return how many samples were accumulated + const_reference count() const noexcept { return sum_; } + + /// Return mean value of accumulated samples + const_reference value() const noexcept { return mean_; } + + /// Return variance of accumulated samples + value_type variance() const noexcept { return sum_of_deltas_squared_ / (sum_ - 1); } + + template <class Archive> + void serialize(Archive& ar, unsigned version) { + if (version == 0) { + // read only + std::size_t sum; + ar& make_nvp("sum", sum); + sum_ = static_cast<value_type>(sum); + } else { + ar& make_nvp("sum", sum_); + } + ar& make_nvp("mean", mean_); + ar& make_nvp("sum_of_deltas_squared", sum_of_deltas_squared_); + } + +private: + value_type sum_{}; + value_type mean_{}; + value_type sum_of_deltas_squared_{}; +}; + +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +namespace boost { +namespace serialization { + +template <class T> +struct version; + +// version 1 for boost::histogram::accumulators::mean<T> +template <class T> +struct version<boost::histogram::accumulators::mean<T>> : std::integral_constant<int, 1> { +}; + +} // namespace serialization +} // namespace boost + +namespace std { +template <class T, class U> +/// Specialization for boost::histogram::accumulators::mean. +struct common_type<boost::histogram::accumulators::mean<T>, + boost::histogram::accumulators::mean<U>> { + using type = boost::histogram::accumulators::mean<common_type_t<T, U>>; +}; +} // namespace std + +#endif + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/ostream.hpp b/ThirdParty/boost/histogram/accumulators/ostream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..7c602500ddc4f8b834396435ce43e01ab9856233 --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/ostream.hpp @@ -0,0 +1,106 @@ +// Copyright 2015-2017 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_OSTREAM_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_OSTREAM_HPP + +#include <boost/histogram/detail/counting_streambuf.hpp> +#include <boost/histogram/fwd.hpp> +#include <ios> + +/** + \file boost/histogram/accumulators/ostream.hpp + Simple streaming operators for the builtin accumulator types. + + The text representation is not guaranteed to be stable between versions of + Boost.Histogram. This header is only included by + [boost/histogram/ostream.hpp](histogram/reference.html#header.boost.histogram.ostream_hpp). + To you use your own, include your own implementation instead of this header and do not + include + [boost/histogram/ostream.hpp](histogram/reference.html#header.boost.histogram.ostream_hpp). + */ + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +namespace boost { +namespace histogram { + +namespace detail { + +template <class CharT, class Traits, class T> +std::basic_ostream<CharT, Traits>& handle_nonzero_width( + std::basic_ostream<CharT, Traits>& os, const T& x) { + const auto w = os.width(); + os.width(0); + counting_streambuf<CharT, Traits> cb; + const auto saved = os.rdbuf(&cb); + os << x; + os.rdbuf(saved); + if (os.flags() & std::ios::left) { + os << x; + for (auto i = cb.count; i < w; ++i) os << os.fill(); + } else { + for (auto i = cb.count; i < w; ++i) os << os.fill(); + os << x; + } + return os; +} + +} // namespace detail + +namespace accumulators { + +template <class CharT, class Traits, class U> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const count<U>& x) { + return os << x.value(); +} + +template <class CharT, class Traits, class U> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const sum<U>& x) { + if (os.width() == 0) return os << "sum(" << x.large() << " + " << x.small() << ")"; + return detail::handle_nonzero_width(os, x); +} + +template <class CharT, class Traits, class U> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const weighted_sum<U>& x) { + if (os.width() == 0) + return os << "weighted_sum(" << x.value() << ", " << x.variance() << ")"; + return detail::handle_nonzero_width(os, x); +} + +template <class CharT, class Traits, class U> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const mean<U>& x) { + if (os.width() == 0) + return os << "mean(" << x.count() << ", " << x.value() << ", " << x.variance() << ")"; + return detail::handle_nonzero_width(os, x); +} + +template <class CharT, class Traits, class U> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const weighted_mean<U>& x) { + if (os.width() == 0) + return os << "weighted_mean(" << x.sum_of_weights() << ", " << x.value() << ", " + << x.variance() << ")"; + return detail::handle_nonzero_width(os, x); +} + +template <class CharT, class Traits, class T> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const thread_safe<T>& x) { + os << x.load(); + return os; +} +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/sum.hpp b/ThirdParty/boost/histogram/accumulators/sum.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d1577f0ba6a07facb7a8c280b80ccb8048df8aae --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/sum.hpp @@ -0,0 +1,178 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_SUM_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_SUM_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/fwd.hpp> // for sum<> +#include <cmath> // std::abs +#include <type_traits> // std::is_floating_point, std::common_type + +namespace boost { +namespace histogram { +namespace accumulators { + +/** + Uses Neumaier algorithm to compute accurate sums of floats. + + The algorithm is an improved Kahan algorithm + (https://en.wikipedia.org/wiki/Kahan_summation_algorithm). The algorithm uses memory for + two numbers and is three to five times slower compared to using a single number to + accumulate a sum, but the relative error of the sum is at the level of the machine + precision, independent of the number of samples. + + A. Neumaier, Zeitschrift fuer Angewandte Mathematik und Mechanik 54 (1974) 39-51. +*/ +template <class ValueType> +class sum { + static_assert(std::is_floating_point<ValueType>::value, + "ValueType must be a floating point type"); + +public: + using value_type = ValueType; + using const_reference = const value_type&; + + sum() = default; + + /// Initialize sum to value and allow implicit conversion + sum(const_reference value) noexcept : sum(value, 0) {} + + /// Allow implicit conversion from sum<T> + template <class T> + sum(const sum<T>& s) noexcept : sum(s.large(), s.small()) {} + + /// Initialize sum explicitly with large and small parts + sum(const_reference large, const_reference small) noexcept + : large_(large), small_(small) {} + + /// Increment sum by one + sum& operator++() noexcept { return operator+=(1); } + + /// Increment sum by value + sum& operator+=(const_reference value) noexcept { + // prevent compiler optimization from destroying the algorithm + // when -ffast-math is enabled + volatile value_type l; + value_type s; + if (std::abs(large_) >= std::abs(value)) { + l = large_; + s = value; + } else { + l = value; + s = large_; + } + large_ += value; + l -= large_; + l += s; + small_ += l; + return *this; + } + + /// Add another sum + sum& operator+=(const sum& s) noexcept { + operator+=(s.large_); + small_ += s.small_; + return *this; + } + + /// Scale by value + sum& operator*=(const_reference value) noexcept { + large_ *= value; + small_ *= value; + return *this; + } + + bool operator==(const sum& rhs) const noexcept { + return large_ + small_ == rhs.large_ + rhs.small_; + } + + bool operator!=(const sum& rhs) const noexcept { return !operator==(rhs); } + + /// Return value of the sum. + value_type value() const noexcept { return large_ + small_; } + + /// Return large part of the sum. + const_reference large() const noexcept { return large_; } + + /// Return small part of the sum. + const_reference small() const noexcept { return small_; } + + // lossy conversion to value type must be explicit + explicit operator value_type() const noexcept { return value(); } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("large", large_); + ar& make_nvp("small", small_); + } + + // begin: extra operators to make sum behave like a regular number + + sum& operator*=(const sum& rhs) noexcept { + const auto scale = static_cast<value_type>(rhs); + large_ *= scale; + small_ *= scale; + return *this; + } + + sum operator*(const sum& rhs) const noexcept { + sum s = *this; + s *= rhs; + return s; + } + + sum& operator/=(const sum& rhs) noexcept { + const auto scale = 1.0 / static_cast<value_type>(rhs); + large_ *= scale; + small_ *= scale; + return *this; + } + + sum operator/(const sum& rhs) const noexcept { + sum s = *this; + s /= rhs; + return s; + } + + bool operator<(const sum& rhs) const noexcept { + return operator value_type() < rhs.operator value_type(); + } + + bool operator>(const sum& rhs) const noexcept { + return operator value_type() > rhs.operator value_type(); + } + + bool operator<=(const sum& rhs) const noexcept { + return operator value_type() <= rhs.operator value_type(); + } + + bool operator>=(const sum& rhs) const noexcept { + return operator value_type() >= rhs.operator value_type(); + } + + // end: extra operators + +private: + value_type large_{}; + value_type small_{}; +}; + +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +namespace std { +template <class T, class U> +struct common_type<boost::histogram::accumulators::sum<T>, + boost::histogram::accumulators::sum<U>> { + using type = boost::histogram::accumulators::sum<common_type_t<T, U>>; +}; +} // namespace std +#endif + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/thread_safe.hpp b/ThirdParty/boost/histogram/accumulators/thread_safe.hpp new file mode 100644 index 0000000000000000000000000000000000000000..87ea416c8ca7bd7569db73a5533fe17f6b06cd3c --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/thread_safe.hpp @@ -0,0 +1,76 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_THREAD_SAFE_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_THREAD_SAFE_HPP + +#include <atomic> +#include <boost/core/nvp.hpp> +#include <boost/mp11/utility.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace accumulators { + +/** Thread-safe adaptor for builtin integral and floating point numbers. + + This adaptor uses std::atomic to make concurrent increments and additions safe for the + stored value. + + On common computing platforms, the adapted integer has the same size and + alignment as underlying type. The atomicity is implemented with a special CPU + instruction. On exotic platforms the size of the adapted number may be larger and/or the + type may have different alignment, which means it cannot be tightly packed into arrays. + + @tparam T type to adapt, must be supported by std::atomic. + */ +template <class T> +class thread_safe : public std::atomic<T> { +public: + using value_type = T; + using super_t = std::atomic<T>; + + thread_safe() noexcept : super_t(static_cast<T>(0)) {} + // non-atomic copy and assign is allowed, because storage is locked in this case + thread_safe(const thread_safe& o) noexcept : super_t(o.load()) {} + thread_safe& operator=(const thread_safe& o) noexcept { + super_t::store(o.load()); + return *this; + } + + thread_safe(value_type arg) : super_t(arg) {} + thread_safe& operator=(value_type arg) { + super_t::store(arg); + return *this; + } + + thread_safe& operator+=(const thread_safe& arg) { + operator+=(arg.load()); + return *this; + } + thread_safe& operator+=(value_type arg) { + super_t::fetch_add(arg, std::memory_order_relaxed); + return *this; + } + thread_safe& operator++() { + operator+=(static_cast<value_type>(1)); + return *this; + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + auto value = super_t::load(); + ar& make_nvp("value", value); + super_t::store(value); + } +}; + +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/weighted_mean.hpp b/ThirdParty/boost/histogram/accumulators/weighted_mean.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c163c49c9e50e8da92a46afb7b6fcce3d343acc5 --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/weighted_mean.hpp @@ -0,0 +1,142 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_WEIGHTED_MEAN_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_WEIGHTED_MEAN_HPP + +#include <boost/assert.hpp> +#include <boost/core/nvp.hpp> +#include <boost/histogram/fwd.hpp> // for weighted_mean<> +#include <boost/histogram/weight.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace accumulators { + +/** + Calculates mean and variance of weighted sample. + + Uses West's incremental algorithm to improve numerical stability + of mean and variance computation. +*/ +template <class ValueType> +class weighted_mean { +public: + using value_type = ValueType; + using const_reference = const value_type&; + + weighted_mean() = default; + + /// Allow implicit conversion from other weighted_means + template <class T> + weighted_mean(const weighted_mean<T>& o) + : sum_of_weights_{o.sum_of_weights_} + , sum_of_weights_squared_{o.sum_of_weights_squared_} + , weighted_mean_{o.weighted_mean_} + , sum_of_weighted_deltas_squared_{o.sum_of_weighted_deltas_squared_} {} + + /// Initialize to external sum of weights, sum of weights squared, mean, and variance + weighted_mean(const_reference wsum, const_reference wsum2, const_reference mean, + const_reference variance) + : sum_of_weights_(wsum) + , sum_of_weights_squared_(wsum2) + , weighted_mean_(mean) + , sum_of_weighted_deltas_squared_( + variance * (sum_of_weights_ - sum_of_weights_squared_ / sum_of_weights_)) {} + + /// Insert sample x + void operator()(const_reference x) { operator()(weight(1), x); } + + /// Insert sample x with weight w + void operator()(const weight_type<value_type>& w, const_reference x) { + sum_of_weights_ += w.value; + sum_of_weights_squared_ += w.value * w.value; + const auto delta = x - weighted_mean_; + weighted_mean_ += w.value * delta / sum_of_weights_; + sum_of_weighted_deltas_squared_ += w.value * delta * (x - weighted_mean_); + } + + /// Add another weighted_mean + weighted_mean& operator+=(const weighted_mean& rhs) { + if (sum_of_weights_ != 0 || rhs.sum_of_weights_ != 0) { + const auto tmp = + weighted_mean_ * sum_of_weights_ + rhs.weighted_mean_ * rhs.sum_of_weights_; + sum_of_weights_ += rhs.sum_of_weights_; + sum_of_weights_squared_ += rhs.sum_of_weights_squared_; + weighted_mean_ = tmp / sum_of_weights_; + } + sum_of_weighted_deltas_squared_ += rhs.sum_of_weighted_deltas_squared_; + return *this; + } + + /** Scale by value + + This acts as if all samples were scaled by the value. + */ + weighted_mean& operator*=(const_reference s) { + weighted_mean_ *= s; + sum_of_weighted_deltas_squared_ *= s * s; + return *this; + } + + bool operator==(const weighted_mean& rhs) const noexcept { + return sum_of_weights_ == rhs.sum_of_weights_ && + sum_of_weights_squared_ == rhs.sum_of_weights_squared_ && + weighted_mean_ == rhs.weighted_mean_ && + sum_of_weighted_deltas_squared_ == rhs.sum_of_weighted_deltas_squared_; + } + + bool operator!=(const weighted_mean& rhs) const noexcept { return !operator==(rhs); } + + /// Return sum of weights + const_reference sum_of_weights() const noexcept { return sum_of_weights_; } + + /// Return sum of weights squared (variance of weight distribution) + const_reference sum_of_weights_squared() const noexcept { + return sum_of_weights_squared_; + } + + /// Return mean of accumulated weighted samples + const_reference value() const noexcept { return weighted_mean_; } + + /// Return variance of accumulated weighted samples + value_type variance() const { + return sum_of_weighted_deltas_squared_ / + (sum_of_weights_ - sum_of_weights_squared_ / sum_of_weights_); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("sum_of_weights", sum_of_weights_); + ar& make_nvp("sum_of_weights_squared", sum_of_weights_squared_); + ar& make_nvp("weighted_mean", weighted_mean_); + ar& make_nvp("sum_of_weighted_deltas_squared", sum_of_weighted_deltas_squared_); + } + +private: + value_type sum_of_weights_{}; + value_type sum_of_weights_squared_{}; + value_type weighted_mean_{}; + value_type sum_of_weighted_deltas_squared_{}; +}; + +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +namespace std { +template <class T, class U> +/// Specialization for boost::histogram::accumulators::weighted_mean. +struct common_type<boost::histogram::accumulators::weighted_mean<T>, + boost::histogram::accumulators::weighted_mean<U>> { + using type = boost::histogram::accumulators::weighted_mean<common_type_t<T, U>>; +}; +} // namespace std +#endif + +#endif diff --git a/ThirdParty/boost/histogram/accumulators/weighted_sum.hpp b/ThirdParty/boost/histogram/accumulators/weighted_sum.hpp new file mode 100644 index 0000000000000000000000000000000000000000..692b14293ff50cc12bfa819d5289ea7686b8677b --- /dev/null +++ b/ThirdParty/boost/histogram/accumulators/weighted_sum.hpp @@ -0,0 +1,119 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ACCUMULATORS_WEIGHTED_SUM_HPP +#define BOOST_HISTOGRAM_ACCUMULATORS_WEIGHTED_SUM_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/fwd.hpp> // for weighted_sum<> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace accumulators { + +/// Holds sum of weights and its variance estimate +template <class ValueType> +class weighted_sum { +public: + using value_type = ValueType; + using const_reference = const value_type&; + + weighted_sum() = default; + + /// Initialize sum to value and allow implicit conversion + weighted_sum(const_reference value) noexcept : weighted_sum(value, value) {} + + /// Allow implicit conversion from sum<T> + template <class T> + weighted_sum(const weighted_sum<T>& s) noexcept + : weighted_sum(s.value(), s.variance()) {} + + /// Initialize sum to value and variance + weighted_sum(const_reference value, const_reference variance) noexcept + : sum_of_weights_(value), sum_of_weights_squared_(variance) {} + + /// Increment by one. + weighted_sum& operator++() { + ++sum_of_weights_; + ++sum_of_weights_squared_; + return *this; + } + + /// Increment by weight. + template <class T> + weighted_sum& operator+=(const weight_type<T>& w) { + sum_of_weights_ += w.value; + sum_of_weights_squared_ += w.value * w.value; + return *this; + } + + /// Added another weighted sum. + weighted_sum& operator+=(const weighted_sum& rhs) { + sum_of_weights_ += rhs.sum_of_weights_; + sum_of_weights_squared_ += rhs.sum_of_weights_squared_; + return *this; + } + + /// Scale by value. + weighted_sum& operator*=(const_reference x) { + sum_of_weights_ *= x; + sum_of_weights_squared_ *= x * x; + return *this; + } + + bool operator==(const weighted_sum& rhs) const noexcept { + return sum_of_weights_ == rhs.sum_of_weights_ && + sum_of_weights_squared_ == rhs.sum_of_weights_squared_; + } + + bool operator!=(const weighted_sum& rhs) const noexcept { return !operator==(rhs); } + + /// Return value of the sum. + const_reference value() const noexcept { return sum_of_weights_; } + + /// Return estimated variance of the sum. + const_reference variance() const noexcept { return sum_of_weights_squared_; } + + // lossy conversion must be explicit + explicit operator const_reference() const { return sum_of_weights_; } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("sum_of_weights", sum_of_weights_); + ar& make_nvp("sum_of_weights_squared", sum_of_weights_squared_); + } + +private: + value_type sum_of_weights_{}; + value_type sum_of_weights_squared_{}; +}; + +} // namespace accumulators +} // namespace histogram +} // namespace boost + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +namespace std { +template <class T, class U> +struct common_type<boost::histogram::accumulators::weighted_sum<T>, + boost::histogram::accumulators::weighted_sum<U>> { + using type = boost::histogram::accumulators::weighted_sum<common_type_t<T, U>>; +}; + +template <class T, class U> +struct common_type<boost::histogram::accumulators::weighted_sum<T>, U> { + using type = boost::histogram::accumulators::weighted_sum<common_type_t<T, U>>; +}; + +template <class T, class U> +struct common_type<T, boost::histogram::accumulators::weighted_sum<U>> { + using type = boost::histogram::accumulators::weighted_sum<common_type_t<T, U>>; +}; +} // namespace std +#endif + +#endif diff --git a/ThirdParty/boost/histogram/algorithm.hpp b/ThirdParty/boost/histogram/algorithm.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bbf8fe1c3fe96cd8dcf90195c60eb62826259341 --- /dev/null +++ b/ThirdParty/boost/histogram/algorithm.hpp @@ -0,0 +1,20 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ALGORITHM_HPP +#define BOOST_HISTOGRAM_ALGORITHM_HPP + +/** + \file boost/histogram/algorithm.hpp + Includes all algorithm headers of the Boost.Histogram library. +*/ + +#include <boost/histogram/algorithm/empty.hpp> +#include <boost/histogram/algorithm/project.hpp> +#include <boost/histogram/algorithm/reduce.hpp> +#include <boost/histogram/algorithm/sum.hpp> + +#endif diff --git a/ThirdParty/boost/histogram/algorithm/empty.hpp b/ThirdParty/boost/histogram/algorithm/empty.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f9f0b1673f2c8836d684fbcd25472cd7fe7e75f1 --- /dev/null +++ b/ThirdParty/boost/histogram/algorithm/empty.hpp @@ -0,0 +1,36 @@ +// Copyright 2019 Henry Schreiner +// +// 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) + +#ifndef BOOST_HISTOGRAM_ALGORITHM_EMPTY_HPP +#define BOOST_HISTOGRAM_ALGORITHM_EMPTY_HPP + +#include <boost/histogram/fwd.hpp> +#include <boost/histogram/indexed.hpp> + +namespace boost { +namespace histogram { +namespace algorithm { +/** Check to see if all histogram cells are empty. Use coverage to include or + exclude the underflow/overflow bins. + + This algorithm has O(N) complexity, where N is the number of cells. + + Returns true if all cells are empty, and false otherwise. + */ +template <class A, class S> +auto empty(const histogram<A, S>& h, coverage cov) { + using value_type = typename histogram<A, S>::value_type; + const value_type default_value = value_type(); + for (auto&& ind : indexed(h, cov)) { + if (*ind != default_value) { return false; } + } + return true; +} +} // namespace algorithm +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/algorithm/project.hpp b/ThirdParty/boost/histogram/algorithm/project.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d897a51b2cc6ef92ee68293f0bb57c22651b21a1 --- /dev/null +++ b/ThirdParty/boost/histogram/algorithm/project.hpp @@ -0,0 +1,104 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ALGORITHM_PROJECT_HPP +#define BOOST_HISTOGRAM_ALGORITHM_PROJECT_HPP + +#include <algorithm> +#include <boost/histogram/axis/variant.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/make_default.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/histogram.hpp> +#include <boost/histogram/indexed.hpp> +#include <boost/histogram/unsafe_access.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/set.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <type_traits> +#include <vector> + +namespace boost { +namespace histogram { +namespace algorithm { + +/** + Returns a lower-dimensional histogram, summing over removed axes. + + Arguments are the source histogram and compile-time numbers, the remaining indices of + the axes. Returns a new histogram which only contains the subset of axes. The source + histogram is summed over the removed axes. +*/ +template <class A, class S, unsigned N, typename... Ns> +auto project(const histogram<A, S>& h, std::integral_constant<unsigned, N>, Ns...) { + using LN = mp11::mp_list<std::integral_constant<unsigned, N>, Ns...>; + static_assert(mp11::mp_is_set<LN>::value, "indices must be unique"); + + const auto& old_axes = unsafe_access::axes(h); + auto axes = detail::static_if<detail::is_tuple<A>>( + [&](const auto& old_axes) { + return std::make_tuple(std::get<N>(old_axes), std::get<Ns::value>(old_axes)...); + }, + [&](const auto& old_axes) { + return std::decay_t<decltype(old_axes)>({old_axes[N], old_axes[Ns::value]...}); + }, + old_axes); + + const auto& old_storage = unsafe_access::storage(h); + using A2 = decltype(axes); + auto result = histogram<A2, S>(std::move(axes), detail::make_default(old_storage)); + auto idx = detail::make_stack_buffer<int>(unsafe_access::axes(result)); + for (auto&& x : indexed(h, coverage::all)) { + auto i = idx.begin(); + mp11::mp_for_each<LN>([&i, &x](auto J) { *i++ = x.index(J); }); + result.at(idx) += *x; + } + return result; +} + +/** + Returns a lower-dimensional histogram, summing over removed axes. + + This version accepts a source histogram and an iterable range containing the remaining + indices. +*/ +template <class A, class S, class Iterable, class = detail::requires_iterable<Iterable>> +auto project(const histogram<A, S>& h, const Iterable& c) { + using namespace boost::mp11; + const auto& old_axes = unsafe_access::axes(h); + + // axes is always std::vector<...>, even if A is tuple + auto axes = detail::make_empty_dynamic_axes(old_axes); + axes.reserve(c.size()); + auto seen = detail::make_stack_buffer<bool>(old_axes, false); + for (auto d : c) { + if (static_cast<unsigned>(d) >= h.rank()) + BOOST_THROW_EXCEPTION(std::invalid_argument("invalid axis index")); + if (seen[d]) BOOST_THROW_EXCEPTION(std::invalid_argument("indices are not unique")); + seen[d] = true; + axes.emplace_back(detail::axis_get(old_axes, d)); + } + + const auto& old_storage = unsafe_access::storage(h); + auto result = + histogram<decltype(axes), S>(std::move(axes), detail::make_default(old_storage)); + auto idx = detail::make_stack_buffer<int>(unsafe_access::axes(result)); + for (auto&& x : indexed(h, coverage::all)) { + auto i = idx.begin(); + for (auto d : c) *i++ = x.index(d); + result.at(idx) += *x; + } + + return result; +} + +} // namespace algorithm +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/algorithm/reduce.hpp b/ThirdParty/boost/histogram/algorithm/reduce.hpp new file mode 100644 index 0000000000000000000000000000000000000000..17d80200777f80db73521fdd709cbcad60963203 --- /dev/null +++ b/ThirdParty/boost/histogram/algorithm/reduce.hpp @@ -0,0 +1,494 @@ +// Copyright 2018-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ALGORITHM_REDUCE_HPP +#define BOOST_HISTOGRAM_ALGORITHM_REDUCE_HPP + +#include <boost/assert.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/make_default.hpp> +#include <boost/histogram/detail/reduce_command.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/histogram/indexed.hpp> +#include <boost/histogram/unsafe_access.hpp> +#include <boost/throw_exception.hpp> +#include <cmath> +#include <initializer_list> +#include <stdexcept> +#include <string> + +namespace boost { +namespace histogram { +namespace algorithm { + +/** Holder for a reduce command. + + Use this type to store reduce commands in a container. The internals of this type are an + implementation detail. +*/ +using reduce_command = detail::reduce_command; + +using reduce_option [[deprecated("use reduce_command instead")]] = + reduce_command; ///< deprecated + +/** Shrink command to be used in `reduce`. + + Command is applied to axis with given index. + + Shrinking is based on an inclusive value interval. The bin which contains the first + value starts the range of bins to keep. The bin which contains the second value is the + last included in that range. When the second value is exactly equal to a lower bin edge, + then the previous bin is the last in the range. + + The counts in removed bins are added to the corresponding underflow and overflow bins, + if they are present. If they are not present, the counts are discarded. Also see + `crop`, which always discards the counts. + + @param iaxis which axis to operate on. + @param lower bin which contains lower is first to be kept. + @param upper bin which contains upper is last to be kept, except if upper is equal to + the lower edge. +*/ +inline reduce_command shrink(unsigned iaxis, double lower, double upper) { + if (lower == upper) + BOOST_THROW_EXCEPTION(std::invalid_argument("lower != upper required")); + reduce_command r; + r.iaxis = iaxis; + r.range = reduce_command::range_t::values; + r.begin.value = lower; + r.end.value = upper; + r.merge = 1; + r.crop = false; + return r; +} + +/** Shrink command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + Shrinking is based on an inclusive value interval. The bin which contains the first + value starts the range of bins to keep. The bin which contains the second value is the + last included in that range. When the second value is exactly equal to a lower bin edge, + then the previous bin is the last in the range. + + The counts in removed bins are added to the corresponding underflow and overflow bins, + if they are present. If they are not present, the counts are discarded. Also see + `crop`, which always discards the counts. + + @param lower bin which contains lower is first to be kept. + @param upper bin which contains upper is last to be kept, except if upper is equal to + the lower edge. +*/ +inline reduce_command shrink(double lower, double upper) { + return shrink(reduce_command::unset, lower, upper); +} + +/** Crop command to be used in `reduce`. + + Command is applied to axis with given index. + + Works like `shrink` (see shrink documentation for details), but counts in removed + bins are always discarded, whether underflow and overflow bins are present or not. + + @param iaxis which axis to operate on. + @param lower bin which contains lower is first to be kept. + @param upper bin which contains upper is last to be kept, except if upper is equal to + the lower edge. +*/ +inline reduce_command crop(unsigned iaxis, double lower, double upper) { + reduce_command r = shrink(iaxis, lower, upper); + r.crop = true; + return r; +} + +/** Crop command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + Works like `shrink` (see shrink documentation for details), but counts in removed bins + are discarded, whether underflow and overflow bins are present or not. + + @param lower bin which contains lower is first to be kept. + @param upper bin which contains upper is last to be kept, except if upper is equal to + the lower edge. +*/ +inline reduce_command crop(double lower, double upper) { + return crop(reduce_command::unset, lower, upper); +} + +/// Whether to behave like `shrink` or `crop` regarding removed bins. +enum class slice_mode { shrink, crop }; + +/** Slice command to be used in `reduce`. + + Command is applied to axis with given index. + + Slicing works like `shrink` or `crop`, but uses bin indices instead of values. + + @param iaxis which axis to operate on. + @param begin first index that should be kept. + @param end one past the last index that should be kept. + @param mode whether to behave like `shrink` or `crop` regarding removed bins. +*/ +inline reduce_command slice(unsigned iaxis, axis::index_type begin, axis::index_type end, + slice_mode mode = slice_mode::shrink) { + if (!(begin < end)) + BOOST_THROW_EXCEPTION(std::invalid_argument("begin < end required")); + + reduce_command r; + r.iaxis = iaxis; + r.range = reduce_command::range_t::indices; + r.begin.index = begin; + r.end.index = end; + r.merge = 1; + r.crop = mode == slice_mode::crop; + return r; +} + +/** Slice command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + Slicing works like `shrink` or `crop`, but uses bin indices instead of values. + + @param begin first index that should be kept. + @param end one past the last index that should be kept. + @param mode whether to behave like `shrink` or `crop` regarding removed bins. +*/ +inline reduce_command slice(axis::index_type begin, axis::index_type end, + slice_mode mode = slice_mode::shrink) { + return slice(reduce_command::unset, begin, end, mode); +} + +/** Rebin command to be used in `reduce`. + + Command is applied to axis with given index. + + The command merges N adjacent bins into one. This makes the axis coarser and the bins + wider. The original number of bins is divided by N. If there is a rest to this devision, + the axis is implicitly shrunk at the upper end by that rest. + + @param iaxis which axis to operate on. + @param merge how many adjacent bins to merge into one. +*/ +inline reduce_command rebin(unsigned iaxis, unsigned merge) { + if (merge == 0) BOOST_THROW_EXCEPTION(std::invalid_argument("merge > 0 required")); + reduce_command r; + r.iaxis = iaxis; + r.merge = merge; + r.range = reduce_command::range_t::none; + r.crop = false; + return r; +} + +/** Rebin command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + The command merges N adjacent bins into one. This makes the axis coarser and the bins + wider. The original number of bins is divided by N. If there is a rest to this devision, + the axis is implicitly shrunk at the upper end by that rest. + + @param merge how many adjacent bins to merge into one. +*/ +inline reduce_command rebin(unsigned merge) { + return rebin(reduce_command::unset, merge); +} + +/** Shrink and rebin command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + To shrink(unsigned, double, double) and rebin(unsigned, unsigned) in one command (see + the respective commands for more details). Equivalent to passing both commands for the + same axis to `reduce`. + + @param iaxis which axis to operate on. + @param lower lowest bound that should be kept. + @param upper highest bound that should be kept. If upper is inside bin interval, the + whole interval is removed. + @param merge how many adjacent bins to merge into one. +*/ +inline reduce_command shrink_and_rebin(unsigned iaxis, double lower, double upper, + unsigned merge) { + reduce_command r = shrink(iaxis, lower, upper); + r.merge = rebin(merge).merge; + return r; +} + +/** Shrink and rebin command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + To `shrink` and `rebin` in one command (see the respective commands for more + details). Equivalent to passing both commands for the same axis to `reduce`. + + @param lower lowest bound that should be kept. + @param upper highest bound that should be kept. If upper is inside bin interval, the + whole interval is removed. + @param merge how many adjacent bins to merge into one. +*/ +inline reduce_command shrink_and_rebin(double lower, double upper, unsigned merge) { + return shrink_and_rebin(reduce_command::unset, lower, upper, merge); +} + +/** Crop and rebin command to be used in `reduce`. + + Command is applied to axis with given index. + + To `crop` and `rebin` in one command (see the respective commands for more + details). Equivalent to passing both commands for the same axis to `reduce`. + + @param iaxis which axis to operate on. + @param lower lowest bound that should be kept. + @param upper highest bound that should be kept. If upper is inside bin interval, + the whole interval is removed. + @param merge how many adjacent bins to merge into one. +*/ +inline reduce_command crop_and_rebin(unsigned iaxis, double lower, double upper, + unsigned merge) { + reduce_command r = crop(iaxis, lower, upper); + r.merge = rebin(merge).merge; + return r; +} + +/** Crop and rebin command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + To `crop` and `rebin` in one command (see the respective commands for more + details). Equivalent to passing both commands for the same axis to `reduce`. + + @param lower lowest bound that should be kept. + @param upper highest bound that should be kept. If upper is inside bin interval, + the whole interval is removed. + @param merge how many adjacent bins to merge into one. +*/ +inline reduce_command crop_and_rebin(double lower, double upper, unsigned merge) { + return crop_and_rebin(reduce_command::unset, lower, upper, merge); +} + +/** Slice and rebin command to be used in `reduce`. + + Command is applied to axis with given index. + + To `slice` and `rebin` in one command (see the respective commands for more + details). Equivalent to passing both commands for the same axis to `reduce`. + + @param iaxis which axis to operate on. + @param begin first index that should be kept. + @param end one past the last index that should be kept. + @param merge how many adjacent bins to merge into one. + @param mode slice mode, see slice_mode. +*/ +inline reduce_command slice_and_rebin(unsigned iaxis, axis::index_type begin, + axis::index_type end, unsigned merge, + slice_mode mode = slice_mode::shrink) { + reduce_command r = slice(iaxis, begin, end, mode); + r.merge = rebin(merge).merge; + return r; +} + +/** Slice and rebin command to be used in `reduce`. + + Command is applied to corresponding axis in order of reduce arguments. + + To `slice` and `rebin` in one command (see the respective commands for more + details). Equivalent to passing both commands for the same axis to `reduce`. + + @param begin first index that should be kept. + @param end one past the last index that should be kept. + @param merge how many adjacent bins to merge into one. + @param mode slice mode, see slice_mode. +*/ +inline reduce_command slice_and_rebin(axis::index_type begin, axis::index_type end, + unsigned merge, + slice_mode mode = slice_mode::shrink) { + return slice_and_rebin(reduce_command::unset, begin, end, merge, mode); +} + +/** Shrink, crop, slice, and/or rebin axes of a histogram. + + Returns a new reduced histogram and leaves the original histogram untouched. + + The commands `rebin` and `shrink` or `slice` for the same axis are + automatically combined, this is not an error. Passing a `shrink` and a `slice` + command for the same axis or two `rebin` commands triggers an `invalid_argument` + exception. Trying to reducing a non-reducible axis triggers an `invalid_argument` + exception. Histograms with non-reducible axes can still be reduced along the + other axes that are reducible. + + @param hist original histogram. + @param options iterable sequence of reduce commands: `shrink`, `slice`, `rebin`, + `shrink_and_rebin`, or `slice_and_rebin`. The element type of the iterable should be + `reduce_command`. +*/ +template <class Histogram, class Iterable, class = detail::requires_iterable<Iterable>> +Histogram reduce(const Histogram& hist, const Iterable& options) { + using axis::index_type; + + const auto& old_axes = unsafe_access::axes(hist); + + auto opts = detail::make_stack_buffer<reduce_command>(old_axes); + + // check for invalid commands, merge commands, and set iaxis for positional commands + unsigned iaxis = 0; + for (const reduce_command& o_in : options) { + BOOST_ASSERT(o_in.merge > 0); + if (o_in.iaxis != reduce_command::unset && o_in.iaxis >= hist.rank()) + BOOST_THROW_EXCEPTION(std::invalid_argument("invalid axis index")); + auto& o_out = opts[o_in.iaxis == reduce_command::unset ? iaxis : o_in.iaxis]; + if (o_out.merge == 0) { + o_out = o_in; + } else { + // Some command was already set for this axis, see if we can combine commands. + // We can combine a rebin and non-rebin command. + if (!((o_in.range == reduce_command::range_t::none) ^ + (o_out.range == reduce_command::range_t::none)) || + (o_out.merge > 1 && o_in.merge > 1)) + BOOST_THROW_EXCEPTION(std::invalid_argument( + "multiple conflicting reduce commands for axis " + + std::to_string(o_in.iaxis == reduce_command::unset ? iaxis : o_in.iaxis))); + if (o_in.range != reduce_command::range_t::none) { + o_out.range = o_in.range; + o_out.begin = o_in.begin; + o_out.end = o_in.end; + } else { + o_out.merge = o_in.merge; + } + } + ++iaxis; + } + + // make new axes container with default-constructed axis instances + auto axes = detail::make_default(old_axes); + detail::static_if<detail::is_tuple<decltype(axes)>>( + [](auto&, const auto&) {}, + [](auto& axes, const auto& old_axes) { + axes.reserve(old_axes.size()); + detail::for_each_axis(old_axes, [&axes](const auto& a) { + axes.emplace_back(detail::make_default(a)); + }); + }, + axes, old_axes); + + // override default-constructed axis instances with modified instances + iaxis = 0; + hist.for_each_axis([&](const auto& a_in) { + using A = std::decay_t<decltype(a_in)>; + using AO = axis::traits::get_options<A>; + auto& o = opts[iaxis]; + o.is_ordered = axis::traits::ordered(a_in); + if (o.merge > 0) { // option is set? + o.use_underflow_bin = !o.crop && AO::test(axis::option::underflow); + o.use_overflow_bin = !o.crop && AO::test(axis::option::overflow); + detail::static_if_c<axis::traits::is_reducible<A>::value>( + [&o](auto&& a_out, const auto& a_in) { + using A = std::decay_t<decltype(a_in)>; + if (o.range == reduce_command::range_t::none) { + o.begin.index = 0; + o.end.index = a_in.size(); + } else { + if (o.range == reduce_command::range_t::values) { + const auto end_value = o.end.value; + o.begin.index = axis::traits::index(a_in, o.begin.value); + o.end.index = axis::traits::index(a_in, o.end.value); + // end = index + 1, unless end_value is exactly equal to (upper) bin edge + if (axis::traits::value_as<double>(a_in, o.end.index) != end_value) + ++o.end.index; + } + // limit [begin, end] to [0, size()] + if (o.begin.index < 0) o.begin.index = 0; + if (o.end.index > a_in.size()) o.end.index = a_in.size(); + } + // shorten the index range to a multiple of o.merge; + // example [1, 4] with merge = 2 is reduced to [1, 3] + o.end.index -= + (o.end.index - o.begin.index) % static_cast<index_type>(o.merge); + a_out = A(a_in, o.begin.index, o.end.index, o.merge); + }, + [iaxis](auto&&, const auto&) { + BOOST_THROW_EXCEPTION(std::invalid_argument("axis " + std::to_string(iaxis) + + " is not reducible")); + }, + axis::get<A>(detail::axis_get(axes, iaxis)), a_in); + } else { + // command was not set for this axis; fill noop values and copy original axis + o.use_underflow_bin = AO::test(axis::option::underflow); + o.use_overflow_bin = AO::test(axis::option::overflow); + o.merge = 1; + o.begin.index = 0; + o.end.index = a_in.size(); + axis::get<A>(detail::axis_get(axes, iaxis)) = a_in; + } + ++iaxis; + }); + + auto idx = detail::make_stack_buffer<index_type>(axes); + auto result = + Histogram(std::move(axes), detail::make_default(unsafe_access::storage(hist))); + for (auto&& x : indexed(hist, coverage::all)) { + auto i = idx.begin(); + auto o = opts.begin(); + bool skip = false; + + for (auto j : x.indices()) { + *i = (j - o->begin.index); + if (o->is_ordered && *i <= -1) { + *i = -1; + if (!o->use_underflow_bin) skip = true; + } else { + if (*i >= 0) + *i /= static_cast<index_type>(o->merge); + else + *i = o->end.index; + const auto reduced_axis_end = + (o->end.index - o->begin.index) / static_cast<index_type>(o->merge); + if (*i >= reduced_axis_end) { + *i = reduced_axis_end; + if (!o->use_overflow_bin) skip = true; + } + } + + ++i; + ++o; + } + + if (!skip) result.at(idx) += *x; + } + + return result; +} + +/** Shrink, slice, and/or rebin axes of a histogram. + + Returns a new reduced histogram and leaves the original histogram untouched. + + The commands `rebin` and `shrink` or `slice` for the same axis are + automatically combined, this is not an error. Passing a `shrink` and a `slice` + command for the same axis or two `rebin` commands triggers an invalid_argument + exception. It is safe to reduce histograms with some axis that are not reducible along + the other axes. Trying to reducing a non-reducible axis triggers an invalid_argument + exception. + + @param hist original histogram. + @param opt first reduce command; one of `shrink`, `slice`, `rebin`, + `shrink_and_rebin`, or `slice_or_rebin`. + @param opts more reduce commands. +*/ +template <class Histogram, class... Ts> +Histogram reduce(const Histogram& hist, const reduce_command& opt, const Ts&... opts) { + // this must be in one line, because any of the ts could be a temporary + return reduce(hist, std::initializer_list<reduce_command>{opt, opts...}); +} + +} // namespace algorithm +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/algorithm/sum.hpp b/ThirdParty/boost/histogram/algorithm/sum.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c6573be9acb2b365889289b12fde9c38e043a8ac --- /dev/null +++ b/ThirdParty/boost/histogram/algorithm/sum.hpp @@ -0,0 +1,67 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_ALGORITHM_SUM_HPP +#define BOOST_HISTOGRAM_ALGORITHM_SUM_HPP + +#include <boost/histogram/accumulators/sum.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/histogram/indexed.hpp> +#include <boost/mp11/utility.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace algorithm { + +/** Compute the sum over all histogram cells (underflow/overflow included by default). + + The implementation favors accuracy and protection against overflow over speed. If the + value type of the histogram is an integral or floating point type, + accumulators::sum<double> is used to compute the sum, else the original value type is + used. Compilation fails, if the value type does not support operator+=. The return type + is double if the value type of the histogram is integral or floating point, and the + original value type otherwise. + + If you need a different trade-off, you can write your own loop or use `std::accumulate`: + ``` + // iterate over all bins + auto sum_all = std::accumulate(hist.begin(), hist.end(), 0.0); + + // skip underflow/overflow bins + double sum = 0; + for (auto&& x : indexed(hist)) + sum += *x; // dereference accessor + + // or: + // auto ind = boost::histogram::indexed(hist); + // auto sum = std::accumulate(ind.begin(), ind.end(), 0.0); + ``` + + @returns accumulator type or double + + @param hist Const reference to the histogram. + @param cov Iterate over all or only inner bins (optional, default: all). +*/ +template <class A, class S> +auto sum(const histogram<A, S>& hist, const coverage cov = coverage::all) { + using T = typename histogram<A, S>::value_type; + using sum_type = mp11::mp_if<std::is_arithmetic<T>, accumulators::sum<double>, T>; + sum_type sum; + if (cov == coverage::all) + for (auto&& x : hist) sum += x; + else + // sum += x also works if sum_type::operator+=(const sum_type&) exists + for (auto&& x : indexed(hist)) sum += *x; + using R = mp11::mp_if<std::is_arithmetic<T>, double, T>; + return static_cast<R>(sum); +} + +} // namespace algorithm +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis.hpp b/ThirdParty/boost/histogram/axis.hpp new file mode 100644 index 0000000000000000000000000000000000000000..88d86780ac0c5050c6fa9f606443239caae3c877 --- /dev/null +++ b/ThirdParty/boost/histogram/axis.hpp @@ -0,0 +1,26 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_HPP +#define BOOST_HISTOGRAM_AXIS_HPP + +/** + \file boost/histogram/axis.hpp + Includes all axis headers of the Boost.Histogram library. + + Extra header not automatically included: + - [boost/histogram/axis/ostream.hpp][1] + + [1]: histogram/reference.html#header.boost.histogram.axis.ostream_hpp +*/ + +#include <boost/histogram/axis/category.hpp> +#include <boost/histogram/axis/integer.hpp> +#include <boost/histogram/axis/regular.hpp> +#include <boost/histogram/axis/variable.hpp> +#include <boost/histogram/axis/variant.hpp> + +#endif diff --git a/ThirdParty/boost/histogram/axis/category.hpp b/ThirdParty/boost/histogram/axis/category.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d3d69e29ef0708e2fdc7dd501e48dc87eb81fd7e --- /dev/null +++ b/ThirdParty/boost/histogram/axis/category.hpp @@ -0,0 +1,202 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_CATEGORY_HPP +#define BOOST_HISTOGRAM_AXIS_CATEGORY_HPP + +#include <algorithm> +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/iterator.hpp> +#include <boost/histogram/axis/metadata_base.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <string> +#include <type_traits> +#include <utility> +#include <vector> + +namespace boost { +namespace histogram { +namespace axis { + +/** + Maps at a set of unique values to bin indices. + + The axis maps a set of values to bins, following the order of arguments in the + constructor. The optional overflow bin for this axis counts input values that + are not part of the set. Binning has O(N) complexity, but with a very small + factor. For small N (the typical use case) it beats other kinds of lookup. + + @tparam Value input value type, must be equal-comparable. + @tparam MetaData type to store meta data. + @tparam Options see boost::histogram::axis::option. + @tparam Allocator allocator to use for dynamic memory management. + + The options `underflow` and `circular` are not allowed. The options `growth` + and `overflow` are mutually exclusive. +*/ +template <class Value, class MetaData, class Options, class Allocator> +class category : public iterator_mixin<category<Value, MetaData, Options, Allocator>>, + public metadata_base<MetaData> { + // these must be private, so that they are not automatically inherited + using value_type = Value; + using metadata_type = typename metadata_base<MetaData>::metadata_type; + using options_type = detail::replace_default<Options, option::overflow_t>; + using allocator_type = Allocator; + using vector_type = std::vector<value_type, allocator_type>; + + static_assert(!options_type::test(option::underflow), + "category axis cannot have underflow"); + static_assert(!options_type::test(option::circular), + "category axis cannot be circular"); + static_assert(!(options_type::test(option::growth) && + options_type::test(option::overflow)), + "growing category axis cannot have entries in overflow bin"); + +public: + constexpr category() = default; + explicit category(allocator_type alloc) : vec_(alloc) {} + + /** Construct from iterator range of unique values. + * + * \param begin begin of category range of unique values. + * \param end end of category range of unique values. + * \param meta description of the axis. + * \param alloc allocator instance to use. + */ + template <class It, class = detail::requires_iterator<It>> + category(It begin, It end, metadata_type meta = {}, allocator_type alloc = {}) + : metadata_base<MetaData>(std::move(meta)), vec_(alloc) { + if (std::distance(begin, end) < 0) + BOOST_THROW_EXCEPTION( + std::invalid_argument("end must be reachable by incrementing begin")); + vec_.reserve(std::distance(begin, end)); + while (begin != end) vec_.emplace_back(*begin++); + } + + /** Construct axis from iterable sequence of unique values. + * + * \param iterable sequence of unique values. + * \param meta description of the axis. + * \param alloc allocator instance to use. + */ + template <class C, class = detail::requires_iterable<C>> + category(const C& iterable, metadata_type meta = {}, allocator_type alloc = {}) + : category(std::begin(iterable), std::end(iterable), std::move(meta), + std::move(alloc)) {} + + /** Construct axis from an initializer list of unique values. + * + * \param list `std::initializer_list` of unique values. + * \param meta description of the axis. + * \param alloc allocator instance to use. + */ + template <class U> + category(std::initializer_list<U> list, metadata_type meta = {}, + allocator_type alloc = {}) + : category(list.begin(), list.end(), std::move(meta), std::move(alloc)) {} + + /// Constructor used by algorithm::reduce to shrink and rebin (not for users). + category(const category& src, index_type begin, index_type end, unsigned merge) + // LCOV_EXCL_START: gcc-8 is missing the delegated ctor for no reason + : category(src.vec_.begin() + begin, src.vec_.begin() + end, src.metadata(), + src.get_allocator()) + // LCOV_EXCL_STOP + { + if (merge > 1) + BOOST_THROW_EXCEPTION(std::invalid_argument("cannot merge bins for category axis")); + } + + /// Return index for value argument. + index_type index(const value_type& x) const noexcept { + const auto beg = vec_.begin(); + const auto end = vec_.end(); + return static_cast<index_type>(std::distance(beg, std::find(beg, end, x))); + } + + /// Returns index and shift (if axis has grown) for the passed argument. + std::pair<index_type, index_type> update(const value_type& x) { + const auto i = index(x); + if (i < size()) return {i, 0}; + vec_.emplace_back(x); + return {i, -1}; + } + + /// Return value for index argument. + /// Throws `std::out_of_range` if the index is out of bounds. + auto value(index_type idx) const + -> std::conditional_t<std::is_scalar<value_type>::value, value_type, + const value_type&> { + if (idx < 0 || idx >= size()) + BOOST_THROW_EXCEPTION(std::out_of_range("category index out of range")); + return vec_[idx]; + } + + /// Return value for index argument; alias for value(...). + decltype(auto) bin(index_type idx) const { return value(idx); } + + /// Returns the number of bins, without over- or underflow. + index_type size() const noexcept { return static_cast<index_type>(vec_.size()); } + + /// Returns the options. + static constexpr unsigned options() noexcept { return options_type::value; } + + /// Whether the axis is inclusive (see axis::traits::is_inclusive). + static constexpr bool inclusive() noexcept { + return options() & (option::overflow | option::growth); + } + + /// Indicate that the axis is not ordered. + static constexpr bool ordered() noexcept { return false; } + + template <class V, class M, class O, class A> + bool operator==(const category<V, M, O, A>& o) const noexcept { + const auto& a = vec_; + const auto& b = o.vec_; + return std::equal(a.begin(), a.end(), b.begin(), b.end()) && + metadata_base<MetaData>::operator==(o); + } + + template <class V, class M, class O, class A> + bool operator!=(const category<V, M, O, A>& o) const noexcept { + return !operator==(o); + } + + allocator_type get_allocator() const { return vec_.get_allocator(); } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("seq", vec_); + ar& make_nvp("meta", this->metadata()); + } + +private: + vector_type vec_; + + template <class V, class M, class O, class A> + friend class category; +}; + +#if __cpp_deduction_guides >= 201606 + +template <class T> +category(std::initializer_list<T>) + ->category<detail::replace_cstring<std::decay_t<T>>, null_type>; + +template <class T, class M> +category(std::initializer_list<T>, M) + ->category<detail::replace_cstring<std::decay_t<T>>, + detail::replace_cstring<std::decay_t<M>>>; + +#endif + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/integer.hpp b/ThirdParty/boost/histogram/axis/integer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0403cc6720bb23a44f303697ca0bff1840ef1b9e --- /dev/null +++ b/ThirdParty/boost/histogram/axis/integer.hpp @@ -0,0 +1,216 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_INTEGER_HPP +#define BOOST_HISTOGRAM_AXIS_INTEGER_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/iterator.hpp> +#include <boost/histogram/axis/metadata_base.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/detail/convert_integer.hpp> +#include <boost/histogram/detail/limits.hpp> +#include <boost/histogram/detail/replace_type.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/throw_exception.hpp> +#include <cmath> +#include <limits> +#include <stdexcept> +#include <string> +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { +namespace axis { + +/** + Axis for an interval of integer values with unit steps. + + Binning is a O(1) operation. This axis bins faster than a regular axis. + + @tparam Value input value type. Must be integer or floating point. + @tparam MetaData type to store meta data. + @tparam Options see boost::histogram::axis::option (all values allowed). + */ +template <class Value, class MetaData, class Options> +class integer : public iterator_mixin<integer<Value, MetaData, Options>>, + public metadata_base<MetaData> { + // these must be private, so that they are not automatically inherited + using value_type = Value; + using metadata_type = typename metadata_base<MetaData>::metadata_type; + using options_type = + detail::replace_default<Options, decltype(option::underflow | option::overflow)>; + + static_assert(std::is_integral<value_type>::value || + std::is_floating_point<value_type>::value, + "integer axis requires floating point or integral type"); + + static_assert(!options_type::test(option::circular | option::growth) || + (options_type::test(option::circular) ^ + options_type::test(option::growth)), + "circular and growth options are mutually exclusive"); + + static_assert(std::is_floating_point<value_type>::value || + (!options_type::test(option::circular) && + !options_type::test(option::growth)) || + (!options_type::test(option::overflow) && + !options_type::test(option::underflow)), + "circular or growing integer axis with integral type " + "cannot have entries in underflow or overflow bins"); + + using local_index_type = std::conditional_t<std::is_integral<value_type>::value, + index_type, real_index_type>; + +public: + constexpr integer() = default; + + /** Construct over semi-open integer interval [start, stop). + * + * \param start first integer of covered range. + * \param stop one past last integer of covered range. + * \param meta description of the axis. + */ + integer(value_type start, value_type stop, metadata_type meta = {}) + : metadata_base<MetaData>(std::move(meta)) + , size_(static_cast<index_type>(stop - start)) + , min_(start) { + if (!(stop >= start)) + BOOST_THROW_EXCEPTION(std::invalid_argument("stop >= start required")); + } + + /// Constructor used by algorithm::reduce to shrink and rebin. + integer(const integer& src, index_type begin, index_type end, unsigned merge) + : integer(src.value(begin), src.value(end), src.metadata()) { + if (merge > 1) + BOOST_THROW_EXCEPTION(std::invalid_argument("cannot merge bins for integer axis")); + if (options_type::test(option::circular) && !(begin == 0 && end == src.size())) + BOOST_THROW_EXCEPTION(std::invalid_argument("cannot shrink circular axis")); + } + + /// Return index for value argument. + index_type index(value_type x) const noexcept { + return detail::static_if<std::is_floating_point<value_type>>( + [this](const auto z) -> index_type { + // need to handle NaN, cannot simply cast to int and call int-implementation + if (options_type::test(option::circular)) { + if (std::isfinite(z)) + return static_cast<index_type>(std::floor(z) - + std::floor(z / this->size()) * this->size()); + } else if (z < this->size()) + return z >= 0 ? static_cast<index_type>(z) : -1; + return this->size(); + }, + [this](const auto z) -> index_type { + if (options_type::test(option::circular)) + return static_cast<index_type>(z - std::floor(float(z) / this->size()) * + this->size()); + if (z < this->size()) return z >= 0 ? z : -1; + return this->size(); + }, + x - min_); + } + + /// Returns index and shift (if axis has grown) for the passed argument. + auto update(value_type x) noexcept { + auto impl = [this](long x) -> std::pair<index_type, index_type> { + const auto i = x - min_; + if (i >= 0) { + const auto k = static_cast<axis::index_type>(i); + if (k < size()) return {k, 0}; + const auto n = k - size() + 1; + size_ += n; + return {k, -n}; + } + const auto k = static_cast<axis::index_type>( + detail::static_if<std::is_floating_point<value_type>>( + [](auto x) { return std::floor(x); }, [](auto x) { return x; }, i)); + min_ += k; + size_ -= k; + return {0, -k}; + }; + + return detail::static_if<std::is_floating_point<value_type>>( + [this, impl](auto x) -> std::pair<index_type, index_type> { + if (std::isfinite(x)) return impl(static_cast<long>(std::floor(x))); + return {x < 0 ? -1 : this->size(), 0}; + }, + impl, x); + } + + /// Return value for index argument. + value_type value(local_index_type i) const noexcept { + if (!options_type::test(option::circular) && + std::is_floating_point<value_type>::value) { + if (i < 0) return detail::lowest<value_type>(); + if (i > size()) return detail::highest<value_type>(); + } + return min_ + i; + } + + /// Return bin for index argument. + decltype(auto) bin(index_type idx) const noexcept { + return detail::static_if<std::is_floating_point<value_type>>( + [this](auto idx) { return interval_view<integer>(*this, idx); }, + [this](auto idx) { return this->value(idx); }, idx); + } + + /// Returns the number of bins, without over- or underflow. + index_type size() const noexcept { return size_; } + + /// Returns the options. + static constexpr unsigned options() noexcept { return options_type::value; } + + /// Whether the axis is inclusive (see axis::traits::is_inclusive). + static constexpr bool inclusive() noexcept { + return (options() & option::underflow || options() & option::overflow) || + (std::is_integral<value_type>::value && + (options() & (option::growth | option::circular))); + } + + template <class V, class M, class O> + bool operator==(const integer<V, M, O>& o) const noexcept { + return size() == o.size() && min_ == o.min_ && metadata_base<MetaData>::operator==(o); + } + + template <class V, class M, class O> + bool operator!=(const integer<V, M, O>& o) const noexcept { + return !operator==(o); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("size", size_); + ar& make_nvp("meta", this->metadata()); + ar& make_nvp("min", min_); + } + +private: + index_type size_{0}; + value_type min_{0}; + + template <class V, class M, class O> + friend class integer; +}; + +#if __cpp_deduction_guides >= 201606 + +template <class T> +integer(T, T)->integer<detail::convert_integer<T, index_type>, null_type>; + +template <class T, class M> +integer(T, T, M) + ->integer<detail::convert_integer<T, index_type>, + detail::replace_type<std::decay_t<M>, const char*, std::string>>; + +#endif + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/interval_view.hpp b/ThirdParty/boost/histogram/axis/interval_view.hpp new file mode 100644 index 0000000000000000000000000000000000000000..278d7a496b3b23abcd1f3bcdd06774da11478183 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/interval_view.hpp @@ -0,0 +1,56 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_INTERVAL_VIEW_HPP +#define BOOST_HISTOGRAM_AXIS_INTERVAL_VIEW_HPP + +#include <boost/histogram/fwd.hpp> + +namespace boost { +namespace histogram { +namespace axis { + +/** + Lightweight bin view. + + Represents the current bin interval. +*/ +template <class Axis> +class interval_view { +public: + interval_view(const Axis& axis, index_type idx) : axis_(axis), idx_(idx) {} + // avoid viewing a temporary that goes out of scope + interval_view(Axis&& axis, index_type idx) = delete; + + /// Return lower edge of bin. + decltype(auto) lower() const noexcept { return axis_.value(idx_); } + /// Return upper edge of bin. + decltype(auto) upper() const noexcept { return axis_.value(idx_ + 1); } + /// Return center of bin. + decltype(auto) center() const noexcept { return axis_.value(idx_ + 0.5); } + /// Return width of bin. + decltype(auto) width() const noexcept { return upper() - lower(); } + + template <class BinType> + bool operator==(const BinType& rhs) const noexcept { + return lower() == rhs.lower() && upper() == rhs.upper(); + } + + template <class BinType> + bool operator!=(const BinType& rhs) const noexcept { + return !operator==(rhs); + } + +private: + const Axis& axis_; + const index_type idx_; +}; + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/iterator.hpp b/ThirdParty/boost/histogram/axis/iterator.hpp new file mode 100644 index 0000000000000000000000000000000000000000..77ce425c89df6b3dc38d74f0d41f51e342738f58 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/iterator.hpp @@ -0,0 +1,66 @@ +// Copyright 2015-2017 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_ITERATOR_HPP +#define BOOST_HISTOGRAM_AXIS_ITERATOR_HPP + +#include <boost/histogram/axis/interval_view.hpp> +#include <boost/histogram/detail/iterator_adaptor.hpp> +#include <iterator> + +namespace boost { +namespace histogram { +namespace axis { + +template <class Axis> +class iterator : public detail::iterator_adaptor<iterator<Axis>, index_type, + decltype(std::declval<Axis>().bin(0))> { +public: + /// Make iterator from axis and index. + iterator(const Axis& axis, index_type idx) + : iterator::iterator_adaptor_(idx), axis_(axis) {} + + /// Return current bin object. + decltype(auto) operator*() const { return axis_.bin(this->base()); } + +private: + const Axis& axis_; +}; + +/// Uses CRTP to inject iterator logic into Derived. +template <class Derived> +class iterator_mixin { +public: + using const_iterator = iterator<Derived>; + using const_reverse_iterator = std::reverse_iterator<const_iterator>; + + /// Bin iterator to beginning of the axis (read-only). + const_iterator begin() const noexcept { + return const_iterator(*static_cast<const Derived*>(this), 0); + } + + /// Bin iterator to the end of the axis (read-only). + const_iterator end() const noexcept { + return const_iterator(*static_cast<const Derived*>(this), + static_cast<const Derived*>(this)->size()); + } + + /// Reverse bin iterator to the last entry of the axis (read-only). + const_reverse_iterator rbegin() const noexcept { + return std::make_reverse_iterator(end()); + } + + /// Reverse bin iterator to the end (read-only). + const_reverse_iterator rend() const noexcept { + return std::make_reverse_iterator(begin()); + } +}; + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/metadata_base.hpp b/ThirdParty/boost/histogram/axis/metadata_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ff3d99d398cfadd624556b454bfdcfb1138dd8be --- /dev/null +++ b/ThirdParty/boost/histogram/axis/metadata_base.hpp @@ -0,0 +1,67 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_METADATA_BASE_HPP +#define BOOST_HISTOGRAM_AXIS_METADATA_BASE_HPP + +#include <boost/core/empty_value.hpp> +#include <boost/histogram/detail/relaxed_equal.hpp> +#include <boost/histogram/detail/replace_type.hpp> +#include <string> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace axis { + +/// Meta data holder with space optimization for empty meta data types. +template <class Metadata, + class DetailMetadata = detail::replace_default<Metadata, std::string>> +class metadata_base : empty_value<DetailMetadata> { + using base_t = empty_value<DetailMetadata>; + +protected: + using metadata_type = DetailMetadata; + + // std::string explicitly guarantees nothrow only in C++17 + static_assert(std::is_same<metadata_type, std::string>::value || + std::is_nothrow_move_constructible<metadata_type>::value, + "metadata must be nothrow move constructible"); + + metadata_base() = default; + metadata_base(const metadata_base&) = default; + metadata_base& operator=(const metadata_base&) = default; + + // make noexcept because std::string is nothrow move constructible only in C++17 + metadata_base(metadata_base&& o) noexcept : base_t(std::move(o)) {} + metadata_base(metadata_type&& o) noexcept : base_t(empty_init_t{}, std::move(o)) {} + // make noexcept because std::string is nothrow move constructible only in C++17 + metadata_base& operator=(metadata_base&& o) noexcept { + base_t::operator=(o); + return *this; + } + +public: + /// Returns reference to metadata. + metadata_type& metadata() noexcept { return base_t::get(); } + + /// Returns reference to const metadata. + const metadata_type& metadata() const noexcept { return base_t::get(); } + + bool operator==(const metadata_base& o) const noexcept { + return detail::relaxed_equal(metadata(), o.metadata()); + } + + bool operator!=(const metadata_base& o) const noexcept { + return operator==(o.metadata()); + } +}; + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/option.hpp b/ThirdParty/boost/histogram/axis/option.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f6142f94454a7c67dcdc81863b158a8bb9e1a681 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/option.hpp @@ -0,0 +1,81 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_OPTION_HPP +#define BOOST_HISTOGRAM_AXIS_OPTION_HPP + +#include <type_traits> + +/** + \file option.hpp Options for builtin axis types. + + Options `circular` and `growth` are mutually exclusive. + Options `circular` and `underflow` are mutually exclusive. +*/ + +namespace boost { +namespace histogram { +namespace axis { +namespace option { + +/// Holder of axis options. +template <unsigned Bits> +struct bitset : std::integral_constant<unsigned, Bits> { + /// Returns true if all option flags in the argument are set and false otherwise. + template <unsigned B> + static constexpr auto test(bitset<B>) { + return std::integral_constant<bool, static_cast<bool>((Bits & B) == B)>{}; + } +}; + +/// Set union of the axis option arguments. +template <unsigned B1, unsigned B2> +constexpr auto operator|(bitset<B1>, bitset<B2>) { + return bitset<(B1 | B2)>{}; +} + +/// Set intersection of the option arguments. +template <unsigned B1, unsigned B2> +constexpr auto operator&(bitset<B1>, bitset<B2>) { + return bitset<(B1 & B2)>{}; +} + +/// Set difference of the option arguments. +template <unsigned B1, unsigned B2> +constexpr auto operator-(bitset<B1>, bitset<B2>) { + return bitset<(B1 & ~B2)>{}; +} + +/** + Single option flag. + + @tparam Pos position of the bit in the set. +*/ +template <unsigned Pos> +struct bit : bitset<(1 << Pos)> {}; + +/// All options off. +using none_t = bitset<0>; +constexpr none_t none{}; ///< Instance of `none_t`. +/// Axis has an underflow bin. Mutually exclusive with `circular`. +using underflow_t = bit<0>; +constexpr underflow_t underflow{}; ///< Instance of `underflow_t`. +/// Axis has overflow bin. +using overflow_t = bit<1>; +constexpr overflow_t overflow{}; ///< Instance of `overflow_t`. +/// Axis is circular. Mutually exclusive with `growth` and `underflow`. +using circular_t = bit<2>; +constexpr circular_t circular{}; ///< Instance of `circular_t`. +/// Axis can grow. Mutually exclusive with `circular`. +using growth_t = bit<3>; +constexpr growth_t growth{}; ///< Instance of `growth_t`. + +} // namespace option +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/ostream.hpp b/ThirdParty/boost/histogram/axis/ostream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ca307a59f2df50c1275cc23b8078eb59ffb00554 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/ostream.hpp @@ -0,0 +1,197 @@ +// Copyright 2015-2017 Hans Dembinski +// +// 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) +// +// String representations here evaluate correctly in Python. + +#ifndef BOOST_HISTOGRAM_AXIS_OSTREAM_HPP +#define BOOST_HISTOGRAM_AXIS_OSTREAM_HPP + +#include <boost/assert.hpp> +#include <boost/histogram/axis/regular.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/detail/type_name.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/throw_exception.hpp> +#include <iomanip> +#include <iosfwd> +#include <sstream> +#include <stdexcept> +#include <type_traits> + +/** + \file boost/histogram/axis/ostream.hpp + Simple streaming operators for the builtin axis types. + + The text representation is not guaranteed to be stable between versions of + Boost.Histogram. This header is only included by + [boost/histogram/ostream.hpp](histogram/reference.html#header.boost.histogram.ostream_hpp). + To you use your own, include your own implementation instead of this header and do not + include + [boost/histogram/ostream.hpp](histogram/reference.html#header.boost.histogram.ostream_hpp). + */ + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +namespace boost { +namespace histogram { + +namespace detail { +inline const char* axis_suffix(const axis::transform::id&) { return ""; } +inline const char* axis_suffix(const axis::transform::log&) { return "_log"; } +inline const char* axis_suffix(const axis::transform::sqrt&) { return "_sqrt"; } +inline const char* axis_suffix(const axis::transform::pow&) { return "_pow"; } + +template <class OStream, class T> +void stream_metadata(OStream& os, const T& t) { + detail::static_if<detail::is_streamable<T>>( + [&os](const auto& t) { + std::ostringstream oss; + oss << t; + if (!oss.str().empty()) { os << ", metadata=" << std::quoted(oss.str()); } + }, + [&os](const auto&) { os << ", metadata=" << detail::type_name<T>(); }, t); +} + +template <class OStream> +void stream_options(OStream& os, const unsigned bits) { + os << ", options="; + bool first = true; + +#define BOOST_HISTOGRAM_AXIS_OPTION_OSTREAM(x) \ + if (bits & axis::option::x) { \ + if (first) \ + first = false; \ + else { \ + os << " | "; \ + } \ + os << #x; \ + } + + BOOST_HISTOGRAM_AXIS_OPTION_OSTREAM(underflow); + BOOST_HISTOGRAM_AXIS_OPTION_OSTREAM(overflow); + BOOST_HISTOGRAM_AXIS_OPTION_OSTREAM(circular); + BOOST_HISTOGRAM_AXIS_OPTION_OSTREAM(growth); + +#undef BOOST_HISTOGRAM_AXIS_OPTION_OSTREAM + + if (first) os << "none"; +} + +template <class OStream, class T> +void stream_transform(OStream&, const T&) {} + +template <class OStream> +void stream_transform(OStream& os, const axis::transform::pow& t) { + os << ", power=" << t.power; +} + +template <class OStream, class T> +void stream_value(OStream& os, const T& t) { + os << t; +} + +template <class OStream, class... Ts> +void stream_value(OStream& os, const std::basic_string<Ts...>& t) { + os << std::quoted(t); +} + +} // namespace detail + +namespace axis { + +template <class T> +class polymorphic_bin; + +template <class... Ts> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, const null_type&) { + return os; // do nothing +} + +template <class... Ts, class U> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const interval_view<U>& i) { + os << "[" << i.lower() << ", " << i.upper() << ")"; + return os; +} + +template <class... Ts, class U> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const polymorphic_bin<U>& i) { + if (i.is_discrete()) + os << static_cast<double>(i); + else + os << "[" << i.lower() << ", " << i.upper() << ")"; + return os; +} + +template <class... Ts, class... Us> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const regular<Us...>& a) { + os << "regular" << detail::axis_suffix(a.transform()) << "(" << a.size() << ", " + << a.value(0) << ", " << a.value(a.size()); + detail::stream_metadata(os, a.metadata()); + detail::stream_options(os, a.options()); + detail::stream_transform(os, a.transform()); + os << ")"; + return os; +} + +template <class... Ts, class... Us> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const integer<Us...>& a) { + os << "integer(" << a.value(0) << ", " << a.value(a.size()); + detail::stream_metadata(os, a.metadata()); + detail::stream_options(os, a.options()); + os << ")"; + return os; +} + +template <class... Ts, class... Us> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const variable<Us...>& a) { + os << "variable(" << a.value(0); + for (index_type i = 1, n = a.size(); i <= n; ++i) { os << ", " << a.value(i); } + detail::stream_metadata(os, a.metadata()); + detail::stream_options(os, a.options()); + os << ")"; + return os; +} + +template <class... Ts, class... Us> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const category<Us...>& a) { + os << "category("; + for (index_type i = 0, n = a.size(); i < n; ++i) { + detail::stream_value(os, a.value(i)); + os << (i == (a.size() - 1) ? "" : ", "); + } + detail::stream_metadata(os, a.metadata()); + detail::stream_options(os, a.options()); + os << ")"; + return os; +} + +template <class... Ts, class... Us> +std::basic_ostream<Ts...>& operator<<(std::basic_ostream<Ts...>& os, + const variant<Us...>& v) { + visit( + [&os](const auto& x) { + using A = std::decay_t<decltype(x)>; + detail::static_if<detail::is_streamable<A>>( + [&os](const auto& x) { os << x; }, + [&os](const auto&) { os << "<unstreamable>"; }, x); + }, + v); + return os; +} + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED + +#endif diff --git a/ThirdParty/boost/histogram/axis/polymorphic_bin.hpp b/ThirdParty/boost/histogram/axis/polymorphic_bin.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3849711d4b2d66834c72303c3ea8394cb076ced1 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/polymorphic_bin.hpp @@ -0,0 +1,89 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_POLYMORPHIC_BIN_HPP +#define BOOST_HISTOGRAM_AXIS_POLYMORPHIC_BIN_HPP + +#include <boost/histogram/detail/detect.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace axis { + +/** + Holds the bin data of an axis::variant. + + The interface is a superset of the axis::interval_view + class. In addition, the object is implicitly convertible to the value type, + returning the equivalent of a call to lower(). For discrete axes, lower() == + upper(), and width() returns zero. + + This is not a view like axis::interval_view for two reasons. + - Sequential calls to lower() and upper() would have to each loop through + the variant types. This is likely to be slower than filling all the data in + one loop. + - polymorphic_bin may be created from a temporary instance of axis::variant, + like in the call histogram::axis(0). Storing a reference to the axis would + result in a dangling reference. Rather than specialing the code to handle + this, it seems easier to just use a value instead of a view. +*/ +template <class RealType> +class polymorphic_bin { + using value_type = RealType; + +public: + polymorphic_bin(value_type lower, value_type upper) + : lower_or_value_(lower), upper_(upper) {} + + /// Implicitly convert to bin value (for axis with discrete values). + operator const value_type&() const noexcept { return lower_or_value_; } + + /// Return lower edge of bin. + value_type lower() const noexcept { return lower_or_value_; } + /// Return upper edge of bin. + value_type upper() const noexcept { return upper_; } + /// Return center of bin. + value_type center() const noexcept { return 0.5 * (lower() + upper()); } + /// Return width of bin. + value_type width() const noexcept { return upper() - lower(); } + + template <class BinType> + bool operator==(const BinType& rhs) const noexcept { + return equal_impl(detail::has_method_lower<BinType>(), rhs); + } + + template <class BinType> + bool operator!=(const BinType& rhs) const noexcept { + return !operator==(rhs); + } + + /// Return true if bin is discrete. + bool is_discrete() const noexcept { return lower_or_value_ == upper_; } + +private: + bool equal_impl(std::true_type, const polymorphic_bin& rhs) const noexcept { + return lower_or_value_ == rhs.lower_or_value_ && upper_ == rhs.upper_; + } + + template <class BinType> + bool equal_impl(std::true_type, const BinType& rhs) const noexcept { + return lower() == rhs.lower() && upper() == rhs.upper(); + } + + template <class BinType> + bool equal_impl(std::false_type, const BinType& rhs) const noexcept { + return is_discrete() && static_cast<value_type>(*this) == rhs; + } + + const value_type lower_or_value_, upper_; +}; + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/regular.hpp b/ThirdParty/boost/histogram/axis/regular.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5db0a38eba18f614405efdaa2aab8ab9f41fda3f --- /dev/null +++ b/ThirdParty/boost/histogram/axis/regular.hpp @@ -0,0 +1,429 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_REGULAR_HPP +#define BOOST_HISTOGRAM_AXIS_REGULAR_HPP + +#include <boost/assert.hpp> +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/interval_view.hpp> +#include <boost/histogram/axis/iterator.hpp> +#include <boost/histogram/axis/metadata_base.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/detail/convert_integer.hpp> +#include <boost/histogram/detail/relaxed_equal.hpp> +#include <boost/histogram/detail/replace_type.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/throw_exception.hpp> +#include <cmath> +#include <limits> +#include <stdexcept> +#include <string> +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +using get_scale_type_helper = typename T::value_type; + +template <class T> +using get_scale_type = mp11::mp_eval_or<T, detail::get_scale_type_helper, T>; + +struct one_unit {}; + +template <class T> +T operator*(T&& t, const one_unit&) { + return std::forward<T>(t); +} + +template <class T> +T operator/(T&& t, const one_unit&) { + return std::forward<T>(t); +} + +template <class T> +using get_unit_type_helper = typename T::unit_type; + +template <class T> +using get_unit_type = mp11::mp_eval_or<one_unit, detail::get_unit_type_helper, T>; + +template <class T, class R = get_scale_type<T>> +R get_scale(const T& t) { + return t / get_unit_type<T>(); +} + +} // namespace detail + +namespace axis { + +namespace transform { + +/// Identity transform for equidistant bins. +struct id { + /// Pass-through. + template <class T> + static T forward(T&& x) noexcept { + return std::forward<T>(x); + } + + /// Pass-through. + template <class T> + static T inverse(T&& x) noexcept { + return std::forward<T>(x); + } + + template <class Archive> + void serialize(Archive&, unsigned /* version */) {} +}; + +/// Log transform for equidistant bins in log-space. +struct log { + /// Returns log(x) of external value x. + template <class T> + static T forward(T x) { + return std::log(x); + } + + /// Returns exp(x) for internal value x. + template <class T> + static T inverse(T x) { + return std::exp(x); + } + + template <class Archive> + void serialize(Archive&, unsigned /* version */) {} +}; + +/// Sqrt transform for equidistant bins in sqrt-space. +struct sqrt { + /// Returns sqrt(x) of external value x. + template <class T> + static T forward(T x) { + return std::sqrt(x); + } + + /// Returns x^2 of internal value x. + template <class T> + static T inverse(T x) { + return x * x; + } + + template <class Archive> + void serialize(Archive&, unsigned /* version */) {} +}; + +/// Pow transform for equidistant bins in pow-space. +struct pow { + double power = 1; /**< power index */ + + /// Make transform with index p. + explicit pow(double p) : power(p) {} + pow() = default; + + /// Returns pow(x, power) of external value x. + template <class T> + auto forward(T x) const { + return std::pow(x, power); + } + + /// Returns pow(x, 1/power) of external value x. + template <class T> + auto inverse(T x) const { + return std::pow(x, 1.0 / power); + } + + bool operator==(const pow& o) const noexcept { return power == o.power; } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("power", power); + } +}; + +} // namespace transform + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +// Type envelope to mark value as step size +template <class T> +struct step_type { + T value; +}; +#endif + +/** + Helper function to mark argument as step size. + */ +template <class T> +step_type<T> step(T t) { + return step_type<T>{t}; +} + +/** + Axis for equidistant intervals on the real line. + + The most common binning strategy. Very fast. Binning is a O(1) operation. + + @tparam Value input value type, must be floating point. + @tparam Transform builtin or user-defined transform type. + @tparam MetaData type to store meta data. + @tparam Options see boost::histogram::axis::option (all values allowed). + */ +template <class Value, class Transform, class MetaData, class Options> +class regular : public iterator_mixin<regular<Value, Transform, MetaData, Options>>, + protected detail::replace_default<Transform, transform::id>, + public metadata_base<MetaData> { + // these must be private, so that they are not automatically inherited + using value_type = Value; + using transform_type = detail::replace_default<Transform, transform::id>; + using metadata_type = typename metadata_base<MetaData>::metadata_type; + using options_type = + detail::replace_default<Options, decltype(option::underflow | option::overflow)>; + + static_assert(std::is_nothrow_move_constructible<transform_type>::value, + "transform must be no-throw move constructible"); + static_assert(std::is_nothrow_move_assignable<transform_type>::value, + "transform must be no-throw move assignable"); + + using unit_type = detail::get_unit_type<value_type>; + using internal_value_type = detail::get_scale_type<value_type>; + + static_assert(std::is_floating_point<internal_value_type>::value, + "regular axis requires floating point type"); + + static_assert( + (!options_type::test(option::circular) && !options_type::test(option::growth)) || + (options_type::test(option::circular) ^ options_type::test(option::growth)), + "circular and growth options are mutually exclusive"); + +public: + constexpr regular() = default; + + /** Construct n bins over real transformed range [start, stop). + * + * @param trans transform instance to use. + * @param n number of bins. + * @param start low edge of first bin. + * @param stop high edge of last bin. + * @param meta description of the axis (optional). + */ + regular(transform_type trans, unsigned n, value_type start, value_type stop, + metadata_type meta = {}) + : transform_type(std::move(trans)) + , metadata_base<MetaData>(std::move(meta)) + , size_(static_cast<index_type>(n)) + , min_(this->forward(detail::get_scale(start))) + , delta_(this->forward(detail::get_scale(stop)) - min_) { + if (size() == 0) BOOST_THROW_EXCEPTION(std::invalid_argument("bins > 0 required")); + if (!std::isfinite(min_) || !std::isfinite(delta_)) + BOOST_THROW_EXCEPTION( + std::invalid_argument("forward transform of start or stop invalid")); + if (delta_ == 0) + BOOST_THROW_EXCEPTION(std::invalid_argument("range of axis is zero")); + } + + /** Construct n bins over real range [start, stop). + * + * @param n number of bins. + * @param start low edge of first bin. + * @param stop high edge of last bin. + * @param meta description of the axis (optional). + */ + regular(unsigned n, value_type start, value_type stop, metadata_type meta = {}) + : regular({}, n, start, stop, std::move(meta)) {} + + /** Construct bins with the given step size over real transformed range + * [start, stop). + * + * @param trans transform instance to use. + * @param step width of a single bin. + * @param start low edge of first bin. + * @param stop upper limit of high edge of last bin (see below). + * @param meta description of the axis (optional). + * + * The axis computes the number of bins as n = abs(stop - start) / step, + * rounded down. This means that stop is an upper limit to the actual value + * (start + n * step). + */ + template <class T> + regular(transform_type trans, step_type<T> step, value_type start, value_type stop, + metadata_type meta = {}) + : regular(trans, static_cast<index_type>(std::abs(stop - start) / step.value), + start, + start + static_cast<index_type>(std::abs(stop - start) / step.value) * + step.value, + std::move(meta)) {} + + /** Construct bins with the given step size over real range [start, stop). + * + * @param step width of a single bin. + * @param start low edge of first bin. + * @param stop upper limit of high edge of last bin (see below). + * @param meta description of the axis (optional). + * + * The axis computes the number of bins as n = abs(stop - start) / step, + * rounded down. This means that stop is an upper limit to the actual value + * (start + n * step). + */ + template <class T> + regular(step_type<T> step, value_type start, value_type stop, metadata_type meta = {}) + : regular({}, step, start, stop, std::move(meta)) {} + + /// Constructor used by algorithm::reduce to shrink and rebin (not for users). + regular(const regular& src, index_type begin, index_type end, unsigned merge) + : regular(src.transform(), (end - begin) / merge, src.value(begin), src.value(end), + src.metadata()) { + BOOST_ASSERT((end - begin) % merge == 0); + if (options_type::test(option::circular) && !(begin == 0 && end == src.size())) + BOOST_THROW_EXCEPTION(std::invalid_argument("cannot shrink circular axis")); + } + + /// Return instance of the transform type. + const transform_type& transform() const noexcept { return *this; } + + /// Return index for value argument. + index_type index(value_type x) const noexcept { + // Runs in hot loop, please measure impact of changes + auto z = (this->forward(x / unit_type{}) - min_) / delta_; + if (options_type::test(option::circular)) { + if (std::isfinite(z)) { + z -= std::floor(z); + return static_cast<index_type>(z * size()); + } + } else { + if (z < 1) { + if (z >= 0) + return static_cast<index_type>(z * size()); + else + return -1; + } + } + return size(); // also returned if x is NaN + } + + /// Returns index and shift (if axis has grown) for the passed argument. + std::pair<index_type, index_type> update(value_type x) noexcept { + BOOST_ASSERT(options_type::test(option::growth)); + const auto z = (this->forward(x / unit_type{}) - min_) / delta_; + if (z < 1) { // don't use i here! + if (z >= 0) { + const auto i = static_cast<axis::index_type>(z * size()); + return {i, 0}; + } + if (z != -std::numeric_limits<internal_value_type>::infinity()) { + const auto stop = min_ + delta_; + const auto i = static_cast<axis::index_type>(std::floor(z * size())); + min_ += i * (delta_ / size()); + delta_ = stop - min_; + size_ -= i; + return {0, -i}; + } + // z is -infinity + return {-1, 0}; + } + // z either beyond range, infinite, or NaN + if (z < std::numeric_limits<internal_value_type>::infinity()) { + const auto i = static_cast<axis::index_type>(z * size()); + const auto n = i - size() + 1; + delta_ /= size(); + delta_ *= size() + n; + size_ += n; + return {i, -n}; + } + // z either infinite or NaN + return {size(), 0}; + } + + /// Return value for fractional index argument. + value_type value(real_index_type i) const noexcept { + auto z = i / size(); + if (!options_type::test(option::circular) && z < 0.0) + z = -std::numeric_limits<internal_value_type>::infinity() * delta_; + else if (options_type::test(option::circular) || z <= 1.0) + z = (1.0 - z) * min_ + z * (min_ + delta_); + else { + z = std::numeric_limits<internal_value_type>::infinity() * delta_; + } + return static_cast<value_type>(this->inverse(z) * unit_type()); + } + + /// Return bin for index argument. + decltype(auto) bin(index_type idx) const noexcept { + return interval_view<regular>(*this, idx); + } + + /// Returns the number of bins, without over- or underflow. + index_type size() const noexcept { return size_; } + + /// Returns the options. + static constexpr unsigned options() noexcept { return options_type::value; } + + template <class V, class T, class M, class O> + bool operator==(const regular<V, T, M, O>& o) const noexcept { + return detail::relaxed_equal(transform(), o.transform()) && size() == o.size() && + min_ == o.min_ && delta_ == o.delta_ && metadata_base<MetaData>::operator==(o); + } + template <class V, class T, class M, class O> + bool operator!=(const regular<V, T, M, O>& o) const noexcept { + return !operator==(o); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("transform", static_cast<transform_type&>(*this)); + ar& make_nvp("size", size_); + ar& make_nvp("meta", this->metadata()); + ar& make_nvp("min", min_); + ar& make_nvp("delta", delta_); + } + +private: + index_type size_{0}; + internal_value_type min_{0}, delta_{1}; + + template <class V, class T, class M, class O> + friend class regular; +}; + +#if __cpp_deduction_guides >= 201606 + +template <class T> +regular(unsigned, T, T) + ->regular<detail::convert_integer<T, double>, transform::id, null_type>; + +template <class T, class M> +regular(unsigned, T, T, M) + ->regular<detail::convert_integer<T, double>, transform::id, + detail::replace_cstring<std::decay_t<M>>>; + +template <class Tr, class T, class = detail::requires_transform<Tr, T>> +regular(Tr, unsigned, T, T)->regular<detail::convert_integer<T, double>, Tr, null_type>; + +template <class Tr, class T, class M> +regular(Tr, unsigned, T, T, M) + ->regular<detail::convert_integer<T, double>, Tr, + detail::replace_cstring<std::decay_t<M>>>; + +#endif + +/// Regular axis with circular option already set. +template <class Value = double, class MetaData = use_default, class Options = use_default> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using circular = regular<Value, transform::id, MetaData, + decltype(detail::replace_default<Options, option::overflow_t>{} | + option::circular)>; +#else +class circular; +#endif + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/traits.hpp b/ThirdParty/boost/histogram/axis/traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b4f8486ea94ae78af0df9e4142027e6898078b90 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/traits.hpp @@ -0,0 +1,475 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_TRAITS_HPP +#define BOOST_HISTOGRAM_AXIS_TRAITS_HPP + +#include <boost/core/ignore_unused.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/detail/args_type.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/priority.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/detail/try_cast.hpp> +#include <boost/histogram/detail/type_name.hpp> +#include <boost/variant2/variant.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <string> +#include <utility> + +namespace boost { +namespace histogram { +namespace detail { + +template <class Axis> +struct value_type_deducer { + using type = + std::remove_cv_t<std::remove_reference_t<detail::arg_type<decltype(&Axis::index)>>>; +}; + +template <class Axis> +auto traits_options(priority<2>) -> axis::option::bitset<Axis::options()>; + +template <class Axis> +auto traits_options(priority<1>) -> decltype(&Axis::update, axis::option::growth_t{}); + +template <class Axis> +auto traits_options(priority<0>) -> axis::option::none_t; + +template <class Axis> +auto traits_is_inclusive(priority<1>) -> std::integral_constant<bool, Axis::inclusive()>; + +template <class Axis> +auto traits_is_inclusive(priority<0>) + -> decltype(traits_options<Axis>(priority<2>{}) + .test(axis::option::underflow | axis::option::overflow)); + +template <class Axis> +auto traits_is_ordered(priority<1>) -> std::integral_constant<bool, Axis::ordered()>; + +template <class Axis, class ValueType = typename value_type_deducer<Axis>::type> +auto traits_is_ordered(priority<0>) -> typename std::is_arithmetic<ValueType>::type; + +template <class I, class D, class A, + class J = std::decay_t<arg_type<decltype(&A::value)>>> +decltype(auto) value_method_switch(I&& i, D&& d, const A& a, priority<1>) { + return static_if<std::is_same<J, axis::index_type>>(std::forward<I>(i), + std::forward<D>(d), a); +} + +template <class I, class D, class A> +double value_method_switch(I&&, D&&, const A&, priority<0>) { + // comma trick to make all compilers happy; some would complain about + // unreachable code after the throw, others about a missing return + return BOOST_THROW_EXCEPTION( + std::runtime_error(type_name<A>() + " has no value method")), + double{}; +} + +static axis::null_type null_value; + +struct variant_access { + template <class T, class Variant> + static auto get_if(Variant* v) noexcept { + using T0 = mp11::mp_first<std::decay_t<Variant>>; + return static_if<std::is_pointer<T0>>( + [](auto* vptr) { + using TP = mp11::mp_if<std::is_const<std::remove_pointer_t<T0>>, const T*, T*>; + auto ptp = variant2::get_if<TP>(vptr); + return ptp ? *ptp : nullptr; + }, + [](auto* vptr) { return variant2::get_if<T>(vptr); }, &(v->impl)); + } + + template <class T0, class Visitor, class Variant> + static decltype(auto) visit_impl(mp11::mp_identity<T0>, Visitor&& vis, Variant&& v) { + return variant2::visit(std::forward<Visitor>(vis), v.impl); + } + + template <class T0, class Visitor, class Variant> + static decltype(auto) visit_impl(mp11::mp_identity<T0*>, Visitor&& vis, Variant&& v) { + return variant2::visit( + [&vis](auto&& x) -> decltype(auto) { return std::forward<Visitor>(vis)(*x); }, + v.impl); + } + + template <class Visitor, class Variant> + static decltype(auto) visit(Visitor&& vis, Variant&& v) { + using T0 = mp11::mp_first<std::decay_t<Variant>>; + return visit_impl(mp11::mp_identity<T0>{}, std::forward<Visitor>(vis), + std::forward<Variant>(v)); + } +}; + +} // namespace detail + +namespace axis { +namespace traits { + +/** Value type for axis type. + + Doxygen does not render this well. This is a meta-function (template alias), it accepts + an axis type and returns the value type. + + The value type is deduced from the argument of the `Axis::index` method. Const + references are decayed to the their value types, for example, the type deduced for + `Axis::index(const int&)` is `int`. + + The deduction always succeeds if the axis type models the Axis concept correctly. Errors + come from violations of the concept, in particular, an index method that is templated or + overloaded is not allowed. + + @tparam Axis axis type. +*/ +template <class Axis> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using value_type = typename detail::value_type_deducer<Axis>::type; +#else +struct value_type; +#endif + +/** Whether axis is continuous or discrete. + + Doxygen does not render this well. This is a meta-function (template alias), it accepts + an axis type and returns a compile-time boolean. + + If the boolean is true, the axis is continuous (covers a continuous range of values). + Otherwise it is discrete (covers discrete values). +*/ +template <class Axis> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using is_continuous = typename std::is_floating_point<traits::value_type<Axis>>::type; +#else +struct is_continuous; +#endif + +/** Meta-function to detect whether an axis is reducible. + + Doxygen does not render this well. This is a meta-function (template alias), it accepts + an axis type and represents compile-time boolean which is true or false, depending on + whether the axis can be reduced with boost::histogram::algorithm::reduce(). + + An axis can be made reducible by adding a special constructor, see Axis concept for + details. + + @tparam Axis axis type. + */ +template <class Axis> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using is_reducible = std::is_constructible<Axis, const Axis&, axis::index_type, + axis::index_type, unsigned>; +#else +struct is_reducible; +#endif + +/** Get axis options for axis type. + + Doxygen does not render this well. This is a meta-function (template alias), it accepts + an axis type and returns the boost::histogram::axis::option::bitset. + + If Axis::options() is valid and constexpr, get_options is the corresponding + option type. Otherwise, it is boost::histogram::axis::option::growth_t, if the + axis has a method `update`, else boost::histogram::axis::option::none_t. + + @tparam Axis axis type +*/ +template <class Axis> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using get_options = decltype(detail::traits_options<Axis>(detail::priority<2>{})); + +template <class Axis> +using static_options [[deprecated("use get_options instead")]] = get_options<Axis>; + +#else +struct get_options; +#endif + +/** Meta-function to detect whether an axis is inclusive. + + Doxygen does not render this well. This is a meta-function (template alias), it accepts + an axis type and represents compile-time boolean which is true or false, depending on + whether the axis is inclusive or not. + + An axis with underflow and overflow bins is always inclusive, but an axis may be + inclusive under other conditions. The meta-function checks for the method `constexpr + static bool inclusive()`, and uses the result. If this method is not present, it uses + get_options<Axis> and checks whether the underflow and overflow bits are present. + + An inclusive axis has a bin for every possible input value. A histogram which consists + only of inclusive axes can be filled more efficiently, since input values always + end up in a valid cell and there is no need to keep track of input tuples that need to + be discarded. + + @tparam Axis axis type +*/ +template <class Axis> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using is_inclusive = decltype(detail::traits_is_inclusive<Axis>(detail::priority<1>{})); + +template <class Axis> +using static_is_inclusive [[deprecated("use is_inclusive instead")]] = is_inclusive<Axis>; + +#else +struct is_inclusive; +#endif + +/** Meta-function to detect whether an axis is ordered. + + Doxygen does not render this well. This is a meta-function (template alias), it accepts + an axis type and returns a compile-time boolean. If the boolean is true, the axis is + ordered. + + The meta-function checks for the method `constexpr static bool ordered()`, and uses the + result. If this method is not present, it returns true if the value type of the Axis is + arithmetic and false otherwise. + + An ordered axis has a value type that is ordered, which means that indices i < + j < k implies either value(i) < value(j) < value(k) or value(i) > value(j) > value(k) + for all i,j,k. For example, the integer axis is ordered, but the category axis is not. + Axis which are not ordered must not have underflow bins, because they only have an + "other" category, which is identified with the overflow bin if it is available. + + @tparam Axis axis type +*/ +template <class Axis> +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED +using is_ordered = decltype(detail::traits_is_ordered<Axis>(detail::priority<1>{})); +#else +struct is_ordered; +#endif + +/** Returns axis options as unsigned integer. + + See get_options for details. + + @param axis any axis instance +*/ +template <class Axis> +constexpr unsigned options(const Axis& axis) noexcept { + boost::ignore_unused(axis); + return get_options<Axis>::value; +} + +// specialization for variant +template <class... Ts> +unsigned options(const variant<Ts...>& axis) noexcept { + return axis.options(); +} + +/** Returns true if axis is inclusive or false. + + See is_inclusive for details. + + @param axis any axis instance +*/ +template <class Axis> +constexpr bool inclusive(const Axis& axis) noexcept { + boost::ignore_unused(axis); + return is_inclusive<Axis>::value; +} + +// specialization for variant +template <class... Ts> +bool inclusive(const variant<Ts...>& axis) noexcept { + return axis.inclusive(); +} + +/** Returns true if axis is ordered or false. + + See is_ordered for details. + + @param axis any axis instance +*/ +template <class Axis> +constexpr bool ordered(const Axis& axis) noexcept { + boost::ignore_unused(axis); + return is_ordered<Axis>::value; +} + +// specialization for variant +template <class... Ts> +bool ordered(const variant<Ts...>& axis) noexcept { + return axis.ordered(); +} + +/** Returns axis size plus any extra bins for under- and overflow. + + @param axis any axis instance +*/ +template <class Axis> +index_type extent(const Axis& axis) noexcept { + const auto opt = options(axis); + return axis.size() + (opt & option::underflow ? 1 : 0) + + (opt & option::overflow ? 1 : 0); +} + +/** Returns reference to metadata of an axis. + + If the expression x.metadata() for an axis instance `x` (maybe const) is valid, return + the result. Otherwise, return a reference to a static instance of + boost::histogram::axis::null_type. + + @param axis any axis instance +*/ +template <class Axis> +decltype(auto) metadata(Axis&& axis) noexcept { + return detail::static_if<detail::has_method_metadata<std::decay_t<Axis>>>( + [](auto&& a) -> decltype(auto) { return a.metadata(); }, + [](auto &&) -> mp11::mp_if<std::is_const<std::remove_reference_t<Axis>>, + axis::null_type const&, axis::null_type&> { + return detail::null_value; + }, + std::forward<Axis>(axis)); +} + +/** Returns axis value for index. + + If the axis has no `value` method, throw std::runtime_error. If the method exists and + accepts a floating point index, pass the index and return the result. If the method + exists but accepts only integer indices, cast the floating point index to int, pass this + index and return the result. + + @param axis any axis instance + @param index floating point axis index +*/ +template <class Axis> +decltype(auto) value(const Axis& axis, real_index_type index) { + return detail::value_method_switch( + [index](const auto& a) { return a.value(static_cast<index_type>(index)); }, + [index](const auto& a) { return a.value(index); }, axis, detail::priority<1>{}); +} + +/** Returns axis value for index if it is convertible to target type or throws. + + Like boost::histogram::axis::traits::value, but converts the result into the requested + return type. If the conversion is not possible, throws std::runtime_error. + + @tparam Result requested return type + @tparam Axis axis type + @param axis any axis instance + @param index floating point axis index +*/ +template <class Result, class Axis> +Result value_as(const Axis& axis, real_index_type index) { + return detail::try_cast<Result, std::runtime_error>( + value(axis, index)); // avoid conversion warning +} + +/** Returns axis index for value. + + Throws std::invalid_argument if the value argument is not implicitly convertible. + + @param axis any axis instance + @param value argument to be passed to `index` method +*/ +template <class Axis, class U> +axis::index_type index(const Axis& axis, const U& value) noexcept( + std::is_convertible<U, value_type<Axis>>::value) { + return axis.index(detail::try_cast<value_type<Axis>, std::invalid_argument>(value)); +} + +// specialization for variant +template <class... Ts, class U> +axis::index_type index(const variant<Ts...>& axis, const U& value) { + return axis.index(value); +} + +/** Return axis rank (how many arguments it processes). + + @param axis any axis instance +*/ +template <class Axis> +constexpr unsigned rank(const Axis& axis) { + boost::ignore_unused(axis); + using T = value_type<Axis>; + // cannot use mp_eval_or since T could be a fixed-sized sequence + return mp11::mp_eval_if_not<detail::is_tuple<T>, mp11::mp_size_t<1>, mp11::mp_size, + T>::value; +} + +// specialization for variant +template <class... Ts> +unsigned rank(const axis::variant<Ts...>& axis) { + return detail::variant_access::visit([](const auto& a) { return rank(a); }, axis); +} + +/** Returns pair of axis index and shift for the value argument. + + Throws `std::invalid_argument` if the value argument is not implicitly convertible to + the argument expected by the `index` method. If the result of + boost::histogram::axis::traits::get_options<decltype(axis)> has the growth flag set, + call `update` method with the argument and return the result. Otherwise, call `index` + and return the pair of the result and a zero shift. + + @param axis any axis instance + @param value argument to be passed to `update` or `index` method +*/ +template <class Axis, class U> +std::pair<index_type, index_type> update(Axis& axis, const U& value) noexcept( + std::is_convertible<U, value_type<Axis>>::value) { + return detail::static_if_c<get_options<Axis>::test(option::growth)>( + [&value](auto& a) { + return a.update(detail::try_cast<value_type<Axis>, std::invalid_argument>(value)); + }, + [&value](auto& a) -> std::pair<index_type, index_type> { + return {index(a, value), 0}; + }, + axis); +} + +// specialization for variant +template <class... Ts, class U> +std::pair<index_type, index_type> update(variant<Ts...>& axis, const U& value) { + return visit([&value](auto& a) { return a.update(value); }, axis); +} + +/** Returns bin width at axis index. + + If the axis has no `value` method, throw std::runtime_error. If the method exists and + accepts a floating point index, return the result of `axis.value(index + 1) - + axis.value(index)`. If the method exists but accepts only integer indices, return 0. + + @param axis any axis instance + @param index bin index + */ +template <class Axis> +decltype(auto) width(const Axis& axis, index_type index) { + return detail::value_method_switch( + [](const auto&) { return 0; }, + [index](const auto& a) { return a.value(index + 1) - a.value(index); }, axis, + detail::priority<1>{}); +} + +/** Returns bin width at axis index. + + Like boost::histogram::axis::traits::width, but converts the result into the requested + return type. If the conversion is not possible, throw std::runtime_error. + + @param axis any axis instance + @param index bin index + */ +template <class Result, class Axis> +Result width_as(const Axis& axis, index_type index) { + return detail::value_method_switch( + [](const auto&) { return Result{}; }, + [index](const auto& a) { + return detail::try_cast<Result, std::runtime_error>(a.value(index + 1) - + a.value(index)); + }, + axis, detail::priority<1>{}); +} + +} // namespace traits +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/variable.hpp b/ThirdParty/boost/histogram/axis/variable.hpp new file mode 100644 index 0000000000000000000000000000000000000000..43772d753c5d2eaddc7f436857d930930e3b9657 --- /dev/null +++ b/ThirdParty/boost/histogram/axis/variable.hpp @@ -0,0 +1,248 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_VARIABLE_HPP +#define BOOST_HISTOGRAM_AXIS_VARIABLE_HPP + +#include <algorithm> +#include <boost/assert.hpp> +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/interval_view.hpp> +#include <boost/histogram/axis/iterator.hpp> +#include <boost/histogram/axis/metadata_base.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/detail/convert_integer.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/limits.hpp> +#include <boost/histogram/detail/replace_type.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/throw_exception.hpp> +#include <cmath> +#include <limits> +#include <memory> +#include <stdexcept> +#include <string> +#include <type_traits> +#include <utility> +#include <vector> + +namespace boost { +namespace histogram { +namespace axis { + +/** + Axis for non-equidistant bins on the real line. + + Binning is a O(log(N)) operation. If speed matters and the problem domain + allows it, prefer a regular axis, possibly with a transform. + + @tparam Value input value type, must be floating point. + @tparam MetaData type to store meta data. + @tparam Options see boost::histogram::axis::option (all values allowed). + @tparam Allocator allocator to use for dynamic memory management. + */ +template <class Value, class MetaData, class Options, class Allocator> +class variable : public iterator_mixin<variable<Value, MetaData, Options, Allocator>>, + public metadata_base<MetaData> { + // these must be private, so that they are not automatically inherited + using value_type = Value; + using metadata_type = typename metadata_base<MetaData>::metadata_type; + using options_type = + detail::replace_default<Options, decltype(option::underflow | option::overflow)>; + using allocator_type = Allocator; + using vector_type = std::vector<Value, allocator_type>; + + static_assert( + std::is_floating_point<value_type>::value, + "current version of variable axis requires floating point type; " + "if you need a variable axis with an integral type, please submit an issue"); + + static_assert( + (!options_type::test(option::circular) && !options_type::test(option::growth)) || + (options_type::test(option::circular) ^ options_type::test(option::growth)), + "circular and growth options are mutually exclusive"); + +public: + constexpr variable() = default; + explicit variable(allocator_type alloc) : vec_(alloc) {} + + /** Construct from iterator range of bin edges. + * + * \param begin begin of edge sequence. + * \param end end of edge sequence. + * \param meta description of the axis. + * \param alloc allocator instance to use. + */ + template <class It, class = detail::requires_iterator<It>> + variable(It begin, It end, metadata_type meta = {}, allocator_type alloc = {}) + : metadata_base<MetaData>(std::move(meta)), vec_(std::move(alloc)) { + if (std::distance(begin, end) < 2) + BOOST_THROW_EXCEPTION(std::invalid_argument("bins > 0 required")); + + vec_.reserve(std::distance(begin, end)); + vec_.emplace_back(*begin++); + bool strictly_ascending = true; + while (begin != end) { + if (*begin <= vec_.back()) strictly_ascending = false; + vec_.emplace_back(*begin++); + } + if (!strictly_ascending) + BOOST_THROW_EXCEPTION( + std::invalid_argument("input sequence must be strictly ascending")); + } + + /** Construct variable axis from iterable range of bin edges. + * + * \param iterable iterable range of bin edges. + * \param meta description of the axis. + * \param alloc allocator instance to use. + */ + template <class U, class = detail::requires_iterable<U>> + variable(const U& iterable, metadata_type meta = {}, allocator_type alloc = {}) + : variable(std::begin(iterable), std::end(iterable), std::move(meta), + std::move(alloc)) {} + + /** Construct variable axis from initializer list of bin edges. + * + * @param list `std::initializer_list` of bin edges. + * @param meta description of the axis. + * @param alloc allocator instance to use. + */ + template <class U> + variable(std::initializer_list<U> list, metadata_type meta = {}, + allocator_type alloc = {}) + : variable(list.begin(), list.end(), std::move(meta), std::move(alloc)) {} + + /// Constructor used by algorithm::reduce to shrink and rebin (not for users). + variable(const variable& src, index_type begin, index_type end, unsigned merge) + : metadata_base<MetaData>(src), vec_(src.get_allocator()) { + BOOST_ASSERT((end - begin) % merge == 0); + if (options_type::test(option::circular) && !(begin == 0 && end == src.size())) + BOOST_THROW_EXCEPTION(std::invalid_argument("cannot shrink circular axis")); + vec_.reserve((end - begin) / merge); + const auto beg = src.vec_.begin(); + for (index_type i = begin; i <= end; i += merge) vec_.emplace_back(*(beg + i)); + } + + /// Return index for value argument. + index_type index(value_type x) const noexcept { + if (options_type::test(option::circular)) { + const auto a = vec_[0]; + const auto b = vec_[size()]; + x -= std::floor((x - a) / (b - a)) * (b - a); + } + return static_cast<index_type>(std::upper_bound(vec_.begin(), vec_.end(), x) - + vec_.begin() - 1); + } + + std::pair<index_type, index_type> update(value_type x) noexcept { + const auto i = index(x); + if (std::isfinite(x)) { + if (0 <= i) { + if (i < size()) return std::make_pair(i, 0); + const auto d = value(size()) - value(size() - 0.5); + x = std::nextafter(x, (std::numeric_limits<value_type>::max)()); + x = (std::max)(x, vec_.back() + d); + vec_.push_back(x); + return {i, -1}; + } + const auto d = value(0.5) - value(0); + x = (std::min)(x, value(0) - d); + vec_.insert(vec_.begin(), x); + return {0, -i}; + } + return {x < 0 ? -1 : size(), 0}; + } + + /// Return value for fractional index argument. + value_type value(real_index_type i) const noexcept { + if (options_type::test(option::circular)) { + auto shift = std::floor(i / size()); + i -= shift * size(); + double z; + const auto k = static_cast<index_type>(std::modf(i, &z)); + const auto a = vec_[0]; + const auto b = vec_[size()]; + return (1.0 - z) * vec_[k] + z * vec_[k + 1] + shift * (b - a); + } + if (i < 0) return detail::lowest<value_type>(); + if (i == size()) return vec_.back(); + if (i > size()) return detail::highest<value_type>(); + const auto k = static_cast<index_type>(i); // precond: i >= 0 + const real_index_type z = i - k; + return (1.0 - z) * vec_[k] + z * vec_[k + 1]; + } + + /// Return bin for index argument. + auto bin(index_type idx) const noexcept { return interval_view<variable>(*this, idx); } + + /// Returns the number of bins, without over- or underflow. + index_type size() const noexcept { return static_cast<index_type>(vec_.size()) - 1; } + + /// Returns the options. + static constexpr unsigned options() noexcept { return options_type::value; } + + template <class V, class M, class O, class A> + bool operator==(const variable<V, M, O, A>& o) const noexcept { + const auto& a = vec_; + const auto& b = o.vec_; + return std::equal(a.begin(), a.end(), b.begin(), b.end()) && + metadata_base<MetaData>::operator==(o); + } + + template <class V, class M, class O, class A> + bool operator!=(const variable<V, M, O, A>& o) const noexcept { + return !operator==(o); + } + + /// Return allocator instance. + auto get_allocator() const { return vec_.get_allocator(); } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("seq", vec_); + ar& make_nvp("meta", this->metadata()); + } + +private: + vector_type vec_; + + template <class V, class M, class O, class A> + friend class variable; +}; + +#if __cpp_deduction_guides >= 201606 + +template <class T> +variable(std::initializer_list<T>) + ->variable<detail::convert_integer<T, double>, null_type>; + +template <class T, class M> +variable(std::initializer_list<T>, M) + ->variable<detail::convert_integer<T, double>, + detail::replace_type<std::decay_t<M>, const char*, std::string>>; + +template <class Iterable, class = detail::requires_iterable<Iterable>> +variable(Iterable) + ->variable< + detail::convert_integer< + std::decay_t<decltype(*std::begin(std::declval<Iterable&>()))>, double>, + null_type>; + +template <class Iterable, class M> +variable(Iterable, M) + ->variable< + detail::convert_integer< + std::decay_t<decltype(*std::begin(std::declval<Iterable&>()))>, double>, + detail::replace_type<std::decay_t<M>, const char*, std::string>>; + +#endif + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/axis/variant.hpp b/ThirdParty/boost/histogram/axis/variant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..35d7f5b61d6a4d5467885c89fd8a96189d1c832a --- /dev/null +++ b/ThirdParty/boost/histogram/axis/variant.hpp @@ -0,0 +1,325 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_AXIS_VARIANT_HPP +#define BOOST_HISTOGRAM_AXIS_VARIANT_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/iterator.hpp> +#include <boost/histogram/axis/polymorphic_bin.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/detail/relaxed_equal.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/detail/type_name.hpp> +#include <boost/variant2/variant.hpp> +#include <boost/histogram/detail/variant_proxy.hpp> +#include <boost/mp11/algorithm.hpp> // mp_contains +#include <boost/mp11/list.hpp> // mp_first +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { +namespace axis { + +/// Polymorphic axis type +template <class... Ts> +class variant : public iterator_mixin<variant<Ts...>> { + using impl_type = boost::variant2::variant<Ts...>; + + template <class T> + using is_bounded_type = mp11::mp_contains<variant, std::decay_t<T>>; + + template <class T> + using requires_bounded_type = std::enable_if_t<is_bounded_type<T>::value>; + + // maybe metadata_type or const metadata_type, if bounded type is const + using metadata_type = std::remove_reference_t<decltype( + traits::metadata(std::declval<std::remove_pointer_t<mp11::mp_first<variant>>>()))>; + +public: + // cannot import ctors with using directive, it breaks gcc and msvc + variant() = default; + variant(const variant&) = default; + variant& operator=(const variant&) = default; + variant(variant&&) = default; + variant& operator=(variant&&) = default; + + template <class T, class = requires_bounded_type<T>> + variant(T&& t) : impl(std::forward<T>(t)) {} + + template <class T, class = requires_bounded_type<T>> + variant& operator=(T&& t) { + impl = std::forward<T>(t); + return *this; + } + + template <class... Us> + variant(const variant<Us...>& u) { + this->operator=(u); + } + + template <class... Us> + variant& operator=(const variant<Us...>& u) { + visit( + [this](const auto& u) { + using U = std::decay_t<decltype(u)>; + detail::static_if<is_bounded_type<U>>( + [this](const auto& u) { this->operator=(u); }, + [](const auto&) { + BOOST_THROW_EXCEPTION(std::runtime_error( + detail::type_name<U>() + " is not convertible to a bounded type of " + + detail::type_name<variant>())); + }, + u); + }, + u); + return *this; + } + + /// Return size of axis. + index_type size() const { + return visit([](const auto& a) -> index_type { return a.size(); }, *this); + } + + /// Return options of axis or option::none_t if axis has no options. + unsigned options() const { + return visit([](const auto& a) { return traits::options(a); }, *this); + } + + /// Returns true if the axis is inclusive or false. + bool inclusive() const { + return visit([](const auto& a) { return traits::inclusive(a); }, *this); + } + + /// Returns true if the axis is ordered or false. + bool ordered() const { + return visit([](const auto& a) { return traits::ordered(a); }, *this); + } + + /// Return reference to const metadata or instance of null_type if axis has no + /// metadata. + const metadata_type& metadata() const { + return visit( + [](const auto& a) -> const metadata_type& { + using M = decltype(traits::metadata(a)); + return detail::static_if<std::is_same<M, const metadata_type&>>( + [](const auto& a) -> const metadata_type& { return traits::metadata(a); }, + [](const auto&) -> const metadata_type& { + BOOST_THROW_EXCEPTION(std::runtime_error( + "cannot return metadata of type " + detail::type_name<M>() + + " through axis::variant interface which uses type " + + detail::type_name<metadata_type>() + + "; use boost::histogram::axis::get to obtain a reference " + "of this axis type")); + }, + a); + }, + *this); + } + + /// Return reference to metadata or instance of null_type if axis has no + /// metadata. + metadata_type& metadata() { + return visit( + [](auto& a) -> metadata_type& { + using M = decltype(traits::metadata(a)); + return detail::static_if<std::is_same<M, metadata_type&>>( + [](auto& a) -> metadata_type& { return traits::metadata(a); }, + [](auto&) -> metadata_type& { + BOOST_THROW_EXCEPTION(std::runtime_error( + "cannot return metadata of type " + detail::type_name<M>() + + " through axis::variant interface which uses type " + + detail::type_name<metadata_type>() + + "; use boost::histogram::axis::get to obtain a reference " + "of this axis type")); + }, + a); + }, + *this); + } + + /** Return index for value argument. + + Throws std::invalid_argument if axis has incompatible call signature. + */ + template <class U> + index_type index(const U& u) const { + return visit([&u](const auto& a) { return traits::index(a, u); }, *this); + } + + /** Return value for index argument. + + Only works for axes with value method that returns something convertible + to double and will throw a runtime_error otherwise, see + axis::traits::value(). + */ + double value(real_index_type idx) const { + return visit([idx](const auto& a) { return traits::value_as<double>(a, idx); }, + *this); + } + + /** Return bin for index argument. + + Only works for axes with value method that returns something convertible + to double and will throw a runtime_error otherwise, see + axis::traits::value(). + */ + auto bin(index_type idx) const { + return visit( + [idx](const auto& a) { + return detail::value_method_switch( + [idx](const auto& a) { // axis is discrete + const double x = traits::value_as<double>(a, idx); + return polymorphic_bin<double>(x, x); + }, + [idx](const auto& a) { // axis is continuous + const double x1 = traits::value_as<double>(a, idx); + const double x2 = traits::value_as<double>(a, idx + 1); + return polymorphic_bin<double>(x1, x2); + }, + a, detail::priority<1>{}); + }, + *this); + } + + /** Compare two variants. + + Return true if the variants point to the same concrete axis type and the types compare + equal. Otherwise return false. + */ + template <class... Us> + bool operator==(const variant<Us...>& u) const { + return visit([&u](const auto& x) { return u == x; }, *this); + } + + /** Compare variant with a concrete axis type. + + Return true if the variant point to the same concrete axis type and the types compare + equal. Otherwise return false. + */ + template <class T> + bool operator==(const T& t) const { + return detail::static_if_c<(mp11::mp_contains<impl_type, T>::value || + mp11::mp_contains<impl_type, T*>::value || + mp11::mp_contains<impl_type, const T*>::value)>( + [&](const auto& t) { + using U = std::decay_t<decltype(t)>; + const U* tp = detail::variant_access::template get_if<U>(this); + return tp && detail::relaxed_equal(*tp, t); + }, + [&](const auto&) { return false; }, t); + } + + /// The negation of operator==. + template <class T> + bool operator!=(const T& t) const { + return !operator==(t); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + detail::variant_proxy<variant> p{*this}; + ar& make_nvp("variant", p); + } + +private: + impl_type impl; + + friend struct detail::variant_access; + friend struct boost::histogram::unsafe_access; +}; + +// specialization for empty argument list, useful for meta-programming +template <> +class variant<> {}; + +/// Apply visitor to variant (reference). +template <class Visitor, class... Us> +decltype(auto) visit(Visitor&& vis, variant<Us...>& var) { + return detail::variant_access::visit(vis, var); +} + +/// Apply visitor to variant (movable reference). +template <class Visitor, class... Us> +decltype(auto) visit(Visitor&& vis, variant<Us...>&& var) { + return detail::variant_access::visit(vis, std::move(var)); +} + +/// Apply visitor to variant (const reference). +template <class Visitor, class... Us> +decltype(auto) visit(Visitor&& vis, const variant<Us...>& var) { + return detail::variant_access::visit(vis, var); +} + +/// Returns pointer to T in variant or null pointer if type does not match. +template <class T, class... Us> +auto get_if(variant<Us...>* v) { + return detail::variant_access::template get_if<T>(v); +} + +/// Returns pointer to const T in variant or null pointer if type does not match. +template <class T, class... Us> +auto get_if(const variant<Us...>* v) { + return detail::variant_access::template get_if<T>(v); +} + +/// Return reference to T, throws std::runtime_error if type does not match. +template <class T, class... Us> +decltype(auto) get(variant<Us...>& v) { + auto tp = get_if<T>(&v); + if (!tp) BOOST_THROW_EXCEPTION(std::runtime_error("T is not the held type")); + return *tp; +} + +/// Return movable reference to T, throws unspecified exception if type does not match. +template <class T, class... Us> +decltype(auto) get(variant<Us...>&& v) { + auto tp = get_if<T>(&v); + if (!tp) BOOST_THROW_EXCEPTION(std::runtime_error("T is not the held type")); + return std::move(*tp); +} + +/// Return const reference to T, throws unspecified exception if type does not match. +template <class T, class... Us> +decltype(auto) get(const variant<Us...>& v) { + auto tp = get_if<T>(&v); + if (!tp) BOOST_THROW_EXCEPTION(std::runtime_error("T is not the held type")); + return *tp; +} + +// pass-through version of visit for generic programming +template <class Visitor, class T> +decltype(auto) visit(Visitor&& vis, T&& var) { + return std::forward<Visitor>(vis)(std::forward<T>(var)); +} + +// pass-through version of get for generic programming +template <class T, class U> +decltype(auto) get(U&& u) { + return std::forward<U>(u); +} + +// pass-through version of get_if for generic programming +template <class T, class U> +auto get_if(U* u) { + return reinterpret_cast<T*>(std::is_same<T, std::decay_t<U>>::value ? u : nullptr); +} + +// pass-through version of get_if for generic programming +template <class T, class U> +auto get_if(const U* u) { + return reinterpret_cast<const T*>(std::is_same<T, std::decay_t<U>>::value ? u + : nullptr); +} + +} // namespace axis +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/accumulator_traits.hpp b/ThirdParty/boost/histogram/detail/accumulator_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ac46021d330151872ef9720f1c3df627b8f7d843 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/accumulator_traits.hpp @@ -0,0 +1,81 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_ACCUMULATOR_TRAITS_HPP +#define BOOST_HISTOGRAM_DETAIL_ACCUMULATOR_TRAITS_HPP + +#include <boost/histogram/detail/priority.hpp> +#include <boost/histogram/fwd.hpp> +#include <tuple> +#include <type_traits> + +namespace boost { + +// forward declare accumulator_set so that it can be matched below +namespace accumulators { +template <class, class, class> +struct accumulator_set; +} + +namespace histogram { +namespace detail { + +template <bool WeightSupport, class... Ts> +struct accumulator_traits_holder { + static constexpr bool weight_support = WeightSupport; + using args = std::tuple<Ts...>; +}; + +// member function pointer with weight_type as first argument is better match +template <class R, class T, class U, class... Ts> +accumulator_traits_holder<true, Ts...> accumulator_traits_impl_call_op( + R (T::*)(boost::histogram::weight_type<U>, Ts...)); + +template <class R, class T, class U, class... Ts> +accumulator_traits_holder<true, Ts...> accumulator_traits_impl_call_op( + R (T::*)(boost::histogram::weight_type<U>&, Ts...)); + +template <class R, class T, class U, class... Ts> +accumulator_traits_holder<true, Ts...> accumulator_traits_impl_call_op( + R (T::*)(boost::histogram::weight_type<U>&&, Ts...)); + +template <class R, class T, class U, class... Ts> +accumulator_traits_holder<true, Ts...> accumulator_traits_impl_call_op( + R (T::*)(const boost::histogram::weight_type<U>&, Ts...)); + +// member function pointer only considered if all specializations above fail +template <class R, class T, class... Ts> +accumulator_traits_holder<false, Ts...> accumulator_traits_impl_call_op(R (T::*)(Ts...)); + +template <class T> +auto accumulator_traits_impl(T&, priority<1>) + -> decltype(accumulator_traits_impl_call_op(&T::operator())); + +template <class T> +auto accumulator_traits_impl(T&, priority<1>) + -> decltype(std::declval<T&>() += 0, accumulator_traits_holder<true>{}); + +template <class T> +auto accumulator_traits_impl(T&, priority<0>) -> accumulator_traits_holder<false>; + +// for boost.accumulators compatibility +template <class S, class F, class W> +accumulator_traits_holder<false, S> accumulator_traits_impl( + boost::accumulators::accumulator_set<S, F, W>&, priority<1>) { + static_assert(std::is_same<W, void>::value, + "accumulator_set with weights is not directly supported, please use " + "a wrapper class that implements the Accumulator concept"); +} + +template <class T> +using accumulator_traits = + decltype(accumulator_traits_impl(std::declval<T&>(), priority<1>{})); + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/args_type.hpp b/ThirdParty/boost/histogram/detail/args_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d57c1dd7980542adc0b79f7210158686fcd94101 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/args_type.hpp @@ -0,0 +1,63 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_ARGS_TYPE_HPP +#define BOOST_HISTOGRAM_DETAIL_ARGS_TYPE_HPP + +#include <tuple> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +struct args_type_impl { + using T::ERROR_this_should_never_be_instantiated_please_write_an_issue; +}; + +template <class R, class T, class... Ts> +struct args_type_impl<R (T::*)(Ts...)> { + using type = std::tuple<Ts...>; +}; + +template <class R, class T, class... Ts> +struct args_type_impl<R (T ::*)(Ts...) const> { + using type = std::tuple<Ts...>; +}; + +template <class R, class... Ts> +struct args_type_impl<R (*)(Ts...)> { + using type = std::tuple<Ts...>; +}; + +#if __cpp_noexcept_function_type >= 201510 +template <class R, class T, class... Ts> +struct args_type_impl<R (T::*)(Ts...) noexcept> { + using type = std::tuple<Ts...>; +}; + +template <class R, class T, class... Ts> +struct args_type_impl<R (T ::*)(Ts...) const noexcept> { + using type = std::tuple<Ts...>; +}; + +template <class R, class... Ts> +struct args_type_impl<R (*)(Ts...) noexcept> { + using type = std::tuple<Ts...>; +}; +#endif + +template <class FunctionPointer> +using args_type = typename args_type_impl<FunctionPointer>::type; + +template <class T, std::size_t N = 0> +using arg_type = std::tuple_element_t<N, args_type<T>>; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/argument_traits.hpp b/ThirdParty/boost/histogram/detail/argument_traits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b32653c63466902766ba4702462e13717c0c3719 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/argument_traits.hpp @@ -0,0 +1,83 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_ARGUMENT_TRAITS_HPP +#define BOOST_HISTOGRAM_DETAIL_ARGUMENT_TRAITS_HPP + +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/integral.hpp> +#include <boost/mp11/list.hpp> +#include <tuple> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +struct is_weight_impl : mp11::mp_false {}; + +template <class T> +struct is_weight_impl<weight_type<T>> : mp11::mp_true {}; + +template <class T> +using is_weight = is_weight_impl<T>; + +template <class T> +struct is_sample_impl : mp11::mp_false {}; + +template <class T> +struct is_sample_impl<sample_type<T>> : mp11::mp_true {}; + +template <class T> +using is_sample = is_sample_impl<T>; + +template <int Idx, class L> +struct sample_args_impl { + using type = mp11::mp_first<std::decay_t<mp11::mp_at_c<L, (Idx >= 0 ? Idx : 0)>>>; +}; + +template <class L> +struct sample_args_impl<-1, L> { + using type = std::tuple<>; +}; + +template <std::size_t NArgs, std::size_t Start, int WeightPos, int SamplePos, + class SampleArgs> +struct argument_traits_holder { + using nargs = mp11::mp_size_t<NArgs>; + using start = mp11::mp_size_t<Start>; + using wpos = mp11::mp_int<WeightPos>; + using spos = mp11::mp_int<SamplePos>; + using sargs = SampleArgs; +}; + +template <class... Ts> +struct argument_traits_impl { + using list_ = mp11::mp_list<Ts...>; + static constexpr std::size_t size_ = sizeof...(Ts); + static constexpr std::size_t weight_ = mp11::mp_find_if<list_, is_weight>::value; + static constexpr std::size_t sample_ = mp11::mp_find_if<list_, is_sample>::value; + static constexpr int spos_ = (sample_ < size_ ? static_cast<int>(sample_) : -1); + static constexpr int wpos_ = (weight_ < size_ ? static_cast<int>(weight_) : -1); + + using type = + argument_traits_holder<(size_ - (weight_ < size_) - (sample_ < size_)), + (weight_ < size_ && sample_ < size_ && + (weight_ + sample_ < 2) + ? 2 + : ((weight_ == 0 || sample_ == 0) ? 1 : 0)), + wpos_, spos_, typename sample_args_impl<spos_, list_>::type>; +}; + +template <class... Ts> +using argument_traits = typename argument_traits_impl<Ts...>::type; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/array_wrapper.hpp b/ThirdParty/boost/histogram/detail/array_wrapper.hpp new file mode 100644 index 0000000000000000000000000000000000000000..752a73032768e39c8e5711b259821b3f0a97ba89 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/array_wrapper.hpp @@ -0,0 +1,67 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_ARRAY_WRAPPER_HPP +#define BOOST_HISTOGRAM_DETAIL_ARRAY_WRAPPER_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/detail/span.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/mp11/function.hpp> +#include <boost/mp11/utility.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T, class = decltype(&T::template save_array<int>)> +struct has_save_array_impl; + +template <class T, class = decltype(&T::template load_array<int>)> +struct has_load_array_impl; + +template <class T> +using has_array_optimization = mp11::mp_or<mp11::mp_valid<has_save_array_impl, T>, + mp11::mp_valid<has_load_array_impl, T>>; + +template <class T> +struct array_wrapper { + using pointer = T*; + + pointer ptr; + std::size_t size; + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + static_if_c<(has_array_optimization<Archive>::value && + std::is_trivially_copyable<T>::value)>( + [this](auto& ar) { + // cannot use and therefore bypass save_array / load_array interface, because + // it requires exact type boost::serialization::array_wrapper<T> + static_if_c<Archive::is_loading::value>( + [this](auto& ar) { ar.load_binary(this->ptr, sizeof(T) * this->size); }, + [this](auto& ar) { ar.save_binary(this->ptr, sizeof(T) * this->size); }, + ar); + }, + [this](auto& ar) { + for (auto&& x : boost::histogram::detail::make_span(this->ptr, this->size)) + ar& make_nvp("item", x); + }, + ar); + } +}; + +template <class T> +auto make_array_wrapper(T* t, std::size_t s) { + return array_wrapper<T>{t, s}; +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/at.hpp b/ThirdParty/boost/histogram/detail/at.hpp new file mode 100644 index 0000000000000000000000000000000000000000..0a01c4c7293c69a67b4a3bf584bd3255e7bfb5cb --- /dev/null +++ b/ThirdParty/boost/histogram/detail/at.hpp @@ -0,0 +1,48 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_AT_HPP +#define BOOST_HISTOGRAM_DETAIL_AT_HPP + +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/linearize.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <tuple> + +namespace boost { +namespace histogram { +namespace detail { + +template <class A, class... Us> +optional_index at(const A& axes, const std::tuple<Us...>& args) noexcept { + optional_index idx{0}; // offset not used by linearize_index + mp11::mp_for_each<mp11::mp_iota_c<sizeof...(Us)>>( + [&, stride = static_cast<std::size_t>(1)](auto i) mutable { + stride *= linearize_index(idx, stride, axis_get<i>(axes), + static_cast<axis::index_type>(std::get<i>(args))); + }); + return idx; +} + +template <class A, class U> +optional_index at(const A& axes, const U& args) noexcept { + optional_index idx{0}; + using std::begin; + for_each_axis(axes, [&, it = begin(args), + stride = static_cast<std::size_t>(1)](const auto& a) mutable { + stride *= linearize_index(idx, stride, a, static_cast<axis::index_type>(*it++)); + }); + return idx; +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/axes.hpp b/ThirdParty/boost/histogram/detail/axes.hpp new file mode 100644 index 0000000000000000000000000000000000000000..400303b2ac39cb41a2df372f4c5888756dda1db5 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/axes.hpp @@ -0,0 +1,385 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_AXES_HPP +#define BOOST_HISTOGRAM_DETAIL_AXES_HPP + +#include <array> +#include <boost/assert.hpp> +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/axis/variant.hpp> +#include <boost/histogram/detail/make_default.hpp> +#include <boost/histogram/detail/optional_index.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/tuple.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <string> +#include <tuple> +#include <type_traits> + +/* Most of the histogram code is generic and works for any number of axes. Buffers with a + * fixed maximum capacity are used in some places, which have a size equal to the rank of + * a histogram. The buffers are statically allocated to improve performance, which means + * that they need a preset maximum capacity. 32 seems like a safe upper limit for the rank + * (you can nevertheless increase it here if necessary): the simplest non-trivial axis has + * 2 bins; even if counters are used which need only a byte of storage per bin, this still + * corresponds to 4 GB of storage. + */ +#ifndef BOOST_HISTOGRAM_DETAIL_AXES_LIMIT +#define BOOST_HISTOGRAM_DETAIL_AXES_LIMIT 32 +#endif + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +unsigned axes_rank(const T& axes) { + using std::begin; + using std::end; + return static_cast<unsigned>(std::distance(begin(axes), end(axes))); +} + +template <class... Ts> +constexpr unsigned axes_rank(const std::tuple<Ts...>&) { + return static_cast<unsigned>(sizeof...(Ts)); +} + +template <class T> +void throw_if_axes_is_too_large(const T& axes) { + if (axes_rank(axes) > BOOST_HISTOGRAM_DETAIL_AXES_LIMIT) + BOOST_THROW_EXCEPTION( + std::invalid_argument("length of axis vector exceeds internal buffers, " + "recompile with " + "-DBOOST_HISTOGRAM_DETAIL_AXES_LIMIT=<new max size> " + "to increase internal buffers")); +} + +// tuple is never too large because internal buffers adapt to size of tuple +template <class... Ts> +void throw_if_axes_is_too_large(const std::tuple<Ts...>&) {} + +template <unsigned N, class... Ts> +decltype(auto) axis_get(std::tuple<Ts...>& axes) { + return std::get<N>(axes); +} + +template <unsigned N, class... Ts> +decltype(auto) axis_get(const std::tuple<Ts...>& axes) { + return std::get<N>(axes); +} + +template <unsigned N, class T> +decltype(auto) axis_get(T& axes) { + return axes[N]; +} + +template <unsigned N, class T> +decltype(auto) axis_get(const T& axes) { + return axes[N]; +} + +template <class... Ts> +auto axis_get(std::tuple<Ts...>& axes, const unsigned i) { + constexpr auto S = sizeof...(Ts); + using V = mp11::mp_unique<axis::variant<Ts*...>>; + return mp11::mp_with_index<S>(i, [&axes](auto i) { return V(&std::get<i>(axes)); }); +} + +template <class... Ts> +auto axis_get(const std::tuple<Ts...>& axes, const unsigned i) { + constexpr auto S = sizeof...(Ts); + using V = mp11::mp_unique<axis::variant<const Ts*...>>; + return mp11::mp_with_index<S>(i, [&axes](auto i) { return V(&std::get<i>(axes)); }); +} + +template <class T> +decltype(auto) axis_get(T& axes, const unsigned i) { + return axes[i]; +} + +template <class T> +decltype(auto) axis_get(const T& axes, const unsigned i) { + return axes[i]; +} + +template <class... Ts, class... Us> +bool axes_equal(const std::tuple<Ts...>& ts, const std::tuple<Us...>& us) { + using namespace ::boost::mp11; + return static_if<std::is_same<mp_list<Ts...>, mp_list<Us...>>>( + [](const auto& ts, const auto& us) { + using N = mp_size<std::decay_t<decltype(ts)>>; + bool equal = true; + mp_for_each<mp_iota<N>>( + [&](auto I) { equal &= relaxed_equal(std::get<I>(ts), std::get<I>(us)); }); + return equal; + }, + [](const auto&, const auto&) { return false; }, ts, us); +} + +template <class T, class... Us> +bool axes_equal(const T& t, const std::tuple<Us...>& u) { + using namespace ::boost::mp11; + if (t.size() != sizeof...(Us)) return false; + bool equal = true; + mp_for_each<mp_iota_c<sizeof...(Us)>>([&](auto I) { equal &= t[I] == std::get<I>(u); }); + return equal; +} + +template <class... Ts, class U> +bool axes_equal(const std::tuple<Ts...>& t, const U& u) { + return axes_equal(u, t); +} + +template <class T, class U> +bool axes_equal(const T& t, const U& u) { + if (t.size() != u.size()) return false; + return std::equal(t.begin(), t.end(), u.begin()); +} + +template <class... Ts, class... Us> +void axes_assign(std::tuple<Ts...>& t, const std::tuple<Us...>& u) { + using namespace ::boost::mp11; + static_if<std::is_same<mp_list<Ts...>, mp_list<Us...>>>( + [](auto& a, const auto& b) { a = b; }, + [](auto&, const auto&) { + BOOST_THROW_EXCEPTION( + std::invalid_argument("cannot assign axes, types do not match")); + }, + t, u); +} + +template <class... Ts, class U> +void axes_assign(std::tuple<Ts...>& t, const U& u) { + using namespace ::boost::mp11; + mp_for_each<mp_iota_c<sizeof...(Ts)>>([&](auto I) { + using T = mp_at_c<std::tuple<Ts...>, I>; + std::get<I>(t) = axis::get<T>(u[I]); + }); +} + +template <class T, class... Us> +void axes_assign(T& t, const std::tuple<Us...>& u) { + // resize instead of reserve, because t may not be empty and we want exact capacity + t.resize(sizeof...(Us)); + using namespace ::boost::mp11; + mp_for_each<mp_iota_c<sizeof...(Us)>>([&](auto I) { t[I] = std::get<I>(u); }); +} + +template <class T, class U> +void axes_assign(T& t, const U& u) { + t.assign(u.begin(), u.end()); +} + +template <class Archive, class T> +void axes_serialize(Archive& ar, T& axes) { + ar& make_nvp("axes", axes); +} + +template <class Archive, class... Ts> +void axes_serialize(Archive& ar, std::tuple<Ts...>& axes) { + // needed to keep serialization format backward compatible + struct proxy { + std::tuple<Ts...>& t; + void serialize(Archive& ar, unsigned /* version */) { + mp11::tuple_for_each(t, [&ar](auto& x) { ar& make_nvp("item", x); }); + } + }; + proxy p{axes}; + ar& make_nvp("axes", p); +} + +// create empty dynamic axis which can store any axes types from the argument +template <class T> +auto make_empty_dynamic_axes(const T& axes) { + return make_default(axes); +} + +template <class... Ts> +auto make_empty_dynamic_axes(const std::tuple<Ts...>&) { + using namespace ::boost::mp11; + using L = mp_unique<axis::variant<Ts...>>; + // return std::vector<axis::variant<Axis0, Axis1, ...>> or std::vector<Axis0> + return std::vector<mp_if_c<(mp_size<L>::value == 1), mp_first<L>, L>>{}; +} + +template <class T> +void axis_index_is_valid(const T& axes, const unsigned N) { + BOOST_ASSERT_MSG(N < axes_rank(axes), "index out of range"); +} + +template <class Axes, class V> +void for_each_axis_impl(std::true_type, Axes&& axes, V&& v) { + for (auto&& a : axes) { axis::visit(std::forward<V>(v), a); } +} + +template <class Axes, class V> +void for_each_axis_impl(std::false_type, Axes&& axes, V&& v) { + for (auto&& a : axes) std::forward<V>(v)(a); +} + +template <class Axes, class V> +void for_each_axis(Axes&& a, V&& v) { + using namespace ::boost::mp11; + using T = mp_first<std::decay_t<Axes>>; + for_each_axis_impl(is_axis_variant<T>(), std::forward<Axes>(a), std::forward<V>(v)); +} + +template <class V, class... Axis> +void for_each_axis(const std::tuple<Axis...>& a, V&& v) { + mp11::tuple_for_each(a, std::forward<V>(v)); +} + +template <class V, class... Axis> +void for_each_axis(std::tuple<Axis...>& a, V&& v) { + mp11::tuple_for_each(a, std::forward<V>(v)); +} + +// total number of bins including *flow bins +template <class T> +std::size_t bincount(const T& axes) { + std::size_t n = 1; + for_each_axis(axes, [&n](const auto& a) { + const auto old = n; + const auto s = axis::traits::extent(a); + n *= s; + if (s > 0 && n < old) BOOST_THROW_EXCEPTION(std::overflow_error("bincount overflow")); + }); + return n; +} + +// initial offset for the linear index +template <class T> +std::size_t offset(const T& axes) { + std::size_t n = 0; + for_each_axis(axes, [&n, stride = static_cast<std::size_t>(1)](const auto& a) mutable { + if (axis::traits::options(a) & axis::option::growth) + n = invalid_index; + else if (n != invalid_index && axis::traits::options(a) & axis::option::underflow) + n += stride; + stride *= axis::traits::extent(a); + }); + return n; +} + +template <class T> +using buffer_size_impl = typename std::tuple_size<T>::type; + +template <class T> +using buffer_size = mp11::mp_eval_or< + std::integral_constant<std::size_t, BOOST_HISTOGRAM_DETAIL_AXES_LIMIT>, + buffer_size_impl, T>; + +template <class T, std::size_t N> +class sub_array : public std::array<T, N> { + using base_type = std::array<T, N>; + +public: + explicit sub_array(std::size_t s) noexcept( + std::is_nothrow_default_constructible<T>::value) + : size_(s) { + BOOST_ASSERT_MSG(size_ <= N, "requested size exceeds size of static buffer"); + } + + sub_array(std::size_t s, + const T& value) noexcept(std::is_nothrow_copy_constructible<T>::value) + : size_(s) { + BOOST_ASSERT_MSG(size_ <= N, "requested size exceeds size of static buffer"); + std::array<T, N>::fill(value); + } + + // need to override both versions of std::array + auto end() noexcept { return base_type::begin() + size_; } + auto end() const noexcept { return base_type::begin() + size_; } + + auto size() const noexcept { return size_; } + +private: + std::size_t size_; +}; + +template <class U, class T> +using stack_buffer = sub_array<U, buffer_size<T>::value>; + +// make default-constructed buffer (no initialization for POD types) +template <class U, class T> +auto make_stack_buffer(const T& t) { + return stack_buffer<U, T>(axes_rank(t)); +} + +// make buffer with elements initialized to v +template <class U, class T, class V> +auto make_stack_buffer(const T& t, V&& v) { + return stack_buffer<U, T>(axes_rank(t), std::forward<V>(v)); +} + +template <class T> +using has_underflow = + decltype(axis::traits::get_options<T>::test(axis::option::underflow)); + +template <class T> +using is_growing = decltype(axis::traits::get_options<T>::test(axis::option::growth)); + +template <class T> +using is_not_inclusive = mp11::mp_not<axis::traits::is_inclusive<T>>; + +// for vector<T> +template <class T> +struct axis_types_impl { + using type = mp11::mp_list<std::decay_t<T>>; +}; + +// for vector<variant<Ts...>> +template <class... Ts> +struct axis_types_impl<axis::variant<Ts...>> { + using type = mp11::mp_list<std::decay_t<Ts>...>; +}; + +// for tuple<Ts...> +template <class... Ts> +struct axis_types_impl<std::tuple<Ts...>> { + using type = mp11::mp_list<std::decay_t<Ts>...>; +}; + +template <class T> +using axis_types = + typename axis_types_impl<mp11::mp_if<is_vector_like<T>, mp11::mp_first<T>, T>>::type; + +template <template <class> class Trait, class Axes> +using has_special_axis = mp11::mp_any_of<axis_types<Axes>, Trait>; + +template <class Axes> +using has_growing_axis = mp11::mp_any_of<axis_types<Axes>, is_growing>; + +template <class Axes> +using has_non_inclusive_axis = mp11::mp_any_of<axis_types<Axes>, is_not_inclusive>; + +template <class T> +constexpr std::size_t type_score() { + return sizeof(T) * + (std::is_integral<T>::value ? 1 : std::is_floating_point<T>::value ? 10 : 100); +} + +// arbitrary ordering of types +template <class T, class U> +using type_less = mp11::mp_bool<(type_score<T>() < type_score<U>())>; + +template <class Axes> +using value_types = mp11::mp_sort< + mp11::mp_unique<mp11::mp_transform<axis::traits::value_type, axis_types<Axes>>>, + type_less>; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/common_type.hpp b/ThirdParty/boost/histogram/detail/common_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..848d10a4523f91b7e060f7d3def6b9e3af52c063 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/common_type.hpp @@ -0,0 +1,47 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_COMMON_TYPE_HPP +#define BOOST_HISTOGRAM_DETAIL_COMMON_TYPE_HPP + +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/utility.hpp> +#include <tuple> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { +// clang-format off +template <class T, class U> +using common_axes = mp11::mp_cond< + is_tuple<T>, T, + is_tuple<U>, U, + is_sequence_of_axis<T>, T, + is_sequence_of_axis<U>, U, + std::true_type, T +>; +// clang-format on + +// Non-PODs rank highest, then floats, than integers; types with more capacity are higher +template <class Storage> +static constexpr std::size_t type_rank() { + using T = typename Storage::value_type; + return !std::is_pod<T>::value * 10000 + std::is_floating_point<T>::value * 100 + + 10 * sizeof(T) + 2 * is_array_like<Storage>::value + + is_vector_like<Storage>::value; + ; +} + +template <class T, class U> +using common_storage = mp11::mp_if_c<(type_rank<T>() >= type_rank<U>()), T, U>; +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/convert_integer.hpp b/ThirdParty/boost/histogram/detail/convert_integer.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bed52f759920133f64311bb420b28eea4e31b162 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/convert_integer.hpp @@ -0,0 +1,24 @@ +// Copyright 2018-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_CONVERT_INTEGER_HPP +#define BOOST_HISTOGRAM_DETAIL_CONVERT_INTEGER_HPP + +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T, class U> +using convert_integer = + std::conditional_t<std::is_integral<std::decay_t<T>>::value, U, T>; + +} +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/counting_streambuf.hpp b/ThirdParty/boost/histogram/detail/counting_streambuf.hpp new file mode 100644 index 0000000000000000000000000000000000000000..10d81439ad72c0350571281755f2d0231dc8a099 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/counting_streambuf.hpp @@ -0,0 +1,40 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_COUNTING_STREAMBUF_HPP +#define BOOST_HISTOGRAM_DETAIL_COUNTING_STREAMBUF_HPP + +#include <streambuf> + +namespace boost { +namespace histogram { +namespace detail { + +// detect how many characters will be printed by formatted output +template <class CharT, class Traits = std::char_traits<CharT>> +struct counting_streambuf : std::basic_streambuf<CharT, Traits> { + using base_t = std::basic_streambuf<CharT, Traits>; + using typename base_t::char_type; + using typename base_t::int_type; + + std::streamsize count = 0; + + std::streamsize xsputn(const char_type* /* s */, std::streamsize n) override { + count += n; + return n; + } + + int_type overflow(int_type ch) override { + ++count; + return ch; + } +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/detect.hpp b/ThirdParty/boost/histogram/detail/detect.hpp new file mode 100644 index 0000000000000000000000000000000000000000..74242aa9b981b50f53fbf4112ea60ec12c9b1b99 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/detect.hpp @@ -0,0 +1,221 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_DETECT_HPP +#define BOOST_HISTOGRAM_DETAIL_DETECT_HPP + +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/function.hpp> +#include <boost/mp11/utility.hpp> +#include <iterator> +#include <tuple> +#include <type_traits> + +// forward declaration +namespace boost { +namespace variant2 { +template <class...> +class variant; +} // namespace variant2 +} // namespace boost + +namespace boost { +namespace histogram { +namespace detail { + +#define BOOST_HISTOGRAM_DETAIL_DETECT(name, cond) \ + template <class T> \ + using name##_impl = decltype(cond); \ + template <class T> \ + using name = typename boost::mp11::mp_valid<name##_impl, T>::type + +#define BOOST_HISTOGRAM_DETAIL_DETECT_BINARY(name, cond) \ + template <class T, class U> \ + using name##_impl = decltype(cond); \ + template <class T, class U = T> \ + using name = typename boost::mp11::mp_valid<name##_impl, T, U>::type + +// metadata has overloads, trying to get pmf in this case always fails +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_metadata, (std::declval<T&>().metadata())); + +// resize has overloads, trying to get pmf in this case always fails +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_resize, (std::declval<T&>().resize(0))); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_size, &T::size); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_clear, &T::clear); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_lower, &T::lower); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_value, &T::value); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_update, &T::update); + +// reset has overloads, trying to get pmf in this case always fails +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_reset, (std::declval<T>().reset(0))); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_method_options, &T::options); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_allocator, &T::get_allocator); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_indexable, (std::declval<T&>()[0])); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY( + is_transform, + (std::declval<T&>().inverse(std::declval<T&>().forward(std::declval<U>())))); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_indexable_container, (std::declval<T>()[0], &T::size, + std::begin(std::declval<T>()), + std::end(std::declval<T>()))); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_vector_like, + (std::declval<T>()[0], &T::size, + std::declval<T>().resize(0), std::begin(std::declval<T>()), + std::end(std::declval<T>()))); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_array_like, + (std::declval<T>()[0], &T::size, std::tuple_size<T>::value, + std::begin(std::declval<T>()), + std::end(std::declval<T>()))); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_map_like, (std::declval<typename T::key_type>(), + std::declval<typename T::mapped_type>(), + std::begin(std::declval<T>()), + std::end(std::declval<T>()))); + +// ok: is_axis is false for axis::variant, because T::index is templated +BOOST_HISTOGRAM_DETAIL_DETECT(is_axis, (&T::size, &T::index)); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_iterable, (std::begin(std::declval<T&>()), + std::end(std::declval<T&>()))); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_iterator, + (typename std::iterator_traits<T>::iterator_category())); + +BOOST_HISTOGRAM_DETAIL_DETECT(is_streamable, + (std::declval<std::ostream&>() << std::declval<T&>())); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_operator_preincrement, (++std::declval<T&>())); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY(has_operator_equal, (std::declval<const T&>() == + std::declval<const U>())); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY(has_operator_radd, + (std::declval<T&>() += std::declval<U>())); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY(has_operator_rsub, + (std::declval<T&>() -= std::declval<U>())); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY(has_operator_rmul, + (std::declval<T&>() *= std::declval<U>())); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY(has_operator_rdiv, + (std::declval<T&>() /= std::declval<U>())); + +BOOST_HISTOGRAM_DETAIL_DETECT_BINARY( + has_method_eq, (std::declval<const T>().operator==(std::declval<const U>()))); + +BOOST_HISTOGRAM_DETAIL_DETECT(has_threading_support, (T::has_threading_support)); + +template <class T> +using is_storage = mp11::mp_and<is_indexable_container<T>, has_method_reset<T>, + has_threading_support<T>>; + +template <class T> +using is_adaptible = + mp11::mp_and<mp11::mp_not<is_storage<T>>, + mp11::mp_or<is_vector_like<T>, is_array_like<T>, is_map_like<T>>>; + +template <class T> +struct is_tuple_impl : mp11::mp_false {}; + +template <class... Ts> +struct is_tuple_impl<std::tuple<Ts...>> : mp11::mp_true {}; + +template <class T> +using is_tuple = typename is_tuple_impl<T>::type; + +template <class T> +struct is_variant_impl : mp11::mp_false {}; + +template <class... Ts> +struct is_variant_impl<boost::variant2::variant<Ts...>> : mp11::mp_true {}; + +template <class T> +using is_variant = typename is_variant_impl<T>::type; + +template <class T> +struct is_axis_variant_impl : mp11::mp_false {}; + +template <class... Ts> +struct is_axis_variant_impl<axis::variant<Ts...>> : mp11::mp_true {}; + +template <class T> +using is_axis_variant = typename is_axis_variant_impl<T>::type; + +template <class T> +using is_any_axis = mp11::mp_or<is_axis<T>, is_axis_variant<T>>; + +template <class T> +using is_sequence_of_axis = mp11::mp_and<is_iterable<T>, is_axis<mp11::mp_first<T>>>; + +template <class T> +using is_sequence_of_axis_variant = + mp11::mp_and<is_iterable<T>, is_axis_variant<mp11::mp_first<T>>>; + +template <class T> +using is_sequence_of_any_axis = + mp11::mp_and<is_iterable<T>, is_any_axis<mp11::mp_first<T>>>; + +// poor-mans concept checks +template <class T, class = std::enable_if_t<is_storage<std::decay_t<T>>::value>> +struct requires_storage {}; + +template <class T, class _ = std::decay_t<T>, + class = std::enable_if_t<(is_storage<_>::value || is_adaptible<_>::value)>> +struct requires_storage_or_adaptible {}; + +template <class T, class = std::enable_if_t<is_iterator<std::decay_t<T>>::value>> +struct requires_iterator {}; + +template <class T, class = std::enable_if_t< + is_iterable<std::remove_cv_t<std::remove_reference_t<T>>>::value>> +struct requires_iterable {}; + +template <class T, class = std::enable_if_t<is_axis<std::decay_t<T>>::value>> +struct requires_axis {}; + +template <class T, class = std::enable_if_t<is_any_axis<std::decay_t<T>>::value>> +struct requires_any_axis {}; + +template <class T, class = std::enable_if_t<is_sequence_of_axis<std::decay_t<T>>::value>> +struct requires_sequence_of_axis {}; + +template <class T, + class = std::enable_if_t<is_sequence_of_axis_variant<std::decay_t<T>>::value>> +struct requires_sequence_of_axis_variant {}; + +template <class T, + class = std::enable_if_t<is_sequence_of_any_axis<std::decay_t<T>>::value>> +struct requires_sequence_of_any_axis {}; + +template <class T, + class = std::enable_if_t<is_any_axis<mp11::mp_first<std::decay_t<T>>>::value>> +struct requires_axes {}; + +template <class T, class U, class = std::enable_if_t<std::is_convertible<T, U>::value>> +struct requires_convertible {}; + +template <class T, class U, + class = std::enable_if_t<is_transform<std::decay_t<T>, U>::value>> +struct requires_transform {}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/fill.hpp b/ThirdParty/boost/histogram/detail/fill.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6205a63f45597491ea7d3ae40e85b8fdae6bb902 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/fill.hpp @@ -0,0 +1,348 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_FILL_HPP +#define BOOST_HISTOGRAM_DETAIL_FILL_HPP + +#include <algorithm> +#include <boost/assert.hpp> +#include <boost/config/workaround.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/axis/variant.hpp> +#include <boost/histogram/detail/argument_traits.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/linearize.hpp> +#include <boost/histogram/detail/make_default.hpp> +#include <boost/histogram/detail/optional_index.hpp> +#include <boost/histogram/detail/priority.hpp> +#include <boost/histogram/detail/tuple_slice.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/integral.hpp> +#include <boost/mp11/tuple.hpp> +#include <boost/mp11/utility.hpp> +#include <mutex> +#include <tuple> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T, class U> +struct sample_args_passed_vs_expected; + +template <class... Passed, class... Expected> +struct sample_args_passed_vs_expected<std::tuple<Passed...>, std::tuple<Expected...>> { + static_assert(!(sizeof...(Expected) > 0 && sizeof...(Passed) == 0), + "error: accumulator requires samples, but sample argument is missing"); + static_assert( + !(sizeof...(Passed) > 0 && sizeof...(Expected) == 0), + "error: accumulator does not accept samples, but sample argument is passed"); + static_assert(sizeof...(Passed) == sizeof...(Expected), + "error: numbers of passed and expected sample arguments differ"); + static_assert( + std::is_convertible<std::tuple<Passed...>, std::tuple<Expected...>>::value, + "error: sample argument(s) not convertible to accumulator argument(s)"); +}; + +template <class A> +struct storage_grower { + const A& axes_; + struct { + axis::index_type idx, old_extent; + std::size_t new_stride; + } data_[buffer_size<A>::value]; + std::size_t new_size_; + + storage_grower(const A& axes) noexcept : axes_(axes) {} + + void from_shifts(const axis::index_type* shifts) noexcept { + auto dit = data_; + std::size_t s = 1; + for_each_axis(axes_, [&](const auto& a) { + const auto n = axis::traits::extent(a); + *dit++ = {0, n - std::abs(*shifts++), s}; + s *= n; + }); + new_size_ = s; + } + + // must be extents before any shifts were applied + void from_extents(const axis::index_type* old_extents) noexcept { + auto dit = data_; + std::size_t s = 1; + for_each_axis(axes_, [&](const auto& a) { + const auto n = axis::traits::extent(a); + *dit++ = {0, *old_extents++, s}; + s *= n; + }); + new_size_ = s; + } + + template <class S> + void apply(S& storage, const axis::index_type* shifts) { + auto new_storage = make_default(storage); + new_storage.reset(new_size_); + const auto dlast = data_ + axes_rank(axes_) - 1; + for (const auto& x : storage) { + auto ns = new_storage.begin(); + auto sit = shifts; + auto dit = data_; + for_each_axis(axes_, [&](const auto& a) { + using opt = axis::traits::get_options<std::decay_t<decltype(a)>>; + if (opt::test(axis::option::underflow)) { + if (dit->idx == 0) { + // axis has underflow and we are in the underflow bin: + // keep storage pointer unchanged + ++dit; + ++sit; + return; + } + } + if (opt::test(axis::option::overflow)) { + if (dit->idx == dit->old_extent - 1) { + // axis has overflow and we are in the overflow bin: + // move storage pointer to corresponding overflow bin position + ns += (axis::traits::extent(a) - 1) * dit->new_stride; + ++dit; + ++sit; + return; + } + } + // we are in a normal bin: + // move storage pointer to index position; apply positive shifts if any + ns += (dit->idx + (*sit >= 0 ? *sit : 0)) * dit->new_stride; + ++dit; + ++sit; + }); + // assign old value to new location + *ns = x; + // advance multi-dimensional index + dit = data_; + ++dit->idx; + while (dit != dlast && dit->idx == dit->old_extent) { + dit->idx = 0; + ++(++dit)->idx; + } + } + storage = std::move(new_storage); + } +}; + +template <class T, class... Us> +auto fill_storage_element_impl(priority<2>, T&& t, const Us&... args) noexcept + -> decltype(t(args...), void()) { + t(args...); +} + +template <class T, class U> +auto fill_storage_element_impl(priority<1>, T&& t, const weight_type<U>& w) noexcept + -> decltype(t += w, void()) { + t += w; +} + +// fallback for arithmetic types and accumulators that do not handle the weight +template <class T, class U> +auto fill_storage_element_impl(priority<0>, T&& t, const weight_type<U>& w) noexcept + -> decltype(t += w.value, void()) { + t += w.value; +} + +template <class T> +auto fill_storage_element_impl(priority<1>, T&& t) noexcept -> decltype(++t, void()) { + ++t; +} + +template <class T, class... Us> +void fill_storage_element(T&& t, const Us&... args) noexcept { + fill_storage_element_impl(priority<2>{}, std::forward<T>(t), args...); +} + +// t may be a proxy and then it is an rvalue reference, not an lvalue reference +template <class IW, class IS, class T, class U> +void fill_storage_2(IW, IS, T&& t, U&& u) noexcept { + mp11::tuple_apply( + [&](const auto&... args) { + fill_storage_element(std::forward<T>(t), std::get<IW::value>(u), args...); + }, + std::get<IS::value>(u).value); +} + +// t may be a proxy and then it is an rvalue reference, not an lvalue reference +template <class IS, class T, class U> +void fill_storage_2(mp11::mp_int<-1>, IS, T&& t, const U& u) noexcept { + mp11::tuple_apply( + [&](const auto&... args) { fill_storage_element(std::forward<T>(t), args...); }, + std::get<IS::value>(u).value); +} + +// t may be a proxy and then it is an rvalue reference, not an lvalue reference +template <class IW, class T, class U> +void fill_storage_2(IW, mp11::mp_int<-1>, T&& t, const U& u) noexcept { + fill_storage_element(std::forward<T>(t), std::get<IW::value>(u)); +} + +// t may be a proxy and then it is an rvalue reference, not an lvalue reference +template <class T, class U> +void fill_storage_2(mp11::mp_int<-1>, mp11::mp_int<-1>, T&& t, const U&) noexcept { + fill_storage_element(std::forward<T>(t)); +} + +template <class IW, class IS, class Storage, class Index, class Args> +auto fill_storage(IW, IS, Storage& s, const Index idx, const Args& a) noexcept { + if (is_valid(idx)) { + BOOST_ASSERT(idx < s.size()); + fill_storage_2(IW{}, IS{}, s[idx], a); + return s.begin() + idx; + } + return s.end(); +} + +template <int S, int N> +struct linearize_args { + template <class Index, class A, class Args> + static void impl(mp11::mp_int<N>, Index&, const std::size_t, A&, const Args&) {} + + template <int I, class Index, class A, class Args> + static void impl(mp11::mp_int<I>, Index& o, const std::size_t s, A& ax, + const Args& args) { + const auto e = linearize(o, s, axis_get<I>(ax), std::get<(S + I)>(args)); + impl(mp11::mp_int<(I + 1)>{}, o, s * e, ax, args); + } + + template <class Index, class A, class Args> + static void apply(Index& o, A& ax, const Args& args) { + impl(mp11::mp_int<0>{}, o, 1, ax, args); + } +}; + +template <int S> +struct linearize_args<S, 1> { + template <class Index, class A, class Args> + static void apply(Index& o, A& ax, const Args& args) { + linearize(o, 1, axis_get<0>(ax), std::get<S>(args)); + } +}; + +template <class A> +constexpr unsigned min(const unsigned n) noexcept { + constexpr unsigned a = static_cast<unsigned>(buffer_size<A>::value); + return a < n ? a : n; +} + +// not growing +template <class ArgTraits, class Storage, class Axes, class Args> +auto fill_2(ArgTraits, mp11::mp_false, const std::size_t offset, Storage& st, + const Axes& axes, const Args& args) { + mp11::mp_if<has_non_inclusive_axis<Axes>, optional_index, std::size_t> idx{offset}; + linearize_args<ArgTraits::start::value, min<Axes>(ArgTraits::nargs::value)>::apply( + idx, axes, args); + return fill_storage(typename ArgTraits::wpos{}, typename ArgTraits::spos{}, st, idx, + args); +} + +// at least one axis is growing +template <class ArgTraits, class Storage, class Axes, class Args> +auto fill_2(ArgTraits, mp11::mp_true, const std::size_t, Storage& st, Axes& axes, + const Args& args) { + std::array<axis::index_type, ArgTraits::nargs::value> shifts; + // offset must be zero for linearize_growth + mp11::mp_if<has_non_inclusive_axis<Axes>, optional_index, std::size_t> idx{0}; + std::size_t stride = 1; + bool update_needed = false; + mp11::mp_for_each<mp11::mp_iota_c<min<Axes>(ArgTraits::nargs::value)>>([&](auto i) { + auto& ax = axis_get<i>(axes); + const auto extent = linearize_growth(idx, shifts[i], stride, ax, + std::get<(ArgTraits::start::value + i)>(args)); + update_needed |= shifts[i] != 0; + stride *= extent; + }); + if (update_needed) { + storage_grower<Axes> g(axes); + g.from_shifts(shifts.data()); + g.apply(st, shifts.data()); + } + return fill_storage(typename ArgTraits::wpos{}, typename ArgTraits::spos{}, st, idx, + args); +} + +// pack original args tuple into another tuple (which is unpacked later) +template <int Start, int Size, class IW, class IS, class Args> +decltype(auto) pack_args(IW, IS, const Args& args) noexcept { + return std::make_tuple(tuple_slice<Start, Size>(args), std::get<IW::value>(args), + std::get<IS::value>(args)); +} + +template <int Start, int Size, class IW, class Args> +decltype(auto) pack_args(IW, mp11::mp_int<-1>, const Args& args) noexcept { + return std::make_tuple(tuple_slice<Start, Size>(args), std::get<IW::value>(args)); +} + +template <int Start, int Size, class IS, class Args> +decltype(auto) pack_args(mp11::mp_int<-1>, IS, const Args& args) noexcept { + return std::make_tuple(tuple_slice<Start, Size>(args), std::get<IS::value>(args)); +} + +template <int Start, int Size, class Args> +decltype(auto) pack_args(mp11::mp_int<-1>, mp11::mp_int<-1>, const Args& args) noexcept { + return std::make_tuple(args); +} + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 0) +#pragma warning(disable : 4702) // fixing warning would reduce code readability a lot +#endif + +template <class ArgTraits, class S, class A, class Args> +auto fill(std::true_type, ArgTraits, const std::size_t offset, S& storage, A& axes, + const Args& args) -> typename S::iterator { + using growing = has_growing_axis<A>; + + // Sometimes we need to pack the tuple into another tuple: + // - histogram contains one axis which accepts tuple + // - user passes tuple to fill(...) + // Tuple is normally unpacked and arguments are processed, this causes pos::nargs > 1. + // Now we pack tuple into another tuple so that original tuple is send to axis. + // Notes: + // - has nice side-effect of making histogram::operator(1, 2) work as well + // - cannot detect call signature of axis at compile-time in all configurations + // (axis::variant provides generic call interface and hides concrete + // interface), so we throw at runtime if incompatible argument is passed (e.g. + // 3d tuple) + + if (axes_rank(axes) == ArgTraits::nargs::value) + return fill_2(ArgTraits{}, growing{}, offset, storage, axes, args); + else if (axes_rank(axes) == 1 && + axis::traits::rank(axis_get<0>(axes)) == ArgTraits::nargs::value) + return fill_2( + argument_traits_holder< + 1, 0, (ArgTraits::wpos::value >= 0 ? 1 : -1), + (ArgTraits::spos::value >= 0 ? (ArgTraits::wpos::value >= 0 ? 2 : 1) : -1), + typename ArgTraits::sargs>{}, + growing{}, offset, storage, axes, + pack_args<ArgTraits::start::value, ArgTraits::nargs::value>( + typename ArgTraits::wpos{}, typename ArgTraits::spos{}, args)); + return (BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments != histogram rank")), + storage.end()); +} + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 0) +#pragma warning(default : 4702) +#endif + +// empty implementation for bad arguments to stop compiler from showing internals +template <class ArgTraits, class S, class A, class Args> +auto fill(std::false_type, ArgTraits, const std::size_t, S& storage, A&, const Args&) -> + typename S::iterator { + return storage.end(); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/fill_n.hpp b/ThirdParty/boost/histogram/detail/fill_n.hpp new file mode 100644 index 0000000000000000000000000000000000000000..224a788cedee64c2c37ab82bd238518d4dbee697 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/fill_n.hpp @@ -0,0 +1,339 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_FILL_N_HPP +#define BOOST_HISTOGRAM_DETAIL_FILL_N_HPP + +#include <algorithm> +#include <boost/assert.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/fill.hpp> +#include <boost/histogram/detail/linearize.hpp> +#include <boost/histogram/detail/non_member_container_access.hpp> +#include <boost/histogram/detail/optional_index.hpp> +#include <boost/histogram/detail/span.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/variant2/variant.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/bind.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { +namespace detail { + +namespace dtl = boost::histogram::detail; + +template <class Axes, class T> +using is_convertible_to_any_value_type = + mp11::mp_any_of_q<value_types<Axes>, mp11::mp_bind_front<std::is_convertible, T>>; + +template <class... Ts> +void fold(Ts&&...) noexcept {} // helper to enable operator folding + +template <class T> +auto to_ptr_size(const T& x) { + return static_if<std::is_scalar<T>>( + [](const auto& x) { return std::make_pair(&x, static_cast<std::size_t>(0)); }, + [](const auto& x) { return std::make_pair(dtl::data(x), dtl::size(x)); }, x); +} + +template <class F, class V> +decltype(auto) maybe_visit(F&& f, V&& v) { + return static_if<is_variant<std::decay_t<V>>>( + [](auto&& f, auto&& v) { + return variant2::visit(std::forward<F>(f), std::forward<V>(v)); + }, + [](auto&& f, auto&& v) { return std::forward<F>(f)(std::forward<V>(v)); }, + std::forward<F>(f), std::forward<V>(v)); +} + +template <class Index, class Axis, class IsGrowing> +struct index_visitor { + using index_type = Index; + using pointer = index_type*; + using value_type = axis::traits::value_type<Axis>; + using Opt = axis::traits::get_options<Axis>; + + Axis& axis_; + const std::size_t stride_, start_, size_; // start and size of value collection + const pointer begin_; + axis::index_type* shift_; + + index_visitor(Axis& a, std::size_t& str, const std::size_t& sta, const std::size_t& si, + const pointer it, axis::index_type* shift) + : axis_(a), stride_(str), start_(sta), size_(si), begin_(it), shift_(shift) {} + + template <class T> + void call_2(std::true_type, pointer it, const T& x) const { + // must use this code for all axes if one of them is growing + axis::index_type shift; + linearize_growth(*it, shift, stride_, axis_, + try_cast<value_type, std::invalid_argument>(x)); + if (shift > 0) { // shift previous indices, because axis zero-point has changed + while (it != begin_) *--it += static_cast<std::size_t>(shift) * stride_; + *shift_ += shift; + } + } + + template <class T> + void call_2(std::false_type, pointer it, const T& x) const { + // no axis is growing + linearize(*it, stride_, axis_, try_cast<value_type, std::invalid_argument>(x)); + } + + template <class T> + void call_1(std::false_type, const T& iterable) const { + // T is iterable; fill N values + const auto* tp = dtl::data(iterable) + start_; + for (auto it = begin_; it != begin_ + size_; ++it) call_2(IsGrowing{}, it, *tp++); + } + + template <class T> + void call_1(std::true_type, const T& value) const { + // T is compatible value; fill single value N times + index_type idx{*begin_}; + call_2(IsGrowing{}, &idx, value); + if (is_valid(idx)) { + const auto delta = + static_cast<std::intptr_t>(idx) - static_cast<std::intptr_t>(*begin_); + for (auto&& i : make_span(begin_, size_)) i += delta; + } else + std::fill(begin_, begin_ + size_, invalid_index); + } + + template <class T> + void operator()(const T& iterable_or_value) const { + call_1(mp11::mp_bool<(std::is_convertible<T, value_type>::value || + !is_iterable<T>::value)>{}, + iterable_or_value); + } +}; + +template <class Index, class S, class Axes, class T> +void fill_n_indices(Index* indices, const std::size_t start, const std::size_t size, + const std::size_t offset, S& storage, Axes& axes, const T* viter) { + axis::index_type extents[buffer_size<Axes>::value]; + axis::index_type shifts[buffer_size<Axes>::value]; + for_each_axis(axes, [eit = extents, sit = shifts](const auto& a) mutable { + *sit++ = 0; + *eit++ = axis::traits::extent(a); + }); // LCOV_EXCL_LINE: gcc-8 is missing this line for no reason + + // offset must be zero for growing axes + using IsGrowing = has_growing_axis<Axes>; + std::fill(indices, indices + size, IsGrowing::value ? 0 : offset); + for_each_axis(axes, [&, stride = static_cast<std::size_t>(1), + pshift = shifts](auto& axis) mutable { + using Axis = std::decay_t<decltype(axis)>; + maybe_visit( + index_visitor<Index, Axis, IsGrowing>{axis, stride, start, size, indices, pshift}, + *viter++); + stride *= static_cast<std::size_t>(axis::traits::extent(axis)); + ++pshift; + }); + + bool update_needed = false; + for_each_axis(axes, [&update_needed, eit = extents](const auto& a) mutable { + update_needed |= *eit++ != axis::traits::extent(a); + }); + if (update_needed) { + storage_grower<Axes> g(axes); + g.from_extents(extents); + g.apply(storage, shifts); + } +} + +template <class S, class Index, class... Ts> +void fill_n_storage(S& s, const Index idx, Ts&&... p) noexcept { + if (is_valid(idx)) { + BOOST_ASSERT(idx < s.size()); + fill_storage_element(s[idx], *p.first...); + } + fold((p.second ? ++p.first : 0)...); +} + +template <class S, class Index, class T, class... Ts> +void fill_n_storage(S& s, const Index idx, weight_type<T>&& w, Ts&&... ps) noexcept { + if (is_valid(idx)) { + BOOST_ASSERT(idx < s.size()); + fill_storage_element(s[idx], weight(*w.value.first), *ps.first...); + } + if (w.value.second) ++w.value.first; + fold((ps.second ? ++ps.first : 0)...); +} + +// general Nd treatment +template <class Index, class S, class A, class T, class... Ts> +void fill_n_nd(const std::size_t offset, S& storage, A& axes, const std::size_t vsize, + const T* values, Ts&&... ts) { + constexpr std::size_t buffer_size = 1ul << 14; + Index indices[buffer_size]; + + /* + Parallelization options. + + A) Run the whole fill2 method in parallel, each thread fills its own buffer of + indices, synchronization (atomics) are needed to synchronize the incrementing of + the storage cells. This leads to a lot of congestion for small histograms. + + B) Run only fill_n_indices in parallel, subsections of the indices buffer + can be filled by different threads. The final loop that fills the storage runs + in the main thread, this requires no synchronization for the storage, cells do + not need to support atomic operations. + + C) Like B), then sort the indices in the main thread and fill the + storage in parallel, where each thread uses a disjunct set of indices. This + should create less congestion and requires no synchronization for the storage. + + Note on C): Let's say we have an axis with 5 bins (with *flow to simplify). + Then after filling 10 values, converting to indices and sorting, the index + buffer may look like this: 0 0 0 1 2 2 2 4 4 5. Let's use two threads to fill + the storage. Still in the main thread, we compute an iterator to the middle of + the index buffer and move it to the right until the pointee changes. Now we have + two ranges which contain disjunct sets of indices. We pass these ranges to the + threads which then fill the storage. Since the threads by construction do not + compete to increment the same cell, no further synchronization is required. + + In all cases, growing axes cannot be parallelized. + */ + + for (std::size_t start = 0; start < vsize; start += buffer_size) { + const std::size_t n = std::min(buffer_size, vsize - start); + // fill buffer of indices... + fill_n_indices(indices, start, n, offset, storage, axes, values); + // ...and fill corresponding storage cells + for (auto&& idx : make_span(indices, n)) + fill_n_storage(storage, idx, std::forward<Ts>(ts)...); + } +} + +template <class S, class... As, class T, class... Us> +void fill_n_1(const std::size_t offset, S& storage, std::tuple<As...>& axes, + const std::size_t vsize, const T* values, Us&&... us) { + using index_type = + mp11::mp_if<has_non_inclusive_axis<std::tuple<As...>>, optional_index, std::size_t>; + fill_n_nd<index_type>(offset, storage, axes, vsize, values, std::forward<Us>(us)...); +} + +template <class S, class A, class T, class... Us> +void fill_n_1(const std::size_t offset, S& storage, A& axes, const std::size_t vsize, + const T* values, Us&&... us) { + bool all_inclusive = true; + for_each_axis(axes, + [&](const auto& ax) { all_inclusive &= axis::traits::inclusive(ax); }); + if (axes_rank(axes) == 1) { + axis::visit( + [&](auto& ax) { + std::tuple<decltype(ax)> axes{ax}; + fill_n_1(offset, storage, axes, vsize, values, std::forward<Us>(us)...); + }, + axes[0]); + } else { + if (all_inclusive) + fill_n_nd<std::size_t>(offset, storage, axes, vsize, values, + std::forward<Us>(us)...); + else + fill_n_nd<optional_index>(offset, storage, axes, vsize, values, + std::forward<Us>(us)...); + } +} + +template <class A, class T, std::size_t N> +std::size_t get_total_size(const A& axes, const dtl::span<const T, N>& values) { + // supported cases (T = value type; CT = containter of T; V<T, CT, ...> = variant): + // - span<CT, N>: for any histogram, N == rank + // - span<V<T, CT>, N>: for any histogram, N == rank + BOOST_ASSERT(axes_rank(axes) == values.size()); + constexpr auto unset = static_cast<std::size_t>(-1); + std::size_t size = unset; + for_each_axis(axes, [&size, vit = values.begin()](const auto& ax) mutable { + using AV = axis::traits::value_type<std::decay_t<decltype(ax)>>; + maybe_visit( + [&size](const auto& v) { + // v is either convertible to value or a sequence of values + using V = std::remove_const_t<std::remove_reference_t<decltype(v)>>; + static_if_c<(std::is_convertible<decltype(v), AV>::value || + !is_iterable<V>::value)>( + [](const auto&) {}, + [&size](const auto& v) { + const auto n = dtl::size(v); + // must repeat this here for msvc :( + constexpr auto unset = static_cast<std::size_t>(-1); + if (size == unset) + size = dtl::size(v); + else if (size != n) + BOOST_THROW_EXCEPTION( + std::invalid_argument("spans must have compatible lengths")); + }, + v); + }, + *vit++); + }); + // if all arguments are not iterables, return size of 1 + return size == unset ? 1 : size; +} + +inline void fill_n_check_extra_args(std::size_t) noexcept {} + +template <class T, class... Ts> +void fill_n_check_extra_args(std::size_t size, T&& x, Ts&&... ts) { + // sequences must have same lengths, but sequences of length 0 are broadcast + if (x.second != 0 && x.second != size) + BOOST_THROW_EXCEPTION(std::invalid_argument("spans must have compatible lengths")); + fill_n_check_extra_args(size, std::forward<Ts>(ts)...); +} + +template <class T, class... Ts> +void fill_n_check_extra_args(std::size_t size, weight_type<T>&& w, Ts&&... ts) { + fill_n_check_extra_args(size, w.value, std::forward<Ts>(ts)...); +} + +template <class S, class A, class T, std::size_t N, class... Us> +void fill_n(std::true_type, const std::size_t offset, S& storage, A& axes, + const dtl::span<const T, N> values, Us&&... us) { + // supported cases (T = value type; CT = containter of T; V<T, CT, ...> = variant): + // - span<T, N>: only valid for 1D histogram, N > 1 allowed + // - span<CT, N>: for any histogram, N == rank + // - span<V<T, CT>, N>: for any histogram, N == rank + static_if<is_convertible_to_any_value_type<A, T>>( + [&](const auto& values, auto&&... us) { + // T matches one of the axis value types, must be 1D special case + if (axes_rank(axes) != 1) + BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments must match histogram rank")); + fill_n_check_extra_args(values.size(), std::forward<Us>(us)...); + fill_n_1(offset, storage, axes, values.size(), &values, std::forward<Us>(us)...); + }, + [&](const auto& values, auto&&... us) { + // generic ND case + if (axes_rank(axes) != values.size()) + BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments must match histogram rank")); + const auto vsize = get_total_size(axes, values); + fill_n_check_extra_args(vsize, std::forward<Us>(us)...); + fill_n_1(offset, storage, axes, vsize, values.data(), std::forward<Us>(us)...); + }, + values, std::forward<Us>(us)...); +} + +// empty implementation for bad arguments to stop compiler from showing internals +template <class... Ts> +void fill_n(std::false_type, Ts...) {} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif // BOOST_HISTOGRAM_DETAIL_FILL_N_HPP diff --git a/ThirdParty/boost/histogram/detail/iterator_adaptor.hpp b/ThirdParty/boost/histogram/detail/iterator_adaptor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..345a4abb194b0212b1652b322e6d9491e6241b7a --- /dev/null +++ b/ThirdParty/boost/histogram/detail/iterator_adaptor.hpp @@ -0,0 +1,162 @@ +// Copyright 2019 Hans Dembinski +// +// 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) +// +// Uses code segments from boost/iterator/iterator_adaptor.hpp +// and boost/iterator/iterator_fascade.hpp + +#ifndef BOOST_HISTOGRAM_DETAIL_ITERATOR_ADAPTOR_HPP +#define BOOST_HISTOGRAM_DETAIL_ITERATOR_ADAPTOR_HPP + +#include <iterator> +#include <memory> +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { +namespace detail { + +// operator->() needs special support for input iterators to strictly meet the +// standard's requirements. If *i is not a reference type, we must still +// produce an lvalue to which a pointer can be formed. We do that by +// returning a proxy object containing an instance of the reference object. +template <class Reference> +struct operator_arrow_dispatch_t // proxy references +{ + struct proxy { + explicit proxy(Reference const& x) noexcept : m_ref(x) {} + Reference* operator->() noexcept { return std::addressof(m_ref); } + Reference m_ref; + }; + + using result_type = proxy; + static result_type apply(Reference const& x) noexcept { return proxy(x); } +}; + +template <class T> +struct operator_arrow_dispatch_t<T&> // "real" references +{ + using result_type = T*; + static result_type apply(T& x) noexcept { return std::addressof(x); } +}; + +// only for random access Base +template <class Derived, class Base, class Reference = std::remove_pointer_t<Base>&, + class Value = std::decay_t<Reference>> +class iterator_adaptor { + using operator_arrow_dispatch = operator_arrow_dispatch_t<Reference>; + +public: + using base_type = Base; + + using reference = Reference; + using value_type = std::remove_const_t<Value>; + using pointer = typename operator_arrow_dispatch::result_type; + using difference_type = std::ptrdiff_t; + using iterator_category = std::random_access_iterator_tag; + + iterator_adaptor() = default; + + explicit iterator_adaptor(base_type const& iter) : iter_(iter) {} + + pointer operator->() const noexcept { + return operator_arrow_dispatch::apply(this->derived().operator*()); + } + reference operator[](difference_type n) const { return *(this->derived() + n); } + + Derived& operator++() { + ++iter_; + return this->derived(); + } + + Derived& operator--() { + --iter_; + return this->derived(); + } + + Derived operator++(int) { + Derived tmp(this->derived()); + ++iter_; + return tmp; + } + + Derived operator--(int) { + Derived tmp(this->derived()); + --iter_; + return tmp; + } + + Derived& operator+=(difference_type n) { + iter_ += n; + return this->derived(); + } + + Derived& operator-=(difference_type n) { + iter_ -= n; + return this->derived(); + } + + Derived operator+(difference_type n) const { + Derived tmp(this->derived()); + tmp += n; + return tmp; + } + + Derived operator-(difference_type n) const { return operator+(-n); } + + template <class... Ts> + difference_type operator-(const iterator_adaptor<Ts...>& x) const noexcept { + return iter_ - x.iter_; + } + + template <class... Ts> + bool operator==(const iterator_adaptor<Ts...>& x) const noexcept { + return iter_ == x.iter_; + } + template <class... Ts> + bool operator!=(const iterator_adaptor<Ts...>& x) const noexcept { + return !this->derived().operator==(x); // equal operator may be overridden in derived + } + template <class... Ts> + bool operator<(const iterator_adaptor<Ts...>& x) const noexcept { + return iter_ < x.iter_; + } + template <class... Ts> + bool operator>(const iterator_adaptor<Ts...>& x) const noexcept { + return iter_ > x.iter_; + } + template <class... Ts> + bool operator<=(const iterator_adaptor<Ts...>& x) const noexcept { + return iter_ <= x.iter_; + } + template <class... Ts> + bool operator>=(const iterator_adaptor<Ts...>& x) const noexcept { + return iter_ >= x.iter_; + } + + friend Derived operator+(difference_type n, const Derived& x) { return x + n; } + + Base const& base() const noexcept { return iter_; } + +protected: + // for convenience in derived classes + using iterator_adaptor_ = iterator_adaptor; + +private: + Derived& derived() noexcept { return *static_cast<Derived*>(this); } + const Derived& derived() const noexcept { return *static_cast<Derived const*>(this); } + + Base iter_; + + template <class, class, class, class> + friend class iterator_adaptor; +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/large_int.hpp b/ThirdParty/boost/histogram/detail/large_int.hpp new file mode 100644 index 0000000000000000000000000000000000000000..363ca33568f773dc9cb3b590ce9da002f376e5e4 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/large_int.hpp @@ -0,0 +1,232 @@ +// Copyright 2018-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_LARGE_INT_HPP +#define BOOST_HISTOGRAM_DETAIL_LARGE_INT_HPP + +#include <boost/assert.hpp> +#include <boost/histogram/detail/operators.hpp> +#include <boost/histogram/detail/safe_comparison.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/function.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/utility.hpp> +#include <cmath> +#include <cstdint> +#include <limits> +#include <type_traits> +#include <utility> +#include <vector> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +using is_unsigned_integral = mp11::mp_and<std::is_integral<T>, std::is_unsigned<T>>; + +template <class T> +bool safe_increment(T& t) { + if (t < (std::numeric_limits<T>::max)()) { + ++t; + return true; + } + return false; +} + +template <class T, class U> +bool safe_radd(T& t, const U& u) { + static_assert(is_unsigned_integral<T>::value, "T must be unsigned integral type"); + static_assert(is_unsigned_integral<U>::value, "T must be unsigned integral type"); + if (static_cast<T>((std::numeric_limits<T>::max)() - t) >= u) { + t += static_cast<T>(u); // static_cast to suppress conversion warning + return true; + } + return false; +} + +// An integer type which can grow arbitrarily large (until memory is exhausted). +// Use boost.multiprecision.cpp_int in your own code, it is much more sophisticated. +// We use it only to reduce coupling between boost libs. +template <class Allocator> +struct large_int : totally_ordered<large_int<Allocator>, large_int<Allocator>>, + partially_ordered<large_int<Allocator>, void> { + explicit large_int(const Allocator& a = {}) : data(1, 0, a) {} + explicit large_int(std::uint64_t v, const Allocator& a = {}) : data(1, v, a) {} + + large_int(const large_int&) = default; + large_int& operator=(const large_int&) = default; + large_int(large_int&&) = default; + large_int& operator=(large_int&&) = default; + + large_int& operator=(std::uint64_t o) { + data = decltype(data)(1, o); + return *this; + } + + large_int& operator++() { + BOOST_ASSERT(data.size() > 0u); + std::size_t i = 0; + while (!safe_increment(data[i])) { + data[i] = 0; + ++i; + if (i == data.size()) { + data.push_back(1); + break; + } + } + return *this; + } + + large_int& operator+=(const large_int& o) { + if (this == &o) { + auto tmp{o}; + return operator+=(tmp); + } + bool carry = false; + std::size_t i = 0; + for (std::uint64_t oi : o.data) { + auto& di = maybe_extend(i); + if (carry) { + if (safe_increment(oi)) + carry = false; + else { + ++i; + continue; + } + } + if (!safe_radd(di, oi)) { + add_remainder(di, oi); + carry = true; + } + ++i; + } + while (carry) { + auto& di = maybe_extend(i); + if (safe_increment(di)) break; + di = 0; + ++i; + } + return *this; + } + + large_int& operator+=(std::uint64_t o) { + BOOST_ASSERT(data.size() > 0u); + if (safe_radd(data[0], o)) return *this; + add_remainder(data[0], o); + // carry the one, data may grow several times + std::size_t i = 1; + while (true) { + auto& di = maybe_extend(i); + if (safe_increment(di)) break; + di = 0; + ++i; + } + return *this; + } + + explicit operator double() const noexcept { + BOOST_ASSERT(data.size() > 0u); + double result = static_cast<double>(data[0]); + std::size_t i = 0; + while (++i < data.size()) + result += static_cast<double>(data[i]) * std::pow(2.0, i * 64); + return result; + } + + bool operator<(const large_int& o) const noexcept { + BOOST_ASSERT(data.size() > 0u); + BOOST_ASSERT(o.data.size() > 0u); + // no leading zeros allowed + BOOST_ASSERT(data.size() == 1 || data.back() > 0u); + BOOST_ASSERT(o.data.size() == 1 || o.data.back() > 0u); + if (data.size() < o.data.size()) return true; + if (data.size() > o.data.size()) return false; + auto s = data.size(); + while (s > 0u) { + --s; + if (data[s] < o.data[s]) return true; + if (data[s] > o.data[s]) return false; + } + return false; // args are equal + } + + bool operator==(const large_int& o) const noexcept { + BOOST_ASSERT(data.size() > 0u); + BOOST_ASSERT(o.data.size() > 0u); + // no leading zeros allowed + BOOST_ASSERT(data.size() == 1 || data.back() > 0u); + BOOST_ASSERT(o.data.size() == 1 || o.data.back() > 0u); + if (data.size() != o.data.size()) return false; + return std::equal(data.begin(), data.end(), o.data.begin()); + } + + template <class U> + std::enable_if_t<std::is_integral<U>::value, bool> operator<(const U& o) const + noexcept { + BOOST_ASSERT(data.size() > 0u); + return data.size() == 1 && safe_less()(data[0], o); + } + + template <class U> + std::enable_if_t<std::is_integral<U>::value, bool> operator>(const U& o) const + noexcept { + BOOST_ASSERT(data.size() > 0u); + BOOST_ASSERT(data.size() == 1 || data.back() > 0u); // no leading zeros allowed + return data.size() > 1 || safe_less()(o, data[0]); + } + + template <class U> + std::enable_if_t<std::is_integral<U>::value, bool> operator==(const U& o) const + noexcept { + BOOST_ASSERT(data.size() > 0u); + return data.size() == 1 && safe_equal()(data[0], o); + } + + template <class U> + std::enable_if_t<std::is_floating_point<U>::value, bool> operator<(const U& o) const + noexcept { + return operator double() < o; + } + template <class U> + std::enable_if_t<std::is_floating_point<U>::value, bool> operator>(const U& o) const + noexcept { + return operator double() > o; + } + template <class U> + std::enable_if_t<std::is_floating_point<U>::value, bool> operator==(const U& o) const + noexcept { + return operator double() == o; + } + + std::uint64_t& maybe_extend(std::size_t i) { + while (i >= data.size()) data.push_back(0); + return data[i]; + } + + static void add_remainder(std::uint64_t& d, const std::uint64_t o) noexcept { + BOOST_ASSERT(d > 0u); + // in decimal system it would look like this: + // 8 + 8 = 6 = 8 - (9 - 8) - 1 + // 9 + 1 = 0 = 9 - (9 - 1) - 1 + auto tmp = (std::numeric_limits<std::uint64_t>::max)(); + tmp -= o; + --d -= tmp; + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("data", data); + } + + std::vector<std::uint64_t, Allocator> data; +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/limits.hpp b/ThirdParty/boost/histogram/detail/limits.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9fcfe909aef2132e7d18f51f81a3cc11d80047e4 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/limits.hpp @@ -0,0 +1,50 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_LIMITS_HPP +#define BOOST_HISTOGRAM_DETAIL_LIMITS_HPP + +#include <limits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +constexpr T lowest() { + return std::numeric_limits<T>::lowest(); +} + +template <> +constexpr double lowest() { + return -std::numeric_limits<double>::infinity(); +} + +template <> +constexpr float lowest() { + return -std::numeric_limits<float>::infinity(); +} + +template <class T> +constexpr T highest() { + return (std::numeric_limits<T>::max)(); +} + +template <> +constexpr double highest() { + return std::numeric_limits<double>::infinity(); +} + +template <> +constexpr float highest() { + return std::numeric_limits<float>::infinity(); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/linearize.hpp b/ThirdParty/boost/histogram/detail/linearize.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1c8ba30ddf8901a5a616b08f7164e6d7e43ac131 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/linearize.hpp @@ -0,0 +1,111 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_LINEARIZE_HPP +#define BOOST_HISTOGRAM_DETAIL_LINEARIZE_HPP + +#include <boost/assert.hpp> +#include <boost/config.hpp> +#include <boost/histogram/axis/option.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/axis/variant.hpp> +#include <boost/histogram/detail/optional_index.hpp> +#include <boost/histogram/fwd.hpp> + +namespace boost { +namespace histogram { +namespace detail { + +// initial offset to out must be set +template <class Index, class Opts> +std::size_t linearize(Opts, Index& out, const std::size_t stride, + const axis::index_type size, const axis::index_type idx) { + constexpr bool u = Opts::test(axis::option::underflow); + constexpr bool o = Opts::test(axis::option::overflow); +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR + if +#else + if constexpr +#endif + (std::is_same<Index, std::size_t>::value || (u && o)) { + BOOST_ASSERT(idx >= (u ? -1 : 0)); + BOOST_ASSERT(idx < (o ? size + 1 : size)); + BOOST_ASSERT(idx >= 0 || static_cast<std::size_t>(-idx * stride) <= out); + out += idx * stride; + } else { + BOOST_ASSERT(idx >= -1); + BOOST_ASSERT(idx < size + 1); + if ((u || idx >= 0) && (o || idx < size)) + out += idx * stride; + else + out = invalid_index; + } + return size + u + o; +} + +template <class Index, class Axis, class Value> +std::size_t linearize(Index& out, const std::size_t stride, const Axis& ax, + const Value& v) { + // mask options to reduce no. of template instantiations + constexpr auto opts = axis::traits::get_options<Axis>{} & + (axis::option::underflow | axis::option::overflow); + return linearize(opts, out, stride, ax.size(), axis::traits::index(ax, v)); +} + +// initial offset of out must be zero +template <class Index, class Axis, class Value> +std::size_t linearize_growth(Index& out, axis::index_type& shift, + const std::size_t stride, Axis& a, const Value& v) { + axis::index_type idx; + std::tie(idx, shift) = axis::traits::update(a, v); + constexpr bool u = axis::traits::get_options<Axis>::test(axis::option::underflow); + if (u) ++idx; + if (std::is_same<Index, std::size_t>::value) { + BOOST_ASSERT(idx < axis::traits::extent(a)); + out += idx * stride; + } else { + if (0 <= idx && idx < axis::traits::extent(a)) + out += idx * stride; + else + out = invalid_index; + } + return axis::traits::extent(a); +} + +// initial offset of out must be zero +template <class A> +std::size_t linearize_index(optional_index& out, const std::size_t stride, const A& ax, + const axis::index_type idx) { + // cannot use get_options here, since A may be variant + const auto opt = axis::traits::options(ax); + const axis::index_type begin = opt & axis::option::underflow ? -1 : 0; + const axis::index_type end = opt & axis::option::overflow ? ax.size() + 1 : ax.size(); + const axis::index_type extent = end - begin; + // i may be arbitrarily out of range + if (begin <= idx && idx < end) + out += (idx - begin) * stride; + else + out = invalid_index; + return extent; +} + +template <class Index, class... Ts, class Value> +std::size_t linearize(Index& o, const std::size_t s, const axis::variant<Ts...>& a, + const Value& v) { + return axis::visit([&o, &s, &v](const auto& a) { return linearize(o, s, a, v); }, a); +} + +template <class Index, class... Ts, class Value> +std::size_t linearize_growth(Index& o, axis::index_type& sh, const std::size_t st, + axis::variant<Ts...>& a, const Value& v) { + return axis::visit([&](auto& a) { return linearize_growth(o, sh, st, a, v); }, a); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif // BOOST_HISTOGRAM_DETAIL_LINEARIZE_HPP diff --git a/ThirdParty/boost/histogram/detail/make_default.hpp b/ThirdParty/boost/histogram/detail/make_default.hpp new file mode 100644 index 0000000000000000000000000000000000000000..738bde6fb6ecc46618ed06c5c3edeb28a6fc4126 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/make_default.hpp @@ -0,0 +1,27 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_MAKE_DEFAULT_HPP +#define BOOST_HISTOGRAM_DETAIL_MAKE_DEFAULT_HPP + +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/static_if.hpp> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +auto make_default(const T& t) { + return static_if<has_allocator<T>>([](const auto& t) { return T(t.get_allocator()); }, + [](const auto&) { return T{}; }, t); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/mutex_base.hpp b/ThirdParty/boost/histogram/detail/mutex_base.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fac45b441153b7dfb45561f551bb859ac6a73b64 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/mutex_base.hpp @@ -0,0 +1,41 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_NOOP_MUTEX_HPP +#define BOOST_HISTOGRAM_DETAIL_NOOP_MUTEX_HPP + +#include <boost/core/empty_value.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/mp11/utility.hpp> // mp_if +#include <mutex> + +namespace boost { +namespace histogram { +namespace detail { + +struct null_mutex { + bool try_lock() noexcept { return true; } + void lock() noexcept {} + void unlock() noexcept {} +}; + +template <class Axes, class Storage, + class DetailMutex = mp11::mp_if_c<(Storage::has_threading_support && + detail::has_growing_axis<Axes>::value), + std::mutex, detail::null_mutex>> +struct mutex_base : empty_value<DetailMutex> { + mutex_base() = default; + // do not copy or move mutex + mutex_base(const mutex_base&) : empty_value<DetailMutex>() {} + // do not copy or move mutex + mutex_base& operator=(const mutex_base&) { return *this; } +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/non_member_container_access.hpp b/ThirdParty/boost/histogram/detail/non_member_container_access.hpp new file mode 100644 index 0000000000000000000000000000000000000000..729f7b3316110485af1be9a7c48327e726cf2cc6 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/non_member_container_access.hpp @@ -0,0 +1,70 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_NON_MEMBER_CONTAINER_ACCESS_HPP +#define BOOST_HISTOGRAM_DETAIL_NON_MEMBER_CONTAINER_ACCESS_HPP + +#if __cpp_lib_nonmember_container_access >= 201411 + +#include <iterator> + +namespace boost { +namespace histogram { +namespace detail { + +using std::data; +using std::size; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#else + +#include <initializer_list> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class C> +constexpr auto data(C& c) -> decltype(c.data()) { + return c.data(); +} + +template <class C> +constexpr auto data(const C& c) -> decltype(c.data()) { + return c.data(); +} + +template <class T, std::size_t N> +constexpr T* data(T (&array)[N]) noexcept { + return array; +} + +template <class E> +constexpr const E* data(std::initializer_list<E> il) noexcept { + return il.begin(); +} + +template <class C> +constexpr auto size(const C& c) -> decltype(c.size()) { + return c.size(); +} + +template <class T, std::size_t N> +constexpr std::size_t size(const T (&)[N]) noexcept { + return N; +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif + +#endif // BOOST_HISTOGRAM_DETAIL_NON_MEMBER_CONTAINER_ACCESS_HPP diff --git a/ThirdParty/boost/histogram/detail/operators.hpp b/ThirdParty/boost/histogram/detail/operators.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b781c495ad667539fde86727a35a7278b966a86d --- /dev/null +++ b/ThirdParty/boost/histogram/detail/operators.hpp @@ -0,0 +1,135 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_OPERATORS_HPP +#define BOOST_HISTOGRAM_DETAIL_OPERATORS_HPP + +#include <boost/histogram/detail/detect.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/utility.hpp> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T, class U> +using if_not_same_and_has_eq = + std::enable_if_t<(!std::is_same<T, U>::value && has_method_eq<T, U>::value), bool>; + +// totally_ordered is for types with a <= b == !(a > b) [floats with NaN violate this] +// Derived must implement <,== for symmetric form and <,>,== for non-symmetric. + +// partially_ordered is for types with a <= b == a < b || a == b [for floats with NaN] +// Derived must implement <,== for the symmetric form and <,>,== for non-symmetric. + +template <class T, class U> +struct mirrored { + friend bool operator<(const U& a, const T& b) noexcept { return b > a; } + friend bool operator>(const U& a, const T& b) noexcept { return b < a; } + friend bool operator==(const U& a, const T& b) noexcept { return b == a; } + friend bool operator<=(const U& a, const T& b) noexcept { return b >= a; } + friend bool operator>=(const U& a, const T& b) noexcept { return b <= a; } + friend bool operator!=(const U& a, const T& b) noexcept { return b != a; } +}; + +template <class T> +struct mirrored<T, void> { + template <class U> + friend if_not_same_and_has_eq<T, U> operator<(const U& a, const T& b) noexcept { + return b > a; + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator>(const U& a, const T& b) noexcept { + return b < a; + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator==(const U& a, const T& b) noexcept { + return b == a; + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator<=(const U& a, const T& b) noexcept { + return b >= a; + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator>=(const U& a, const T& b) noexcept { + return b <= a; + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator!=(const U& a, const T& b) noexcept { + return b != a; + } +}; + +template <class T> +struct mirrored<T, T> { + friend bool operator>(const T& a, const T& b) noexcept { return b.operator<(a); } +}; + +template <class T, class U> +struct equality { + friend bool operator!=(const T& a, const U& b) noexcept { return !a.operator==(b); } +}; + +template <class T> +struct equality<T, void> { + template <class U> + friend if_not_same_and_has_eq<T, U> operator!=(const T& a, const U& b) noexcept { + return !(a == b); + } +}; + +template <class T, class U> +struct totally_ordered_impl : equality<T, U>, mirrored<T, U> { + friend bool operator<=(const T& a, const U& b) noexcept { return !(a > b); } + friend bool operator>=(const T& a, const U& b) noexcept { return !(a < b); } +}; + +template <class T> +struct totally_ordered_impl<T, void> : equality<T, void>, mirrored<T, void> { + template <class U> + friend if_not_same_and_has_eq<T, U> operator<=(const T& a, const U& b) noexcept { + return !(a > b); + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator>=(const T& a, const U& b) noexcept { + return !(a < b); + } +}; + +template <class T, class... Ts> +using totally_ordered = mp11::mp_rename< + mp11::mp_product<totally_ordered_impl, mp11::mp_list<T>, mp11::mp_list<Ts...> >, + mp11::mp_inherit>; + +template <class T, class U> +struct partially_ordered_impl : equality<T, U>, mirrored<T, U> { + friend bool operator<=(const T& a, const U& b) noexcept { return a < b || a == b; } + friend bool operator>=(const T& a, const U& b) noexcept { return a > b || a == b; } +}; + +template <class T> +struct partially_ordered_impl<T, void> : equality<T, void>, mirrored<T, void> { + template <class U> + friend if_not_same_and_has_eq<T, U> operator<=(const T& a, const U& b) noexcept { + return a < b || a == b; + } + template <class U> + friend if_not_same_and_has_eq<T, U> operator>=(const T& a, const U& b) noexcept { + return a > b || a == b; + } +}; + +template <class T, class... Ts> +using partially_ordered = mp11::mp_rename< + mp11::mp_product<partially_ordered_impl, mp11::mp_list<T>, mp11::mp_list<Ts...> >, + mp11::mp_inherit>; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif // BOOST_HISTOGRAM_DETAIL_OPERATORS_HPP diff --git a/ThirdParty/boost/histogram/detail/optional_index.hpp b/ThirdParty/boost/histogram/detail/optional_index.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e64df653e69a373ce3a7673567f39e6e1f63f84c --- /dev/null +++ b/ThirdParty/boost/histogram/detail/optional_index.hpp @@ -0,0 +1,55 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_OPTIONAL_INDEX_HPP +#define BOOST_HISTOGRAM_DETAIL_OPTIONAL_INDEX_HPP + +#include <boost/assert.hpp> +#include <cstdint> + +namespace boost { +namespace histogram { +namespace detail { + +constexpr auto invalid_index = ~static_cast<std::size_t>(0); + +// integer with a persistent invalid state, similar to NaN +struct optional_index { + std::size_t value; + + optional_index& operator=(std::size_t x) noexcept { + value = x; + return *this; + } + + optional_index& operator+=(std::intptr_t x) noexcept { + BOOST_ASSERT(x >= 0 || static_cast<std::size_t>(-x) <= value); + if (value != invalid_index) { value += x; } + return *this; + } + + optional_index& operator+=(const optional_index& x) noexcept { + if (value != invalid_index) return operator+=(x.value); + value = invalid_index; + return *this; + } + + operator std::size_t() const noexcept { return value; } + + friend bool operator<=(std::size_t x, optional_index idx) noexcept { + return x <= idx.value; + } +}; + +constexpr inline bool is_valid(const std::size_t) noexcept { return true; } + +inline bool is_valid(const optional_index x) noexcept { return x.value != invalid_index; } + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/priority.hpp b/ThirdParty/boost/histogram/detail/priority.hpp new file mode 100644 index 0000000000000000000000000000000000000000..061f281e62aed76f9850036a5cc5f71362a4420d --- /dev/null +++ b/ThirdParty/boost/histogram/detail/priority.hpp @@ -0,0 +1,28 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_PRIORITY_HPP +#define BOOST_HISTOGRAM_DETAIL_PRIORITY_HPP + +#include <cstdint> + +namespace boost { +namespace histogram { +namespace detail { + +// priority is used to priorise ambiguous overloads + +template <std::size_t N> +struct priority : priority<(N - 1)> {}; + +template <> +struct priority<0> {}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/reduce_command.hpp b/ThirdParty/boost/histogram/detail/reduce_command.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a3262fe491be1ce32a48c8c26aa0e7c72dc08b5a --- /dev/null +++ b/ThirdParty/boost/histogram/detail/reduce_command.hpp @@ -0,0 +1,40 @@ +// Copyright 2020 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_REDUCE_COMMAND_HPP +#define BOOST_HISTOGRAM_DETAIL_REDUCE_COMMAND_HPP + +#include <boost/histogram/fwd.hpp> + +namespace boost { +namespace histogram { +namespace detail { + +struct reduce_command { + static constexpr unsigned unset = static_cast<unsigned>(-1); + unsigned iaxis; + enum class range_t : char { + none, + indices, + values, + } range = range_t::none; + union { + axis::index_type index; + double value; + } begin, end; + unsigned merge = 0; // default value indicates unset option + bool crop = false; + // for internal use by the reduce algorithm + bool is_ordered = true; + bool use_underflow_bin = true; + bool use_overflow_bin = true; +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/relaxed_equal.hpp b/ThirdParty/boost/histogram/detail/relaxed_equal.hpp new file mode 100644 index 0000000000000000000000000000000000000000..123a05a20b40b54ec75ebc91661cf67b25aa45d7 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/relaxed_equal.hpp @@ -0,0 +1,28 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_RELAXED_EQUAL_HPP +#define BOOST_HISTOGRAM_DETAIL_RELAXED_EQUAL_HPP + +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/static_if.hpp> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +constexpr bool relaxed_equal(const T& a, const T& b) noexcept { + return static_if<has_operator_equal<T>>( + [](const auto& a, const auto& b) { return a == b; }, + [](const auto&, const auto&) { return true; }, a, b); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/replace_type.hpp b/ThirdParty/boost/histogram/detail/replace_type.hpp new file mode 100644 index 0000000000000000000000000000000000000000..affe5b3d7b06f54b2d2e1670a75af0ee27abc043 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/replace_type.hpp @@ -0,0 +1,31 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_REPLACE_TYPE_HPP +#define BOOST_HISTOGRAM_DETAIL_REPLACE_TYPE_HPP + +#include <boost/core/use_default.hpp> +#include <string> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T, class From, class To> +using replace_type = std::conditional_t<std::is_same<T, From>::value, To, T>; + +template <class T, class Default> +using replace_default = replace_type<T, boost::use_default, Default>; + +template <class T> +using replace_cstring = replace_type<T, const char*, std::string>; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/safe_comparison.hpp b/ThirdParty/boost/histogram/detail/safe_comparison.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3ac793ba44bcd3e2d5118b653c321a4b21f748d2 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/safe_comparison.hpp @@ -0,0 +1,87 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_SAFE_COMPARISON_HPP +#define BOOST_HISTOGRAM_DETAIL_SAFE_COMPARISON_HPP + +#include <boost/mp11/utility.hpp> +#include <boost/type.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +auto make_unsigned(const T& t) noexcept { + static_assert(std::is_integral<T>::value, ""); + return static_cast<std::make_unsigned_t<T>>(t); +} + +template <class T> +using number_category = + mp11::mp_if<std::is_integral<T>, + mp11::mp_if<std::is_signed<T>, type<int>, type<unsigned>>, type<void>>; + +// version of std::equal_to<> which handles signed and unsigned integers correctly +struct safe_equal { + template <class T, class U> + bool operator()(const T& t, const U& u) const noexcept { + return impl(number_category<T>{}, number_category<U>{}, t, u); + } + + template <class C1, class C2, class T, class U> + bool impl(C1, C2, const T& t, const U& u) const noexcept { + return t == u; + } + + template <class T, class U> + bool impl(type<int>, type<unsigned>, const T& t, const U& u) const noexcept { + return t >= 0 && make_unsigned(t) == u; + } + + template <class T, class U> + bool impl(type<unsigned>, type<int>, const T& t, const U& u) const noexcept { + return impl(type<int>{}, type<unsigned>{}, u, t); + } +}; + +// version of std::less<> which handles signed and unsigned integers correctly +struct safe_less { + template <class T, class U> + bool operator()(const T& t, const U& u) const noexcept { + return impl(number_category<T>{}, number_category<U>{}, t, u); + } + + template <class C1, class C2, class T, class U> + bool impl(C1, C2, const T& t, const U& u) const noexcept { + return t < u; + } + + template <class T, class U> + bool impl(type<int>, type<unsigned>, const T& t, const U& u) const noexcept { + return t < 0 || make_unsigned(t) < u; + } + + template <class T, class U> + bool impl(type<unsigned>, type<int>, const T& t, const U& u) const noexcept { + return 0 < u && t < make_unsigned(u); + } +}; + +// version of std::greater<> which handles signed and unsigned integers correctly +struct safe_greater { + template <class T, class U> + bool operator()(const T& t, const U& u) const noexcept { + return safe_less()(u, t); + } +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/span.hpp b/ThirdParty/boost/histogram/detail/span.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c0e70c806626f38b0b7005c63ca4e9bc85075b4d --- /dev/null +++ b/ThirdParty/boost/histogram/detail/span.hpp @@ -0,0 +1,274 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_SPAN_HPP +#define BOOST_HISTOGRAM_DETAIL_SPAN_HPP + +#ifdef __has_include +#if __has_include(<version>) +#include <version> +#ifdef __cpp_lib_span +#if __cpp_lib_span >= 201902 +#define BOOST_HISTOGRAM_DETAIL_HAS_STD_SPAN +#endif +#endif +#endif +#endif + +#ifdef BOOST_HISTOGRAM_DETAIL_HAS_STD_SPAN + +#include <span> + +namespace boost { +namespace histogram { +namespace detail { +using std::span; +} // namespace detail +} // namespace histogram +} // namespace boost + +#else // C++17 span not available, so we use our implementation + +// to be replaced by boost::span + +#include <array> +#include <boost/assert.hpp> +#include <boost/histogram/detail/non_member_container_access.hpp> +#include <initializer_list> +#include <iterator> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +namespace dtl = ::boost::histogram::detail; + +static constexpr std::size_t dynamic_extent = ~static_cast<std::size_t>(0); + +template <class T, std::size_t N> +class span_base { +public: + constexpr T* data() noexcept { return begin_; } + constexpr const T* data() const noexcept { return begin_; } + constexpr std::size_t size() const noexcept { return N; } + +protected: + constexpr span_base(T* b, std::size_t s) noexcept : begin_(b) { BOOST_ASSERT(N == s); } + constexpr void set(T* b, std::size_t s) noexcept { + begin_ = b; + BOOST_ASSERT(N == s); + } + +private: + T* begin_; +}; + +template <class T> +class span_base<T, dynamic_extent> { +public: + constexpr T* data() noexcept { return begin_; } + constexpr const T* data() const noexcept { return begin_; } + constexpr std::size_t size() const noexcept { return size_; } + +protected: + constexpr span_base(T* b, std::size_t s) noexcept : begin_(b), size_(s) {} + + constexpr void set(T* b, std::size_t s) noexcept { + begin_ = b; + size_ = s; + } + +private: + T* begin_; + std::size_t size_; +}; + +template <class T, std::size_t Extent = dynamic_extent> +class span : public span_base<T, Extent> { + using base = span_base<T, Extent>; + +public: + using element_type = T; + using value_type = std::remove_cv_t<T>; + using index_type = std::size_t; + using difference_type = std::ptrdiff_t; + using pointer = T*; + using const_pointer = const T*; + using reference = T&; + using const_reference = const T&; + using iterator = pointer; + using const_iterator = const_pointer; + using reverse_iterator = std::reverse_iterator<iterator>; + using const_reverse_iterator = std::reverse_iterator<const_iterator>; + + static constexpr std::size_t extent = Extent; + + template <std::size_t _ = extent, + class = std::enable_if_t<(_ == 0 || _ == dynamic_extent)> > + constexpr span() noexcept : base(nullptr, 0) {} + + constexpr span(pointer first, pointer last) + : span(first, static_cast<std::size_t>(last - first)) { + BOOST_ASSERT(extent == dynamic_extent || + static_cast<difference_type>(extent) == (last - first)); + } + + constexpr span(pointer ptr, index_type count) : base(ptr, count) {} + + template <std::size_t N> + constexpr span(element_type (&arr)[N]) noexcept : span(dtl::data(arr), N) { + static_assert(extent == dynamic_extent || extent == N, "static sizes do not match"); + } + + template <std::size_t N, + class = std::enable_if_t<(extent == dynamic_extent || extent == N)> > + constexpr span(std::array<value_type, N>& arr) noexcept : span(dtl::data(arr), N) {} + + template <std::size_t N, + class = std::enable_if_t<(extent == dynamic_extent || extent == N)> > + constexpr span(const std::array<value_type, N>& arr) noexcept + : span(dtl::data(arr), N) {} + + template <class Container, class = std::enable_if_t<std::is_convertible< + decltype(dtl::size(std::declval<Container>()), + dtl::data(std::declval<Container>())), + pointer>::value> > + constexpr span(const Container& cont) : span(dtl::data(cont), dtl::size(cont)) {} + + template <class Container, class = std::enable_if_t<std::is_convertible< + decltype(dtl::size(std::declval<Container>()), + dtl::data(std::declval<Container>())), + pointer>::value> > + constexpr span(Container& cont) : span(dtl::data(cont), dtl::size(cont)) {} + + template <class U, std::size_t N, + class = std::enable_if_t<((extent == dynamic_extent || extent == N) && + std::is_convertible<U, element_type>::value)> > + constexpr span(const span<U, N>& s) noexcept : span(s.data(), s.size()) {} + + template <class U, std::size_t N, + class = std::enable_if_t<((extent == dynamic_extent || extent == N) && + std::is_convertible<U, element_type>::value)> > + constexpr span(span<U, N>& s) noexcept : span(s.data(), s.size()) {} + + constexpr span(const span& other) noexcept = default; + + constexpr iterator begin() { return base::data(); } + constexpr const_iterator begin() const { return base::data(); } + constexpr const_iterator cbegin() const { return base::data(); } + + constexpr iterator end() { return base::data() + base::size(); } + constexpr const_iterator end() const { return base::data() + base::size(); } + constexpr const_iterator cend() const { return base::data() + base::size(); } + + reverse_iterator rbegin() { return reverse_iterator(end()); } + const_reverse_iterator rbegin() const { return reverse_iterator(end()); } + const_reverse_iterator crbegin() { return reverse_iterator(end()); } + + reverse_iterator rend() { return reverse_iterator(begin()); } + const_reverse_iterator rend() const { return reverse_iterator(begin()); } + const_reverse_iterator crend() { return reverse_iterator(begin()); } + + constexpr reference front() { *base::data(); } + constexpr reference back() { *(base::data() + base::size() - 1); } + + constexpr reference operator[](index_type idx) const { return base::data()[idx]; } + + constexpr std::size_t size_bytes() const noexcept { + return base::size() * sizeof(element_type); + } + + constexpr bool empty() const noexcept { return base::size() == 0; } + + template <std::size_t Count> + constexpr span<element_type, Count> first() const { + BOOST_ASSERT(Count <= base::size()); + return span<element_type, Count>(base::data(), Count); + } + + constexpr span<element_type, dynamic_extent> first(std::size_t count) const { + BOOST_ASSERT(count <= base::size()); + return span<element_type, dynamic_extent>(base::data(), count); + } + + template <std::size_t Count> + constexpr span<element_type, Count> last() const { + BOOST_ASSERT(Count <= base::size()); + return span<element_type, Count>(base::data() + base::size() - Count, Count); + } + + constexpr span<element_type, dynamic_extent> last(std::size_t count) const { + BOOST_ASSERT(count <= base::size()); + return span<element_type, dynamic_extent>(base::data() + base::size() - count, count); + } + + template <std::size_t Offset, std::size_t Count = dynamic_extent> + constexpr span<element_type, + (Count != dynamic_extent + ? Count + : (extent != dynamic_extent ? extent - Offset : dynamic_extent))> + subspan() const { + BOOST_ASSERT(Offset <= base::size()); + constexpr std::size_t E = + (Count != dynamic_extent + ? Count + : (extent != dynamic_extent ? extent - Offset : dynamic_extent)); + BOOST_ASSERT(E == dynamic_extent || E <= base::size()); + return span<element_type, E>(base::data() + Offset, + Count == dynamic_extent ? base::size() - Offset : Count); + } + + constexpr span<element_type, dynamic_extent> subspan( + std::size_t offset, std::size_t count = dynamic_extent) const { + BOOST_ASSERT(offset <= base::size()); + const std::size_t s = count == dynamic_extent ? base::size() - offset : count; + BOOST_ASSERT(s <= base::size()); + return span<element_type, dynamic_extent>(base::data() + offset, s); + } +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif + +#include <boost/histogram/detail/non_member_container_access.hpp> +#include <utility> + +namespace boost { +namespace histogram { +namespace detail { + +namespace dtl = ::boost::histogram::detail; + +template <class T> +auto make_span(T* begin, T* end) { + return dtl::span<T>{begin, end}; +} + +template <class T> +auto make_span(T* begin, std::size_t size) { + return dtl::span<T>{begin, size}; +} + +template <class Container, class = decltype(dtl::size(std::declval<Container>()), + dtl::data(std::declval<Container>()))> +auto make_span(const Container& cont) { + return make_span(dtl::data(cont), dtl::size(cont)); +} + +template <class T, std::size_t N> +auto make_span(T (&arr)[N]) { + return dtl::span<T, N>(arr, N); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/static_if.hpp b/ThirdParty/boost/histogram/detail/static_if.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a7e8ba941576bb1a09b31d1368256410f86e27b2 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/static_if.hpp @@ -0,0 +1,47 @@ +// Copyright 2018-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_STATIC_IF_HPP +#define BOOST_HISTOGRAM_DETAIL_STATIC_IF_HPP + +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T, class F, class... Args> +constexpr decltype(auto) static_if_impl( + std::true_type, T&& t, F&&, + Args&&... args) noexcept(noexcept(std::declval<T>()(std::declval<Args>()...))) { + return std::forward<T>(t)(std::forward<Args>(args)...); +} + +template <class T, class F, class... Args> +constexpr decltype(auto) static_if_impl( + std::false_type, T&&, F&& f, + Args&&... args) noexcept(noexcept(std::declval<F>()(std::declval<Args>()...))) { + return std::forward<F>(f)(std::forward<Args>(args)...); +} + +template <bool B, class... Ts> +constexpr decltype(auto) static_if_c(Ts&&... ts) noexcept( + noexcept(static_if_impl(std::integral_constant<bool, B>{}, std::declval<Ts>()...))) { + return static_if_impl(std::integral_constant<bool, B>{}, std::forward<Ts>(ts)...); +} + +template <class Bool, class... Ts> +constexpr decltype(auto) static_if(Ts&&... ts) noexcept( + noexcept(static_if_impl(Bool{}, std::declval<Ts>()...))) { + return static_if_impl(Bool{}, std::forward<Ts>(ts)...); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/try_cast.hpp b/ThirdParty/boost/histogram/detail/try_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1e8a7d27015203341185863a65d48ae095a7fb1b --- /dev/null +++ b/ThirdParty/boost/histogram/detail/try_cast.hpp @@ -0,0 +1,49 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_TRY_CAST_HPP +#define BOOST_HISTOGRAM_DETAIL_TRY_CAST_HPP + +#include <boost/config.hpp> +#include <boost/core/demangle.hpp> +#include <boost/histogram/detail/type_name.hpp> +#include <boost/mp11/integral.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <string> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { +template <class T, class E, class U> +BOOST_NORETURN T try_cast_impl(mp11::mp_int<0>, U&&) { + BOOST_THROW_EXCEPTION(E("cannot cast " + type_name<T>() + " to " + type_name<U>())); +} + +template <class T, class E, class U> +T try_cast_impl(mp11::mp_int<1>, U&& u) noexcept { + return static_cast<T>(u); +} + +template <class T, class E, class U> +decltype(auto) try_cast_impl(mp11::mp_int<2>, U&& u) noexcept { + return std::forward<U>(u); +} + +// cast fails at runtime with exception E instead of compile-time, T must be a value +template <class T, class E, class U> +decltype(auto) try_cast(U&& u) noexcept(std::is_convertible<U, T>::value) { + return try_cast_impl<T, E>(mp11::mp_int<(std::is_convertible<U, T>::value + + std::is_same<T, std::decay_t<U>>::value)>{}, + std::forward<U>(u)); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/tuple_slice.hpp b/ThirdParty/boost/histogram/detail/tuple_slice.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a48a10598c1617e04f4ebc9ecb8efae1f04e8fbb --- /dev/null +++ b/ThirdParty/boost/histogram/detail/tuple_slice.hpp @@ -0,0 +1,34 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_TUPLE_SLICE_HPP +#define BOOST_HISTOGRAM_DETAIL_TUPLE_SLICE_HPP + +#include <boost/mp11/integer_sequence.hpp> +#include <tuple> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <std::size_t I, class T, std::size_t... K> +decltype(auto) tuple_slice_impl(T&& t, mp11::index_sequence<K...>) { + return std::forward_as_tuple(std::get<(I + K)>(std::forward<T>(t))...); +} + +template <std::size_t I, std::size_t N, class Tuple> +decltype(auto) tuple_slice(Tuple&& t) { + constexpr auto S = std::tuple_size<std::decay_t<Tuple>>::value; + static_assert(I + N <= S, "I, N must be a valid subset"); + return tuple_slice_impl<I>(std::forward<Tuple>(t), mp11::make_index_sequence<N>{}); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/type_name.hpp b/ThirdParty/boost/histogram/detail/type_name.hpp new file mode 100644 index 0000000000000000000000000000000000000000..bea8f88a626f2048aaf7eb5d2042077dd2e418ee --- /dev/null +++ b/ThirdParty/boost/histogram/detail/type_name.hpp @@ -0,0 +1,47 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_TYPE_NAME_HPP +#define BOOST_HISTOGRAM_DETAIL_TYPE_NAME_HPP + +#include <boost/core/typeinfo.hpp> +#include <boost/type.hpp> +#include <string> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +std::string type_name_impl(boost::type<T>) { + return boost::core::demangled_name(BOOST_CORE_TYPEID(T)); +} + +template <class T> +std::string type_name_impl(boost::type<const T>) { + return type_name_impl(boost::type<T>{}) + " const"; +} + +template <class T> +std::string type_name_impl(boost::type<T&>) { + return type_name_impl(boost::type<T>{}) + " &"; +} + +template <class T> +std::string type_name_impl(boost::type<T&&>) { + return type_name_impl(boost::type<T>{}) + " &&"; +} + +template <class T> +std::string type_name() { + return type_name_impl(boost::type<T>{}); +} + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/detail/variant_proxy.hpp b/ThirdParty/boost/histogram/detail/variant_proxy.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6103a59ba6834e370816d7a603a43b4c158431d1 --- /dev/null +++ b/ThirdParty/boost/histogram/detail/variant_proxy.hpp @@ -0,0 +1,67 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_DETAIL_VARIANT_PROXY_HPP +#define BOOST_HISTOGRAM_DETAIL_VARIANT_PROXY_HPP + +#include <boost/core/nvp.hpp> +#include <boost/histogram/axis/traits.hpp> // variant_access +#include <boost/histogram/detail/static_if.hpp> +#include <boost/mp11/algorithm.hpp> // mp_with_index, mp_find, mp_at +#include <boost/mp11/list.hpp> // mp_size +#include <boost/throw_exception.hpp> +#include <stdexcept> + +namespace boost { +namespace histogram { +namespace detail { + +// This is a workaround to remain backward compatible in the serialization format. The +// proxy uses only the public interface of axis::variant for serialization and works +// independently of the underlying variant implementation. +template <class Variant> +struct variant_proxy { + Variant& variant; + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + detail::static_if_c<Archive::is_loading::value>( + [this](auto& ar) { // loading + int which = 0; + ar >> make_nvp("which", which); + constexpr unsigned N = mp11::mp_size<Variant>::value; + if (which < 0 || static_cast<unsigned>(which) >= N) + // throw if which >= N, can happen if type was removed from variant + BOOST_THROW_EXCEPTION( + std::runtime_error("variant has fewer types than stored version")); + mp11::mp_with_index<N>(static_cast<unsigned>(which), [&ar, this](auto i) { + using T = mp11::mp_at_c<Variant, i>; + T value; + ar >> make_nvp("value", value); + this->variant = std::move(value); + T* new_address = variant_access::template get_if<T>(&this->variant); + ar.reset_object_address(new_address, &value); + }); + }, + [this](auto& ar) { // saving + visit( + [&ar](const auto& value) { + using T = std::decay_t<decltype(value)>; + const int which = static_cast<int>(mp11::mp_find<Variant, T>::value); + ar << make_nvp("which", which); + ar << make_nvp("value", value); + }, + this->variant); + }, + ar); + } +}; + +} // namespace detail +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/fwd.hpp b/ThirdParty/boost/histogram/fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..63e067dce6e07c01b0aaf2a15d4ecdcf07263834 --- /dev/null +++ b/ThirdParty/boost/histogram/fwd.hpp @@ -0,0 +1,151 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_FWD_HPP +#define BOOST_HISTOGRAM_FWD_HPP + +/** + \file boost/histogram/fwd.hpp + Forward declarations, tag types and type aliases. +*/ + +#include <boost/config.hpp> // BOOST_ATTRIBUTE_NODISCARD +#include <boost/core/use_default.hpp> +#include <vector> + +namespace boost { +namespace histogram { + +/// Tag type to indicate use of a default type +using boost::use_default; + +namespace axis { + +/// Integral type for axis indices +using index_type = int; + +/// Real type for axis indices +using real_index_type = double; + +/// Empty metadata type +struct null_type { + template <class Archive> + void serialize(Archive&, unsigned /* version */) {} +}; + +/// Another alias for an empty metadata type +using empty_type = null_type; + +// some forward declarations must be hidden from doxygen to fix the reference docu :( +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +namespace transform { + +struct id; + +struct log; + +struct sqrt; + +struct pow; + +} // namespace transform + +template <class Value = double, class Transform = use_default, + class MetaData = use_default, class Options = use_default> +class regular; + +template <class Value = int, class MetaData = use_default, class Options = use_default> +class integer; + +template <class Value = double, class MetaData = use_default, class Options = use_default, + class Allocator = std::allocator<Value>> +class variable; + +template <class Value = int, class MetaData = use_default, class Options = use_default, + class Allocator = std::allocator<Value>> +class category; + +template <class... Ts> +class variant; + +#endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED + +} // namespace axis + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +template <class T> +struct weight_type; + +template <class T> +struct sample_type; + +namespace accumulators { + +template <class ValueType = double> +class count; + +template <class ValueType = double> +class sum; + +template <class ValueType = double> +class weighted_sum; + +template <class ValueType = double> +class mean; + +template <class ValueType = double> +class weighted_mean; + +template <class T> +class thread_safe; + +template <class T> +struct is_thread_safe : std::false_type {}; +template <class T> +struct is_thread_safe<thread_safe<T>> : std::true_type {}; + +} // namespace accumulators + +struct unsafe_access; + +template <class Allocator = std::allocator<char>> +class unlimited_storage; + +template <class T> +class storage_adaptor; + +#endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED + +/// Vector-like storage for fast zero-overhead access to cells. +template <class T, class A = std::allocator<T>> +using dense_storage = storage_adaptor<std::vector<T, A>>; + +/// Default storage, optimized for unweighted histograms +using default_storage = unlimited_storage<>; + +/// Dense storage which tracks sums of weights and a variance estimate. +using weight_storage = dense_storage<accumulators::weighted_sum<>>; + +/// Dense storage which tracks means of samples in each cell. +using profile_storage = dense_storage<accumulators::mean<>>; + +/// Dense storage which tracks means of weighted samples in each cell. +using weighted_profile_storage = dense_storage<accumulators::weighted_mean<>>; + +// some forward declarations must be hidden from doxygen to fix the reference docu :( +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +template <class Axes, class Storage = default_storage> +class BOOST_ATTRIBUTE_NODISCARD histogram; + +#endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/histogram.hpp b/ThirdParty/boost/histogram/histogram.hpp new file mode 100644 index 0000000000000000000000000000000000000000..19b5c260d2bf99848316adb5d411ce87cb5a5b13 --- /dev/null +++ b/ThirdParty/boost/histogram/histogram.hpp @@ -0,0 +1,692 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_HISTOGRAM_HPP +#define BOOST_HISTOGRAM_HISTOGRAM_HPP + +#include <boost/histogram/detail/accumulator_traits.hpp> +#include <boost/histogram/detail/argument_traits.hpp> +#include <boost/histogram/detail/at.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/common_type.hpp> +#include <boost/histogram/detail/fill.hpp> +#include <boost/histogram/detail/fill_n.hpp> +#include <boost/histogram/detail/mutex_base.hpp> +#include <boost/histogram/detail/non_member_container_access.hpp> +#include <boost/histogram/detail/span.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/histogram/sample.hpp> +#include <boost/histogram/storage_adaptor.hpp> +#include <boost/histogram/unsafe_access.hpp> +#include <boost/histogram/weight.hpp> +#include <boost/mp11/integral.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/tuple.hpp> +#include <boost/throw_exception.hpp> +#include <mutex> +#include <stdexcept> +#include <tuple> +#include <type_traits> +#include <utility> +#include <vector> + +namespace boost { +namespace histogram { + +/** Central class of the histogram library. + + Histogram uses the call operator to insert data, like the + [Boost.Accumulators](https://www.boost.org/doc/libs/develop/doc/html/accumulators.html). + + Use factory functions (see + [make_histogram.hpp](histogram/reference.html#header.boost.histogram.make_histogram_hpp) + and + [make_profile.hpp](histogram/reference.html#header.boost.histogram.make_profile_hpp)) to + conveniently create histograms rather than calling the ctors directly. + + Use the [indexed](boost/histogram/indexed.html) range generator to iterate over filled + histograms, which is convenient and faster than hand-written loops for multi-dimensional + histograms. + + @tparam Axes std::tuple of axis types OR std::vector of an axis type or axis::variant + @tparam Storage class that implements the storage interface + */ +template <class Axes, class Storage> +class histogram : detail::mutex_base<Axes, Storage> { + static_assert(std::is_same<std::decay_t<Storage>, Storage>::value, + "Storage may not be a reference or const or volatile"); + static_assert(mp11::mp_size<Axes>::value > 0, "at least one axis required"); + +public: + using axes_type = Axes; + using storage_type = Storage; + using value_type = typename storage_type::value_type; + // typedefs for boost::range_iterator + using iterator = typename storage_type::iterator; + using const_iterator = typename storage_type::const_iterator; + +private: + using mutex_base = typename detail::mutex_base<axes_type, storage_type>; + +public: + histogram() = default; + + template <class A, class S> + explicit histogram(histogram<A, S>&& rhs) + : storage_(std::move(unsafe_access::storage(rhs))) + , offset_(unsafe_access::offset(rhs)) { + detail::axes_assign(axes_, std::move(unsafe_access::axes(rhs))); + detail::throw_if_axes_is_too_large(axes_); + } + + template <class A, class S> + explicit histogram(const histogram<A, S>& rhs) + : storage_(unsafe_access::storage(rhs)), offset_(unsafe_access::offset(rhs)) { + detail::axes_assign(axes_, unsafe_access::axes(rhs)); + detail::throw_if_axes_is_too_large(axes_); + } + + template <class A, class S> + histogram& operator=(histogram<A, S>&& rhs) { + detail::axes_assign(axes_, std::move(unsafe_access::axes(rhs))); + detail::throw_if_axes_is_too_large(axes_); + storage_ = std::move(unsafe_access::storage(rhs)); + offset_ = unsafe_access::offset(rhs); + return *this; + } + + template <class A, class S> + histogram& operator=(const histogram<A, S>& rhs) { + detail::axes_assign(axes_, unsafe_access::axes(rhs)); + detail::throw_if_axes_is_too_large(axes_); + storage_ = unsafe_access::storage(rhs); + offset_ = unsafe_access::offset(rhs); + return *this; + } + + template <class A, class = detail::requires_axes<A>> + histogram(A&& a, Storage s) + : axes_(std::forward<A>(a)) + , storage_(std::move(s)) + , offset_(detail::offset(axes_)) { + detail::throw_if_axes_is_too_large(axes_); + storage_.reset(detail::bincount(axes_)); + } + + explicit histogram(Axes axes) : histogram(axes, storage_type()) {} + + template <class... As, class = detail::requires_axes<std::tuple<std::decay_t<As>...>>> + explicit histogram(As&&... as) + : histogram(std::tuple<std::decay_t<As>...>(std::forward<As>(as)...), + storage_type()) {} + + /// Number of axes (dimensions). + constexpr unsigned rank() const noexcept { return detail::axes_rank(axes_); } + + /// Total number of bins (including underflow/overflow). + std::size_t size() const noexcept { return storage_.size(); } + + /// Reset all bins to default initialized values. + void reset() { storage_.reset(size()); } + + /// Get N-th axis using a compile-time number. + /// This version is more efficient than the one accepting a run-time number. + template <unsigned N = 0> + decltype(auto) axis(std::integral_constant<unsigned, N> = {}) const { + detail::axis_index_is_valid(axes_, N); + return detail::axis_get<N>(axes_); + } + + /// Get N-th axis with run-time number. + /// Prefer the version that accepts a compile-time number, if you can use it. + decltype(auto) axis(unsigned i) const { + detail::axis_index_is_valid(axes_, i); + return detail::axis_get(axes_, i); + } + + /// Apply unary functor/function to each axis. + template <class Unary> + auto for_each_axis(Unary&& unary) const { + return detail::for_each_axis(axes_, std::forward<Unary>(unary)); + } + + /** Fill histogram with values, an optional weight, and/or a sample. + + Returns iterator to located cell. + + Arguments are passed in order to the axis objects. Passing an argument type that is + not convertible to the value type accepted by the axis or passing the wrong number + of arguments causes a throw of `std::invalid_argument`. + + __Optional weight__ + + An optional weight can be passed as the first or last argument + with the [weight](boost/histogram/weight.html) helper function. Compilation fails if + the storage elements do not support weights. + + __Samples__ + + If the storage elements accept samples, pass them with the sample helper function + in addition to the axis arguments, which can be the first or last argument. The + [sample](boost/histogram/sample.html) helper function can pass one or more arguments + to the storage element. If samples and weights are used together, they can be passed + in any order at the beginning or end of the argument list. + + __Axis with multiple arguments__ + + If the histogram contains an axis which accepts a `std::tuple` of arguments, the + arguments for that axis need to be passed as a `std::tuple`, for example, + `std::make_tuple(1.2, 2.3)`. If the histogram contains only this axis and no other, + the arguments can be passed directly. + */ + template <class T0, class... Ts, + class = std::enable_if_t<(detail::is_tuple<T0>::value == false || + sizeof...(Ts) > 0)>> + iterator operator()(const T0& arg0, const Ts&... args) { + return operator()(std::forward_as_tuple(arg0, args...)); + } + + /// Fill histogram with values, an optional weight, and/or a sample from a `std::tuple`. + template <class... Ts> + iterator operator()(const std::tuple<Ts...>& args) { + using arg_traits = detail::argument_traits<std::decay_t<Ts>...>; + using acc_traits = detail::accumulator_traits<value_type>; + constexpr bool weight_valid = + arg_traits::wpos::value == -1 || acc_traits::weight_support; + static_assert(weight_valid, "error: accumulator does not support weights"); + detail::sample_args_passed_vs_expected<typename arg_traits::sargs, + typename acc_traits::args>(); + constexpr bool sample_valid = + std::is_convertible<typename arg_traits::sargs, typename acc_traits::args>::value; + std::lock_guard<typename mutex_base::type> guard{mutex_base::get()}; + return detail::fill(mp11::mp_bool<(weight_valid && sample_valid)>{}, arg_traits{}, + offset_, storage_, axes_, args); + } + + /** Fill histogram with several values at once. + + The argument must be an iterable with a size that matches the + rank of the histogram. The element of an iterable may be 1) a value or 2) an iterable + with contiguous storage over values or 3) a variant of 1) and 2). Sub-iterables must + have the same length. + + Values are passed to the corresponding histogram axis in order. If a single value is + passed together with an iterable of values, the single value is treated like an + iterable with matching length of copies of this value. + + If the histogram has only one axis, an iterable of values may be passed directly. + + @param args iterable as explained in the long description. + */ + template <class Iterable, class = detail::requires_iterable<Iterable>> + void fill(const Iterable& args) { + using acc_traits = detail::accumulator_traits<value_type>; + constexpr unsigned n_sample_args_expected = + std::tuple_size<typename acc_traits::args>::value; + static_assert(n_sample_args_expected == 0, + "sample argument is missing but required by accumulator"); + std::lock_guard<typename mutex_base::type> guard{mutex_base::get()}; + detail::fill_n(mp11::mp_bool<(n_sample_args_expected == 0)>{}, offset_, storage_, + axes_, detail::make_span(args)); + } + + /** Fill histogram with several values and weights at once. + + @param args iterable of values. + @param weights single weight or an iterable of weights. + */ + template <class Iterable, class T, class = detail::requires_iterable<Iterable>> + void fill(const Iterable& args, const weight_type<T>& weights) { + using acc_traits = detail::accumulator_traits<value_type>; + constexpr bool weight_valid = acc_traits::weight_support; + static_assert(weight_valid, "error: accumulator does not support weights"); + detail::sample_args_passed_vs_expected<std::tuple<>, typename acc_traits::args>(); + constexpr bool sample_valid = + std::is_convertible<std::tuple<>, typename acc_traits::args>::value; + std::lock_guard<typename mutex_base::type> guard{mutex_base::get()}; + detail::fill_n(mp11::mp_bool<(weight_valid && sample_valid)>{}, offset_, storage_, + axes_, detail::make_span(args), + weight(detail::to_ptr_size(weights.value))); + } + + /** Fill histogram with several values and weights at once. + + @param weights single weight or an iterable of weights. + @param args iterable of values. + */ + template <class Iterable, class T, class = detail::requires_iterable<Iterable>> + void fill(const weight_type<T>& weights, const Iterable& args) { + fill(args, weights); + } + + /** Fill histogram with several values and samples at once. + + @param args iterable of values. + @param samples single sample or an iterable of samples. + */ + template <class Iterable, class... Ts, class = detail::requires_iterable<Iterable>> + void fill(const Iterable& args, const sample_type<std::tuple<Ts...>>& samples) { + using acc_traits = detail::accumulator_traits<value_type>; + using sample_args_passed = + std::tuple<decltype(*detail::to_ptr_size(std::declval<Ts>()).first)...>; + detail::sample_args_passed_vs_expected<sample_args_passed, + typename acc_traits::args>(); + std::lock_guard<typename mutex_base::type> guard{mutex_base::get()}; + mp11::tuple_apply( + [&](const auto&... sargs) { + constexpr bool sample_valid = + std::is_convertible<sample_args_passed, typename acc_traits::args>::value; + detail::fill_n(mp11::mp_bool<(sample_valid)>{}, offset_, storage_, axes_, + detail::make_span(args), detail::to_ptr_size(sargs)...); + }, + samples.value); + } + + /** Fill histogram with several values and samples at once. + + @param samples single sample or an iterable of samples. + @param args iterable of values. + */ + template <class Iterable, class T, class = detail::requires_iterable<Iterable>> + void fill(const sample_type<T>& samples, const Iterable& args) { + fill(args, samples); + } + + template <class Iterable, class T, class... Ts, + class = detail::requires_iterable<Iterable>> + void fill(const Iterable& args, const weight_type<T>& weights, + const sample_type<std::tuple<Ts...>>& samples) { + using acc_traits = detail::accumulator_traits<value_type>; + using sample_args_passed = + std::tuple<decltype(*detail::to_ptr_size(std::declval<Ts>()).first)...>; + detail::sample_args_passed_vs_expected<sample_args_passed, + typename acc_traits::args>(); + std::lock_guard<typename mutex_base::type> guard{mutex_base::get()}; + mp11::tuple_apply( + [&](const auto&... sargs) { + constexpr bool weight_valid = acc_traits::weight_support; + static_assert(weight_valid, "error: accumulator does not support weights"); + constexpr bool sample_valid = + std::is_convertible<sample_args_passed, typename acc_traits::args>::value; + detail::fill_n(mp11::mp_bool<(weight_valid && sample_valid)>{}, offset_, + storage_, axes_, detail::make_span(args), + weight(detail::to_ptr_size(weights.value)), + detail::to_ptr_size(sargs)...); + }, + samples.value); + } + + template <class Iterable, class T, class U, class = detail::requires_iterable<Iterable>> + void fill(const sample_type<T>& samples, const weight_type<U>& weights, + const Iterable& args) { + fill(args, weights, samples); + } + + template <class Iterable, class T, class U, class = detail::requires_iterable<Iterable>> + void fill(const weight_type<T>& weights, const sample_type<U>& samples, + const Iterable& args) { + fill(args, weights, samples); + } + + template <class Iterable, class T, class U, class = detail::requires_iterable<Iterable>> + void fill(const Iterable& args, const sample_type<T>& samples, + const weight_type<U>& weights) { + fill(args, weights, samples); + } + + /** Access cell value at integral indices. + + You can pass indices as individual arguments, as a std::tuple of integers, or as an + interable range of integers. Passing the wrong number of arguments causes a throw of + std::invalid_argument. Passing an index which is out of bounds causes a throw of + std::out_of_range. + + @param i index of first axis. + @param is indices of second, third, ... axes. + @returns reference to cell value. + */ + template <class... Indices> + decltype(auto) at(axis::index_type i, Indices... is) { + return at(std::forward_as_tuple(i, is...)); + } + + /// Access cell value at integral indices (read-only). + template <class... Indices> + decltype(auto) at(axis::index_type i, Indices... is) const { + return at(std::forward_as_tuple(i, is...)); + } + + /// Access cell value at integral indices stored in `std::tuple`. + template <class... Indices> + decltype(auto) at(const std::tuple<Indices...>& is) { + if (rank() != sizeof...(Indices)) + BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments != histogram rank")); + const auto idx = detail::at(axes_, is); + if (!is_valid(idx)) + BOOST_THROW_EXCEPTION(std::out_of_range("at least one index out of bounds")); + BOOST_ASSERT(idx < storage_.size()); + return storage_[idx]; + } + + /// Access cell value at integral indices stored in `std::tuple` (read-only). + template <class... Indices> + decltype(auto) at(const std::tuple<Indices...>& is) const { + if (rank() != sizeof...(Indices)) + BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments != histogram rank")); + const auto idx = detail::at(axes_, is); + if (!is_valid(idx)) + BOOST_THROW_EXCEPTION(std::out_of_range("at least one index out of bounds")); + BOOST_ASSERT(idx < storage_.size()); + return storage_[idx]; + } + + /// Access cell value at integral indices stored in iterable. + template <class Iterable, class = detail::requires_iterable<Iterable>> + decltype(auto) at(const Iterable& is) { + if (rank() != detail::axes_rank(is)) + BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments != histogram rank")); + const auto idx = detail::at(axes_, is); + if (!is_valid(idx)) + BOOST_THROW_EXCEPTION(std::out_of_range("at least one index out of bounds")); + BOOST_ASSERT(idx < storage_.size()); + return storage_[idx]; + } + + /// Access cell value at integral indices stored in iterable (read-only). + template <class Iterable, class = detail::requires_iterable<Iterable>> + decltype(auto) at(const Iterable& is) const { + if (rank() != detail::axes_rank(is)) + BOOST_THROW_EXCEPTION( + std::invalid_argument("number of arguments != histogram rank")); + const auto idx = detail::at(axes_, is); + if (!is_valid(idx)) + BOOST_THROW_EXCEPTION(std::out_of_range("at least one index out of bounds")); + BOOST_ASSERT(idx < storage_.size()); + return storage_[idx]; + } + + /// Access value at index (number for rank = 1, else `std::tuple` or iterable). + template <class Indices> + decltype(auto) operator[](const Indices& is) { + return at(is); + } + + /// Access value at index (read-only). + template <class Indices> + decltype(auto) operator[](const Indices& is) const { + return at(is); + } + + /// Equality operator, tests equality for all axes and the storage. + template <class A, class S> + bool operator==(const histogram<A, S>& rhs) const noexcept { + // testing offset is redundant, but offers fast return if it fails + return offset_ == unsafe_access::offset(rhs) && + detail::axes_equal(axes_, unsafe_access::axes(rhs)) && + storage_ == unsafe_access::storage(rhs); + } + + /// Negation of the equality operator. + template <class A, class S> + bool operator!=(const histogram<A, S>& rhs) const noexcept { + return !operator==(rhs); + } + + /** Add values of another histogram. + + This operator is only available if the value_type supports operator+=. + */ + template <class A, class S> +#ifdef BOOST_HISTOGRAM_DOXYGEN_INVOKED + histogram& +#else + std::enable_if_t< + detail::has_operator_radd<value_type, typename histogram<A, S>::value_type>::value, + histogram&> +#endif + operator+=(const histogram<A, S>& rhs) { + if (!detail::axes_equal(axes_, unsafe_access::axes(rhs))) + BOOST_THROW_EXCEPTION(std::invalid_argument("axes of histograms differ")); + auto rit = unsafe_access::storage(rhs).begin(); + for (auto&& x : storage_) x += *rit++; + return *this; + } + + /** Subtract values of another histogram. + + This operator is only available if the value_type supports operator-=. + */ + template <class A, class S> +#ifdef BOOST_HISTOGRAM_DOXYGEN_INVOKED + histogram& +#else + std::enable_if_t< + detail::has_operator_rsub<value_type, typename histogram<A, S>::value_type>::value, + histogram&> +#endif + operator-=(const histogram<A, S>& rhs) { + if (!detail::axes_equal(axes_, unsafe_access::axes(rhs))) + BOOST_THROW_EXCEPTION(std::invalid_argument("axes of histograms differ")); + auto rit = unsafe_access::storage(rhs).begin(); + for (auto&& x : storage_) x -= *rit++; + return *this; + } + + /** Multiply by values of another histogram. + + This operator is only available if the value_type supports operator*=. + */ + template <class A, class S> +#ifdef BOOST_HISTOGRAM_DOXYGEN_INVOKED + histogram& +#else + std::enable_if_t< + detail::has_operator_rmul<value_type, typename histogram<A, S>::value_type>::value, + histogram&> +#endif + operator*=(const histogram<A, S>& rhs) { + if (!detail::axes_equal(axes_, unsafe_access::axes(rhs))) + BOOST_THROW_EXCEPTION(std::invalid_argument("axes of histograms differ")); + auto rit = unsafe_access::storage(rhs).begin(); + for (auto&& x : storage_) x *= *rit++; + return *this; + } + + /** Divide by values of another histogram. + + This operator is only available if the value_type supports operator/=. + */ + template <class A, class S> +#ifdef BOOST_HISTOGRAM_DOXYGEN_INVOKED + histogram& +#else + std::enable_if_t< + detail::has_operator_rdiv<value_type, typename histogram<A, S>::value_type>::value, + histogram&> +#endif + operator/=(const histogram<A, S>& rhs) { + if (!detail::axes_equal(axes_, unsafe_access::axes(rhs))) + BOOST_THROW_EXCEPTION(std::invalid_argument("axes of histograms differ")); + auto rit = unsafe_access::storage(rhs).begin(); + for (auto&& x : storage_) x /= *rit++; + return *this; + } + + /** Multiply all values with a scalar. + + This operator is only available if the value_type supports operator*=. + */ +#ifdef BOOST_HISTOGRAM_DOXYGEN_INVOKED + histogram& +#else + template <class V = value_type> + std::enable_if_t<(detail::has_operator_rmul<V, double>::value), histogram&> +#endif + operator*=(const double x) { + // use special storage implementation of scaling if available, + // else fallback to scaling item by item + detail::static_if<detail::has_operator_rmul<storage_type, double>>( + [x](auto& s) { s *= x; }, + [x](auto& s) { + for (auto&& si : s) si *= x; + }, + storage_); + return *this; + } + + /** Divide all values by a scalar. + + This operator is only available if operator*= is available. + */ +#ifdef BOOST_HISTOGRAM_DOXYGEN_INVOKED + histogram& +#else + template <class H = histogram> + std::enable_if_t<(detail::has_operator_rmul<H, double>::value), histogram&> +#endif + operator/=(const double x) { + return operator*=(1.0 / x); + } + + /// Return value iterator to the beginning of the histogram. + iterator begin() noexcept { return storage_.begin(); } + + /// Return value iterator to the end in the histogram. + iterator end() noexcept { return storage_.end(); } + + /// Return value iterator to the beginning of the histogram (read-only). + const_iterator begin() const noexcept { return storage_.begin(); } + + /// Return value iterator to the end in the histogram (read-only). + const_iterator end() const noexcept { return storage_.end(); } + + /// Return value iterator to the beginning of the histogram (read-only). + const_iterator cbegin() const noexcept { return begin(); } + + /// Return value iterator to the end in the histogram (read-only). + const_iterator cend() const noexcept { return end(); } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + detail::axes_serialize(ar, axes_); + ar& make_nvp("storage", storage_); + if (Archive::is_loading::value) { + offset_ = detail::offset(axes_); + detail::throw_if_axes_is_too_large(axes_); + } + } + +private: + axes_type axes_; + storage_type storage_; + std::size_t offset_ = 0; + + friend struct unsafe_access; +}; + +/** + Pairwise add cells of two histograms and return histogram with the sum. + + The returned histogram type is the most efficient and safest one constructible from the + inputs, if they are not the same type. If one histogram has a tuple axis, the result has + a tuple axis. The chosen storage is the one with the larger dynamic range. +*/ +template <class A1, class S1, class A2, class S2> +auto operator+(const histogram<A1, S1>& a, const histogram<A2, S2>& b) { + auto r = histogram<detail::common_axes<A1, A2>, detail::common_storage<S1, S2>>(a); + return r += b; +} + +/** Pairwise multiply cells of two histograms and return histogram with the product. + + For notes on the returned histogram type, see operator+. +*/ +template <class A1, class S1, class A2, class S2> +auto operator*(const histogram<A1, S1>& a, const histogram<A2, S2>& b) { + auto r = histogram<detail::common_axes<A1, A2>, detail::common_storage<S1, S2>>(a); + return r *= b; +} + +/** Pairwise subtract cells of two histograms and return histogram with the difference. + + For notes on the returned histogram type, see operator+. +*/ +template <class A1, class S1, class A2, class S2> +auto operator-(const histogram<A1, S1>& a, const histogram<A2, S2>& b) { + auto r = histogram<detail::common_axes<A1, A2>, detail::common_storage<S1, S2>>(a); + return r -= b; +} + +/** Pairwise divide cells of two histograms and return histogram with the quotient. + + For notes on the returned histogram type, see operator+. +*/ +template <class A1, class S1, class A2, class S2> +auto operator/(const histogram<A1, S1>& a, const histogram<A2, S2>& b) { + auto r = histogram<detail::common_axes<A1, A2>, detail::common_storage<S1, S2>>(a); + return r /= b; +} + +/** Multiply all cells of the histogram by a number and return a new histogram. + + If the original histogram has integer cells, the result has double cells. +*/ +template <class A, class S> +auto operator*(const histogram<A, S>& h, double x) { + auto r = histogram<A, detail::common_storage<S, dense_storage<double>>>(h); + return r *= x; +} + +/** Multiply all cells of the histogram by a number and return a new histogram. + + If the original histogram has integer cells, the result has double cells. +*/ +template <class A, class S> +auto operator*(double x, const histogram<A, S>& h) { + return h * x; +} + +/** Divide all cells of the histogram by a number and return a new histogram. + + If the original histogram has integer cells, the result has double cells. +*/ +template <class A, class S> +auto operator/(const histogram<A, S>& h, double x) { + return h * (1.0 / x); +} + +#if __cpp_deduction_guides >= 201606 + +template <class... Axes, class = detail::requires_axes<std::tuple<std::decay_t<Axes>...>>> +histogram(Axes...)->histogram<std::tuple<std::decay_t<Axes>...>>; + +template <class... Axes, class S, class = detail::requires_storage_or_adaptible<S>> +histogram(std::tuple<Axes...>, S) + ->histogram<std::tuple<Axes...>, std::conditional_t<detail::is_adaptible<S>::value, + storage_adaptor<S>, S>>; + +template <class Iterable, class = detail::requires_iterable<Iterable>, + class = detail::requires_any_axis<typename Iterable::value_type>> +histogram(Iterable)->histogram<std::vector<typename Iterable::value_type>>; + +template <class Iterable, class S, class = detail::requires_iterable<Iterable>, + class = detail::requires_any_axis<typename Iterable::value_type>, + class = detail::requires_storage_or_adaptible<S>> +histogram(Iterable, S) + ->histogram< + std::vector<typename Iterable::value_type>, + std::conditional_t<detail::is_adaptible<S>::value, storage_adaptor<S>, S>>; + +#endif + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/indexed.hpp b/ThirdParty/boost/histogram/indexed.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5d95b616ad0fc847c3537f829931dd2df04ae64b --- /dev/null +++ b/ThirdParty/boost/histogram/indexed.hpp @@ -0,0 +1,372 @@ +// Copyright 2015-2016 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_INDEXED_HPP +#define BOOST_HISTOGRAM_INDEXED_HPP + +#include <array> +#include <boost/config.hpp> +#include <boost/histogram/axis/traits.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/iterator_adaptor.hpp> +#include <boost/histogram/detail/operators.hpp> +#include <boost/histogram/fwd.hpp> +#include <iterator> +#include <type_traits> +#include <utility> + +namespace boost { +namespace histogram { + +/** Coverage mode of the indexed range generator. + + Defines options for the iteration strategy. +*/ +enum class coverage { + inner, /*!< iterate over inner bins, exclude underflow and overflow */ + all, /*!< iterate over all bins, including underflow and overflow */ +}; + +/** Input iterator range over histogram bins with multi-dimensional index. + + The iterator returned by begin() can only be incremented. begin() may only be called + once, calling it a second time returns the end() iterator. If several copies of the + input iterators exist, the other copies become invalid if one of them is incremented. +*/ +template <class Histogram> +class BOOST_ATTRIBUTE_NODISCARD indexed_range { +private: + using histogram_type = Histogram; + static constexpr std::size_t buffer_size = + detail::buffer_size<typename std::remove_const_t<histogram_type>::axes_type>::value; + +public: + using value_iterator = std::conditional_t<std::is_const<histogram_type>::value, + typename histogram_type::const_iterator, + typename histogram_type::iterator>; + using value_reference = typename std::iterator_traits<value_iterator>::reference; + using value_type = typename std::iterator_traits<value_iterator>::value_type; + + class iterator; + using range_iterator [[deprecated("use iterator instead")]] = iterator; ///< deprecated + + /** Lightweight view to access value and index of current cell. + + The methods provide access to the current cell indices and bins. It acts like a + pointer to the cell value, and in a limited way also like a reference. To interoperate + with the algorithms of the standard library, the accessor is implicitly convertible to + a cell value. Assignments and comparisons are passed through to the cell. An accessor + is coupled to its parent indexed_range::iterator. Moving the parent iterator + forward also updates the linked accessor. Accessors are not copyable. They cannot be + stored in containers, but indexed_range::iterator can be stored. + */ + class BOOST_ATTRIBUTE_NODISCARD accessor : detail::mirrored<accessor, void> { + public: + /// Array-like view into the current multi-dimensional index. + class index_view { + using index_pointer = const typename iterator::index_data*; + + public: + using const_reference = const axis::index_type&; + using reference [[deprecated("use const_reference instead")]] = + const_reference; ///< deprecated + + /// implementation detail + class const_iterator + : public detail::iterator_adaptor<const_iterator, index_pointer, + const_reference> { + public: + const_reference operator*() const noexcept { return const_iterator::base()->idx; } + + private: + explicit const_iterator(index_pointer i) noexcept + : const_iterator::iterator_adaptor_(i) {} + + friend class index_view; + }; + + const_iterator begin() const noexcept { return const_iterator{begin_}; } + const_iterator end() const noexcept { return const_iterator{end_}; } + std::size_t size() const noexcept { + return static_cast<std::size_t>(end_ - begin_); + } + const_reference operator[](unsigned d) const noexcept { return begin_[d].idx; } + const_reference at(unsigned d) const { return begin_[d].idx; } + + private: + /// implementation detail + index_view(index_pointer b, index_pointer e) : begin_(b), end_(e) {} + + index_pointer begin_, end_; + friend class accessor; + }; + + // assignment is pass-through + accessor& operator=(const accessor& o) { + get() = o.get(); + return *this; + } + + // assignment is pass-through + template <class T> + accessor& operator=(const T& x) { + get() = x; + return *this; + } + + /// Returns the cell reference. + value_reference get() const noexcept { return *(iter_.iter_); } + /// @copydoc get() + value_reference operator*() const noexcept { return get(); } + /// Access fields and methods of the cell object. + value_iterator operator->() const noexcept { return iter_.iter_; } + + /// Access current index. + /// @param d axis dimension. + axis::index_type index(unsigned d = 0) const noexcept { + return iter_.indices_[d].idx; + } + + /// Access indices as an iterable range. + index_view indices() const noexcept { + BOOST_ASSERT(iter_.indices_.hist_); + return {iter_.indices_.begin(), iter_.indices_.end()}; + } + + /// Access current bin. + /// @tparam N axis dimension. + template <unsigned N = 0> + decltype(auto) bin(std::integral_constant<unsigned, N> = {}) const { + BOOST_ASSERT(iter_.indices_.hist_); + return iter_.indices_.hist_->axis(std::integral_constant<unsigned, N>()) + .bin(index(N)); + } + + /// Access current bin. + /// @param d axis dimension. + decltype(auto) bin(unsigned d) const { + BOOST_ASSERT(iter_.indices_.hist_); + return iter_.indices_.hist_->axis(d).bin(index(d)); + } + + /** Computes density in current cell. + + The density is computed as the cell value divided by the product of bin widths. Axes + without bin widths, like axis::category, are treated as having unit bin with. + */ + double density() const { + BOOST_ASSERT(iter_.indices_.hist_); + double x = 1; + unsigned d = 0; + iter_.indices_.hist_->for_each_axis([&](const auto& a) { + const auto w = axis::traits::width_as<double>(a, this->index(d++)); + x *= w ? w : 1; + }); + return get() / x; + } + + // forward all comparison operators to the value + bool operator<(const accessor& o) noexcept { return get() < o.get(); } + bool operator>(const accessor& o) noexcept { return get() > o.get(); } + bool operator==(const accessor& o) noexcept { return get() == o.get(); } + bool operator!=(const accessor& o) noexcept { return get() != o.get(); } + bool operator<=(const accessor& o) noexcept { return get() <= o.get(); } + bool operator>=(const accessor& o) noexcept { return get() >= o.get(); } + + template <class U> + bool operator<(const U& o) const noexcept { + return get() < o; + } + + template <class U> + bool operator>(const U& o) const noexcept { + return get() > o; + } + + template <class U> + bool operator==(const U& o) const noexcept { + return get() == o; + } + + template <class U> + bool operator!=(const U& o) const noexcept { + return get() != o; + } + + template <class U> + bool operator<=(const U& o) const noexcept { + return get() <= o; + } + + template <class U> + bool operator>=(const U& o) const noexcept { + return get() >= o; + } + + operator value_type() const noexcept { return get(); } + + private: + accessor(iterator& i) noexcept : iter_(i) {} + + accessor(const accessor&) = default; // only callable by indexed_range::iterator + + iterator& iter_; + + friend class iterator; + }; + + /// implementation detail + class iterator { + public: + using value_type = typename indexed_range::value_type; + using reference = accessor; + + private: + struct pointer_proxy { + reference* operator->() noexcept { return std::addressof(ref_); } + reference ref_; + }; + + public: + using pointer = pointer_proxy; + using difference_type = std::ptrdiff_t; + using iterator_category = std::forward_iterator_tag; + + reference operator*() noexcept { return *this; } + pointer operator->() noexcept { return pointer_proxy{operator*()}; } + + iterator& operator++() { + BOOST_ASSERT(iter_ < indices_.hist_->end()); + const auto cbeg = indices_.begin(); + auto c = cbeg; + ++iter_; + ++c->idx; + if (c->idx < c->end) return *this; + while (c->idx == c->end) { + iter_ += c->end_skip; + if (++c == indices_.end()) return *this; + ++c->idx; + } + while (c-- != cbeg) { + c->idx = c->begin; + iter_ += c->begin_skip; + } + return *this; + } + + iterator operator++(int) { + auto prev = *this; + operator++(); + return prev; + } + + bool operator==(const iterator& x) const noexcept { return iter_ == x.iter_; } + bool operator!=(const iterator& x) const noexcept { return !operator==(x); } + + // make iterator ready for C++17 sentinels + bool operator==(const value_iterator& x) const noexcept { return iter_ == x; } + bool operator!=(const value_iterator& x) const noexcept { return !operator==(x); } + + // useful for iterator debugging + std::size_t offset() const noexcept { return iter_ - indices_.hist_->begin(); } + + private: + iterator(value_iterator i, histogram_type& h) : iter_(i), indices_(&h) {} + + value_iterator iter_; + + struct index_data { + axis::index_type idx, begin, end; + std::size_t begin_skip, end_skip; + }; + + struct indices_t : private std::array<index_data, buffer_size> { + using base_type = std::array<index_data, buffer_size>; + using pointer = index_data*; + using const_pointer = const index_data*; + + indices_t(histogram_type* h) noexcept : hist_{h} {} + + using base_type::operator[]; + unsigned size() const noexcept { return hist_->rank(); } + pointer begin() noexcept { return base_type::data(); } + const_pointer begin() const noexcept { return base_type::data(); } + pointer end() noexcept { return begin() + size(); } + const_pointer end() const noexcept { return begin() + size(); } + + histogram_type* hist_; + } indices_; + + friend class indexed_range; + }; + + indexed_range(histogram_type& hist, coverage cov) + : begin_(hist.begin(), hist), end_(hist.end(), hist) { + begin_.indices_.hist_->for_each_axis([ca = begin_.indices_.begin(), cov, + stride = std::size_t{1}, + this](const auto& a) mutable { + using opt = axis::traits::get_options<std::decay_t<decltype(a)>>; + constexpr axis::index_type under = opt::test(axis::option::underflow); + constexpr axis::index_type over = opt::test(axis::option::overflow); + const auto size = a.size(); + + // -1 if underflow and cover all, else 0 + ca->begin = cov == coverage::all ? -under : 0; + // size + 1 if overflow and cover all, else size + ca->end = cov == coverage::all ? size + over : size; + ca->idx = ca->begin; + + // if axis has *flow and coverage::all OR axis has no *flow: + // begin + under == 0, size + over - end == 0 + // if axis has *flow and coverage::inner: + // begin + under == 1, size + over - end == 1 + ca->begin_skip = static_cast<std::size_t>(ca->begin + under) * stride; + ca->end_skip = static_cast<std::size_t>(size + over - ca->end) * stride; + begin_.iter_ += ca->begin_skip; + + stride *= size + under + over; + ++ca; + }); + } + + iterator begin() noexcept { return begin_; } + iterator end() noexcept { return end_; } + +private: + iterator begin_, end_; +}; + +/** Generates an indexed range of <a + href="https://en.cppreference.com/w/cpp/named_req/ForwardIterator">forward iterators</a> + over the histogram cells. + + Use this in a range-based for loop: + + ``` + for (auto&& x : indexed(hist)) { ... } + ``` + + This generates an optimized loop which is nearly always faster than a hand-written loop + over the histogram cells. The iterators dereference to an indexed_range::accessor, which + has methods to query the current indices and bins and acts like a pointer to the cell + value. The returned iterators are forward iterators. They can be stored in a container, + but may not be used after the life-time of the histogram ends. + + @returns indexed_range + + @param hist Reference to the histogram. + @param cov Iterate over all or only inner bins (optional, default: inner). + */ +template <class Histogram> +auto indexed(Histogram&& hist, coverage cov = coverage::inner) { + return indexed_range<std::remove_reference_t<Histogram>>{std::forward<Histogram>(hist), + cov}; +} + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/literals.hpp b/ThirdParty/boost/histogram/literals.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b5d45967956f08c746f43fcf01d19fa5fc5bd288 --- /dev/null +++ b/ThirdParty/boost/histogram/literals.hpp @@ -0,0 +1,33 @@ +// Copyright 2015-2017 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_LITERALS_HPP +#define BOOST_HISTOGRAM_LITERALS_HPP + +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { +constexpr unsigned parse_number(unsigned n) { return n; } + +template <class... Rest> +constexpr unsigned parse_number(unsigned n, char f, Rest... rest) { + return parse_number(10u * n + static_cast<unsigned>(f - '0'), rest...); +} +} // namespace detail + +namespace literals { +/// Suffix operator to generate literal compile-time numbers, 0_c, 12_c, etc. +template <char... digits> +auto operator"" _c() { + return std::integral_constant<unsigned, detail::parse_number(0, digits...)>(); +} +} // namespace literals +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/make_histogram.hpp b/ThirdParty/boost/histogram/make_histogram.hpp new file mode 100644 index 0000000000000000000000000000000000000000..a24d26a82b88e77bae503206e4d1affb631d81c7 --- /dev/null +++ b/ThirdParty/boost/histogram/make_histogram.hpp @@ -0,0 +1,138 @@ +// Copyright 2015-2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_MAKE_HISTOGRAM_HPP +#define BOOST_HISTOGRAM_MAKE_HISTOGRAM_HPP + +/** + \file boost/histogram/make_histogram.hpp + Collection of factory functions to conveniently create histograms. +*/ + +#include <boost/histogram/accumulators/weighted_sum.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/histogram.hpp> +#include <boost/histogram/storage_adaptor.hpp> +#include <boost/histogram/unlimited_storage.hpp> // = default_storage +#include <boost/mp11/utility.hpp> +#include <tuple> +#include <vector> + +namespace boost { +namespace histogram { + +/** + Make histogram from compile-time axis configuration and custom storage. + @param storage Storage or container with standard interface (any vector, array, or map). + @param axis First axis instance. + @param axes Other axis instances. +*/ +template <class Storage, class Axis, class... Axes, + class = detail::requires_storage_or_adaptible<Storage>, + class = detail::requires_axis<Axis>> +auto make_histogram_with(Storage&& storage, Axis&& axis, Axes&&... axes) { + auto a = std::make_tuple(std::forward<Axis>(axis), std::forward<Axes>(axes)...); + using U = std::decay_t<Storage>; + using S = mp11::mp_if<detail::is_storage<U>, U, storage_adaptor<U>>; + return histogram<decltype(a), S>(std::move(a), S(std::forward<Storage>(storage))); +} + +/** + Make histogram from compile-time axis configuration and default storage. + @param axis First axis instance. + @param axes Other axis instances. +*/ +template <class Axis, class... Axes, class = detail::requires_axis<Axis>> +auto make_histogram(Axis&& axis, Axes&&... axes) { + return make_histogram_with(default_storage(), std::forward<Axis>(axis), + std::forward<Axes>(axes)...); +} + +/** + Make histogram from compile-time axis configuration and weight-counting storage. + @param axis First axis instance. + @param axes Other axis instances. +*/ +template <class Axis, class... Axes, class = detail::requires_axis<Axis>> +auto make_weighted_histogram(Axis&& axis, Axes&&... axes) { + return make_histogram_with(weight_storage(), std::forward<Axis>(axis), + std::forward<Axes>(axes)...); +} + +/** + Make histogram from iterable range and custom storage. + @param storage Storage or container with standard interface (any vector, array, or map). + @param iterable Iterable range of axis objects. +*/ +template <class Storage, class Iterable, + class = detail::requires_storage_or_adaptible<Storage>, + class = detail::requires_sequence_of_any_axis<Iterable>> +auto make_histogram_with(Storage&& storage, Iterable&& iterable) { + using U = std::decay_t<Storage>; + using S = mp11::mp_if<detail::is_storage<U>, U, storage_adaptor<U>>; + using It = std::decay_t<Iterable>; + using A = mp11::mp_if<detail::is_indexable_container<It>, It, + std::vector<mp11::mp_first<It>>>; + return histogram<A, S>(std::forward<Iterable>(iterable), + S(std::forward<Storage>(storage))); +} + +/** + Make histogram from iterable range and default storage. + @param iterable Iterable range of axis objects. +*/ +template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>> +auto make_histogram(Iterable&& iterable) { + return make_histogram_with(default_storage(), std::forward<Iterable>(iterable)); +} + +/** + Make histogram from iterable range and weight-counting storage. + @param iterable Iterable range of axis objects. +*/ +template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>> +auto make_weighted_histogram(Iterable&& iterable) { + return make_histogram_with(weight_storage(), std::forward<Iterable>(iterable)); +} + +/** + Make histogram from iterator interval and custom storage. + @param storage Storage or container with standard interface (any vector, array, or map). + @param begin Iterator to range of axis objects. + @param end Iterator to range of axis objects. +*/ +template <class Storage, class Iterator, + class = detail::requires_storage_or_adaptible<Storage>, + class = detail::requires_iterator<Iterator>> +auto make_histogram_with(Storage&& storage, Iterator begin, Iterator end) { + using T = std::decay_t<decltype(*begin)>; + return make_histogram_with(std::forward<Storage>(storage), std::vector<T>(begin, end)); +} + +/** + Make histogram from iterator interval and default storage. + @param begin Iterator to range of axis objects. + @param end Iterator to range of axis objects. +*/ +template <class Iterator, class = detail::requires_iterator<Iterator>> +auto make_histogram(Iterator begin, Iterator end) { + return make_histogram_with(default_storage(), begin, end); +} + +/** + Make histogram from iterator interval and weight-counting storage. + @param begin Iterator to range of axis objects. + @param end Iterator to range of axis objects. +*/ +template <class Iterator, class = detail::requires_iterator<Iterator>> +auto make_weighted_histogram(Iterator begin, Iterator end) { + return make_histogram_with(weight_storage(), begin, end); +} + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/make_profile.hpp b/ThirdParty/boost/histogram/make_profile.hpp new file mode 100644 index 0000000000000000000000000000000000000000..cef01d9edef8b9d830a7fde3e5c86ad7f130f2ef --- /dev/null +++ b/ThirdParty/boost/histogram/make_profile.hpp @@ -0,0 +1,90 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_MAKE_PROFILE_HPP +#define BOOST_HISTOGRAM_MAKE_PROFILE_HPP + +#include <boost/histogram/accumulators/mean.hpp> +#include <boost/histogram/accumulators/weighted_mean.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/histogram/make_histogram.hpp> + +/** + \file boost/histogram/make_profile.hpp + Collection of factory functions to conveniently create profiles. + + Profiles are histograms which accept an additional sample and compute the mean of the + sample in each cell. +*/ + +namespace boost { +namespace histogram { + +/** + Make profle from compile-time axis configuration. + @param axis First axis instance. + @param axes Other axis instances. +*/ +template <class Axis, class... Axes, class = detail::requires_axis<Axis>> +auto make_profile(Axis&& axis, Axes&&... axes) { + return make_histogram_with(profile_storage(), std::forward<Axis>(axis), + std::forward<Axes>(axes)...); +} + +/** + Make profle from compile-time axis configuration which accepts weights. + @param axis First axis instance. + @param axes Other axis instances. +*/ +template <class Axis, class... Axes, class = detail::requires_axis<Axis>> +auto make_weighted_profile(Axis&& axis, Axes&&... axes) { + return make_histogram_with(weighted_profile_storage(), std::forward<Axis>(axis), + std::forward<Axes>(axes)...); +} + +/** + Make profile from iterable range. + @param iterable Iterable range of axis objects. +*/ +template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>> +auto make_profile(Iterable&& iterable) { + return make_histogram_with(profile_storage(), std::forward<Iterable>(iterable)); +} + +/** + Make profile from iterable range which accepts weights. + @param iterable Iterable range of axis objects. +*/ +template <class Iterable, class = detail::requires_sequence_of_any_axis<Iterable>> +auto make_weighted_profile(Iterable&& iterable) { + return make_histogram_with(weighted_profile_storage(), + std::forward<Iterable>(iterable)); +} + +/** + Make profile from iterator interval. + @param begin Iterator to range of axis objects. + @param end Iterator to range of axis objects. +*/ +template <class Iterator, class = detail::requires_iterator<Iterator>> +auto make_profile(Iterator begin, Iterator end) { + return make_histogram_with(profile_storage(), begin, end); +} + +/** + Make profile from iterator interval which accepts weights. + @param begin Iterator to range of axis objects. + @param end Iterator to range of axis objects. +*/ +template <class Iterator, class = detail::requires_iterator<Iterator>> +auto make_weighted_profile(Iterator begin, Iterator end) { + return make_histogram_with(weighted_profile_storage(), begin, end); +} + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/ostream.hpp b/ThirdParty/boost/histogram/ostream.hpp new file mode 100644 index 0000000000000000000000000000000000000000..4a7437a485be6c6f55e9654e9d9511402fe82206 --- /dev/null +++ b/ThirdParty/boost/histogram/ostream.hpp @@ -0,0 +1,310 @@ +// Copyright 2015-2019 Hans Dembinski +// Copyright 2019 Przemyslaw Bartosik +// +// 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) + +#ifndef BOOST_HISTOGRAM_OSTREAM_HPP +#define BOOST_HISTOGRAM_OSTREAM_HPP + +#include <boost/histogram/accumulators/ostream.hpp> +#include <boost/histogram/axis/ostream.hpp> +#include <boost/histogram/axis/variant.hpp> +#include <boost/histogram/detail/axes.hpp> +#include <boost/histogram/detail/counting_streambuf.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/static_if.hpp> +#include <boost/histogram/indexed.hpp> +#include <cmath> +#include <iomanip> +#include <ios> +#include <limits> +#include <numeric> +#include <ostream> +#include <streambuf> +#include <type_traits> + +/** + \file boost/histogram/ostream.hpp + + A simple streaming operator for the histogram type. The text representation is + rudimentary and not guaranteed to be stable between versions of Boost.Histogram. This + header is not included by any other header and must be explicitly included to use the + streaming operator. + + To you use your own, simply include your own implementation instead of this header. + */ + +namespace boost { +namespace histogram { +namespace detail { + +template <class OStream, unsigned N> +class tabular_ostream_wrapper : public std::array<int, N> { + using base_t = std::array<int, N>; + using char_type = typename OStream::char_type; + using traits_type = typename OStream::traits_type; + +public: + template <class T> + tabular_ostream_wrapper& operator<<(const T& t) { + if (collect_) { + if (static_cast<std::size_t>(iter_ - base_t::begin()) == size_) { + ++size_; + BOOST_ASSERT(size_ <= N); + BOOST_ASSERT(iter_ != end()); + *iter_ = 0; + } + cbuf_.count = 0; + os_ << t; + *iter_ = std::max(*iter_, static_cast<int>(cbuf_.count)); + } else { + BOOST_ASSERT(iter_ != end()); + os_ << std::setw(*iter_) << t; + } + ++iter_; + return *this; + } + + tabular_ostream_wrapper& operator<<(decltype(std::setprecision(0)) t) { + os_ << t; + return *this; + } + + tabular_ostream_wrapper& operator<<(decltype(std::fixed) t) { + os_ << t; + return *this; + } + + tabular_ostream_wrapper& row() { + iter_ = base_t::begin(); + return *this; + } + + explicit tabular_ostream_wrapper(OStream& os) : os_(os), orig_(os_.rdbuf(&cbuf_)) {} + + auto end() { return base_t::begin() + size_; } + auto end() const { return base_t::begin() + size_; } + auto cend() const { return base_t::cbegin() + size_; } + + void complete() { + BOOST_ASSERT(collect_); // only call this once + collect_ = false; + os_.rdbuf(orig_); + } + +private: + typename base_t::iterator iter_ = base_t::begin(); + std::size_t size_ = 0; + bool collect_ = true; + OStream& os_; + counting_streambuf<char_type, traits_type> cbuf_; + std::basic_streambuf<char_type, traits_type>* orig_; +}; + +template <class OStream, class T> +void ostream_value(OStream& os, const T& val) { + // a value from bin or histogram cell + os << std::left; + static_if_c<(std::is_convertible<T, double>::value && !std::is_integral<T>::value)>( + [](auto& os, const auto& val) { + const auto d = static_cast<double>(val); + if (std::isfinite(d)) { + const auto i = static_cast<std::int64_t>(d); + if (i == d) { + os << i; + return; + } + } + os << std::defaultfloat << std::setprecision(4) << d; + }, + [](auto& os, const auto& val) { os << val; }, os, val); +} + +template <class OStream, class Axis> +void ostream_bin(OStream& os, const Axis& ax, const int i) { + os << std::right; + static_if<has_method_value<Axis>>( + [&](const auto& ax) { + static_if<axis::traits::is_continuous<Axis>>( + [&](const auto& ax) { + os << std::defaultfloat << std::setprecision(4); + auto a = ax.value(i); + auto b = ax.value(i + 1); + // round bin edge to zero if deviation from zero is absolut and relatively + // small + const auto eps = 1e-8 * std::abs(b - a); + if (std::abs(a) < 1e-14 && std::abs(a) < eps) a = 0; + if (std::abs(b) < 1e-14 && std::abs(b) < eps) b = 0; + os << "[" << a << ", " << b << ")"; + }, + [&](const auto& ax) { os << ax.value(i); }, ax); + }, + [&](const auto&) { os << i; }, ax); +} + +template <class OStream, class... Ts> +void ostream_bin(OStream& os, const axis::category<Ts...>& ax, const int i) { + os << std::right; + if (i < ax.size()) + os << ax.value(i); + else + os << "other"; +} + +template <class CharT> +struct line_t { + CharT ch; + int size; +}; + +template <class CharT> +auto line(CharT c, int n) { + return line_t<CharT>{c, n}; +} + +template <class C, class T> +std::basic_ostream<C, T>& operator<<(std::basic_ostream<C, T>& os, line_t<C>&& l) { + for (int i = 0; i < l.size; ++i) os << l.ch; + return os; +} + +template <class OStream, class Axis, class T> +void stream_head(OStream& os, const Axis& ax, int index, const T& val) { + axis::visit( + [&](const auto& ax) { + ostream_bin(os, ax, index); + os << ' '; + ostream_value(os, val); + }, + ax); +} + +template <class OStream, class Histogram> +void ascii_plot(OStream& os, const Histogram& h, int w_total) { + if (w_total == 0) w_total = 78; // TODO detect actual width of terminal + + const auto& ax = h.axis(); + + // value range; can be integer or float, positive or negative + double vmin = 0; + double vmax = 0; + tabular_ostream_wrapper<OStream, 7> tos(os); + // first pass to get widths + for (auto&& v : indexed(h, coverage::all)) { + stream_head(tos.row(), ax, v.index(), *v); + vmin = std::min(vmin, static_cast<double>(*v)); + vmax = std::max(vmax, static_cast<double>(*v)); + } + tos.complete(); + if (vmax == 0) vmax = 1; + + // calculate width useable by bar (notice extra space at top) + // <-- head --> |<--- bar ---> | + // w_head + 2 + 2 + const int w_head = std::accumulate(tos.begin(), tos.end(), 0); + const int w_bar = w_total - 4 - w_head; + if (w_bar < 0) return; + + // draw upper line + os << '\n' << line(' ', w_head + 1) << '+' << line('-', w_bar + 1) << "+\n"; + + const int zero_offset = static_cast<int>(std::lround((-vmin) / (vmax - vmin) * w_bar)); + for (auto&& v : indexed(h, coverage::all)) { + stream_head(tos.row(), ax, v.index(), *v); + // rest uses os, not tos + os << " |"; + const int k = static_cast<int>(std::lround(*v / (vmax - vmin) * w_bar)); + if (k < 0) { + os << line(' ', zero_offset + k) << line('=', -k) << line(' ', w_bar - zero_offset); + } else { + os << line(' ', zero_offset) << line('=', k) << line(' ', w_bar - zero_offset - k); + } + os << " |\n"; + } + + // draw lower line + os << line(' ', w_head + 1) << '+' << line('-', w_bar + 1) << "+\n"; +} + +template <class OStream, class Histogram> +void ostream(OStream& os, const Histogram& h, const bool show_values = true) { + os << "histogram("; + + unsigned iaxis = 0; + const auto rank = h.rank(); + h.for_each_axis([&](const auto& ax) { + using A = std::decay_t<decltype(ax)>; + if ((show_values && rank > 0) || rank > 1) os << "\n "; + static_if<is_streamable<A>>([&](const auto& ax) { os << ax; }, + [&](const auto&) { os << "<unstreamable>"; }, ax); + }); + + if (show_values && rank > 0) { + tabular_ostream_wrapper<OStream, (BOOST_HISTOGRAM_DETAIL_AXES_LIMIT + 1)> tos(os); + for (auto&& v : indexed(h, coverage::all)) { + tos.row(); + for (auto i : v.indices()) tos << std::right << i; + ostream_value(tos, *v); + } + tos.complete(); + + const int w_item = std::accumulate(tos.begin(), tos.end(), 0) + 4 + h.rank(); + const int nrow = std::max(1, 65 / w_item); + int irow = 0; + for (auto&& v : indexed(h, coverage::all)) { + os << (irow == 0 ? "\n (" : " ("); + tos.row(); + iaxis = 0; + for (auto i : v.indices()) { + tos << std::right << i; + os << (++iaxis == h.rank() ? "):" : " "); + } + os << ' '; + ostream_value(tos, *v); + ++irow; + if (nrow > 0 && irow == nrow) irow = 0; + } + os << '\n'; + } + os << ')'; +} + +} // namespace detail + +#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED + +template <class CharT, class Traits, class A, class S> +std::basic_ostream<CharT, Traits>& operator<<(std::basic_ostream<CharT, Traits>& os, + const histogram<A, S>& h) { + // save fmt + const auto flags = os.flags(); + + os.flags(std::ios::dec | std::ios::left); + + const auto w = static_cast<int>(os.width()); + os.width(0); + + using value_type = typename histogram<A, S>::value_type; + detail::static_if<std::is_convertible<value_type, double>>( + [&os, w](const auto& h) { + if (h.rank() == 1) { + detail::ostream(os, h, false); + detail::ascii_plot(os, h, w); + } else + detail::ostream(os, h); + }, + [&os](const auto& h) { detail::ostream(os, h); }, h); + + // restore fmt + os.flags(flags); + return os; +} + +} // namespace histogram +} // namespace boost + +#endif // BOOST_HISTOGRAM_DOXYGEN_INVOKED + +#endif diff --git a/ThirdParty/boost/histogram/sample.hpp b/ThirdParty/boost/histogram/sample.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6289bd31a479d177ad0afbe864420508ddb11f83 --- /dev/null +++ b/ThirdParty/boost/histogram/sample.hpp @@ -0,0 +1,33 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_SAMPLE_HPP +#define BOOST_HISTOGRAM_SAMPLE_HPP + +#include <tuple> +#include <utility> + +namespace boost { +namespace histogram { + +template <class T> +struct sample_type { + T value; +}; + +/** Helper function to mark arguments as sample. + + @param ts arguments to be forwarded to the accumulator. +*/ +template <class... Ts> +auto sample(Ts&&... ts) noexcept { + return sample_type<std::tuple<Ts...>>{std::forward_as_tuple(std::forward<Ts>(ts)...)}; +} + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/serialization.hpp b/ThirdParty/boost/histogram/serialization.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b43323764f9437daeb29dec26b6d77de385386d7 --- /dev/null +++ b/ThirdParty/boost/histogram/serialization.hpp @@ -0,0 +1,23 @@ +// Copyright 2015-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_SERIALIZATION_HPP +#define BOOST_HISTOGRAM_SERIALIZATION_HPP + +#include <boost/serialization/array.hpp> +#include <boost/serialization/map.hpp> +#include <boost/serialization/string.hpp> +#include <boost/serialization/vector.hpp> + +/** + \file boost/histogram/serialization.hpp + + Headers from + [Boost.Serialization](https://www.boost.org/doc/libs/develop/libs/serialization/doc/index.html) + needed to serialize STL types that are used internally by the Boost.Histogram classes. + */ + +#endif diff --git a/ThirdParty/boost/histogram/storage_adaptor.hpp b/ThirdParty/boost/histogram/storage_adaptor.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b0d19ad193eadc3dcb6fee900482534672261606 --- /dev/null +++ b/ThirdParty/boost/histogram/storage_adaptor.hpp @@ -0,0 +1,395 @@ +// Copyright 2018-2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_STORAGE_ADAPTOR_HPP +#define BOOST_HISTOGRAM_STORAGE_ADAPTOR_HPP + +#include <algorithm> +#include <boost/core/nvp.hpp> +#include <boost/histogram/detail/array_wrapper.hpp> +#include <boost/histogram/detail/detect.hpp> +#include <boost/histogram/detail/iterator_adaptor.hpp> +#include <boost/histogram/detail/safe_comparison.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/utility.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +struct vector_impl : T { + using allocator_type = typename T::allocator_type; + + static constexpr bool has_threading_support = + accumulators::is_thread_safe<typename T::value_type>::value; + + vector_impl(const allocator_type& a = {}) : T(a) {} + vector_impl(const vector_impl&) = default; + vector_impl& operator=(const vector_impl&) = default; + vector_impl(vector_impl&&) = default; + vector_impl& operator=(vector_impl&&) = default; + + explicit vector_impl(T&& t) : T(std::move(t)) {} + explicit vector_impl(const T& t) : T(t) {} + + template <class U, class = requires_iterable<U>> + explicit vector_impl(const U& u, const allocator_type& a = {}) + : T(std::begin(u), std::end(u), a) {} + + template <class U, class = requires_iterable<U>> + vector_impl& operator=(const U& u) { + T::resize(u.size()); + auto it = T::begin(); + for (auto&& x : u) *it++ = x; + return *this; + } + + void reset(std::size_t n) { + using value_type = typename T::value_type; + const auto old_size = T::size(); + T::resize(n, value_type()); + std::fill_n(T::begin(), (std::min)(n, old_size), value_type()); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("vector", static_cast<T&>(*this)); + } +}; + +template <class T> +struct array_impl : T { + static constexpr bool has_threading_support = + accumulators::is_thread_safe<typename T::value_type>::value; + + array_impl() = default; + array_impl(const array_impl& t) : T(t), size_(t.size_) {} + array_impl& operator=(const array_impl& t) { + T::operator=(t); + size_ = t.size_; + return *this; + } + + explicit array_impl(T&& t) : T(std::move(t)) {} + explicit array_impl(const T& t) : T(t) {} + + template <class U, class = requires_iterable<U>> + explicit array_impl(const U& u) : size_(u.size()) { + using std::begin; + using std::end; + std::copy(begin(u), end(u), this->begin()); + } + + template <class U, class = requires_iterable<U>> + array_impl& operator=(const U& u) { + if (u.size() > T::max_size()) // for std::arra + BOOST_THROW_EXCEPTION(std::length_error("argument size exceeds maximum capacity")); + size_ = u.size(); + using std::begin; + using std::end; + std::copy(begin(u), end(u), T::begin()); + return *this; + } + + void reset(std::size_t n) { + using value_type = typename T::value_type; + if (n > T::max_size()) // for std::array + BOOST_THROW_EXCEPTION(std::length_error("argument size exceeds maximum capacity")); + std::fill_n(T::begin(), n, value_type()); + size_ = n; + } + + typename T::iterator end() noexcept { return T::begin() + size_; } + typename T::const_iterator end() const noexcept { return T::begin() + size_; } + + std::size_t size() const noexcept { return size_; } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("size", size_); + auto w = detail::make_array_wrapper(T::data(), size_); + ar& make_nvp("array", w); + } + + std::size_t size_ = 0; +}; + +template <class T> +struct map_impl : T { + static_assert(std::is_same<typename T::key_type, std::size_t>::value, + "requires std::size_t as key_type"); + + using value_type = typename T::mapped_type; + using const_reference = const value_type&; + + static constexpr bool has_threading_support = false; + static_assert( + !accumulators::is_thread_safe<value_type>::value, + "std::map and std::unordered_map do not support thread-safe element access. " + "If you have a map with thread-safe element access, please file an issue and" + "support will be added."); + + struct reference { + reference(map_impl* m, std::size_t i) noexcept : map(m), idx(i) {} + + reference(const reference&) noexcept = default; + reference& operator=(const reference& o) { + if (this != &o) operator=(static_cast<const_reference>(o)); + return *this; + } + + operator const_reference() const noexcept { + return static_cast<const map_impl*>(map)->operator[](idx); + } + + reference& operator=(const_reference u) { + auto it = map->find(idx); + if (u == value_type{}) { + if (it != static_cast<T*>(map)->end()) { map->erase(it); } + } else { + if (it != static_cast<T*>(map)->end()) { + it->second = u; + } else { + map->emplace(idx, u); + } + } + return *this; + } + + template <class U, class V = value_type, + class = std::enable_if_t<has_operator_radd<V, U>::value>> + reference& operator+=(const U& u) { + auto it = map->find(idx); + if (it != static_cast<T*>(map)->end()) { + it->second += u; + } else { + map->emplace(idx, u); + } + return *this; + } + + template <class U, class V = value_type, + class = std::enable_if_t<has_operator_rsub<V, U>::value>> + reference& operator-=(const U& u) { + auto it = map->find(idx); + if (it != static_cast<T*>(map)->end()) { + it->second -= u; + } else { + map->emplace(idx, -u); + } + return *this; + } + + template <class U, class V = value_type, + class = std::enable_if_t<has_operator_rmul<V, U>::value>> + reference& operator*=(const U& u) { + auto it = map->find(idx); + if (it != static_cast<T*>(map)->end()) it->second *= u; + return *this; + } + + template <class U, class V = value_type, + class = std::enable_if_t<has_operator_rdiv<V, U>::value>> + reference& operator/=(const U& u) { + auto it = map->find(idx); + if (it != static_cast<T*>(map)->end()) { + it->second /= u; + } else if (!(value_type{} / u == value_type{})) { + map->emplace(idx, value_type{} / u); + } + return *this; + } + + template <class V = value_type, + class = std::enable_if_t<has_operator_preincrement<V>::value>> + reference operator++() { + auto it = map->find(idx); + if (it != static_cast<T*>(map)->end()) { + ++it->second; + } else { + value_type tmp{}; + ++tmp; + map->emplace(idx, tmp); + } + return *this; + } + + template <class V = value_type, + class = std::enable_if_t<has_operator_preincrement<V>::value>> + value_type operator++(int) { + const value_type tmp = *this; + operator++(); + return tmp; + } + + template <class U, class = std::enable_if_t<has_operator_equal<value_type, U>::value>> + bool operator==(const U& rhs) const { + return operator const_reference() == rhs; + } + + template <class U, class = std::enable_if_t<has_operator_equal<value_type, U>::value>> + bool operator!=(const U& rhs) const { + return !operator==(rhs); + } + + template <class CharT, class Traits> + friend std::basic_ostream<CharT, Traits>& operator<<( + std::basic_ostream<CharT, Traits>& os, reference x) { + os << static_cast<const_reference>(x); + return os; + } + + template <class... Ts> + auto operator()(const Ts&... args) -> decltype(std::declval<value_type>()(args...)) { + return (*map)[idx](args...); + } + + map_impl* map; + std::size_t idx; + }; + + template <class Value, class Reference, class MapPtr> + struct iterator_t + : iterator_adaptor<iterator_t<Value, Reference, MapPtr>, std::size_t, Reference> { + iterator_t() = default; + template <class V, class R, class M, class = requires_convertible<M, MapPtr>> + iterator_t(const iterator_t<V, R, M>& it) noexcept : iterator_t(it.map_, it.base()) {} + iterator_t(MapPtr m, std::size_t i) noexcept + : iterator_t::iterator_adaptor_(i), map_(m) {} + template <class V, class R, class M> + bool equal(const iterator_t<V, R, M>& rhs) const noexcept { + return map_ == rhs.map_ && iterator_t::base() == rhs.base(); + } + Reference operator*() const { return (*map_)[iterator_t::base()]; } + MapPtr map_ = nullptr; + }; + + using iterator = iterator_t<value_type, reference, map_impl*>; + using const_iterator = iterator_t<const value_type, const_reference, const map_impl*>; + + using allocator_type = typename T::allocator_type; + + map_impl(const allocator_type& a = {}) : T(a) {} + + map_impl(const map_impl&) = default; + map_impl& operator=(const map_impl&) = default; + map_impl(map_impl&&) = default; + map_impl& operator=(map_impl&&) = default; + + map_impl(const T& t) : T(t), size_(t.size()) {} + map_impl(T&& t) : T(std::move(t)), size_(t.size()) {} + + template <class U, class = requires_iterable<U>> + explicit map_impl(const U& u, const allocator_type& a = {}) : T(a), size_(u.size()) { + using std::begin; + using std::end; + std::copy(begin(u), end(u), this->begin()); + } + + template <class U, class = requires_iterable<U>> + map_impl& operator=(const U& u) { + if (u.size() < size_) + reset(u.size()); + else + size_ = u.size(); + using std::begin; + using std::end; + std::copy(begin(u), end(u), this->begin()); + return *this; + } + + void reset(std::size_t n) { + T::clear(); + size_ = n; + } + + reference operator[](std::size_t i) noexcept { return {this, i}; } + const_reference operator[](std::size_t i) const noexcept { + auto it = T::find(i); + static const value_type null = value_type{}; + if (it == T::end()) return null; + return it->second; + } + + iterator begin() noexcept { return {this, 0}; } + iterator end() noexcept { return {this, size_}; } + + const_iterator begin() const noexcept { return {this, 0}; } + const_iterator end() const noexcept { return {this, size_}; } + + std::size_t size() const noexcept { return size_; } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("size", size_); + ar& make_nvp("map", static_cast<T&>(*this)); + } + + std::size_t size_ = 0; +}; + +template <class T> +struct ERROR_type_passed_to_storage_adaptor_not_recognized; + +// clang-format off +template <class T> +using storage_adaptor_impl = + mp11::mp_cond< + is_vector_like<T>, vector_impl<T>, + is_array_like<T>, array_impl<T>, + is_map_like<T>, map_impl<T>, + std::true_type, ERROR_type_passed_to_storage_adaptor_not_recognized<T> + >; +// clang-format on +} // namespace detail + +/// Turns any vector-like, array-like, and map-like container into a storage type. +template <class T> +class storage_adaptor : public detail::storage_adaptor_impl<T> { + using impl_type = detail::storage_adaptor_impl<T>; + +public: + // standard copy, move, assign + storage_adaptor(storage_adaptor&&) = default; + storage_adaptor(const storage_adaptor&) = default; + storage_adaptor& operator=(storage_adaptor&&) = default; + storage_adaptor& operator=(const storage_adaptor&) = default; + + // forwarding constructor + template <class... Ts> + storage_adaptor(Ts&&... ts) : impl_type(std::forward<Ts>(ts)...) {} + + // forwarding assign + template <class U> + storage_adaptor& operator=(U&& u) { + impl_type::operator=(std::forward<U>(u)); + return *this; + } + + template <class U, class = detail::requires_iterable<U>> + bool operator==(const U& u) const { + using std::begin; + using std::end; + return std::equal(this->begin(), this->end(), begin(u), end(u), detail::safe_equal{}); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + ar& make_nvp("impl", static_cast<impl_type&>(*this)); + } + +private: + friend struct unsafe_access; +}; + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/unlimited_storage.hpp b/ThirdParty/boost/histogram/unlimited_storage.hpp new file mode 100644 index 0000000000000000000000000000000000000000..abedef74664f573a0c8b90e6503d979d531bd0a8 --- /dev/null +++ b/ThirdParty/boost/histogram/unlimited_storage.hpp @@ -0,0 +1,641 @@ +// Copyright 2015-2019 Hans Dembinski +// Copyright 2019 Glen Joseph Fernandes (glenjofe@gmail.com) +// +// 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) + +#ifndef BOOST_HISTOGRAM_UNLIMTED_STORAGE_HPP +#define BOOST_HISTOGRAM_UNLIMTED_STORAGE_HPP + +#include <algorithm> +#include <boost/assert.hpp> +#include <boost/config.hpp> +#include <boost/core/alloc_construct.hpp> +#include <boost/core/exchange.hpp> +#include <boost/core/nvp.hpp> +#include <boost/histogram/detail/array_wrapper.hpp> +#include <boost/histogram/detail/iterator_adaptor.hpp> +#include <boost/histogram/detail/large_int.hpp> +#include <boost/histogram/detail/operators.hpp> +#include <boost/histogram/detail/safe_comparison.hpp> +#include <boost/histogram/fwd.hpp> +#include <boost/mp11/algorithm.hpp> +#include <boost/mp11/list.hpp> +#include <boost/mp11/utility.hpp> +#include <cmath> +#include <cstdint> +#include <functional> +#include <iterator> +#include <memory> +#include <type_traits> + +namespace boost { +namespace histogram { +namespace detail { + +template <class T> +struct is_large_int : std::false_type {}; + +template <class A> +struct is_large_int<large_int<A>> : std::true_type {}; + +template <class T, class ReturnType> +using if_arithmetic_or_large_int = + std::enable_if_t<(std::is_arithmetic<T>::value || is_large_int<T>::value), + ReturnType>; + +template <class L, class T> +using next_type = mp11::mp_at_c<L, (mp11::mp_find<L, T>::value + 1)>; + +template <class Allocator> +class construct_guard { +public: + using pointer = typename std::allocator_traits<Allocator>::pointer; + + construct_guard(Allocator& a, pointer p, std::size_t n) noexcept + : a_(a), p_(p), n_(n) {} + + ~construct_guard() { + if (p_) { a_.deallocate(p_, n_); } + } + + void release() { p_ = pointer(); } + + construct_guard(const construct_guard&) = delete; + construct_guard& operator=(const construct_guard&) = delete; + +private: + Allocator& a_; + pointer p_; + std::size_t n_; +}; + +template <class Allocator> +void* buffer_create(Allocator& a, std::size_t n) { + auto ptr = a.allocate(n); // may throw + static_assert(std::is_trivially_copyable<decltype(ptr)>::value, + "ptr must be trivially copyable"); + construct_guard<Allocator> guard(a, ptr, n); + boost::alloc_construct_n(a, ptr, n); + guard.release(); + return static_cast<void*>(ptr); +} + +template <class Allocator, class Iterator> +auto buffer_create(Allocator& a, std::size_t n, Iterator iter) { + BOOST_ASSERT(n > 0u); + auto ptr = a.allocate(n); // may throw + static_assert(std::is_trivially_copyable<decltype(ptr)>::value, + "ptr must be trivially copyable"); + construct_guard<Allocator> guard(a, ptr, n); + using T = typename std::allocator_traits<Allocator>::value_type; + struct casting_iterator { + void operator++() noexcept { ++iter_; } + T operator*() noexcept { + return static_cast<T>(*iter_); + } // silence conversion warnings + Iterator iter_; + }; + boost::alloc_construct_n(a, ptr, n, casting_iterator{iter}); + guard.release(); + return ptr; +} + +template <class Allocator> +void buffer_destroy(Allocator& a, typename std::allocator_traits<Allocator>::pointer p, + std::size_t n) { + BOOST_ASSERT(p); + BOOST_ASSERT(n > 0u); + boost::alloc_destroy_n(a, p, n); + a.deallocate(p, n); +} + +} // namespace detail + +/** + Memory-efficient storage for integral counters which cannot overflow. + + This storage provides a no-overflow-guarantee if the counters are incremented with + integer weights. It maintains a contiguous array of elemental counters, one for each + cell. If an operation is requested which would overflow a counter, the array is + replaced with another of a wider integral type, then the operation is executed. The + storage uses integers of 8, 16, 32, 64 bits, and then switches to a multiprecision + integral type, similar to those in + [Boost.Multiprecision](https://www.boost.org/doc/libs/develop/libs/multiprecision/doc/html/index.html). + + A scaling operation or adding a floating point number triggers a conversion of the + elemental counters into doubles, which voids the no-overflow-guarantee. +*/ +template <class Allocator> +class unlimited_storage { + static_assert( + std::is_same<typename std::allocator_traits<Allocator>::pointer, + typename std::allocator_traits<Allocator>::value_type*>::value, + "unlimited_storage requires allocator with trivial pointer type"); + using U8 = std::uint8_t; + using U16 = std::uint16_t; + using U32 = std::uint32_t; + using U64 = std::uint64_t; + +public: + static constexpr bool has_threading_support = false; + + using allocator_type = Allocator; + using value_type = double; + using large_int = detail::large_int< + typename std::allocator_traits<allocator_type>::template rebind_alloc<U64>>; + + struct buffer_type { + // cannot be moved outside of scope of unlimited_storage, large_int is dependent type + using types = mp11::mp_list<U8, U16, U32, U64, large_int, double>; + + template <class T> + static constexpr unsigned type_index() noexcept { + return static_cast<unsigned>(mp11::mp_find<types, T>::value); + } + + template <class F, class... Ts> + decltype(auto) visit(F&& f, Ts&&... ts) const { + // this is intentionally not a switch, the if-chain is faster in benchmarks + if (type == type_index<U8>()) + return f(static_cast<U8*>(ptr), std::forward<Ts>(ts)...); + if (type == type_index<U16>()) + return f(static_cast<U16*>(ptr), std::forward<Ts>(ts)...); + if (type == type_index<U32>()) + return f(static_cast<U32*>(ptr), std::forward<Ts>(ts)...); + if (type == type_index<U64>()) + return f(static_cast<U64*>(ptr), std::forward<Ts>(ts)...); + if (type == type_index<large_int>()) + return f(static_cast<large_int*>(ptr), std::forward<Ts>(ts)...); + return f(static_cast<double*>(ptr), std::forward<Ts>(ts)...); + } + + buffer_type(const allocator_type& a = {}) : alloc(a) {} + + buffer_type(buffer_type&& o) noexcept + : alloc(std::move(o.alloc)) + , size(boost::exchange(o.size, 0)) + , type(boost::exchange(o.type, 0)) + , ptr(boost::exchange(o.ptr, nullptr)) {} + + buffer_type& operator=(buffer_type&& o) noexcept { + using std::swap; + swap(alloc, o.alloc); + swap(size, o.size); + swap(type, o.type); + swap(ptr, o.ptr); + return *this; + } + + buffer_type(const buffer_type& x) : alloc(x.alloc) { + x.visit([this, n = x.size](const auto* xp) { + using T = std::decay_t<decltype(*xp)>; + this->template make<T>(n, xp); + }); + } + + buffer_type& operator=(const buffer_type& o) { + *this = buffer_type(o); + return *this; + } + + ~buffer_type() noexcept { destroy(); } + + void destroy() noexcept { + BOOST_ASSERT((ptr == nullptr) == (size == 0)); + if (ptr == nullptr) return; + visit([this](auto* p) { + using T = std::decay_t<decltype(*p)>; + using alloc_type = + typename std::allocator_traits<allocator_type>::template rebind_alloc<T>; + alloc_type a(alloc); // rebind allocator + detail::buffer_destroy(a, p, this->size); + }); + size = 0; + type = 0; + ptr = nullptr; + } + + template <class T> + void make(std::size_t n) { + // note: order of commands is to not leave buffer in invalid state upon throw + destroy(); + if (n > 0) { + // rebind allocator + using alloc_type = + typename std::allocator_traits<allocator_type>::template rebind_alloc<T>; + alloc_type a(alloc); + ptr = detail::buffer_create(a, n); // may throw + } + size = n; + type = type_index<T>(); + } + + template <class T, class U> + void make(std::size_t n, U iter) { + // note: iter may be current ptr, so create new buffer before deleting old buffer + void* new_ptr = nullptr; + const auto new_type = type_index<T>(); + if (n > 0) { + // rebind allocator + using alloc_type = + typename std::allocator_traits<allocator_type>::template rebind_alloc<T>; + alloc_type a(alloc); + new_ptr = detail::buffer_create(a, n, iter); // may throw + } + destroy(); + size = n; + type = new_type; + ptr = new_ptr; + } + + allocator_type alloc; + std::size_t size = 0; + unsigned type = 0; + mutable void* ptr = nullptr; + }; + + class reference; // forward declare to make friend of const_reference + + /// implementation detail + class const_reference + : detail::partially_ordered<const_reference, const_reference, void> { + public: + const_reference(buffer_type& b, std::size_t i) noexcept : bref_(b), idx_(i) { + BOOST_ASSERT(idx_ < bref_.size); + } + + const_reference(const const_reference&) noexcept = default; + + // no assignment for const_references + const_reference& operator=(const const_reference&) = delete; + const_reference& operator=(const_reference&&) = delete; + + operator double() const noexcept { + return bref_.visit( + [this](const auto* p) { return static_cast<double>(p[this->idx_]); }); + } + + bool operator<(const const_reference& o) const noexcept { + return apply_binary<detail::safe_less>(o); + } + + bool operator==(const const_reference& o) const noexcept { + return apply_binary<detail::safe_equal>(o); + } + + template <class U> + detail::if_arithmetic_or_large_int<U, bool> operator<(const U& o) const noexcept { + return apply_binary<detail::safe_less>(o); + } + + template <class U> + detail::if_arithmetic_or_large_int<U, bool> operator>(const U& o) const noexcept { + return apply_binary<detail::safe_greater>(o); + } + + template <class U> + detail::if_arithmetic_or_large_int<U, bool> operator==(const U& o) const noexcept { + return apply_binary<detail::safe_equal>(o); + } + + private: + template <class Binary> + bool apply_binary(const const_reference& x) const noexcept { + return x.bref_.visit([this, ix = x.idx_](const auto* xp) { + return this->apply_binary<Binary>(xp[ix]); + }); + } + + template <class Binary, class U> + bool apply_binary(const U& x) const noexcept { + return bref_.visit([i = idx_, &x](const auto* p) { return Binary()(p[i], x); }); + } + + protected: + buffer_type& bref_; + std::size_t idx_; + friend class reference; + }; + + /// implementation detail + class reference : public const_reference, + public detail::partially_ordered<reference, reference, void> { + public: + reference(buffer_type& b, std::size_t i) noexcept : const_reference(b, i) {} + + // references do copy-construct + reference(const reference& x) noexcept = default; + + // references do not rebind, assign through + reference& operator=(const reference& x) { + return operator=(static_cast<const_reference>(x)); + } + + // references do not rebind, assign through + reference& operator=(const const_reference& x) { + // safe for self-assignment, assigning matching type doesn't invalide buffer + x.bref_.visit([this, ix = x.idx_](const auto* xp) { this->operator=(xp[ix]); }); + return *this; + } + + template <class U> + detail::if_arithmetic_or_large_int<U, reference&> operator=(const U& x) { + this->bref_.visit([this, &x](auto* p) { + // gcc-8 optimizes the expression `p[this->idx_] = 0` away even at -O0, + // so we merge it into the next line which is properly counted + adder()((p[this->idx_] = 0, p), this->bref_, this->idx_, x); + }); + return *this; + } + + bool operator<(const reference& o) const noexcept { + return const_reference::operator<(o); + } + + bool operator==(const reference& o) const noexcept { + return const_reference::operator==(o); + } + + template <class U> + detail::if_arithmetic_or_large_int<U, bool> operator<(const U& o) const noexcept { + return const_reference::operator<(o); + } + + template <class U> + detail::if_arithmetic_or_large_int<U, bool> operator>(const U& o) const noexcept { + return const_reference::operator>(o); + } + + template <class U> + detail::if_arithmetic_or_large_int<U, bool> operator==(const U& o) const noexcept { + return const_reference::operator==(o); + } + + reference& operator+=(const const_reference& x) { + x.bref_.visit([this, ix = x.idx_](const auto* xp) { this->operator+=(xp[ix]); }); + return *this; + } + + template <class U> + detail::if_arithmetic_or_large_int<U, reference&> operator+=(const U& x) { + this->bref_.visit(adder(), this->bref_, this->idx_, x); + return *this; + } + + reference& operator-=(const double x) { return operator+=(-x); } + + reference& operator*=(const double x) { + this->bref_.visit(multiplier(), this->bref_, this->idx_, x); + return *this; + } + + reference& operator/=(const double x) { return operator*=(1.0 / x); } + + reference& operator++() { + this->bref_.visit(incrementor(), this->bref_, this->idx_); + return *this; + } + }; + +private: + template <class Value, class Reference> + class iterator_impl : public detail::iterator_adaptor<iterator_impl<Value, Reference>, + std::size_t, Reference, Value> { + public: + iterator_impl() = default; + template <class V, class R> + iterator_impl(const iterator_impl<V, R>& it) + : iterator_impl::iterator_adaptor_(it.base()), buffer_(it.buffer_) {} + iterator_impl(buffer_type* b, std::size_t i) noexcept + : iterator_impl::iterator_adaptor_(i), buffer_(b) {} + + Reference operator*() const noexcept { return {*buffer_, this->base()}; } + + template <class V, class R> + friend class iterator_impl; + + private: + mutable buffer_type* buffer_ = nullptr; + }; + +public: + using const_iterator = iterator_impl<const value_type, const_reference>; + using iterator = iterator_impl<value_type, reference>; + + explicit unlimited_storage(const allocator_type& a = {}) : buffer_(a) {} + unlimited_storage(const unlimited_storage&) = default; + unlimited_storage& operator=(const unlimited_storage&) = default; + unlimited_storage(unlimited_storage&&) = default; + unlimited_storage& operator=(unlimited_storage&&) = default; + + // TODO + // template <class Allocator> + // unlimited_storage(const unlimited_storage<Allocator>& s) + + template <class Iterable, class = detail::requires_iterable<Iterable>> + explicit unlimited_storage(const Iterable& s) { + using std::begin; + using std::end; + auto s_begin = begin(s); + auto s_end = end(s); + using V = typename std::iterator_traits<decltype(begin(s))>::value_type; + constexpr auto ti = buffer_type::template type_index<V>(); + constexpr auto nt = mp11::mp_size<typename buffer_type::types>::value; + const std::size_t size = static_cast<std::size_t>(std::distance(s_begin, s_end)); +#ifdef BOOST_NO_CXX17_IF_CONSTEXPR + if +#else + if constexpr +#endif + (ti < nt) + buffer_.template make<V>(size, s_begin); + else + buffer_.template make<double>(size, s_begin); + } + + template <class Iterable, class = detail::requires_iterable<Iterable>> + unlimited_storage& operator=(const Iterable& s) { + *this = unlimited_storage(s); + return *this; + } + + allocator_type get_allocator() const { return buffer_.alloc; } + + void reset(std::size_t n) { buffer_.template make<U8>(n); } + + std::size_t size() const noexcept { return buffer_.size; } + + reference operator[](std::size_t i) noexcept { return {buffer_, i}; } + const_reference operator[](std::size_t i) const noexcept { return {buffer_, i}; } + + bool operator==(const unlimited_storage& x) const noexcept { + if (size() != x.size()) return false; + return buffer_.visit([&x](const auto* p) { + return x.buffer_.visit([p, n = x.size()](const auto* xp) { + return std::equal(p, p + n, xp, detail::safe_equal{}); + }); + }); + } + + template <class Iterable> + bool operator==(const Iterable& iterable) const { + if (size() != iterable.size()) return false; + return buffer_.visit([&iterable](const auto* p) { + return std::equal(p, p + iterable.size(), std::begin(iterable), + detail::safe_equal{}); + }); + } + + unlimited_storage& operator*=(const double x) { + buffer_.visit(multiplier(), buffer_, x); + return *this; + } + + iterator begin() noexcept { return {&buffer_, 0}; } + iterator end() noexcept { return {&buffer_, size()}; } + const_iterator begin() const noexcept { return {&buffer_, 0}; } + const_iterator end() const noexcept { return {&buffer_, size()}; } + + /// implementation detail; used by unit tests, not part of generic storage interface + template <class T> + unlimited_storage(std::size_t s, const T* p, const allocator_type& a = {}) + : buffer_(std::move(a)) { + buffer_.template make<T>(s, p); + } + + template <class Archive> + void serialize(Archive& ar, unsigned /* version */) { + if (Archive::is_loading::value) { + buffer_type tmp(buffer_.alloc); + std::size_t size; + ar& make_nvp("type", tmp.type); + ar& make_nvp("size", size); + tmp.visit([this, size](auto* tp) { + BOOST_ASSERT(tp == nullptr); + using T = std::decay_t<decltype(*tp)>; + buffer_.template make<T>(size); + }); + } else { + ar& make_nvp("type", buffer_.type); + ar& make_nvp("size", buffer_.size); + } + buffer_.visit([this, &ar](auto* tp) { + auto w = detail::make_array_wrapper(tp, this->buffer_.size); + ar& make_nvp("buffer", w); + }); + } + +private: + struct incrementor { + template <class T> + void operator()(T* tp, buffer_type& b, std::size_t i) { + BOOST_ASSERT(tp && i < b.size); + if (!detail::safe_increment(tp[i])) { + using U = detail::next_type<typename buffer_type::types, T>; + b.template make<U>(b.size, tp); + ++static_cast<U*>(b.ptr)[i]; + } + } + + void operator()(large_int* tp, buffer_type&, std::size_t i) { ++tp[i]; } + + void operator()(double* tp, buffer_type&, std::size_t i) { ++tp[i]; } + }; + + struct adder { + template <class U> + void operator()(double* tp, buffer_type&, std::size_t i, const U& x) { + tp[i] += static_cast<double>(x); + } + + void operator()(large_int* tp, buffer_type&, std::size_t i, const large_int& x) { + tp[i] += x; // potentially adding large_int to itself is safe + } + + template <class T, class U> + void operator()(T* tp, buffer_type& b, std::size_t i, const U& x) { + is_x_integral(std::is_integral<U>{}, tp, b, i, x); + } + + template <class T, class U> + void is_x_integral(std::false_type, T* tp, buffer_type& b, std::size_t i, + const U& x) { + // x could be reference to buffer we manipulate, make copy before changing buffer + const auto v = static_cast<double>(x); + b.template make<double>(b.size, tp); + operator()(static_cast<double*>(b.ptr), b, i, v); + } + + template <class T> + void is_x_integral(std::false_type, T* tp, buffer_type& b, std::size_t i, + const large_int& x) { + // x could be reference to buffer we manipulate, make copy before changing buffer + const auto v = static_cast<large_int>(x); + b.template make<large_int>(b.size, tp); + operator()(static_cast<large_int*>(b.ptr), b, i, v); + } + + template <class T, class U> + void is_x_integral(std::true_type, T* tp, buffer_type& b, std::size_t i, const U& x) { + is_x_unsigned(std::is_unsigned<U>{}, tp, b, i, x); + } + + template <class T, class U> + void is_x_unsigned(std::false_type, T* tp, buffer_type& b, std::size_t i, + const U& x) { + if (x >= 0) + is_x_unsigned(std::true_type{}, tp, b, i, detail::make_unsigned(x)); + else + is_x_integral(std::false_type{}, tp, b, i, static_cast<double>(x)); + } + + template <class T, class U> + void is_x_unsigned(std::true_type, T* tp, buffer_type& b, std::size_t i, const U& x) { + if (detail::safe_radd(tp[i], x)) return; + // x could be reference to buffer we manipulate, need to convert to value + const auto y = x; + using TN = detail::next_type<typename buffer_type::types, T>; + b.template make<TN>(b.size, tp); + is_x_unsigned(std::true_type{}, static_cast<TN*>(b.ptr), b, i, y); + } + + template <class U> + void is_x_unsigned(std::true_type, large_int* tp, buffer_type&, std::size_t i, + const U& x) { + tp[i] += x; + } + }; + + struct multiplier { + template <class T> + void operator()(T* tp, buffer_type& b, const double x) { + // potential lossy conversion that cannot be avoided + b.template make<double>(b.size, tp); + operator()(static_cast<double*>(b.ptr), b, x); + } + + void operator()(double* tp, buffer_type& b, const double x) { + for (auto end = tp + b.size; tp != end; ++tp) *tp *= x; + } + + template <class T> + void operator()(T* tp, buffer_type& b, std::size_t i, const double x) { + b.template make<double>(b.size, tp); + operator()(static_cast<double*>(b.ptr), b, i, x); + } + + void operator()(double* tp, buffer_type&, std::size_t i, const double x) { + tp[i] *= static_cast<double>(x); + } + }; + + mutable buffer_type buffer_; + friend struct unsafe_access; +}; + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/unsafe_access.hpp b/ThirdParty/boost/histogram/unsafe_access.hpp new file mode 100644 index 0000000000000000000000000000000000000000..568008245df1ed690105de2f0e6ca88bd23e249d --- /dev/null +++ b/ThirdParty/boost/histogram/unsafe_access.hpp @@ -0,0 +1,118 @@ +// Copyright 2018 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_UNSAFE_ACCESS_HPP +#define BOOST_HISTOGRAM_UNSAFE_ACCESS_HPP + +#include <boost/histogram/detail/axes.hpp> +#include <type_traits> + +namespace boost { +namespace histogram { + +/** Unsafe read/write access to private data that potentially breaks consistency. + + This struct enables access to private data of some classes. It is intended for library + developers who need this to implement algorithms efficiently, for example, + serialization. Users should not use this. If you are a user who absolutely needs this to + get a specific effect, please submit an issue on Github. Perhaps the public + interface is insufficient and should be extended for your use case. + + Unlike the normal interface, the unsafe_access interface may change between versions. + If your code relies on unsafe_access, it may or may not break when you update Boost. + This is another reason to not use it unless you are ok with these conditions. +*/ +struct unsafe_access { + /** + Get axes. + @param hist histogram. + */ + template <class Histogram> + static auto& axes(Histogram& hist) { + return hist.axes_; + } + + /// @copydoc axes() + template <class Histogram> + static const auto& axes(const Histogram& hist) { + return hist.axes_; + } + + /** + Get mutable axis reference with compile-time number. + @param hist histogram. + @tparam I axis index (optional, default: 0). + */ + template <class Histogram, unsigned I = 0> + static decltype(auto) axis(Histogram& hist, std::integral_constant<unsigned, I> = {}) { + detail::axis_index_is_valid(hist.axes_, I); + return detail::axis_get<I>(hist.axes_); + } + + /** + Get mutable axis reference with run-time number. + @param hist histogram. + @param i axis index. + */ + template <class Histogram> + static decltype(auto) axis(Histogram& hist, unsigned i) { + detail::axis_index_is_valid(hist.axes_, i); + return detail::axis_get(hist.axes_, i); + } + + /** + Get storage. + @param hist histogram. + */ + template <class Histogram> + static auto& storage(Histogram& hist) { + return hist.storage_; + } + + /// @copydoc storage() + template <class Histogram> + static const auto& storage(const Histogram& hist) { + return hist.storage_; + } + + /** + Get index offset. + @param hist histogram + */ + template <class Histogram> + static auto& offset(Histogram& hist) { + return hist.offset_; + } + + /// @copydoc offset() + template <class Histogram> + static const auto& offset(const Histogram& hist) { + return hist.offset_; + } + + /** + Get buffer of unlimited_storage. + @param storage instance of unlimited_storage. + */ + template <class Allocator> + static constexpr auto& unlimited_storage_buffer(unlimited_storage<Allocator>& storage) { + return storage.buffer_; + } + + /** + Get implementation of storage_adaptor. + @param storage instance of storage_adaptor. + */ + template <class T> + static constexpr auto& storage_adaptor_impl(storage_adaptor<T>& storage) { + return static_cast<typename storage_adaptor<T>::impl_type&>(storage); + } +}; + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/histogram/weight.hpp b/ThirdParty/boost/histogram/weight.hpp new file mode 100644 index 0000000000000000000000000000000000000000..63efab1899158caedda24f36f6750a0f0b5d905a --- /dev/null +++ b/ThirdParty/boost/histogram/weight.hpp @@ -0,0 +1,45 @@ +// Copyright 2019 Hans Dembinski +// +// 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) + +#ifndef BOOST_HISTOGRAM_WEIGHT_HPP +#define BOOST_HISTOGRAM_WEIGHT_HPP + +#include <utility> + +namespace boost { +namespace histogram { + +/** Weight holder and type envelope. + + You should not construct these directly, use the weight() helper function. + + @tparam Underlying arithmetic type. +*/ +template <class T> +struct weight_type { + /// Access underlying value. + T value; + + /// Allow implicit conversions of types when the underlying value type allows them. + template <class U> + operator weight_type<U>() const { + return weight_type<U>{static_cast<U>(value)}; + } +}; + +/** Helper function to mark argument as weight. + + @param t argument to be forward to the histogram. +*/ +template <class T> +auto weight(T&& t) noexcept { + return weight_type<T>{std::forward<T>(t)}; +} + +} // namespace histogram +} // namespace boost + +#endif diff --git a/ThirdParty/boost/implicit_cast.hpp b/ThirdParty/boost/implicit_cast.hpp index d82db7628ee9616601dc0d1f0b97deafbff1d308..03abe1d495e9b1f0301ba06e04234334e7ed8fbe 100644 --- a/ThirdParty/boost/implicit_cast.hpp +++ b/ThirdParty/boost/implicit_cast.hpp @@ -2,8 +2,9 @@ // 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) -#ifndef IMPLICIT_CAST_DWA200356_HPP -# define IMPLICIT_CAST_DWA200356_HPP + +#ifndef BOOST_IMPLICIT_CAST_DWA200356_HPP +#define BOOST_IMPLICIT_CAST_DWA200356_HPP namespace boost { @@ -26,11 +27,7 @@ inline T implicit_cast (typename boost::detail::icast_identity<T>::type x) { return x; } -// incomplete return type now is here -//template <typename T> -//void implicit_cast (...); - } // namespace boost -#endif // IMPLICIT_CAST_DWA200356_HPP +#endif // BOOST_IMPLICIT_CAST_DWA200356_HPP diff --git a/ThirdParty/boost/intrusive/detail/workaround.hpp b/ThirdParty/boost/intrusive/detail/workaround.hpp index a9e157077a0a41b259cc79769e2c65a701f2a54f..f0cfaf2b2d576bf8e5714d9c21512b731f11bbba 100644 --- a/ThirdParty/boost/intrusive/detail/workaround.hpp +++ b/ThirdParty/boost/intrusive/detail/workaround.hpp @@ -23,6 +23,11 @@ #include <boost/config.hpp> #endif +// MSVC-12 ICEs when variadic templates are enabled. +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && (!defined(BOOST_MSVC) || BOOST_MSVC >= 1900) + #define BOOST_INTRUSIVE_VARIADIC_TEMPLATES +#endif + #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #define BOOST_INTRUSIVE_PERFECT_FORWARDING #endif diff --git a/ThirdParty/boost/intrusive/pack_options.hpp b/ThirdParty/boost/intrusive/pack_options.hpp index 944243f661c11c810a0fd677b2ef2c9b37032671..ff07678ffffe4b79b7918456bf8300cabe61a59b 100644 --- a/ThirdParty/boost/intrusive/pack_options.hpp +++ b/ThirdParty/boost/intrusive/pack_options.hpp @@ -209,6 +209,12 @@ struct do_pack<typelist<Prev, Last> > typedef typename Prev::template pack<Last> type; }; +template<class ...Others> +struct do_pack<typelist<void, Others...> > +{ + typedef typename do_pack<typelist<Others...> >::type type; +}; + template<class Prev, class ...Others> struct do_pack<typelist<Prev, Others...> > { diff --git a/ThirdParty/boost/io/detail/buffer_fill.hpp b/ThirdParty/boost/io/detail/buffer_fill.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b25a884473a38086d7dfdb44aba07f8a9807b2d2 --- /dev/null +++ b/ThirdParty/boost/io/detail/buffer_fill.hpp @@ -0,0 +1,39 @@ +/* +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_DETAIL_BUFFER_FILL_HPP +#define BOOST_IO_DETAIL_BUFFER_FILL_HPP + +#include <iosfwd> +#include <cstddef> + +namespace boost { +namespace io { +namespace detail { + +template<class charT, class traits> +inline bool +buffer_fill(std::basic_streambuf<charT, traits>& buf, charT ch, + std::size_t size) +{ + charT fill[] = { ch, ch, ch, ch, ch, ch, ch, ch }; + enum { + chunk = sizeof fill / sizeof(charT) + }; + for (; size > chunk; size -= chunk) { + if (static_cast<std::size_t>(buf.sputn(fill, chunk)) != chunk) { + return false; + } + } + return static_cast<std::size_t>(buf.sputn(fill, size)) == size; +} + +} /* detail */ +} /* io */ +} /* boost */ + +#endif diff --git a/ThirdParty/boost/io/detail/ostream_guard.hpp b/ThirdParty/boost/io/detail/ostream_guard.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6999d8134482edff95df6463ba7494e6068e056c --- /dev/null +++ b/ThirdParty/boost/io/detail/ostream_guard.hpp @@ -0,0 +1,45 @@ +/* +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_DETAIL_OSTREAM_GUARD_HPP +#define BOOST_IO_DETAIL_OSTREAM_GUARD_HPP + +#include <boost/config.hpp> +#include <iosfwd> + +namespace boost { +namespace io { +namespace detail { + +template<class Char, class Traits> +class ostream_guard { +public: + explicit ostream_guard(std::basic_ostream<Char, Traits>& os) BOOST_NOEXCEPT + : os_(&os) { } + + ~ostream_guard() BOOST_NOEXCEPT_IF(false) { + if (os_) { + os_->setstate(std::basic_ostream<Char, Traits>::badbit); + } + } + + void release() BOOST_NOEXCEPT { + os_ = 0; + } + +private: + ostream_guard(const ostream_guard&); + ostream_guard& operator=(const ostream_guard&); + + std::basic_ostream<Char, Traits>* os_; +}; + +} /* detail */ +} /* io */ +} /* boost */ + +#endif diff --git a/ThirdParty/boost/io/detail/quoted_manip.hpp b/ThirdParty/boost/io/detail/quoted_manip.hpp deleted file mode 100644 index 502f422aa1af66306bd2b6477db294c7fae02213..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/io/detail/quoted_manip.hpp +++ /dev/null @@ -1,190 +0,0 @@ -// boost/io/quoted_manip.hpp ---------------------------------------------------------// - -// Copyright Beman Dawes 2010 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page http://www.boost.org/libs/io - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_IO_QUOTED_MANIP -#define BOOST_IO_QUOTED_MANIP - -#include <iosfwd> -#include <ios> -#include <string> -#include <iterator> -#include <boost/io/ios_state.hpp> - -namespace boost -{ - namespace io - { - namespace detail { template <class String, class Char> struct quoted_proxy; } - - // ------------ public interface ------------------------------------------------// - - // manipulator for const std::basic_string& - template <class Char, class Traits, class Alloc> - detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char> - quoted(const std::basic_string<Char, Traits, Alloc>& s, - Char escape='\\', Char delim='\"'); - - // manipulator for non-const std::basic_string& - template <class Char, class Traits, class Alloc> - detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> &, Char> - quoted(std::basic_string<Char, Traits, Alloc>& s, - Char escape='\\', Char delim='\"'); - - // manipulator for const C-string* - template <class Char> - detail::quoted_proxy<const Char*, Char> - quoted(const Char* s, Char escape='\\', Char delim='\"'); - - // ----------- implementation details -------------------------------------------// - - namespace detail - { - // proxy used as an argument pack - template <class String, class Char> - struct quoted_proxy - { - String string; - Char escape; - Char delim; - - quoted_proxy(String s_, Char escape_, Char delim_) - : string(s_), escape(escape_), delim(delim_) {} - private: - // String may be a const type, so disable the assignment operator - quoted_proxy& operator=(const quoted_proxy&); // = deleted - }; - - // abstract away difference between proxies with const or non-const basic_strings - template <class Char, class Traits, class Alloc> - std::basic_ostream<Char, Traits>& - basic_string_inserter_imp(std::basic_ostream<Char, Traits>& os, - std::basic_string<Char, Traits, Alloc> const & string, Char escape, Char delim) - { - os << delim; - typename std::basic_string<Char, Traits, Alloc>::const_iterator - end_it = string.end(); - for (typename std::basic_string<Char, Traits, Alloc>::const_iterator - it = string.begin(); - it != end_it; - ++it ) - { - if (*it == delim || *it == escape) - os << escape; - os << *it; - } - os << delim; - return os; - } - - // inserter for const std::basic_string& proxies - template <class Char, class Traits, class Alloc> - inline - std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, - const quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char>& proxy) - { - return basic_string_inserter_imp(os, proxy.string, proxy.escape, proxy.delim); - } - - // inserter for non-const std::basic_string& proxies - template <class Char, class Traits, class Alloc> - inline - std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, - const quoted_proxy<std::basic_string<Char, Traits, Alloc>&, Char>& proxy) - { - return basic_string_inserter_imp(os, proxy.string, proxy.escape, proxy.delim); - } - - // inserter for const C-string* proxies - template <class Char, class Traits> - std::basic_ostream<Char, Traits>& operator<<(std::basic_ostream<Char, Traits>& os, - const quoted_proxy<const Char*, Char>& proxy) - { - os << proxy.delim; - for (const Char* it = proxy.string; - *it; - ++it ) - { - if (*it == proxy.delim || *it == proxy.escape) - os << proxy.escape; - os << *it; - } - os << proxy.delim; - return os; - } - - // extractor for non-const std::basic_string& proxies - template <class Char, class Traits, class Alloc> - std::basic_istream<Char, Traits>& operator>>(std::basic_istream<Char, Traits>& is, - const quoted_proxy<std::basic_string<Char, Traits, Alloc>&, Char>& proxy) - { - proxy.string.clear(); - Char c; - is >> c; - if (c != proxy.delim) - { - is.unget(); - is >> proxy.string; - return is; - } - { - boost::io::ios_flags_saver ifs(is); - is >> std::noskipws; - for (;;) - { - is >> c; - if (!is.good()) // cope with I/O errors or end-of-file - break; - if (c == proxy.escape) - { - is >> c; - if (!is.good()) // cope with I/O errors or end-of-file - break; - } - else if (c == proxy.delim) - break; - proxy.string += c; - } - } - return is; - } - - } // namespace detail - - // manipulator implementation for const std::basic_string& - template <class Char, class Traits, class Alloc> - inline detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char> - quoted(const std::basic_string<Char, Traits, Alloc>& s, Char escape, Char delim) - { - return detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> const &, Char> - (s, escape, delim); - } - - // manipulator implementation for non-const std::basic_string& - template <class Char, class Traits, class Alloc> - inline detail::quoted_proxy<std::basic_string<Char, Traits, Alloc> &, Char> - quoted(std::basic_string<Char, Traits, Alloc>& s, Char escape, Char delim) - { - return detail::quoted_proxy<std::basic_string<Char, Traits, Alloc>&, Char> - (s, escape, delim); - } - - // manipulator implementation for const C-string* - template <class Char> - inline detail::quoted_proxy<const Char*, Char> - quoted(const Char* s, Char escape, Char delim) - { - return detail::quoted_proxy<const Char*, Char> (s, escape, delim); - } - - } // namespace io -} // namespace boost - -#endif // BOOST_IO_QUOTED_MANIP diff --git a/ThirdParty/boost/io/ios_state.hpp b/ThirdParty/boost/io/ios_state.hpp index 07cfb345ff517348b2d07679d143a360c59ad593..632a12202d2f36aaf32cda3eac9b4467e1e8aff0 100644 --- a/ThirdParty/boost/io/ios_state.hpp +++ b/ThirdParty/boost/io/ios_state.hpp @@ -1,439 +1,485 @@ -// Boost io/ios_state.hpp header file --------------------------------------// - -// Copyright 2002, 2005 Daryle Walker. Use, modification, and distribution -// are subject to the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) - -// See <http://www.boost.org/libs/io/> for the library's home page. +/* +Copyright 2002, 2005 Daryle Walker +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ #ifndef BOOST_IO_IOS_STATE_HPP #define BOOST_IO_IOS_STATE_HPP -#include <boost/io_fwd.hpp> // self include -#include <boost/detail/workaround.hpp> - -#include <ios> // for std::ios_base, std::basic_ios, etc. +#include <boost/config.hpp> +#include <boost/io_fwd.hpp> +#include <ios> #ifndef BOOST_NO_STD_LOCALE -#include <locale> // for std::locale +#include <locale> #endif -#include <ostream> // for std::basic_ostream -#include <streambuf> // for std::basic_streambuf -#include <string> // for std::char_traits +#include <ostream> +#include <streambuf> +#include <string> +namespace boost { +namespace io { -namespace boost -{ -namespace io -{ - +class ios_flags_saver { +public: + typedef std::ios_base state_type; + typedef std::ios_base::fmtflags aspect_type; -// Basic stream state saver class declarations -----------------------------// + explicit ios_flags_saver(state_type& s) + : s_save_(s) + , a_save_(s.flags()) { } -class ios_flags_saver -{ -public: - typedef ::std::ios_base state_type; - typedef ::std::ios_base::fmtflags aspect_type; + ios_flags_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.flags(a)) { } - explicit ios_flags_saver( state_type &s ) - : s_save_( s ), a_save_( s.flags() ) - {} - ios_flags_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.flags(a) ) - {} - ~ios_flags_saver() - { this->restore(); } + ~ios_flags_saver() { + this->restore(); + } - void restore() - { s_save_.flags( a_save_ ); } + void restore() { + s_save_.flags(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; - + ios_flags_saver(const ios_flags_saver&); ios_flags_saver& operator=(const ios_flags_saver&); + + state_type& s_save_; + aspect_type a_save_; }; -class ios_precision_saver -{ +class ios_precision_saver { public: - typedef ::std::ios_base state_type; - typedef ::std::streamsize aspect_type; + typedef std::ios_base state_type; + typedef std::streamsize aspect_type; - explicit ios_precision_saver( state_type &s ) - : s_save_( s ), a_save_( s.precision() ) - {} - ios_precision_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.precision(a) ) - {} - ~ios_precision_saver() - { this->restore(); } + explicit ios_precision_saver(state_type& s) + : s_save_(s) + , a_save_(s.precision()) { } - void restore() - { s_save_.precision( a_save_ ); } + ios_precision_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.precision(a)) { } -private: - state_type & s_save_; - aspect_type const a_save_; + ~ios_precision_saver() { + this->restore(); + } + void restore() { + s_save_.precision(a_save_); + } + +private: + ios_precision_saver(const ios_precision_saver&); ios_precision_saver& operator=(const ios_precision_saver&); + + state_type& s_save_; + aspect_type a_save_; }; -class ios_width_saver -{ +class ios_width_saver { public: - typedef ::std::ios_base state_type; - typedef ::std::streamsize aspect_type; + typedef std::ios_base state_type; + typedef std::streamsize aspect_type; + + explicit ios_width_saver(state_type& s) + : s_save_(s) + , a_save_(s.width()) { } - explicit ios_width_saver( state_type &s ) - : s_save_( s ), a_save_( s.width() ) - {} - ios_width_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.width(a) ) - {} - ~ios_width_saver() - { this->restore(); } + ios_width_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.width(a)) { } - void restore() - { s_save_.width( a_save_ ); } + ~ios_width_saver() { + this->restore(); + } + + void restore() { + s_save_.width(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + ios_width_saver(const ios_width_saver&); ios_width_saver& operator=(const ios_width_saver&); + + state_type& s_save_; + aspect_type a_save_; }; +template<class Ch, class Tr> +class basic_ios_iostate_saver { +public: + typedef std::basic_ios<Ch, Tr> state_type; + typedef std::ios_base::iostate aspect_type; -// Advanced stream state saver class template declarations -----------------// + explicit basic_ios_iostate_saver(state_type& s) + : s_save_(s) + , a_save_(s.rdstate()) { } -template < typename Ch, class Tr > -class basic_ios_iostate_saver -{ -public: - typedef ::std::basic_ios<Ch, Tr> state_type; - typedef ::std::ios_base::iostate aspect_type; + basic_ios_iostate_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.rdstate()) { + s.clear(a); + } - explicit basic_ios_iostate_saver( state_type &s ) - : s_save_( s ), a_save_( s.rdstate() ) - {} - basic_ios_iostate_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.rdstate() ) - { s.clear(a); } - ~basic_ios_iostate_saver() - { this->restore(); } + ~basic_ios_iostate_saver() { + this->restore(); + } - void restore() - { s_save_.clear( a_save_ ); } + void restore() { + s_save_.clear(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + basic_ios_iostate_saver(const basic_ios_iostate_saver&); basic_ios_iostate_saver& operator=(const basic_ios_iostate_saver&); + + state_type& s_save_; + aspect_type a_save_; }; -template < typename Ch, class Tr > -class basic_ios_exception_saver -{ +template<class Ch, class Tr> +class basic_ios_exception_saver { public: - typedef ::std::basic_ios<Ch, Tr> state_type; - typedef ::std::ios_base::iostate aspect_type; - - explicit basic_ios_exception_saver( state_type &s ) - : s_save_( s ), a_save_( s.exceptions() ) - {} -#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) - basic_ios_exception_saver( state_type &s, aspect_type a ) -#else - basic_ios_exception_saver( state_type &s, aspect_type const &a ) -#endif - : s_save_( s ), a_save_( s.exceptions() ) - { s.exceptions(a); } - ~basic_ios_exception_saver() - { this->restore(); } + typedef std::basic_ios<Ch, Tr> state_type; + typedef std::ios_base::iostate aspect_type; + + explicit basic_ios_exception_saver(state_type& s) + : s_save_(s) + , a_save_(s.exceptions()) { } - void restore() - { s_save_.exceptions( a_save_ ); } + basic_ios_exception_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.exceptions()) { + s.exceptions(a); + } + + ~basic_ios_exception_saver() { + this->restore(); + } + + void restore() { + s_save_.exceptions(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + basic_ios_exception_saver(const basic_ios_exception_saver&); basic_ios_exception_saver& operator=(const basic_ios_exception_saver&); + + state_type& s_save_; + aspect_type a_save_; }; -template < typename Ch, class Tr > -class basic_ios_tie_saver -{ +template<class Ch, class Tr> +class basic_ios_tie_saver { public: - typedef ::std::basic_ios<Ch, Tr> state_type; - typedef ::std::basic_ostream<Ch, Tr> * aspect_type; + typedef std::basic_ios<Ch, Tr> state_type; + typedef std::basic_ostream<Ch, Tr>* aspect_type; - explicit basic_ios_tie_saver( state_type &s ) - : s_save_( s ), a_save_( s.tie() ) - {} - basic_ios_tie_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.tie(a) ) - {} - ~basic_ios_tie_saver() - { this->restore(); } + explicit basic_ios_tie_saver(state_type& s) + : s_save_(s) + , a_save_(s.tie()) { } - void restore() - { s_save_.tie( a_save_ ); } + basic_ios_tie_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.tie(a)) { } + + ~basic_ios_tie_saver() { + this->restore(); + } + + void restore() { + s_save_.tie(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + basic_ios_tie_saver(const basic_ios_tie_saver&); basic_ios_tie_saver& operator=(const basic_ios_tie_saver&); + + state_type& s_save_; + aspect_type a_save_; }; -template < typename Ch, class Tr > -class basic_ios_rdbuf_saver -{ +template<class Ch, class Tr> +class basic_ios_rdbuf_saver { public: - typedef ::std::basic_ios<Ch, Tr> state_type; - typedef ::std::basic_streambuf<Ch, Tr> * aspect_type; + typedef std::basic_ios<Ch, Tr> state_type; + typedef std::basic_streambuf<Ch, Tr>* aspect_type; - explicit basic_ios_rdbuf_saver( state_type &s ) - : s_save_( s ), a_save_( s.rdbuf() ) - {} - basic_ios_rdbuf_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.rdbuf(a) ) - {} - ~basic_ios_rdbuf_saver() - { this->restore(); } + explicit basic_ios_rdbuf_saver(state_type& s) + : s_save_(s) + , a_save_(s.rdbuf()) { } - void restore() - { s_save_.rdbuf( a_save_ ); } + basic_ios_rdbuf_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.rdbuf(a)) { } + + ~basic_ios_rdbuf_saver() { + this->restore(); + } + + void restore() { + s_save_.rdbuf(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + basic_ios_rdbuf_saver(const basic_ios_rdbuf_saver&); basic_ios_rdbuf_saver& operator=(const basic_ios_rdbuf_saver&); + + state_type& s_save_; + aspect_type a_save_; }; -template < typename Ch, class Tr > -class basic_ios_fill_saver -{ +template<class Ch, class Tr> +class basic_ios_fill_saver { public: - typedef ::std::basic_ios<Ch, Tr> state_type; - typedef typename state_type::char_type aspect_type; + typedef std::basic_ios<Ch, Tr> state_type; + typedef typename state_type::char_type aspect_type; + + explicit basic_ios_fill_saver(state_type& s) + : s_save_(s) + , a_save_(s.fill()) { } - explicit basic_ios_fill_saver( state_type &s ) - : s_save_( s ), a_save_( s.fill() ) - {} - basic_ios_fill_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.fill(a) ) - {} - ~basic_ios_fill_saver() - { this->restore(); } + basic_ios_fill_saver(state_type& s, aspect_type a) + : s_save_(s) + , a_save_(s.fill(a)) { } - void restore() - { s_save_.fill( a_save_ ); } + ~basic_ios_fill_saver() { + this->restore(); + } + + void restore() { + s_save_.fill(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + basic_ios_fill_saver(const basic_ios_fill_saver&); basic_ios_fill_saver& operator=(const basic_ios_fill_saver&); + + state_type& s_save_; + aspect_type a_save_; }; #ifndef BOOST_NO_STD_LOCALE -template < typename Ch, class Tr > -class basic_ios_locale_saver -{ +template<class Ch, class Tr> +class basic_ios_locale_saver { public: - typedef ::std::basic_ios<Ch, Tr> state_type; - typedef ::std::locale aspect_type; + typedef std::basic_ios<Ch, Tr> state_type; + typedef std::locale aspect_type; + + explicit basic_ios_locale_saver(state_type& s) + : s_save_(s) + , a_save_(s.getloc()) { } + + basic_ios_locale_saver(state_type& s, const aspect_type& a) + : s_save_(s) + , a_save_(s.imbue(a)) { } - explicit basic_ios_locale_saver( state_type &s ) - : s_save_( s ), a_save_( s.getloc() ) - {} - basic_ios_locale_saver( state_type &s, aspect_type const &a ) - : s_save_( s ), a_save_( s.imbue(a) ) - {} - ~basic_ios_locale_saver() - { this->restore(); } + ~basic_ios_locale_saver() { + this->restore(); + } - void restore() - { s_save_.imbue( a_save_ ); } + void restore() { + s_save_.imbue(a_save_); + } private: - state_type & s_save_; - aspect_type const a_save_; + basic_ios_locale_saver(const basic_ios_locale_saver&); basic_ios_locale_saver& operator=(const basic_ios_locale_saver&); + + state_type& s_save_; + aspect_type a_save_; }; #endif +class ios_iword_saver { +public: + typedef std::ios_base state_type; + typedef int index_type; + typedef long aspect_type; + + explicit ios_iword_saver(state_type& s, index_type i) + : s_save_(s) + , a_save_(s.iword(i)) + , i_save_(i) { } + + ios_iword_saver(state_type& s, index_type i, aspect_type a) + : s_save_(s) + , a_save_(s.iword(i)) + , i_save_(i) { + s.iword(i) = a; + } -// User-defined stream state saver class declarations ----------------------// + ~ios_iword_saver() { + this->restore(); + } -class ios_iword_saver -{ -public: - typedef ::std::ios_base state_type; - typedef int index_type; - typedef long aspect_type; - - explicit ios_iword_saver( state_type &s, index_type i ) - : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) - {} - ios_iword_saver( state_type &s, index_type i, aspect_type const &a ) - : s_save_( s ), a_save_( s.iword(i) ), i_save_( i ) - { s.iword(i) = a; } - ~ios_iword_saver() - { this->restore(); } - - void restore() - { s_save_.iword( i_save_ ) = a_save_; } + void restore() { + s_save_.iword(i_save_) = a_save_; + } private: - state_type & s_save_; - aspect_type const a_save_; - index_type const i_save_; - + ios_iword_saver(const ios_iword_saver&); ios_iword_saver& operator=(const ios_iword_saver&); + + state_type& s_save_; + aspect_type a_save_; + index_type i_save_; }; -class ios_pword_saver -{ +class ios_pword_saver { public: - typedef ::std::ios_base state_type; - typedef int index_type; - typedef void * aspect_type; - - explicit ios_pword_saver( state_type &s, index_type i ) - : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) - {} - ios_pword_saver( state_type &s, index_type i, aspect_type const &a ) - : s_save_( s ), a_save_( s.pword(i) ), i_save_( i ) - { s.pword(i) = a; } - ~ios_pword_saver() - { this->restore(); } - - void restore() - { s_save_.pword( i_save_ ) = a_save_; } + typedef std::ios_base state_type; + typedef int index_type; + typedef void* aspect_type; + + explicit ios_pword_saver(state_type& s, index_type i) + : s_save_(s) + , a_save_(s.pword(i)) + , i_save_(i) { } + + ios_pword_saver(state_type& s, index_type i, aspect_type a) + : s_save_(s) + , a_save_(s.pword(i)) + , i_save_(i) { + s.pword(i) = a; + } -private: - state_type & s_save_; - aspect_type const a_save_; - index_type const i_save_; + ~ios_pword_saver() { + this->restore(); + } - ios_pword_saver operator=(const ios_pword_saver&); -}; + void restore() { + s_save_.pword(i_save_) = a_save_; + } +private: + ios_pword_saver(const ios_pword_saver&); + ios_pword_saver operator=(const ios_pword_saver&); -// Combined stream state saver class (template) declarations ---------------// + state_type& s_save_; + aspect_type a_save_; + index_type i_save_; +}; -class ios_base_all_saver -{ +class ios_base_all_saver { public: - typedef ::std::ios_base state_type; + typedef std::ios_base state_type; - explicit ios_base_all_saver( state_type &s ) - : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) - , a3_save_( s.width() ) - {} + explicit ios_base_all_saver(state_type& s) + : s_save_(s) + , a1_save_(s.flags()) + , a2_save_(s.precision()) + , a3_save_(s.width()) { } - ~ios_base_all_saver() - { this->restore(); } + ~ios_base_all_saver() { + this->restore(); + } - void restore() - { - s_save_.width( a3_save_ ); - s_save_.precision( a2_save_ ); - s_save_.flags( a1_save_ ); + void restore() { + s_save_.width(a3_save_); + s_save_.precision(a2_save_); + s_save_.flags(a1_save_); } private: - state_type & s_save_; - state_type::fmtflags const a1_save_; - ::std::streamsize const a2_save_; - ::std::streamsize const a3_save_; - + ios_base_all_saver(const ios_base_all_saver&); ios_base_all_saver& operator=(const ios_base_all_saver&); + + state_type& s_save_; + state_type::fmtflags a1_save_; + std::streamsize a2_save_; + std::streamsize a3_save_; }; -template < typename Ch, class Tr > -class basic_ios_all_saver -{ +template<class Ch, class Tr> +class basic_ios_all_saver { public: - typedef ::std::basic_ios<Ch, Tr> state_type; - - explicit basic_ios_all_saver( state_type &s ) - : s_save_( s ), a1_save_( s.flags() ), a2_save_( s.precision() ) - , a3_save_( s.width() ), a4_save_( s.rdstate() ) - , a5_save_( s.exceptions() ), a6_save_( s.tie() ) - , a7_save_( s.rdbuf() ), a8_save_( s.fill() ) - #ifndef BOOST_NO_STD_LOCALE - , a9_save_( s.getloc() ) - #endif - {} - - ~basic_ios_all_saver() - { this->restore(); } - - void restore() - { - #ifndef BOOST_NO_STD_LOCALE - s_save_.imbue( a9_save_ ); - #endif - s_save_.fill( a8_save_ ); - s_save_.rdbuf( a7_save_ ); - s_save_.tie( a6_save_ ); - s_save_.exceptions( a5_save_ ); - s_save_.clear( a4_save_ ); - s_save_.width( a3_save_ ); - s_save_.precision( a2_save_ ); - s_save_.flags( a1_save_ ); + typedef std::basic_ios<Ch, Tr> state_type; + + explicit basic_ios_all_saver(state_type& s) + : s_save_(s) + , a1_save_(s.flags()) + , a2_save_(s.precision()) + , a3_save_(s.width()) + , a4_save_(s.rdstate()) + , a5_save_(s.exceptions()) + , a6_save_(s.tie()) + , a7_save_(s.rdbuf()) + , a8_save_(s.fill()) +#ifndef BOOST_NO_STD_LOCALE + , a9_save_(s.getloc()) +#endif + { } + + ~basic_ios_all_saver() { + this->restore(); } -private: - state_type & s_save_; - typename state_type::fmtflags const a1_save_; - ::std::streamsize const a2_save_; - ::std::streamsize const a3_save_; - typename state_type::iostate const a4_save_; - typename state_type::iostate const a5_save_; - ::std::basic_ostream<Ch, Tr> * const a6_save_; - ::std::basic_streambuf<Ch, Tr> * const a7_save_; - typename state_type::char_type const a8_save_; - #ifndef BOOST_NO_STD_LOCALE - ::std::locale const a9_save_; - #endif + void restore() { +#ifndef BOOST_NO_STD_LOCALE + s_save_.imbue(a9_save_); +#endif + s_save_.fill(a8_save_); + s_save_.rdbuf(a7_save_); + s_save_.tie(a6_save_); + s_save_.exceptions(a5_save_); + s_save_.clear(a4_save_); + s_save_.width(a3_save_); + s_save_.precision(a2_save_); + s_save_.flags(a1_save_); + } +private: + basic_ios_all_saver(const basic_ios_all_saver&); basic_ios_all_saver& operator=(const basic_ios_all_saver&); + + state_type& s_save_; + typename state_type::fmtflags a1_save_; + std::streamsize a2_save_; + std::streamsize a3_save_; + typename state_type::iostate a4_save_; + typename state_type::iostate a5_save_; + std::basic_ostream<Ch, Tr>* a6_save_; + std::basic_streambuf<Ch, Tr>* a7_save_; + typename state_type::char_type a8_save_; +#ifndef BOOST_NO_STD_LOCALE + std::locale a9_save_; +#endif }; -class ios_all_word_saver -{ +class ios_all_word_saver { public: - typedef ::std::ios_base state_type; - typedef int index_type; + typedef std::ios_base state_type; + typedef int index_type; - ios_all_word_saver( state_type &s, index_type i ) - : s_save_( s ), i_save_( i ), a1_save_( s.iword(i) ) - , a2_save_( s.pword(i) ) - {} + ios_all_word_saver(state_type& s, index_type i) + : s_save_(s) + , i_save_(i) + , a1_save_(s.iword(i)) + , a2_save_(s.pword(i)) { } - ~ios_all_word_saver() - { this->restore(); } + ~ios_all_word_saver() { + this->restore(); + } - void restore() - { - s_save_.pword( i_save_ ) = a2_save_; - s_save_.iword( i_save_ ) = a1_save_; + void restore() { + s_save_.pword(i_save_) = a2_save_; + s_save_.iword(i_save_) = a1_save_; } private: - state_type & s_save_; - index_type const i_save_; - long const a1_save_; - void * const a2_save_; - + ios_all_word_saver(const ios_all_word_saver&); ios_all_word_saver& operator=(const ios_all_word_saver&); -}; - -} // namespace io -} // namespace boost + state_type& s_save_; + index_type i_save_; + long a1_save_; + void* a2_save_; +}; +} /* io */ +} /* boost */ -#endif // BOOST_IO_IOS_STATE_HPP +#endif diff --git a/ThirdParty/boost/io/quoted.hpp b/ThirdParty/boost/io/quoted.hpp new file mode 100644 index 0000000000000000000000000000000000000000..fc7d205e822adab4a9854132f837c38425d98d6d --- /dev/null +++ b/ThirdParty/boost/io/quoted.hpp @@ -0,0 +1,217 @@ +/* +Copyright 2010 Beman Dawes + +Copyright 2019-2020 Glen Joseph Fernandes +(glenjofe@gmail.com) + +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ +#ifndef BOOST_IO_QUOTED_HPP +#define BOOST_IO_QUOTED_HPP + +#include <boost/io/detail/buffer_fill.hpp> +#include <boost/io/detail/ostream_guard.hpp> +#include <boost/io/ios_state.hpp> + +namespace boost { +namespace io { +namespace detail { + +template<class String, class Char> +struct quoted_proxy { + String string; + Char escape; + Char delim; +}; + +template<class Char> +struct quoted_state { + const Char* string; + std::size_t size; + std::size_t count; +}; + +template<class Char> +inline quoted_state<Char> +quoted_start(const Char* string, Char escape, Char delim) +{ + const Char* end = string; + std::size_t count = 2; + for (Char ch; (ch = *end) != 0; ++end) { + count += 1 + (ch == escape || ch == delim); + } + quoted_state<Char> state = { string, + static_cast<std::size_t>(end - string), count }; + return state; +} + +template<class Char, class String> +inline quoted_state<Char> +quoted_start(const String* string, Char escape, Char delim) +{ + const Char* begin = string->data(); + std::size_t size = string->size(); + std::size_t count = 2; + for (const Char *it = begin, *end = begin + size; it != end; ++it) { + Char ch = *it; + count += 1 + (ch == escape || ch == delim); + } + quoted_state<Char> state = { begin, size, count }; + return state; +} + +template<class Char, class Traits> +inline bool +quoted_put(std::basic_streambuf<Char, Traits>& buf, const Char* string, + std::size_t size, std::size_t count, Char escape, Char delim) +{ + if (buf.sputc(delim) == Traits::eof()) { + return false; + } + if (size == count) { + if (static_cast<std::size_t>(buf.sputn(string, size)) != size) { + return false; + } + } else { + for (const Char* end = string + size; string != end; ++string) { + Char ch = *string; + if ((ch == escape || ch == delim) && + buf.sputc(escape) == Traits::eof()) { + return false; + } + if (buf.sputc(ch) == Traits::eof()) { + return false; + } + } + } + return buf.sputc(delim) != Traits::eof(); +} + +template<class Char, class Traits, class String> +inline std::basic_ostream<Char, Traits>& +quoted_out(std::basic_ostream<Char, Traits>& os, String* string, Char escape, + Char delim) +{ + typedef std::basic_ostream<Char, Traits> stream; + ostream_guard<Char, Traits> guard(os); + typename stream::sentry entry(os); + if (entry) { + quoted_state<Char> state = boost::io::detail::quoted_start(string, + escape, delim); + std::basic_streambuf<Char, Traits>& buf = *os.rdbuf(); + std::size_t width = static_cast<std::size_t>(os.width()); + if (width <= state.count) { + if (!boost::io::detail::quoted_put(buf, state.string, state.size, + state.count, escape, delim)) { + return os; + } + } else if ((os.flags() & stream::adjustfield) == stream::left) { + if (!boost::io::detail::quoted_put(buf, state.string, state.size, + state.count, escape, delim) || + !boost::io::detail::buffer_fill(buf, os.fill(), + width - state.count)) { + return os; + } + } else if (!boost::io::detail::buffer_fill(buf, os.fill(), + width - state.count) || + !boost::io::detail::quoted_put(buf, state.string, state.size, + state.count, escape, delim)) { + return os; + } + os.width(0); + } + guard.release(); + return os; +} + +template<class Char, class Traits> +inline std::basic_ostream<Char, Traits>& +operator<<(std::basic_ostream<Char, Traits>& os, + const quoted_proxy<const Char*, Char>& proxy) +{ + return boost::io::detail::quoted_out(os, proxy.string, proxy.escape, + proxy.delim); +} + +template <class Char, class Traits, class Alloc> +inline std::basic_ostream<Char, Traits>& +operator<<(std::basic_ostream<Char, Traits>& os, + const quoted_proxy<const std::basic_string<Char, Traits, Alloc>*, + Char>& proxy) +{ + return boost::io::detail::quoted_out(os, proxy.string, proxy.escape, + proxy.delim); +} + +template<class Char, class Traits, class Alloc> +inline std::basic_ostream<Char, Traits>& +operator<<(std::basic_ostream<Char, Traits>& os, + const quoted_proxy<std::basic_string<Char, Traits, Alloc>*, Char>& proxy) +{ + return boost::io::detail::quoted_out(os, proxy.string, proxy.escape, + proxy.delim); +} + +template<class Char, class Traits, class Alloc> +inline std::basic_istream<Char, Traits>& +operator>>(std::basic_istream<Char, Traits>& is, + const quoted_proxy<std::basic_string<Char, Traits, Alloc>*, Char>& proxy) +{ + Char ch; + if (!(is >> ch)) { + return is; + } + if (ch != proxy.delim) { + is.unget(); + return is >> *proxy.string; + } + { + boost::io::ios_flags_saver ifs(is); + std::noskipws(is); + proxy.string->clear(); + while ((is >> ch) && ch != proxy.delim) { + if (ch == proxy.escape && !(is >> ch)) { + break; + } + proxy.string->push_back(ch); + } + } + return is; +} + +} /* detail */ + +template<class Char, class Traits, class Alloc> +inline detail::quoted_proxy<const std::basic_string<Char, Traits, Alloc>*, + Char> +quoted(const std::basic_string<Char, Traits, Alloc>& s, Char escape='\\', + Char delim='\"') +{ + detail::quoted_proxy<const std::basic_string<Char, Traits, Alloc>*, + Char> proxy = { &s, escape, delim }; + return proxy; +} + +template<class Char, class Traits, class Alloc> +inline detail::quoted_proxy<std::basic_string<Char, Traits, Alloc>*, Char> +quoted(std::basic_string<Char, Traits, Alloc>& s, Char escape='\\', + Char delim='\"') +{ + detail::quoted_proxy<std::basic_string<Char, Traits, Alloc>*, + Char> proxy = { &s, escape, delim }; + return proxy; +} + +template<class Char> +inline detail::quoted_proxy<const Char*, Char> +quoted(const Char* s, Char escape='\\', Char delim='\"') +{ + detail::quoted_proxy<const Char*, Char> proxy = { s, escape, delim }; + return proxy; +} + +} /* io */ +} /* boost */ + +#endif diff --git a/ThirdParty/boost/io_fwd.hpp b/ThirdParty/boost/io_fwd.hpp index 417b81e3e12f2107f1cbda3047dad7d4cbacf77d..2594d4e8dd5d6dbbe507d932a4dacf346d916c92 100644 --- a/ThirdParty/boost/io_fwd.hpp +++ b/ThirdParty/boost/io_fwd.hpp @@ -1,67 +1,63 @@ -// Boost io_fwd.hpp header file --------------------------------------------// - -// Copyright 2002 Daryle Walker. Use, modification, and distribution are subject -// to the Boost Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or a copy at <http://www.boost.org/LICENSE_1_0.txt>.) - -// See <http://www.boost.org/libs/io/> for the library's home page. +/* +Copyright 2002 Daryle Walker +Distributed under the Boost Software License, Version 1.0. +(http://www.boost.org/LICENSE_1_0.txt) +*/ #ifndef BOOST_IO_FWD_HPP #define BOOST_IO_FWD_HPP -#include <iosfwd> // for std::char_traits (declaration) - - -namespace boost -{ -namespace io -{ +#include <iosfwd> - -// From <boost/io/ios_state.hpp> -------------------------------------------// +namespace boost { +namespace io { class ios_flags_saver; class ios_precision_saver; class ios_width_saver; class ios_base_all_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_iostate_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_exception_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_tie_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_rdbuf_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_fill_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_locale_saver; -template < typename Ch, class Tr = ::std::char_traits<Ch> > - class basic_ios_all_saver; +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_iostate_saver; + +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_exception_saver; + +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_tie_saver; -typedef basic_ios_iostate_saver<char> ios_iostate_saver; -typedef basic_ios_iostate_saver<wchar_t> wios_iostate_saver; -typedef basic_ios_exception_saver<char> ios_exception_saver; -typedef basic_ios_exception_saver<wchar_t> wios_exception_saver; -typedef basic_ios_tie_saver<char> ios_tie_saver; -typedef basic_ios_tie_saver<wchar_t> wios_tie_saver; -typedef basic_ios_rdbuf_saver<char> ios_rdbuf_saver; -typedef basic_ios_rdbuf_saver<wchar_t> wios_rdbuf_saver; -typedef basic_ios_fill_saver<char> ios_fill_saver; -typedef basic_ios_fill_saver<wchar_t> wios_fill_saver; -typedef basic_ios_locale_saver<char> ios_locale_saver; -typedef basic_ios_locale_saver<wchar_t> wios_locale_saver; -typedef basic_ios_all_saver<char> ios_all_saver; -typedef basic_ios_all_saver<wchar_t> wios_all_saver; +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_rdbuf_saver; + +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_fill_saver; + +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_locale_saver; + +template<class Ch, class Tr = std::char_traits<Ch> > +class basic_ios_all_saver; + +typedef basic_ios_iostate_saver<char> ios_iostate_saver; +typedef basic_ios_iostate_saver<wchar_t> wios_iostate_saver; +typedef basic_ios_exception_saver<char> ios_exception_saver; +typedef basic_ios_exception_saver<wchar_t> wios_exception_saver; +typedef basic_ios_tie_saver<char> ios_tie_saver; +typedef basic_ios_tie_saver<wchar_t> wios_tie_saver; +typedef basic_ios_rdbuf_saver<char> ios_rdbuf_saver; +typedef basic_ios_rdbuf_saver<wchar_t> wios_rdbuf_saver; +typedef basic_ios_fill_saver<char> ios_fill_saver; +typedef basic_ios_fill_saver<wchar_t> wios_fill_saver; +typedef basic_ios_locale_saver<char> ios_locale_saver; +typedef basic_ios_locale_saver<wchar_t> wios_locale_saver; +typedef basic_ios_all_saver<char> ios_all_saver; +typedef basic_ios_all_saver<wchar_t> wios_all_saver; class ios_iword_saver; class ios_pword_saver; class ios_all_word_saver; +} /* io */ +} /* boost */ -} // namespace io -} // namespace boost - - -#endif // BOOST_IO_FWD_HPP +#endif diff --git a/ThirdParty/boost/lexical_cast.hpp b/ThirdParty/boost/lexical_cast.hpp index e5d6fcf3cceaf1543653bcbf38e90ced0fb7abb7..174883c0fc5fc03dd48672ed2ac2e1731a8c86c3 100644 --- a/ThirdParty/boost/lexical_cast.hpp +++ b/ThirdParty/boost/lexical_cast.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/bad_lexical_cast.hpp b/ThirdParty/boost/lexical_cast/bad_lexical_cast.hpp index bf7b28acf0cf391ef80f38b41df69bd9efabb8ee..481c08a1aed7dcbbaa208314cd6eab98879966b2 100644 --- a/ThirdParty/boost/lexical_cast/bad_lexical_cast.hpp +++ b/ThirdParty/boost/lexical_cast/bad_lexical_cast.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -60,23 +60,30 @@ namespace boost {} #ifndef BOOST_NO_TYPEID + private: +#ifdef BOOST_NO_STD_TYPEINFO + typedef ::type_info type_info_t; +#else + typedef ::std::type_info type_info_t; +#endif + public: bad_lexical_cast( - const std::type_info &source_type_arg, - const std::type_info &target_type_arg) BOOST_NOEXCEPT + const type_info_t &source_type_arg, + const type_info_t &target_type_arg) BOOST_NOEXCEPT : source(&source_type_arg), target(&target_type_arg) {} - const std::type_info &source_type() const BOOST_NOEXCEPT { + const type_info_t &source_type() const BOOST_NOEXCEPT { return *source; } - const std::type_info &target_type() const BOOST_NOEXCEPT { + const type_info_t &target_type() const BOOST_NOEXCEPT { return *target; } private: - const std::type_info *source; - const std::type_info *target; + const type_info_t *source; + const type_info_t *target; #endif }; diff --git a/ThirdParty/boost/lexical_cast/detail/converter_lexical.hpp b/ThirdParty/boost/lexical_cast/detail/converter_lexical.hpp index 59c4c24f04dcddfef12c6b594100553cc625792b..92e35c88b906840eb698d0e40b59ef40e456289b 100644 --- a/ThirdParty/boost/lexical_cast/detail/converter_lexical.hpp +++ b/ThirdParty/boost/lexical_cast/detail/converter_lexical.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -59,7 +59,7 @@ namespace boost { { // Converts signed/unsigned char to char template < class Char > - struct normalize_single_byte_char + struct normalize_single_byte_char { typedef Char type; }; @@ -79,7 +79,7 @@ namespace boost { namespace detail // deduce_character_type_later<T> { - // Helper type, meaning that stram character for T must be deduced + // Helper type, meaning that stram character for T must be deduced // at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) template < class T > struct deduce_character_type_later {}; } @@ -116,7 +116,7 @@ namespace boost { Char, boost::detail::deduce_character_type_later< boost::iterator_range< Char* > > > {}; - + template < typename Char > struct stream_char_common< boost::iterator_range< const Char* > >: public boost::conditional< boost::detail::is_character< Char >::value, @@ -187,19 +187,19 @@ namespace boost { // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char<Char>. // Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) - template < class Char > + template < class Char > struct deduce_source_char_impl - { - typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type; + { + typedef BOOST_DEDUCED_TYPENAME boost::detail::normalize_single_byte_char< Char >::type type; }; - - template < class T > - struct deduce_source_char_impl< deduce_character_type_later< T > > + + template < class T > + struct deduce_source_char_impl< deduce_character_type_later< T > > { typedef boost::has_left_shift< std::basic_ostream< char >, T > result_t; #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), + BOOST_STATIC_ASSERT_MSG((result_t::value), "Source type is not std::ostream`able and std::wostream`s are not supported by your STL implementation"); typedef char type; #else @@ -207,7 +207,7 @@ namespace boost { result_t::value, char, wchar_t >::type type; - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_left_shift< std::basic_ostream< type >, T >::value), + BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_left_shift< std::basic_ostream< type >, T >::value), "Source type is neither std::ostream`able nor std::wostream`able"); #endif }; @@ -220,47 +220,47 @@ namespace boost { // Otherwise supplied type T is a character type, that must be normalized // using normalize_single_byte_char<Char>. // Executed at Stage 2 (See deduce_source_char<T> and deduce_target_char<T>) - template < class Char > - struct deduce_target_char_impl - { - typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type; + template < class Char > + struct deduce_target_char_impl + { + typedef BOOST_DEDUCED_TYPENAME normalize_single_byte_char< Char >::type type; }; - - template < class T > - struct deduce_target_char_impl< deduce_character_type_later<T> > - { + + template < class T > + struct deduce_target_char_impl< deduce_character_type_later<T> > + { typedef boost::has_right_shift<std::basic_istream<char>, T > result_t; #if defined(BOOST_LCAST_NO_WCHAR_T) - BOOST_STATIC_ASSERT_MSG((result_t::value), + BOOST_STATIC_ASSERT_MSG((result_t::value), "Target type is not std::istream`able and std::wistream`s are not supported by your STL implementation"); typedef char type; #else typedef BOOST_DEDUCED_TYPENAME boost::conditional< result_t::value, char, wchar_t >::type type; - - BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value), + + BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value), "Target type is neither std::istream`able nor std::wistream`able"); #endif }; - } + } namespace detail // deduce_target_char<T> and deduce_source_char<T> { // We deduce stream character types in two stages. // - // Stage 1 is common for Target and Source. At Stage 1 we get + // Stage 1 is common for Target and Source. At Stage 1 we get // non normalized character type (may contain unsigned/signed char) // or deduce_character_type_later<T> where T is the original type. // Stage 1 is executed by stream_char_common<T> // - // At Stage 2 we normalize character types or try to deduce character - // type using metafunctions. - // Stage 2 is executed by deduce_target_char_impl<T> and + // At Stage 2 we normalize character types or try to deduce character + // type using metafunctions. + // Stage 2 is executed by deduce_target_char_impl<T> and // deduce_source_char_impl<T> // - // deduce_target_char<T> and deduce_source_char<T> functions combine + // deduce_target_char<T> and deduce_source_char<T> functions combine // both stages template < class T > @@ -322,7 +322,7 @@ namespace boost { typedef const T * type; }; } - + namespace detail // lcast_src_length { // Return max. length of string representation of Source; @@ -368,7 +368,7 @@ namespace boost { // -1.23456789e-123456 // ^ sign // ^ leading digit - // ^ decimal point + // ^ decimal point // ^^^^^^^^ lcast_precision<Source>::value // ^ "e" // ^ exponent sign @@ -401,11 +401,11 @@ namespace boost { struct lexical_cast_stream_traits { typedef BOOST_DEDUCED_TYPENAME boost::detail::array_to_pointer_decay<Source>::type src; typedef BOOST_DEDUCED_TYPENAME boost::remove_cv<src>::type no_cv_src; - + typedef boost::detail::deduce_source_char<no_cv_src> deduce_src_char_metafunc; typedef BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::type src_char_t; typedef BOOST_DEDUCED_TYPENAME boost::detail::deduce_target_char<Target>::type target_char_t; - + typedef BOOST_DEDUCED_TYPENAME boost::detail::widest_char< target_char_t, src_char_t >::type char_type; @@ -426,33 +426,33 @@ namespace boost { BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits<char_type, Target>, BOOST_DEDUCED_TYPENAME boost::detail::extract_char_traits<char_type, no_cv_src> >::type::trait_t traits; - + typedef boost::integral_constant< bool, boost::is_same<char, src_char_t>::value && // source is not a wide character based type (sizeof(char) != sizeof(target_char_t)) && // target type is based on wide character (!(boost::detail::is_character<no_cv_src>::value)) - > is_string_widening_required_t; + > is_string_widening_required_t; typedef boost::integral_constant< bool, - !(boost::is_integral<no_cv_src>::value || + !(boost::is_integral<no_cv_src>::value || boost::detail::is_character< BOOST_DEDUCED_TYPENAME deduce_src_char_metafunc::stage1_type // if we did not get character type at stage1 >::value // then we have no optimization for that type - ) - > is_source_input_not_optimized_t; - + ) + > is_source_input_not_optimized_t; + // If we have an optimized conversion for // Source, we do not need to construct stringbuf. - BOOST_STATIC_CONSTANT(bool, requires_stringbuf = - (is_string_widening_required_t::value || is_source_input_not_optimized_t::value) + BOOST_STATIC_CONSTANT(bool, requires_stringbuf = + (is_string_widening_required_t::value || is_source_input_not_optimized_t::value) ); - + typedef boost::detail::lcast_src_length<no_cv_src> len_t; }; } - + namespace detail { template<typename Target, typename Source> diff --git a/ThirdParty/boost/lexical_cast/detail/converter_lexical_streams.hpp b/ThirdParty/boost/lexical_cast/detail/converter_lexical_streams.hpp index 2906846a96ce28e2271031974d060408c58b314f..ffc308967c9bb8291a07c8af7fa5289a7b6931b7 100644 --- a/ThirdParty/boost/lexical_cast/detail/converter_lexical_streams.hpp +++ b/ThirdParty/boost/lexical_cast/detail/converter_lexical_streams.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/detail/converter_numeric.hpp b/ThirdParty/boost/lexical_cast/detail/converter_numeric.hpp index 1488fd5765e9eb29cd3dedcde8effa609ba87bc4..111613d2c7563bb3f4208a081cf13d886d85560d 100644 --- a/ThirdParty/boost/lexical_cast/detail/converter_numeric.hpp +++ b/ThirdParty/boost/lexical_cast/detail/converter_numeric.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/detail/inf_nan.hpp b/ThirdParty/boost/lexical_cast/detail/inf_nan.hpp index bea55b70a0325572b9266166ee0a6203a9297e6a..296688c0027393327d9a0b064ebdeeb810aee0c1 100644 --- a/ThirdParty/boost/lexical_cast/detail/inf_nan.hpp +++ b/ThirdParty/boost/lexical_cast/detail/inf_nan.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/detail/is_character.hpp b/ThirdParty/boost/lexical_cast/detail/is_character.hpp index c50664625c157fbac76df383c62f5421c982a4fe..3f02232df564ea02180c10b8ded70f88a0eefcea 100644 --- a/ThirdParty/boost/lexical_cast/detail/is_character.hpp +++ b/ThirdParty/boost/lexical_cast/detail/is_character.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -35,8 +35,8 @@ namespace boost { struct is_character { typedef BOOST_DEDUCED_TYPENAME boost::integral_constant< - bool, - boost::is_same< T, char >::value || + bool, + boost::is_same< T, char >::value || #if !defined(BOOST_NO_STRINGSTREAM) && !defined(BOOST_NO_STD_WSTRING) boost::is_same< T, wchar_t >::value || #endif @@ -46,8 +46,8 @@ namespace boost { #ifndef BOOST_NO_CXX11_CHAR32_T boost::is_same< T, char32_t >::value || #endif - boost::is_same< T, unsigned char >::value || - boost::is_same< T, signed char >::value + boost::is_same< T, unsigned char >::value || + boost::is_same< T, signed char >::value > type; BOOST_STATIC_CONSTANT(bool, value = (type::value) ); diff --git a/ThirdParty/boost/lexical_cast/detail/lcast_char_constants.hpp b/ThirdParty/boost/lexical_cast/detail/lcast_char_constants.hpp index ee6ef4b46d21b3d4ada7e5a2cd14ad4df8b93ab6..9805da00b3a025e500c9cdb8b0b1033ce66c5fb1 100644 --- a/ThirdParty/boost/lexical_cast/detail/lcast_char_constants.hpp +++ b/ThirdParty/boost/lexical_cast/detail/lcast_char_constants.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/detail/lcast_unsigned_converters.hpp b/ThirdParty/boost/lexical_cast/detail/lcast_unsigned_converters.hpp index c837832f34fc26e10e484acca24236697dc598cb..bbfdc3f090240399aa3da2de6ca364080c7d28f6 100644 --- a/ThirdParty/boost/lexical_cast/detail/lcast_unsigned_converters.hpp +++ b/ThirdParty/boost/lexical_cast/detail/lcast_unsigned_converters.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/detail/widest_char.hpp b/ThirdParty/boost/lexical_cast/detail/widest_char.hpp index b9c725b61fbb0c04ec7ef136005575affff02600..ba172f38819dd6504b1c0302a3c53bec7e0d6320 100644 --- a/ThirdParty/boost/lexical_cast/detail/widest_char.hpp +++ b/ThirdParty/boost/lexical_cast/detail/widest_char.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/lexical_cast/try_lexical_convert.hpp b/ThirdParty/boost/lexical_cast/try_lexical_convert.hpp index ac2e4f3cfc47254cf868e3f8f6f37c1b7aeaa550..1e2e44a7f1a03b659bbb9bf753ca2c51067ef648 100644 --- a/ThirdParty/boost/lexical_cast/try_lexical_convert.hpp +++ b/ThirdParty/boost/lexical_cast/try_lexical_convert.hpp @@ -1,6 +1,6 @@ // Copyright Kevlin Henney, 2000-2005. // Copyright Alexander Nasonov, 2006-2010. -// Copyright Antony Polukhin, 2011-2019. +// Copyright Antony Polukhin, 2011-2020. // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at diff --git a/ThirdParty/boost/math/policies/policy.hpp b/ThirdParty/boost/math/policies/policy.hpp index c1e1a7be4a4afd6888d1f4b190101d05cbffd1c2..559c960310e64e83b7b7919e508bee8681837bb9 100644 --- a/ThirdParty/boost/math/policies/policy.hpp +++ b/ThirdParty/boost/math/policies/policy.hpp @@ -118,7 +118,7 @@ namespace policies{ #if !defined(__BORLANDC__) #define BOOST_MATH_META_INT(type, name, Default)\ - template <type N = Default> struct name : public boost::mpl::int_<N>{};\ + template <type N = Default> struct name : public boost::integral_constant<int, N>{};\ namespace detail{\ template <type N>\ char test_is_valid_arg(const name<N>*);\ @@ -130,10 +130,10 @@ namespace policies{ BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast<T*>(0))) == 1);\ };\ }\ - template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; + template <class T> struct is_##name : public boost::integral_constant<bool, ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; #define BOOST_MATH_META_BOOL(name, Default)\ - template <bool N = Default> struct name : public boost::mpl::bool_<N>{};\ + template <bool N = Default> struct name : public boost::integral_constant<bool, N>{};\ namespace detail{\ template <bool N>\ char test_is_valid_arg(const name<N>*);\ @@ -145,10 +145,10 @@ namespace policies{ BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast<T*>(0))) == 1);\ };\ }\ - template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; + template <class T> struct is_##name : public boost::integral_constant<bool, ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; #else #define BOOST_MATH_META_INT(Type, name, Default)\ - template <Type N = Default> struct name : public boost::mpl::int_<N>{};\ + template <Type N = Default> struct name : public boost::integral_constant<int, N>{};\ namespace detail{\ template <Type N>\ char test_is_valid_arg(const name<N>*);\ @@ -164,13 +164,13 @@ namespace policies{ BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester<T>::test(inst)) == 1);\ };\ }\ - template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>\ + template <class T> struct is_##name : public boost::integral_constant<bool, ::boost::math::policies::detail::is_##name##_imp<T>::value>\ {\ template <class U> struct apply{ typedef is_##name<U> type; };\ }; #define BOOST_MATH_META_BOOL(name, Default)\ - template <bool N = Default> struct name : public boost::mpl::bool_<N>{};\ + template <bool N = Default> struct name : public boost::integral_constant<bool, N>{};\ namespace detail{\ template <bool N>\ char test_is_valid_arg(const name<N>*);\ @@ -186,7 +186,7 @@ namespace policies{ BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester<T>::test(inst)) == 1);\ };\ }\ - template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>\ + template <class T> struct is_##name : public boost::integral_constant<bool, ::boost::math::policies::detail::is_##name##_imp<T>::value>\ {\ template <class U> struct apply{ typedef is_##name<U> type; };\ }; @@ -318,13 +318,11 @@ struct is_default_policy_imp }; template <class T> struct is_valid_policy -: public mpl::bool_< - ::boost::math::policies::detail::is_valid_policy_imp<T>::value> +: public boost::integral_constant<bool, ::boost::math::policies::detail::is_valid_policy_imp<T>::value> {}; template <class T> struct is_default_policy -: public mpl::bool_< - ::boost::math::policies::detail::is_default_policy_imp<T>::value> +: public boost::integral_constant<bool, ::boost::math::policies::detail::is_default_policy_imp<T>::value> { template <class U> struct apply @@ -593,19 +591,19 @@ private: typedef typename detail::append_N<reduced_list, default_policy, (14 - ::boost::mpl::size<reduced_list>::value)>::type result_type; public: typedef policy< - typename mpl::at<result_type, mpl::int_<0> >::type, - typename mpl::at<result_type, mpl::int_<1> >::type, - typename mpl::at<result_type, mpl::int_<2> >::type, - typename mpl::at<result_type, mpl::int_<3> >::type, - typename mpl::at<result_type, mpl::int_<4> >::type, - typename mpl::at<result_type, mpl::int_<5> >::type, - typename mpl::at<result_type, mpl::int_<6> >::type, - typename mpl::at<result_type, mpl::int_<7> >::type, - typename mpl::at<result_type, mpl::int_<8> >::type, - typename mpl::at<result_type, mpl::int_<9> >::type, - typename mpl::at<result_type, mpl::int_<10> >::type, - typename mpl::at<result_type, mpl::int_<11> >::type, - typename mpl::at<result_type, mpl::int_<12> >::type > type; + typename mpl::at<result_type, boost::integral_constant<int, 0> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 1> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 2> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 3> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 4> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 5> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 6> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 7> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 8> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 9> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 10> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 11> >::type, + typename mpl::at<result_type, boost::integral_constant<int, 12> >::type > type; }; // // Full specialisation to speed up compilation of the common case: @@ -748,13 +746,13 @@ struct evaluation<double, Policy> #ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS template <class Real> -struct basic_digits : public mpl::int_<0>{ }; +struct basic_digits : public boost::integral_constant<int, 0>{ }; template <> -struct basic_digits<float> : public mpl::int_<FLT_MANT_DIG>{ }; +struct basic_digits<float> : public boost::integral_constant<int, FLT_MANT_DIG>{ }; template <> -struct basic_digits<double> : public mpl::int_<DBL_MANT_DIG>{ }; +struct basic_digits<double> : public boost::integral_constant<int, DBL_MANT_DIG>{ }; template <> -struct basic_digits<long double> : public mpl::int_<LDBL_MANT_DIG>{ }; +struct basic_digits<long double> : public boost::integral_constant<int, LDBL_MANT_DIG>{ }; template <class Real, class Policy> struct precision @@ -763,11 +761,11 @@ struct precision typedef typename Policy::precision_type precision_type; typedef basic_digits<Real> digits_t; typedef typename mpl::if_< - mpl::equal_to<digits_t, mpl::int_<0> >, + mpl::equal_to<digits_t, boost::integral_constant<int, 0> >, // Possibly unknown precision: precision_type, typename mpl::if_< - mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, mpl::int_<0> > >, + mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, boost::integral_constant<int, 0> > >, // Default case, full precision for RealType: digits2< ::std::numeric_limits<Real>::digits>, // User customised precision: @@ -815,14 +813,14 @@ struct precision >::type type; #else typedef typename Policy::precision_type precision_type; - typedef mpl::int_< ::std::numeric_limits<Real>::digits> digits_t; - typedef mpl::bool_< ::std::numeric_limits<Real>::is_specialized> spec_t; + typedef boost::integral_constant<int, ::std::numeric_limits<Real>::digits> digits_t; + typedef boost::integral_constant<bool, ::std::numeric_limits<Real>::is_specialized> spec_t; typedef typename mpl::if_< - mpl::or_<mpl::equal_to<spec_t, mpl::false_>, mpl::equal_to<digits_t, mpl::int_<0> > >, + mpl::or_<mpl::equal_to<spec_t, boost::true_type>, mpl::equal_to<digits_t, boost::integral_constant<int, 0> > >, // Possibly unknown precision: precision_type, typename mpl::if_< - mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, mpl::int_<0> > >, + mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, boost::integral_constant<int, 0> > >, // Default case, full precision for RealType: digits2< ::std::numeric_limits<Real>::digits>, // User customised precision: @@ -839,7 +837,7 @@ struct precision template <class Policy> struct precision<BOOST_MATH_FLOAT128_TYPE, Policy> { - typedef mpl::int_<113> type; + typedef boost::integral_constant<int, 113> type; }; #endif @@ -847,7 +845,7 @@ struct precision<BOOST_MATH_FLOAT128_TYPE, Policy> namespace detail{ template <class T, class Policy> -inline BOOST_MATH_CONSTEXPR int digits_imp(mpl::true_ const&) BOOST_NOEXCEPT +inline BOOST_MATH_CONSTEXPR int digits_imp(boost::true_type const&) BOOST_NOEXCEPT { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized); @@ -859,7 +857,7 @@ inline BOOST_MATH_CONSTEXPR int digits_imp(mpl::true_ const&) BOOST_NOEXCEPT } template <class T, class Policy> -inline BOOST_MATH_CONSTEXPR int digits_imp(mpl::false_ const&) BOOST_NOEXCEPT +inline BOOST_MATH_CONSTEXPR int digits_imp(boost::false_type const&) BOOST_NOEXCEPT { return tools::digits<T>(); } @@ -869,7 +867,7 @@ inline BOOST_MATH_CONSTEXPR int digits_imp(mpl::false_ const&) BOOST_NOEXCEPT template <class T, class Policy> inline BOOST_MATH_CONSTEXPR int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_NOEXCEPT { - typedef mpl::bool_< std::numeric_limits<T>::is_specialized > tag_type; + typedef boost::integral_constant<bool, std::numeric_limits<T>::is_specialized > tag_type; return detail::digits_imp<T, Policy>(tag_type()); } template <class T, class Policy> @@ -904,7 +902,7 @@ struct series_factor_calc }; template <class T, class Digits> -struct series_factor_calc<T, Digits, mpl::true_, mpl::true_> +struct series_factor_calc<T, Digits, boost::true_type, boost::true_type> { static BOOST_MATH_CONSTEXPR T get() BOOST_MATH_NOEXCEPT(T) { @@ -912,7 +910,7 @@ struct series_factor_calc<T, Digits, mpl::true_, mpl::true_> } }; template <class T, class Digits> -struct series_factor_calc<T, Digits, mpl::true_, mpl::false_> +struct series_factor_calc<T, Digits, boost::true_type, boost::false_type> { static BOOST_MATH_CONSTEXPR T get() BOOST_MATH_NOEXCEPT(T) { @@ -920,7 +918,7 @@ struct series_factor_calc<T, Digits, mpl::true_, mpl::false_> } }; template <class T, class Digits> -struct series_factor_calc<T, Digits, mpl::false_, mpl::true_> +struct series_factor_calc<T, Digits, boost::false_type, boost::true_type> { static BOOST_MATH_CONSTEXPR T get() BOOST_MATH_NOEXCEPT(T) { @@ -929,7 +927,7 @@ struct series_factor_calc<T, Digits, mpl::false_, mpl::true_> }; template <class T, class Policy> -inline BOOST_MATH_CONSTEXPR T get_epsilon_imp(mpl::true_ const&) BOOST_MATH_NOEXCEPT(T) +inline BOOST_MATH_CONSTEXPR T get_epsilon_imp(boost::true_type const&) BOOST_MATH_NOEXCEPT(T) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized); @@ -939,13 +937,13 @@ inline BOOST_MATH_CONSTEXPR T get_epsilon_imp(mpl::true_ const&) BOOST_MATH_NOEX BOOST_ASSERT(::std::numeric_limits<T>::radix == 2); #endif typedef typename boost::math::policies::precision<T, Policy>::type p_t; - typedef mpl::bool_<p_t::value <= std::numeric_limits<boost::uintmax_t>::digits> is_small_int; - typedef mpl::bool_<p_t::value >= std::numeric_limits<T>::digits> is_default_value; + typedef boost::integral_constant<bool, p_t::value <= std::numeric_limits<boost::uintmax_t>::digits> is_small_int; + typedef boost::integral_constant<bool, p_t::value >= std::numeric_limits<T>::digits> is_default_value; return series_factor_calc<T, p_t, is_small_int, is_default_value>::get(); } template <class T, class Policy> -inline BOOST_MATH_CONSTEXPR T get_epsilon_imp(mpl::false_ const&) BOOST_MATH_NOEXCEPT(T) +inline BOOST_MATH_CONSTEXPR T get_epsilon_imp(boost::false_type const&) BOOST_MATH_NOEXCEPT(T) { return tools::epsilon<T>(); } @@ -955,7 +953,7 @@ inline BOOST_MATH_CONSTEXPR T get_epsilon_imp(mpl::false_ const&) BOOST_MATH_NOE template <class T, class Policy> inline BOOST_MATH_CONSTEXPR T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) BOOST_MATH_NOEXCEPT(T) { - typedef mpl::bool_< (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2)) > tag_type; + typedef boost::integral_constant<bool, (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2)) > tag_type; return detail::get_epsilon_imp<T, Policy>(tag_type()); } @@ -984,7 +982,7 @@ struct is_policy_imp } template <class P> -struct is_policy : public mpl::bool_< ::boost::math::policies::detail::is_policy_imp<P>::value> {}; +struct is_policy : public boost::integral_constant<bool, ::boost::math::policies::detail::is_policy_imp<P>::value> {}; // // Helper traits class for distribution error handling: @@ -995,8 +993,8 @@ struct constructor_error_check typedef typename Policy::domain_error_type domain_error_type; typedef typename mpl::if_c< (domain_error_type::value == throw_on_error) || (domain_error_type::value == user_error) || (domain_error_type::value == errno_on_error), - mpl::true_, - mpl::false_>::type type; + boost::true_type, + boost::false_type>::type type; }; template <class Policy> @@ -1005,8 +1003,8 @@ struct method_error_check typedef typename Policy::domain_error_type domain_error_type; typedef typename mpl::if_c< (domain_error_type::value == throw_on_error) && (domain_error_type::value != user_error), - mpl::false_, - mpl::true_>::type type; + boost::false_type, + boost::true_type>::type type; }; // // Does the Policy ever throw on error? diff --git a/ThirdParty/boost/math/special_functions/math_fwd.hpp b/ThirdParty/boost/math/special_functions/math_fwd.hpp index 795620b4ed76d0e14a8b089c92ca5a6394ea0f93..f143c08bcedac20392a1ada48c7483da41f285d9 100644 --- a/ThirdParty/boost/math/special_functions/math_fwd.hpp +++ b/ThirdParty/boost/math/special_functions/math_fwd.hpp @@ -639,9 +639,9 @@ namespace boost namespace detail{ - typedef mpl::int_<0> bessel_no_int_tag; // No integer optimisation possible. - typedef mpl::int_<1> bessel_maybe_int_tag; // Maybe integer optimisation. - typedef mpl::int_<2> bessel_int_tag; // Definite integer optimistaion. + typedef boost::integral_constant<int, 0> bessel_no_int_tag; // No integer optimisation possible. + typedef boost::integral_constant<int, 1> bessel_maybe_int_tag; // Maybe integer optimisation. + typedef boost::integral_constant<int, 2> bessel_int_tag; // Definite integer optimisation. template <class T1, class T2, class Policy> struct bessel_traits @@ -656,8 +656,8 @@ namespace boost typedef typename mpl::if_< mpl::or_< - mpl::less_equal<precision_type, mpl::int_<0> >, - mpl::greater<precision_type, mpl::int_<64> > >, + mpl::less_equal<precision_type, boost::integral_constant<int, 0> >, + mpl::greater<precision_type, boost::integral_constant<int, 64> > >, bessel_no_int_tag, typename mpl::if_< is_integral<T1>, @@ -667,8 +667,8 @@ namespace boost >::type optimisation_tag; typedef typename mpl::if_< mpl::or_< - mpl::less_equal<precision_type, mpl::int_<0> >, - mpl::greater<precision_type, mpl::int_<113> > >, + mpl::less_equal<precision_type, boost::integral_constant<int, 0> >, + mpl::greater<precision_type, boost::integral_constant<int, 113> > >, bessel_no_int_tag, typename mpl::if_< is_integral<T1>, @@ -1103,7 +1103,18 @@ namespace boost template <class T> typename boost::math::tools::promote_args<T>::type lambert_wm1_prime(T z); + // Hypergeometrics: + template <class T1, class T2> typename tools::promote_args<T1, T2>::type hypergeometric_1F0(T1 a, T2 z); + template <class T1, class T2, class Policy> typename tools::promote_args<T1, T2>::type hypergeometric_1F0(T1 a, T2 z, const Policy&); + template <class T1, class T2> typename tools::promote_args<T1, T2>::type hypergeometric_0F1(T1 b, T2 z); + template <class T1, class T2, class Policy> typename tools::promote_args<T1, T2>::type hypergeometric_0F1(T1 b, T2 z, const Policy&); + + template <class T1, class T2, class T3> typename tools::promote_args<T1, T2, T3>::type hypergeometric_2F0(T1 a1, T2 a2, T3 z); + template <class T1, class T2, class T3, class Policy> typename tools::promote_args<T1, T2, T3>::type hypergeometric_2F0(T1 a1, T2 a2, T3 z, const Policy&); + + template <class T1, class T2, class T3> typename tools::promote_args<T1, T2, T3>::type hypergeometric_1F1(T1 a, T2 b, T3 z); + template <class T1, class T2, class T3, class Policy> typename tools::promote_args<T1, T2, T3>::type hypergeometric_1F1(T1 a, T2 b, T3 z, const Policy&); } // namespace math @@ -1125,9 +1136,20 @@ namespace boost #define BOOST_MATH_DETAIL_LL_FUNC(Policy) #endif +#if !defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_CXX11_HDR_ARRAY) +# define BOOST_MATH_DETAIL_11_FUNC(Policy)\ + template <class T, class U, class V>\ + inline typename boost::math::tools::promote_args<T, U>::type hypergeometric_1F1(const T& a, const U& b, const V& z)\ + { return boost::math::hypergeometric_1F1(a, b, z, Policy()); }\ + +#else +# define BOOST_MATH_DETAIL_11_FUNC(Policy) +#endif + #define BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(Policy)\ \ BOOST_MATH_DETAIL_LL_FUNC(Policy)\ + BOOST_MATH_DETAIL_11_FUNC(Policy)\ \ template <class RT1, class RT2>\ inline typename boost::math::tools::promote_args<RT1, RT2>::type \ @@ -1669,6 +1691,18 @@ template <class OutputIterator, class T>\ template <class T> inline typename boost::math::tools::promote_args<T>::type lambert_w0_prime(T z) { return boost::math::lambert_w0(z, Policy()); }\ template <class T> inline typename boost::math::tools::promote_args<T>::type lambert_wm1_prime(T z) { return boost::math::lambert_w0(z, Policy()); }\ \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type hypergeometric_1F0(const T& a, const U& z)\ + { return boost::math::hypergeometric_1F0(a, z, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type hypergeometric_0F1(const T& a, const U& z)\ + { return boost::math::hypergeometric_0F1(a, z, Policy()); }\ + \ + template <class T, class U, class V>\ + inline typename boost::math::tools::promote_args<T, U>::type hypergeometric_2F0(const T& a1, const U& a2, const V& z)\ + { return boost::math::hypergeometric_2F0(a1, a2, z, Policy()); }\ + \ diff --git a/ThirdParty/boost/math/tools/config.hpp b/ThirdParty/boost/math/tools/config.hpp index 47fdea65c8d0e3b76c26fef7fab1f109b47b2ce6..cb36fcf0816dac30123ecd923a385e06ec5ce32a 100644 --- a/ThirdParty/boost/math/tools/config.hpp +++ b/ThirdParty/boost/math/tools/config.hpp @@ -46,7 +46,7 @@ #endif #ifdef __IBMCPP__ // -// For reasons I don't unserstand, the tests with IMB's compiler all +// For reasons I don't understand, the tests with IMB's compiler all // pass at long double precision, but fail with real_concept, those tests // are disabled for now. (JM 2012). # define BOOST_MATH_NO_REAL_CONCEPT_TESTS @@ -184,10 +184,20 @@ // #ifdef BOOST_MSVC # define BOOST_MATH_POLY_METHOD 2 +#if BOOST_MSVC <= 1900 # define BOOST_MATH_RATIONAL_METHOD 1 +#else +# define BOOST_MATH_RATIONAL_METHOD 2 +#endif +#if BOOST_MSVC > 1900 +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +#endif + #elif defined(BOOST_INTEL) # define BOOST_MATH_POLY_METHOD 2 # define BOOST_MATH_RATIONAL_METHOD 1 + #elif defined(__GNUC__) #if __GNUC__ < 4 # define BOOST_MATH_POLY_METHOD 3 @@ -196,8 +206,18 @@ # define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L #else # define BOOST_MATH_POLY_METHOD 3 -# define BOOST_MATH_RATIONAL_METHOD 1 +# define BOOST_MATH_RATIONAL_METHOD 3 #endif + +#elif defined(__clang__) + +#if __clang__ > 6 +# define BOOST_MATH_POLY_METHOD 3 +# define BOOST_MATH_RATIONAL_METHOD 3 +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +#endif + #endif #if defined(BOOST_NO_LONG_LONG) && !defined(BOOST_MATH_INT_TABLE_TYPE) diff --git a/ThirdParty/boost/math/tools/promotion.hpp b/ThirdParty/boost/math/tools/promotion.hpp index 494d7f99e20a132b46c64852cf6292cca4ca478f..212bc3a6e413fff4a893bce1e0972d3408f62bae 100644 --- a/ThirdParty/boost/math/tools/promotion.hpp +++ b/ThirdParty/boost/math/tools/promotion.hpp @@ -84,15 +84,15 @@ namespace boost typedef typename promote_arg<T1>::type T1P; // T1 perhaps promoted. typedef typename promote_arg<T2>::type T2P; // T2 perhaps promoted. - typedef typename mpl::if_< - typename mpl::and_<is_floating_point<T1P>, is_floating_point<T2P> >::type, // both T1P and T2P are floating-point? + typedef typename mpl::if_c< + is_floating_point<T1P>::value && is_floating_point<T2P>::value, // both T1P and T2P are floating-point? #ifdef BOOST_MATH_USE_FLOAT128 - typename mpl::if_< typename mpl::or_<is_same<__float128, T1P>, is_same<__float128, T2P> >::type, // either long double? + typename mpl::if_c<is_same<__float128, T1P>::value || is_same<__float128, T2P>::value, // either long double? __float128, #endif - typename mpl::if_< typename mpl::or_<is_same<long double, T1P>, is_same<long double, T2P> >::type, // either long double? + typename mpl::if_c<is_same<long double, T1P>::value || is_same<long double, T2P>::value, // either long double? long double, // then result type is long double. - typename mpl::if_< typename mpl::or_<is_same<double, T1P>, is_same<double, T2P> >::type, // either double? + typename mpl::if_c<is_same<double, T1P>::value || is_same<double, T2P>::value, // either double? double, // result type is double. float // else result type is float. >::type @@ -101,7 +101,7 @@ namespace boost #endif >::type, // else one or the other is a user-defined type: - typename mpl::if_< typename mpl::and_<mpl::not_<is_floating_point<T2P> >, ::boost::is_convertible<T1P, T2P> >, T2P, T1P>::type>::type type; + typename mpl::if_c<!is_floating_point<T2P>::value && ::boost::is_convertible<T1P, T2P>::value, T2P, T1P>::type>::type type; }; // promote_arg2 // These full specialisations reduce mpl::if_ usage and speed up // compilation: diff --git a/ThirdParty/boost/math/tools/user.hpp b/ThirdParty/boost/math/tools/user.hpp index 08a7e53d9eb190cdb872e340e3ab51479a64cdd3..6d3df000c00558036536f05d163521236de7ef34 100644 --- a/ThirdParty/boost/math/tools/user.hpp +++ b/ThirdParty/boost/math/tools/user.hpp @@ -54,7 +54,7 @@ // // #define BOOST_MATH_EVALUATION_ERROR_POLICY throw_on_error // -// Underfow: +// Underflow: // // #define BOOST_MATH_UNDERFLOW_ERROR_POLICY ignore_error // @@ -84,7 +84,7 @@ // // #define BOOST_MATH_ASSERT_UNDEFINED_POLICY true // -// Maximum series iterstions permitted: +// Maximum series iterations permitted: // // #define BOOST_MATH_MAX_SERIES_ITERATION_POLICY 1000000 // diff --git a/ThirdParty/boost/move/algo/move.hpp b/ThirdParty/boost/move/algo/move.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5d5ba19ea0f46700fa3478d1bbdad9c8b876d5ac --- /dev/null +++ b/ThirdParty/boost/move/algo/move.hpp @@ -0,0 +1,156 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2016. +// 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) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_ALGO_MOVE_HPP +#define BOOST_MOVE_ALGO_MOVE_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include <boost/move/detail/config_begin.hpp> + +#include <boost/move/utility_core.hpp> +#include <boost/move/detail/iterator_traits.hpp> +#include <boost/move/detail/iterator_to_raw_pointer.hpp> +#include <boost/core/no_exceptions_support.hpp> + +namespace boost { + +////////////////////////////////////////////////////////////////////////////// +// +// move +// +////////////////////////////////////////////////////////////////////////////// + +#if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + + //! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last - + //! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first), + //! performs *(result + n) = ::boost::move (*(first + n)). + //! + //! <b>Effects</b>: result + (last - first). + //! + //! <b>Requires</b>: result shall not be in the range [first,last). + //! + //! <b>Complexity</b>: Exactly last - first move assignments. + template <typename I, // I models InputIterator + typename O> // O models OutputIterator + O move(I f, I l, O result) + { + while (f != l) { + *result = ::boost::move(*f); + ++f; ++result; + } + return result; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // move_backward + // + ////////////////////////////////////////////////////////////////////////////// + + //! <b>Effects</b>: Moves elements in the range [first,last) into the range + //! [result - (last-first),result) starting from last - 1 and proceeding to + //! first. For each positive integer n <= (last - first), + //! performs *(result - n) = ::boost::move(*(last - n)). + //! + //! <b>Requires</b>: result shall not be in the range [first,last). + //! + //! <b>Returns</b>: result - (last - first). + //! + //! <b>Complexity</b>: Exactly last - first assignments. + template <typename I, // I models BidirectionalIterator + typename O> // O models BidirectionalIterator + O move_backward(I f, I l, O result) + { + while (f != l) { + --l; --result; + *result = ::boost::move(*l); + } + return result; + } + +#else + + using ::std::move_backward; + +#endif //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_move +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! new (static_cast<void*>(&*result)) +//! typename iterator_traits<ForwardIterator>::value_type(boost::move(*first)); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move(I f, I l, F r + /// @cond +// ,typename ::boost::move_detail::enable_if<has_move_emulation_enabled<typename boost::movelib::iterator_traits<I>::value_type> >::type* = 0 + /// @endcond + ) +{ + typedef typename boost::movelib::iterator_traits<I>::value_type input_value_type; + + F back = r; + BOOST_TRY{ + while (f != l) { + void * const addr = static_cast<void*>(::boost::move_detail::addressof(*r)); + ::new(addr) input_value_type(::boost::move(*f)); + ++f; ++r; + } + } + BOOST_CATCH(...){ + for (; back != r; ++back){ + boost::movelib::iterator_to_raw_pointer(back)->~input_value_type(); + } + BOOST_RETHROW; + } + BOOST_CATCH_END + return r; +} + +/// @cond +/* +template + <typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move(I f, I l, F r, + typename ::boost::move_detail::disable_if<has_move_emulation_enabled<typename boost::movelib::iterator_traits<I>::value_type> >::type* = 0) +{ + return std::uninitialized_copy(f, l, r); +} +*/ + +/// @endcond + +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_ALGO_MOVE_HPP diff --git a/ThirdParty/boost/move/algorithm.hpp b/ThirdParty/boost/move/algorithm.hpp new file mode 100644 index 0000000000000000000000000000000000000000..880d661e7dd82dada16715fb4108db52438ccf58 --- /dev/null +++ b/ThirdParty/boost/move/algorithm.hpp @@ -0,0 +1,167 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2012-2012. +// 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) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_ALGORITHM_HPP +#define BOOST_MOVE_ALGORITHM_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include <boost/move/detail/config_begin.hpp> + +#include <boost/move/utility_core.hpp> +#include <boost/move/iterator.hpp> +#include <boost/move/algo/move.hpp> +#include <boost/core/no_exceptions_support.hpp> + +#include <algorithm> //copy, copy_backward +#include <memory> //uninitialized_copy + +namespace boost { + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_move_move_iterator(I f, I l, F r +// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0 +) +{ + return ::boost::uninitialized_move(f, l, r); +} +/* +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +F uninitialized_move_move_iterator(I f, I l, F r, + typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0) +{ + return std::uninitialized_copy(f.base(), l.base(), r); +} +*/ +} //namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_copy_or_move(I f, I l, F r, + typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r); +} + +////////////////////////////////////////////////////////////////////////////// +// +// copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F move_move_iterator(I f, I l, F r +// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0 +) +{ + return ::boost::move(f, l, r); +} +/* +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +F move_move_iterator(I f, I l, F r, + typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0) +{ + return std::copy(f.base(), l.base(), r); +} +*/ + +} //namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F copy_or_move(I f, I l, F r, + typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::move_detail::move_move_iterator(f, l, r); +} + +/// @endcond + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! new (static_cast<void*>(&*result)) +//! typename iterator_traits<ForwardIterator>::value_type(*first); +//! \endcode +//! +//! <b>Returns</b>: result +//! +//! <b>Note</b>: This function is provided because +//! <i>std::uninitialized_copy</i> from some STL implementations +//! is not compatible with <i>move_iterator</i> +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_copy_or_move(I f, I l, F r + /// @cond + ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0 + /// @endcond + ) +{ + return std::uninitialized_copy(f, l, r); +} + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! *result = *first; +//! \endcode +//! +//! <b>Returns</b>: result +//! +//! <b>Note</b>: This function is provided because +//! <i>std::uninitialized_copy</i> from some STL implementations +//! is not compatible with <i>move_iterator</i> +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F copy_or_move(I f, I l, F r + /// @cond + ,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0 + /// @endcond + ) +{ + return std::copy(f, l, r); +} + +} //namespace boost { + +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_ALGORITHM_HPP diff --git a/ThirdParty/boost/move/move.hpp b/ThirdParty/boost/move/move.hpp new file mode 100644 index 0000000000000000000000000000000000000000..62dddbc954813d17b1b71f1d2a1bceb8f30cbc2b --- /dev/null +++ b/ThirdParty/boost/move/move.hpp @@ -0,0 +1,35 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright David Abrahams, Vicente Botet 2009. +// (C) Copyright Ion Gaztanaga 2009-2012. +// 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) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file +//! A general library header that includes +//! the rest of top-level headers. + +#ifndef BOOST_MOVE_MOVE_HPP +#define BOOST_MOVE_MOVE_HPP + +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include <boost/move/detail/config_begin.hpp> +#include <boost/move/utility.hpp> +#include <boost/move/iterator.hpp> +#include <boost/move/traits.hpp> +#include <boost/move/algorithm.hpp> +#include <boost/move/detail/config_end.hpp> + +#endif //#ifndef BOOST_MOVE_MOVE_HPP diff --git a/ThirdParty/boost/mp11/algorithm.hpp b/ThirdParty/boost/mp11/algorithm.hpp index b8719d68768f1e729aa46cf5bebc0a4c0debf992..f0a700d68dd1fec6b28eb551386ea44bd0d9e74e 100644 --- a/ThirdParty/boost/mp11/algorithm.hpp +++ b/ThirdParty/boost/mp11/algorithm.hpp @@ -405,31 +405,31 @@ struct mp_take_c_impl<4, L<T1, T2, T3, T4, T...>> template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class... T> struct mp_take_c_impl<5, L<T1, T2, T3, T4, T5, T...>> { - using type = L<T1, T2, T3, T4, T5>; + using type = L<T1, T2, T3, T4, T5>; }; template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class... T> struct mp_take_c_impl<6, L<T1, T2, T3, T4, T5, T6, T...>> { - using type = L<T1, T2, T3, T4, T5, T6>; + using type = L<T1, T2, T3, T4, T5, T6>; }; template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class... T> struct mp_take_c_impl<7, L<T1, T2, T3, T4, T5, T6, T7, T...>> { - using type = L<T1, T2, T3, T4, T5, T6, T7>; + using type = L<T1, T2, T3, T4, T5, T6, T7>; }; template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class... T> struct mp_take_c_impl<8, L<T1, T2, T3, T4, T5, T6, T7, T8, T...>> { - using type = L<T1, T2, T3, T4, T5, T6, T7, T8>; + using type = L<T1, T2, T3, T4, T5, T6, T7, T8>; }; template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class... T> struct mp_take_c_impl<9, L<T1, T2, T3, T4, T5, T6, T7, T8, T9, T...>> { - using type = L<T1, T2, T3, T4, T5, T6, T7, T8, T9>; + using type = L<T1, T2, T3, T4, T5, T6, T7, T8, T9>; }; template<template<class...> class L, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class... T, std::size_t N> @@ -519,6 +519,19 @@ template<class L, class V> using mp_remove = typename detail::mp_remove_impl<L, // mp_remove_if<L, P> // in detail/mp_remove_if.hpp +// mp_flatten<L, L2 = mp_clear<L>> +namespace detail +{ + +template<class L2> struct mp_flatten_impl +{ + template<class T> using fn = mp_if<mp_similar<L2, T>, T, mp_list<T>>; +}; + +} // namespace detail + +template<class L, class L2 = mp_clear<L>> using mp_flatten = mp_apply<mp_append, mp_push_front<mp_transform_q<detail::mp_flatten_impl<L2>, L>, mp_clear<L>>>; + // mp_partition<L, P> namespace detail { @@ -950,6 +963,32 @@ template<template<class...> class L, class... T> struct mp_unique_impl<L<T...>> template<class L> using mp_unique = typename detail::mp_unique_impl<L>::type; +// mp_unique_if<L, P> +namespace detail +{ + +template<template<class...> class P> struct mp_unique_if_push_back +{ + template<class...> struct impl + { + }; + + template<template<class...> class L, class... Ts, class T> + struct impl<L<Ts...>, T> + { + using type = mp_if<mp_any<P<Ts, T>...>, L<Ts...>, L<Ts..., T>>; + }; + + template<class... T> using fn = typename impl<T...>::type; +}; + +} // namespace detail + +template<class L, template<class...> class P> +using mp_unique_if = mp_fold_q<L, mp_clear<L>, detail::mp_unique_if_push_back<P>>; + +template<class L, class Q> using mp_unique_if_q = mp_unique_if<L, Q::template fn>; + // mp_all_of<L, P> template<class L, template<class...> class P> using mp_all_of = mp_bool< mp_count_if<L, P>::value == mp_size<L>::value >; template<class L, class Q> using mp_all_of_q = mp_all_of<L, Q::template fn>; @@ -1062,10 +1101,125 @@ struct mp_starts_with_impl<L1<T1...>, L2<T2...> > { template<class L1, class L2> using mp_starts_with = typename detail::mp_starts_with_impl<L1, L2>::type; +// mp_rotate_left(_c)<L, N> +namespace detail +{ + +// limit divisor to 1 to avoid division by 0 and give a rotation of 0 for lists containing 0 or 1 elements +template<std::size_t Ln, std::size_t N> using canonical_left_rotation = mp_size_t<N % (Ln == 0? 1: Ln)>; + +// perform right rotation as a left rotation by inverting the number of elements to rotate +template<std::size_t Ln, std::size_t N> using canonical_right_rotation = mp_size_t<Ln - N % (Ln == 0? 1: Ln)>; + +// avoid errors when rotating fixed-sized lists by using mp_list for the transformation +template<class L, class N, class L2 = mp_rename<L, mp_list>> using mp_rotate_impl = mp_assign<L, mp_append< mp_drop<L2, N>, mp_take<L2, N> >>; + +} // namespace detail + +template<class L, std::size_t N> using mp_rotate_left_c = detail::mp_rotate_impl<L, detail::canonical_left_rotation<mp_size<L>::value, N>>; +template<class L, class N> using mp_rotate_left = mp_rotate_left_c<L, std::size_t{ N::value }>; + +// mp_rotate_right(_c)<L, N> +template<class L, std::size_t N> using mp_rotate_right_c = mp_rotate_left<L, detail::canonical_right_rotation<mp_size<L>::value, N>>; +template<class L, class N> using mp_rotate_right = mp_rotate_right_c<L, std::size_t{ N::value }>; + // mp_min_element<L, P> // mp_max_element<L, P> // in detail/mp_min_element.hpp +// mp_power_set<L> +namespace detail +{ + +template<class L> struct mp_power_set_impl; + +} // namespace detail + +template<class L> using mp_power_set = typename detail::mp_power_set_impl<L>::type; + +namespace detail +{ + +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1800 ) + +template<template<class...> class L, class... T> struct mp_power_set_impl< L<T...> > +{ + static_assert( sizeof...(T) == 0, "T... must be empty" ); + using type = L< L<> >; +}; + +#else + +template<template<class...> class L> struct mp_power_set_impl< L<> > +{ + using type = L< L<> >; +}; + +#endif + +template<template<class...> class L, class T1, class... T> struct mp_power_set_impl< L<T1, T...> > +{ + using S1 = mp_power_set< L<T...> >; + + template<class L2> using _f = mp_push_front<L2, T1>; + + using S2 = mp_transform<_f, S1>; + + using type = mp_append< S1, S2 >; +}; + +} // namespace detail + +// mp_partial_sum<L, V, F> +namespace detail +{ + +template<template<class...> class F> struct mp_partial_sum_impl_f +{ +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, <= 1900 ) + + template<class V, class T> using fn = mp_list<F<mp_first<V>, T>, mp_push_back<mp_second<V>, F<mp_first<V>, T>> >; + +#else + + template<class V, class T, class N = F<mp_first<V>, T>> using fn = mp_list<N, mp_push_back<mp_second<V>, N>>; + +#endif +}; + +} // namespace detail + +template<class L, class V, template<class...> class F> using mp_partial_sum = mp_second<mp_fold_q<L, mp_list<V, mp_clear<L>>, detail::mp_partial_sum_impl_f<F>> >; +template<class L, class V, class Q> using mp_partial_sum_q = mp_partial_sum<L, V, Q::template fn>; + +// mp_iterate<V, F, R> +namespace detail +{ + +template<class V, template<class...> class F, template<class...> class R, class N> struct mp_iterate_impl; + +} // namespace detail + +template<class V, template<class...> class F, template<class...> class R> using mp_iterate = typename detail::mp_iterate_impl<V, F, R, mp_valid<R, V>>::type; + +namespace detail +{ + +template<class V, template<class...> class F, template<class...> class R> struct mp_iterate_impl<V, F, R, mp_false> +{ + template<class X> using _f = mp_list<F<X>>; + using type = mp_eval_or<mp_list<>, _f, V>; +}; + +template<class V, template<class...> class F, template<class...> class R> struct mp_iterate_impl<V, F, R, mp_true> +{ + using type = mp_push_front<mp_iterate<R<V>, F, R>, F<V>>; +}; + +} // namespace detail + +template<class V, class Qf, class Qr> using mp_iterate_q = mp_iterate<V, Qf::template fn, Qr::template fn>; + } // namespace mp11 } // namespace boost diff --git a/ThirdParty/boost/mp11/detail/config.hpp b/ThirdParty/boost/mp11/detail/config.hpp index 63c21f43f451656aa41155925c650270885d0e2d..0a9ded50b521383dddd22fce02be7109c8ec8337 100644 --- a/ThirdParty/boost/mp11/detail/config.hpp +++ b/ThirdParty/boost/mp11/detail/config.hpp @@ -123,25 +123,14 @@ // BOOST_MP11_DEPRECATED(msg) -#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) +#if BOOST_MP11_WORKAROUND( BOOST_MP11_CLANG, < 304 ) # define BOOST_MP11_DEPRECATED(msg) -#elif BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 50000 ) +#elif defined(__GNUC__) || defined(__clang__) # define BOOST_MP11_DEPRECATED(msg) __attribute__((deprecated(msg))) -#elif BOOST_MP11_CLANG -# if defined(__has_cpp_attribute) -// 3.8 warns about [[deprecated]] when in C++11 mode -// so we only use it on 3.9 and above, detected via [[fallthrough]] -// can't version check because Apple -# if __has_cpp_attribute(deprecated) && __has_cpp_attribute(fallthrough) -# define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]] -# else -# define BOOST_MP11_DEPRECATED(msg) -# endif -# else // defined(__has_cpp_attribute) -# define BOOST_MP11_DEPRECATED(msg) -# endif -#else +#elif defined(_MSC_VER) && _MSC_VER >= 1900 # define BOOST_MP11_DEPRECATED(msg) [[deprecated(msg)]] +#else +# define BOOST_MP11_DEPRECATED(msg) #endif #endif // #ifndef BOOST_MP11_DETAIL_CONFIG_HPP_INCLUDED diff --git a/ThirdParty/boost/mp11/detail/mp_count.hpp b/ThirdParty/boost/mp11/detail/mp_count.hpp index 2daed904c677f304e1fb73bf34a2f3cad6719eaf..1e221ca355d1c584990b64d8457ab6c9068b6877 100644 --- a/ThirdParty/boost/mp11/detail/mp_count.hpp +++ b/ThirdParty/boost/mp11/detail/mp_count.hpp @@ -39,13 +39,13 @@ constexpr std::size_t cx_plus() template<class T1, class... T> constexpr std::size_t cx_plus(T1 t1, T... t) { - return t1 + cx_plus(t...); + return static_cast<std::size_t>(t1) + cx_plus(t...); } template<class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9, class T10, class... T> constexpr std::size_t cx_plus(T1 t1, T2 t2, T3 t3, T4 t4, T5 t5, T6 t6, T7 t7, T8 t8, T9 t9, T10 t10, T... t) { - return t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10 + cx_plus(t...); + return static_cast<std::size_t>(t1 + t2 + t3 + t4 + t5 + t6 + t7 + t8 + t9 + t10) + cx_plus(t...); } template<template<class...> class L, class... T, class V> struct mp_count_impl<L<T...>, V> diff --git a/ThirdParty/boost/mp11/detail/mp_with_index.hpp b/ThirdParty/boost/mp11/detail/mp_with_index.hpp index 1062877df1fa3f8fb7894cbf788038155151ab71..3eec9b691c61941a5321868dddd84c63475265cf 100644 --- a/ThirdParty/boost/mp11/detail/mp_with_index.hpp +++ b/ThirdParty/boost/mp11/detail/mp_with_index.hpp @@ -20,10 +20,12 @@ # define BOOST_MP11_CONSTEXPR14 #endif -#if defined( _MSC_VER ) && !defined( __clang__ ) -# define BOOST_MP11_UNREACHABLE() __assume(false) +#if defined( __GNUC__ ) || defined( __clang__ ) +# define BOOST_MP11_UNREACHABLE_DEFAULT default: __builtin_unreachable(); +#elif defined( _MSC_VER ) +# define BOOST_MP11_UNREACHABLE_DEFAULT default: __assume(false); #else -# define BOOST_MP11_UNREACHABLE() __builtin_unreachable() +# define BOOST_MP11_UNREACHABLE_DEFAULT #endif namespace boost @@ -80,7 +82,7 @@ template<> struct mp_with_index_impl_<2> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); } @@ -93,7 +95,7 @@ template<> struct mp_with_index_impl_<3> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -107,7 +109,7 @@ template<> struct mp_with_index_impl_<4> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -122,7 +124,7 @@ template<> struct mp_with_index_impl_<5> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -138,7 +140,7 @@ template<> struct mp_with_index_impl_<6> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -155,7 +157,7 @@ template<> struct mp_with_index_impl_<7> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -173,7 +175,7 @@ template<> struct mp_with_index_impl_<8> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -192,7 +194,7 @@ template<> struct mp_with_index_impl_<9> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -212,7 +214,7 @@ template<> struct mp_with_index_impl_<10> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -233,7 +235,7 @@ template<> struct mp_with_index_impl_<11> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -255,7 +257,7 @@ template<> struct mp_with_index_impl_<12> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -278,7 +280,7 @@ template<> struct mp_with_index_impl_<13> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -302,7 +304,7 @@ template<> struct mp_with_index_impl_<14> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -327,7 +329,7 @@ template<> struct mp_with_index_impl_<15> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -353,7 +355,7 @@ template<> struct mp_with_index_impl_<16> { switch( i ) { - default: BOOST_MP11_UNREACHABLE(); + BOOST_MP11_UNREACHABLE_DEFAULT case 0: return std::forward<F>(f)( mp_size_t<K+0>() ); case 1: return std::forward<F>(f)( mp_size_t<K+1>() ); case 2: return std::forward<F>(f)( mp_size_t<K+2>() ); @@ -388,7 +390,7 @@ template<class N, class F> inline BOOST_MP11_CONSTEXPR14 decltype(std::declval<F } #undef BOOST_MP11_CONSTEXPR14 -#undef BOOST_MP11_UNREACHABLE +#undef BOOST_MP11_UNREACHABLE_DEFAULT } // namespace mp11 } // namespace boost diff --git a/ThirdParty/boost/mp11/detail/mpl_common.hpp b/ThirdParty/boost/mp11/detail/mpl_common.hpp new file mode 100644 index 0000000000000000000000000000000000000000..208885cbd06eea46a9783aa960a1075cdd5bf458 --- /dev/null +++ b/ThirdParty/boost/mp11/detail/mpl_common.hpp @@ -0,0 +1,160 @@ +#ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED +#define BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED + +// Copyright 2017, 2019 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/mp11/list.hpp> +#include <boost/mp11/algorithm.hpp> + +namespace boost +{ +namespace mpl +{ + +struct forward_iterator_tag; + +namespace aux +{ + +struct mp11_tag {}; + +template<class L> struct mp11_iterator +{ + using category = forward_iterator_tag; + + using type = mp11::mp_first<L>; + using next = mp11_iterator<mp11::mp_rest<L>>; +}; + +} // namespace aux + +// at + +template< typename Tag > struct at_impl; + +template<> struct at_impl<aux::mp11_tag> +{ + template<class L, class I> struct apply + { + using type = mp11::mp_at<L, I>; + }; +}; + +// back + +template< typename Tag > struct back_impl; + +template<> struct back_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using N = mp11::mp_size<L>; + using type = mp11::mp_at_c<L, N::value - 1>; + }; +}; + +// begin + +template< typename Tag > struct begin_impl; + +template<> struct begin_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using type = aux::mp11_iterator<L>; + }; +}; + +// clear + +template< typename Tag > struct clear_impl; + +template<> struct clear_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using type = mp11::mp_clear<L>; + }; +}; + +// end + +template< typename Tag > struct end_impl; + +template<> struct end_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using type = aux::mp11_iterator<mp11::mp_clear<L>>; + }; +}; + +// front + +template< typename Tag > struct front_impl; + +template<> struct front_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using type = mp11::mp_front<L>; + }; +}; + +// pop_front + +template< typename Tag > struct pop_front_impl; + +template<> struct pop_front_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using type = mp11::mp_pop_front<L>; + }; +}; + +// push_back + +template< typename Tag > struct push_back_impl; + +template<> struct push_back_impl<aux::mp11_tag> +{ + template<class L, class T> struct apply + { + using type = mp11::mp_push_back<L, T>; + }; +}; + +// push_front + +template< typename Tag > struct push_front_impl; + +template<> struct push_front_impl<aux::mp11_tag> +{ + template<class L, class T> struct apply + { + using type = mp11::mp_push_front<L, T>; + }; +}; + +// size + +template< typename Tag > struct size_impl; + +template<> struct size_impl<aux::mp11_tag> +{ + template<class L> struct apply + { + using type = mp11::mp_size<L>; + }; +}; + +} // namespace mpl +} // namespace boost + +#endif // #ifndef BOOST_MP11_DETAIL_MPL_COMMON_HPP_INCLUDED diff --git a/ThirdParty/boost/mp11/function.hpp b/ThirdParty/boost/mp11/function.hpp index f1c11b49873559be5eaed44f4c9511feb63a66cc..1aeccac4ef51b858148af6ad948ec94a228cf4ed 100644 --- a/ThirdParty/boost/mp11/function.hpp +++ b/ThirdParty/boost/mp11/function.hpp @@ -80,7 +80,8 @@ template<class... T> using mp_and = typename detail::mp_and_impl<mp_list<T...>>: #endif // mp_all<T...> -#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) || BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 100000 ) +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86355 +#if BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) || BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, != 0 ) template<class... T> using mp_all = mp_bool< mp_count_if< mp_list<T...>, mp_not >::value == 0 >; @@ -125,7 +126,8 @@ template<class T1, class... T> struct mp_or_impl<T1, T...> } // namespace detail // mp_any<T...> -#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, < 100000 ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86356 +#if defined( BOOST_MP11_HAS_FOLD_EXPRESSIONS ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_GCC, != 0 ) && !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1920 ) template<class... T> using mp_any = mp_bool<(static_cast<bool>(T::value) || ...)>; @@ -186,6 +188,11 @@ template<template<class...> class L, class... T1, class... T2> struct mp_similar using type = mp_true; }; +template<template<class...> class L, class... T> struct mp_similar_impl<L<T...>, L<T...>> +{ + using type = mp_true; +}; + template<class T1, class T2, class T3, class... T> struct mp_similar_impl<T1, T2, T3, T...> { using type = mp_all< typename mp_similar_impl<T1, T2>::type, typename mp_similar_impl<T1, T3>::type, typename mp_similar_impl<T1, T>::type... >; diff --git a/ThirdParty/boost/mp11/mpl.hpp b/ThirdParty/boost/mp11/mpl.hpp index 0e836cba44808d4de1c1b10905cda7323514f48b..994705ffc4d516110409042deb94e7bc18d08772 100644 --- a/ThirdParty/boost/mp11/mpl.hpp +++ b/ThirdParty/boost/mp11/mpl.hpp @@ -1,175 +1,14 @@ #ifndef BOOST_MP11_MPL_HPP_INCLUDED #define BOOST_MP11_MPL_HPP_INCLUDED -// Copyright 2017 Peter Dimov. +// Copyright 2017, 2019 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include <boost/mp11/list.hpp> -#include <boost/mp11/algorithm.hpp> -#include <tuple> - -namespace boost -{ -namespace mpl -{ - -struct forward_iterator_tag; - -namespace aux -{ - -struct mp11_tag {}; - -template<class L> struct mp11_iterator -{ - using category = forward_iterator_tag; - - using type = mp11::mp_first<L>; - using next = mp11_iterator<mp11::mp_rest<L>>; -}; - -} // namespace aux - -// at - -template< typename Tag > struct at_impl; - -template<> struct at_impl<aux::mp11_tag> -{ - template<class L, class I> struct apply - { - using type = mp11::mp_at<L, I>; - }; -}; - -// back - -template< typename Tag > struct back_impl; - -template<> struct back_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using N = mp11::mp_size<L>; - using type = mp11::mp_at_c<L, N::value - 1>; - }; -}; - -// begin - -template< typename Tag > struct begin_impl; - -template<> struct begin_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = aux::mp11_iterator<L>; - }; -}; - -// clear - -template< typename Tag > struct clear_impl; - -template<> struct clear_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_clear<L>; - }; -}; - -// end - -template< typename Tag > struct end_impl; - -template<> struct end_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = aux::mp11_iterator<mp11::mp_clear<L>>; - }; -}; - -// front - -template< typename Tag > struct front_impl; - -template<> struct front_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_front<L>; - }; -}; - -// pop_front - -template< typename Tag > struct pop_front_impl; - -template<> struct pop_front_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_pop_front<L>; - }; -}; - -// push_back - -template< typename Tag > struct push_back_impl; - -template<> struct push_back_impl<aux::mp11_tag> -{ - template<class L, class T> struct apply - { - using type = mp11::mp_push_back<L, T>; - }; -}; - -// push_front - -template< typename Tag > struct push_front_impl; - -template<> struct push_front_impl<aux::mp11_tag> -{ - template<class L, class T> struct apply - { - using type = mp11::mp_push_front<L, T>; - }; -}; - -// sequence_tag - -template< typename Sequence > struct sequence_tag; - -template<class... T> struct sequence_tag<mp11::mp_list<T...>> -{ - using type = aux::mp11_tag; -}; - -template<class... T> struct sequence_tag<std::tuple<T...>> -{ - using type = aux::mp11_tag; -}; - -// size - -template< typename Tag > struct size_impl; - -template<> struct size_impl<aux::mp11_tag> -{ - template<class L> struct apply - { - using type = mp11::mp_size<L>; - }; -}; - -} // namespace mpl -} // namespace boost +#include <boost/mp11/mpl_list.hpp> +#include <boost/mp11/mpl_tuple.hpp> #endif // #ifndef BOOST_MP11_MPL_HPP_INCLUDED diff --git a/ThirdParty/boost/mp11/mpl_list.hpp b/ThirdParty/boost/mp11/mpl_list.hpp new file mode 100644 index 0000000000000000000000000000000000000000..643da43a08a75eb616165152b1f1f425fc0f55b3 --- /dev/null +++ b/ThirdParty/boost/mp11/mpl_list.hpp @@ -0,0 +1,28 @@ +#ifndef BOOST_MP11_MPL_LIST_HPP_INCLUDED +#define BOOST_MP11_MPL_LIST_HPP_INCLUDED + +// Copyright 2017, 2019 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/mp11/detail/mpl_common.hpp> + +namespace boost +{ +namespace mpl +{ + +template< typename Sequence > struct sequence_tag; + +template<class... T> struct sequence_tag<mp11::mp_list<T...>> +{ + using type = aux::mp11_tag; +}; + +} // namespace mpl +} // namespace boost + +#endif // #ifndef BOOST_MP11_MPL_LIST_HPP_INCLUDED diff --git a/ThirdParty/boost/mp11/mpl_tuple.hpp b/ThirdParty/boost/mp11/mpl_tuple.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b6900b1cd4213c991023c27d3a1897182ec4a871 --- /dev/null +++ b/ThirdParty/boost/mp11/mpl_tuple.hpp @@ -0,0 +1,29 @@ +#ifndef BOOST_MP11_MPL_TUPLE_HPP_INCLUDED +#define BOOST_MP11_MPL_TUPLE_HPP_INCLUDED + +// Copyright 2017, 2019 Peter Dimov. +// +// Distributed under the Boost Software License, Version 1.0. +// +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt + +#include <boost/mp11/detail/mpl_common.hpp> +#include <tuple> + +namespace boost +{ +namespace mpl +{ + +template< typename Sequence > struct sequence_tag; + +template<class... T> struct sequence_tag<std::tuple<T...>> +{ + using type = aux::mp11_tag; +}; + +} // namespace mpl +} // namespace boost + +#endif // #ifndef BOOST_MP11_MPL_TUPLE_HPP_INCLUDED diff --git a/ThirdParty/boost/mp11/utility.hpp b/ThirdParty/boost/mp11/utility.hpp index 38989f40bfdc744420c62b777eae299c13ccd99e..a8a32fb09f458592012ee9eb048f08c2aa524116 100644 --- a/ThirdParty/boost/mp11/utility.hpp +++ b/ThirdParty/boost/mp11/utility.hpp @@ -1,7 +1,7 @@ #ifndef BOOST_MP11_UTILITY_HPP_INCLUDED #define BOOST_MP11_UTILITY_HPP_INCLUDED -// Copyright 2015, 2017, 2019 Peter Dimov. +// Copyright 2015-2020 Peter Dimov. // // Distributed under the Boost Software License, Version 1.0. // @@ -9,6 +9,8 @@ // http://www.boost.org/LICENSE_1_0.txt #include <boost/mp11/integral.hpp> +#include <boost/mp11/detail/mp_list.hpp> +#include <boost/mp11/detail/mp_fold.hpp> #include <boost/mp11/detail/config.hpp> namespace boost @@ -220,8 +222,23 @@ template<class Q, class... T> using mp_invoke_q = typename Q::template fn<T...>; #endif // old name for mp_invoke_q retained for compatibility, but deprecated +#if !defined(__clang__) + template<class Q, class... T> using mp_invoke BOOST_MP11_DEPRECATED("please use mp_invoke_q") = mp_invoke_q<Q, T...>; +#else + +// Clang doesn't warn on deprecated alias templates + +template<class Q, class... T> struct BOOST_MP11_DEPRECATED("please use mp_invoke_q") mp_invoke_ +{ + using type = mp_invoke_q<Q, T...>; +}; + +template<class Q, class... T> using mp_invoke = typename mp_invoke_<Q, T...>::type; + +#endif + // mp_not_fn<P> template<template<class...> class P> struct mp_not_fn { @@ -230,6 +247,28 @@ template<template<class...> class P> struct mp_not_fn template<class Q> using mp_not_fn_q = mp_not_fn<Q::template fn>; +// mp_compose +namespace detail +{ + +template<class T, class Q> using mp_reverse_invoke_q = mp_invoke_q<Q, T>; + +} // namespace detail + +#if !BOOST_MP11_WORKAROUND( BOOST_MP11_MSVC, < 1900 ) + +template<template<class...> class... F> struct mp_compose +{ + template<class T> using fn = mp_fold<mp_list<mp_quote<F>...>, T, detail::mp_reverse_invoke_q>; +}; + +#endif + +template<class... Q> struct mp_compose_q +{ + template<class T> using fn = mp_fold<mp_list<Q...>, T, detail::mp_reverse_invoke_q>; +}; + } // namespace mp11 } // namespace boost diff --git a/ThirdParty/boost/mp11/version.hpp b/ThirdParty/boost/mp11/version.hpp index 5a1f21a50e606996b97716c3e2d47e53a43c3a17..3eba11031026729f4e2b2f33ae7ae146a1fab48c 100644 --- a/ThirdParty/boost/mp11/version.hpp +++ b/ThirdParty/boost/mp11/version.hpp @@ -11,6 +11,6 @@ // Same format as BOOST_VERSION: // major * 100000 + minor * 100 + patch -#define BOOST_MP11_VERSION 107000 +#define BOOST_MP11_VERSION 107300 #endif // #ifndef BOOST_MP11_VERSION_HPP_INCLUDED diff --git a/ThirdParty/boost/mpl/if.hpp b/ThirdParty/boost/mpl/if.hpp index b6bdf6c692258b35e8126e95a8f067b543e8ac07..3b0ae19228e92ee73bd367880a58fd68582da69c 100644 --- a/ThirdParty/boost/mpl/if.hpp +++ b/ThirdParty/boost/mpl/if.hpp @@ -46,7 +46,7 @@ struct if_c<false,T1,T2> }; // agurt, 05/sep/04: nondescriptive parameter names for the sake of DigitalMars -// (and possibly MWCW < 8.0); see http://article.gmane.org/gmane.comp.lib.boost.devel/108959 +// (and possibly MWCW < 8.0); see https://lists.boost.org/Archives/boost/2004/09/71383.php template< typename BOOST_MPL_AUX_NA_PARAM(T1) , typename BOOST_MPL_AUX_NA_PARAM(T2) diff --git a/ThirdParty/boost/none.hpp b/ThirdParty/boost/none.hpp index a37c45c5143e1c4803a4d64c383b5a9a39b32800..b5df2143b10900276f170d4753d21d57da138bd6 100644 --- a/ThirdParty/boost/none.hpp +++ b/ThirdParty/boost/none.hpp @@ -13,6 +13,7 @@ #ifndef BOOST_NONE_17SEP2003_HPP #define BOOST_NONE_17SEP2003_HPP +#include "boost/config.hpp" #include "boost/none_t.hpp" // NOTE: Borland users have to include this header outside any precompiled headers @@ -23,7 +24,7 @@ namespace boost { #ifdef BOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE -none_t const none = (static_cast<none_t>(0)) ; +BOOST_INLINE_VARIABLE none_t const none = (static_cast<none_t>(0)) ; #elif defined BOOST_OPTIONAL_USE_SINGLETON_DEFINITION_OF_NONE @@ -35,7 +36,7 @@ namespace detail { namespace optional_detail { { static const T instance; }; - + template <typename T> const T none_instance<T>::instance = T(); // global, but because 'tis a template, no cpp file required @@ -49,7 +50,7 @@ namespace { #else -const none_t none ((none_t::init_tag())); +BOOST_INLINE_VARIABLE const none_t none ((none_t::init_tag())); #endif // older definitions diff --git a/ThirdParty/boost/numeric/conversion/converter_policies.hpp b/ThirdParty/boost/numeric/conversion/converter_policies.hpp index e7a5e67ce9eb8e0513b2c5c490c35b64eff71ac3..1619d64df63ae7b3024ddcf086308da8d5f88ac0 100644 --- a/ThirdParty/boost/numeric/conversion/converter_policies.hpp +++ b/ThirdParty/boost/numeric/conversion/converter_policies.hpp @@ -12,6 +12,7 @@ #include <typeinfo> // for std::bad_cast +#include <boost/config.hpp> #include <boost/config/no_tr1/cmath.hpp> // for std::floor and std::ceil #include <boost/throw_exception.hpp> @@ -136,7 +137,7 @@ class bad_numeric_cast : public std::bad_cast { public: - virtual const char * what() const throw() + virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW { return "bad numeric conversion: overflow"; } }; @@ -144,14 +145,14 @@ class negative_overflow : public bad_numeric_cast { public: - virtual const char * what() const throw() + virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW { return "bad numeric conversion: negative overflow"; } }; class positive_overflow : public bad_numeric_cast { public: - virtual const char * what() const throw() + virtual const char * what() const BOOST_NOEXCEPT_OR_NOTHROW { return "bad numeric conversion: positive overflow"; } }; diff --git a/ThirdParty/boost/optional/bad_optional_access.hpp b/ThirdParty/boost/optional/bad_optional_access.hpp index cabf43fbace84163cc79e7ef622953fe67e129a8..add7867545f0b1f8e74ddf0ddeefe9bab190c2cf 100644 --- a/ThirdParty/boost/optional/bad_optional_access.hpp +++ b/ThirdParty/boost/optional/bad_optional_access.hpp @@ -19,6 +19,11 @@ namespace boost { +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif + class bad_optional_access : public std::logic_error { public: @@ -27,6 +32,10 @@ public: {} }; +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + } // namespace boost #endif diff --git a/ThirdParty/boost/optional/detail/optional_trivially_copyable_base.hpp b/ThirdParty/boost/optional/detail/optional_trivially_copyable_base.hpp index 5a37eacfec3b1fc17f41e85130bbd231501e26a1..2cabf9a7c6c16b6c9e9e79a23fcdeb2943689943 100644 --- a/ThirdParty/boost/optional/detail/optional_trivially_copyable_base.hpp +++ b/ThirdParty/boost/optional/detail/optional_trivially_copyable_base.hpp @@ -359,7 +359,7 @@ class tc_optional_base : public optional_tag template<class Expr> void construct ( Expr const& factory, in_place_factory_base const* ) { - boost_optional_detail::construct<value_type>(factory, m_storage.address()); + boost_optional_detail::construct<value_type>(factory, boost::addressof(m_storage)); m_initialized = true ; } diff --git a/ThirdParty/boost/optional/optional.hpp b/ThirdParty/boost/optional/optional.hpp index 90acd40a1728b316d749d777a5b361e5a8fd2a58..aadc975a7ae098bf0f7c4d30ef8b144ec085a34f 100644 --- a/ThirdParty/boost/optional/optional.hpp +++ b/ThirdParty/boost/optional/optional.hpp @@ -777,7 +777,7 @@ class optional_base : public optional_tag #include <boost/optional/detail/optional_trivially_copyable_base.hpp> -// definition of metafunciton is_optional_val_init_candidate +// definition of metafunction is_optional_val_init_candidate template <typename U> struct is_optional_related : boost::conditional< boost::is_base_of<optional_detail::optional_tag, BOOST_DEDUCED_TYPENAME boost::decay<U>::type>::value @@ -813,9 +813,14 @@ struct is_optional_constructible : boost::true_type #endif // is_convertible condition -template <typename T, typename U> +template <typename T, typename U, bool = is_optional_related<U>::value> struct is_optional_val_init_candidate - : boost::conditional< !is_optional_related<U>::value && is_convertible_to_T_or_factory<T, U>::value + : boost::false_type +{}; + +template <typename T, typename U> +struct is_optional_val_init_candidate<T, U, false> + : boost::conditional< is_convertible_to_T_or_factory<T, U>::value , boost::true_type, boost::false_type>::type {}; @@ -967,7 +972,7 @@ class optional // Can throw if T::T(T&&) does #ifndef BOOST_OPTIONAL_DETAIL_NO_DEFAULTED_MOVE_FUNCTIONS - optional ( optional && rhs ) = default; + optional ( optional && ) = default; #else optional ( optional && rhs ) BOOST_NOEXCEPT_IF(::boost::is_nothrow_move_constructible<T>::value) diff --git a/ThirdParty/boost/pointer_to_other.hpp b/ThirdParty/boost/pointer_to_other.hpp new file mode 100644 index 0000000000000000000000000000000000000000..d7d455dc6e3e1ef60bce487a3f9b1a164fa3890f --- /dev/null +++ b/ThirdParty/boost/pointer_to_other.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED +#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED + +// +// pointer_to_other.hpp +// +// (C) Copyright Ion Gaztanaga 2005. +// Copyright (c) 2005 Peter Dimov. +// +// 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) +// +// See http://www.boost.org/libs/smart_ptr/ for documentation. +// + +namespace boost +{ + +// Defines the same pointer type (raw or smart) to another pointee type + +template<class T, class U> +struct pointer_to_other; + +template<class T, class U, + template<class> class Sp> +struct pointer_to_other< Sp<T>, U > +{ + typedef Sp<U> type; +}; + +template<class T, class T2, class U, + template<class, class> class Sp> +struct pointer_to_other< Sp<T, T2>, U > +{ + typedef Sp<U, T2> type; +}; + +template<class T, class T2, class T3, class U, + template<class, class, class> class Sp> +struct pointer_to_other< Sp<T, T2, T3>, U > +{ + typedef Sp<U, T2, T3> type; +}; + +template<class T, class U> +struct pointer_to_other< T*, U > +{ + typedef U* type; +}; + +} // namespace boost + +#endif // #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED diff --git a/ThirdParty/boost/polymorphic_cast.hpp b/ThirdParty/boost/polymorphic_cast.hpp index 70afa6be2eee4cc73c9cf311a14a1d83a2b67018..3592506003250f5f6cf16b39ac19cd98f2956e42 100644 --- a/ThirdParty/boost/polymorphic_cast.hpp +++ b/ThirdParty/boost/polymorphic_cast.hpp @@ -50,14 +50,20 @@ #define BOOST_POLYMORPHIC_CAST_HPP # include <boost/config.hpp> -# include <boost/assert.hpp> -# include <boost/throw_exception.hpp> -# include <typeinfo> #ifdef BOOST_HAS_PRAGMA_ONCE # pragma once #endif +# include <boost/assert.hpp> +# include <boost/core/addressof.hpp> +# include <boost/core/enable_if.hpp> +# include <boost/throw_exception.hpp> +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/remove_reference.hpp> + +# include <typeinfo> + namespace boost { // See the documentation for descriptions of how to choose between @@ -79,7 +85,7 @@ namespace boost // polymorphic_downcast ----------------------------------------------------// - // BOOST_ASSERT() checked polymorphic downcast. Crosscasts prohibited. + // BOOST_ASSERT() checked raw pointer polymorphic downcast. Crosscasts prohibited. // WARNING: Because this cast uses BOOST_ASSERT(), it violates // the One Definition Rule if used in multiple translation units @@ -95,6 +101,26 @@ namespace boost return static_cast<Target>(x); } + // BOOST_ASSERT() checked reference polymorphic downcast. Crosscasts prohibited. + + // WARNING: Because this cast uses BOOST_ASSERT(), it violates + // the One Definition Rule if used in multiple translation units + // where BOOST_DISABLE_ASSERTS, BOOST_ENABLE_ASSERT_HANDLER + // NDEBUG are defined inconsistently. + + // Contributed by Julien Delacroix + + template <class Target, class Source> + inline typename boost::enable_if_c< + boost::is_reference<Target>::value, Target + >::type polymorphic_downcast(Source& x) + { + typedef typename boost::remove_reference<Target>::type* target_pointer_type; + return *boost::polymorphic_downcast<target_pointer_type>( + boost::addressof(x) + ); + } + } // namespace boost #endif // BOOST_POLYMORPHIC_CAST_HPP diff --git a/ThirdParty/boost/predef/architecture.h b/ThirdParty/boost/predef/architecture.h index 120d557963bf32648f32c0eafa6b039c24747cd1..732d6f0e5d95e57cc0c7efc6e90144b05cdb6ffe 100644 --- a/ThirdParty/boost/predef/architecture.h +++ b/ThirdParty/boost/predef/architecture.h @@ -21,6 +21,7 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/architecture/ppc.h> #include <boost/predef/architecture/ptx.h> #include <boost/predef/architecture/pyramid.h> +#include <boost/predef/architecture/riscv.h> #include <boost/predef/architecture/rs6k.h> #include <boost/predef/architecture/sparc.h> #include <boost/predef/architecture/superh.h> diff --git a/ThirdParty/boost/predef/architecture/alpha.h b/ThirdParty/boost/predef/architecture/alpha.h index 5bcade18b17ea586085cd22c234c914c97b7eafa..a24b10fac3cac720bddc141e7cf192b0456c28bc 100644 --- a/ThirdParty/boost/predef/architecture/alpha.h +++ b/ThirdParty/boost/predef/architecture/alpha.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_ALPHA`] - -[@http://en.wikipedia.org/wiki/DEC_Alpha DEC Alpha] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - [[`__alpha__`] [__predef_detection__]] - [[`__alpha`] [__predef_detection__]] - [[`_M_ALPHA`] [__predef_detection__]] - - [[`__alpha_ev4__`] [4.0.0]] - [[`__alpha_ev5__`] [5.0.0]] - [[`__alpha_ev6__`] [6.0.0]] - ] - */ +/* tag::reference[] += `BOOST_ARCH_ALPHA` + +http://en.wikipedia.org/wiki/DEC_Alpha[DEC Alpha] architecture. + +[options="header"] +|=== +| {predef_symbol} | {predef_version} +| `+__alpha__+` | {predef_detection} +| `+__alpha+` | {predef_detection} +| `+_M_ALPHA+` | {predef_detection} + +| `+__alpha_ev4__+` | 4.0.0 +| `+__alpha_ev5__+` | 5.0.0 +| `+__alpha_ev6__+` | 6.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_ALPHA BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/arm.h b/ThirdParty/boost/predef/architecture/arm.h index 45a0a8e306cb63aa45cafe24e528897ec04e178b..b7a8a835dbc3cc920d11f77fa35f3c3c0da98670 100644 --- a/ThirdParty/boost/predef/architecture/arm.h +++ b/ThirdParty/boost/predef/architecture/arm.h @@ -13,59 +13,60 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_ARM`] +/* tag::reference[] += `BOOST_ARCH_ARM` -[@http://en.wikipedia.org/wiki/ARM_architecture ARM] architecture. +http://en.wikipedia.org/wiki/ARM_architecture[ARM] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__ARM_ARCH`] [__predef_detection__]] - [[`__TARGET_ARCH_ARM`] [__predef_detection__]] - [[`__TARGET_ARCH_THUMB`] [__predef_detection__]] - [[`_M_ARM`] [__predef_detection__]] - [[`__arm__`] [__predef_detection__]] - [[`__arm64`] [__predef_detection__]] - [[`__thumb__`] [__predef_detection__]] - [[`_M_ARM64`] [__predef_detection__]] - [[`__aarch64__`] [__predef_detection__]] - [[`__AARCH64EL__`] [__predef_detection__]] - [[`__ARM_ARCH_7__`] [__predef_detection__]] - [[`__ARM_ARCH_7A__`] [__predef_detection__]] - [[`__ARM_ARCH_7R__`] [__predef_detection__]] - [[`__ARM_ARCH_7M__`] [__predef_detection__]] - [[`__ARM_ARCH_6K__`] [__predef_detection__]] - [[`__ARM_ARCH_6Z__`] [__predef_detection__]] - [[`__ARM_ARCH_6KZ__`] [__predef_detection__]] - [[`__ARM_ARCH_6T2__`] [__predef_detection__]] - [[`__ARM_ARCH_5TE__`] [__predef_detection__]] - [[`__ARM_ARCH_5TEJ__`] [__predef_detection__]] - [[`__ARM_ARCH_4T__`] [__predef_detection__]] - [[`__ARM_ARCH_4__`] [__predef_detection__]] +| `+__ARM_ARCH+` | {predef_detection} +| `+__TARGET_ARCH_ARM+` | {predef_detection} +| `+__TARGET_ARCH_THUMB+` | {predef_detection} +| `+_M_ARM+` | {predef_detection} +| `+__arm__+` | {predef_detection} +| `+__arm64+` | {predef_detection} +| `+__thumb__+` | {predef_detection} +| `+_M_ARM64+` | {predef_detection} +| `+__aarch64__+` | {predef_detection} +| `+__AARCH64EL__+` | {predef_detection} +| `+__ARM_ARCH_7__+` | {predef_detection} +| `+__ARM_ARCH_7A__+` | {predef_detection} +| `+__ARM_ARCH_7R__+` | {predef_detection} +| `+__ARM_ARCH_7M__+` | {predef_detection} +| `+__ARM_ARCH_6K__+` | {predef_detection} +| `+__ARM_ARCH_6Z__+` | {predef_detection} +| `+__ARM_ARCH_6KZ__+` | {predef_detection} +| `+__ARM_ARCH_6T2__+` | {predef_detection} +| `+__ARM_ARCH_5TE__+` | {predef_detection} +| `+__ARM_ARCH_5TEJ__+` | {predef_detection} +| `+__ARM_ARCH_4T__+` | {predef_detection} +| `+__ARM_ARCH_4__+` | {predef_detection} - [[`__ARM_ARCH`] [V.0.0]] - [[`__TARGET_ARCH_ARM`] [V.0.0]] - [[`__TARGET_ARCH_THUMB`] [V.0.0]] - [[`_M_ARM`] [V.0.0]] - [[`__arm64`] [8.0.0]] - [[`_M_ARM64`] [8.0.0]] - [[`__aarch64__`] [8.0.0]] - [[`__AARCH64EL__`] [8.0.0]] - [[`__ARM_ARCH_7__`] [7.0.0]] - [[`__ARM_ARCH_7A__`] [7.0.0]] - [[`__ARM_ARCH_7R__`] [7.0.0]] - [[`__ARM_ARCH_7M__`] [7.0.0]] - [[`__ARM_ARCH_6K__`] [6.0.0]] - [[`__ARM_ARCH_6Z__`] [6.0.0]] - [[`__ARM_ARCH_6KZ__`] [6.0.0]] - [[`__ARM_ARCH_6T2__`] [6.0.0]] - [[`__ARM_ARCH_5TE__`] [5.0.0]] - [[`__ARM_ARCH_5TEJ__`] [5.0.0]] - [[`__ARM_ARCH_4T__`] [4.0.0]] - [[`__ARM_ARCH_4__`] [4.0.0]] - ] - */ +| `+__ARM_ARCH+` | V.0.0 +| `+__TARGET_ARCH_ARM+` | V.0.0 +| `+__TARGET_ARCH_THUMB+` | V.0.0 +| `+_M_ARM+` | V.0.0 +| `+__arm64+` | 8.0.0 +| `+_M_ARM64+` | 8.0.0 +| `+__aarch64__+` | 8.0.0 +| `+__AARCH64EL__+` | 8.0.0 +| `+__ARM_ARCH_7__+` | 7.0.0 +| `+__ARM_ARCH_7A__+` | 7.0.0 +| `+__ARM_ARCH_7R__+` | 7.0.0 +| `+__ARM_ARCH_7M__+` | 7.0.0 +| `+__ARM_ARCH_6K__+` | 6.0.0 +| `+__ARM_ARCH_6Z__+` | 6.0.0 +| `+__ARM_ARCH_6KZ__+` | 6.0.0 +| `+__ARM_ARCH_6T2__+` | 6.0.0 +| `+__ARM_ARCH_5TE__+` | 5.0.0 +| `+__ARM_ARCH_5TEJ__+` | 5.0.0 +| `+__ARM_ARCH_4T__+` | 4.0.0 +| `+__ARM_ARCH_4__+` | 4.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/blackfin.h b/ThirdParty/boost/predef/architecture/blackfin.h index 84c58a25e9f854d490fa1c17acb2e954112eb6d5..ce1a65557e8147bcb620f7ed03600ca4025c38df 100644 --- a/ThirdParty/boost/predef/architecture/blackfin.h +++ b/ThirdParty/boost/predef/architecture/blackfin.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_BLACKFIN`] +/* tag::reference[] += `BOOST_ARCH_BLACKFIN` Blackfin Processors from Analog Devices. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__bfin__`] [__predef_detection__]] - [[`__BFIN__`] [__predef_detection__]] - [[`bfin`] [__predef_detection__]] - [[`BFIN`] [__predef_detection__]] - ] - */ +| `+__bfin__+` | {predef_detection} +| `+__BFIN__+` | {predef_detection} +| `bfin` | {predef_detection} +| `BFIN` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_BLACKFIN BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/convex.h b/ThirdParty/boost/predef/architecture/convex.h index ac783a9cc1a9384ce2fb1e55fc0486247e155908..5ce59c7539608e081c84819331e7b6716ef2768d 100644 --- a/ThirdParty/boost/predef/architecture/convex.h +++ b/ThirdParty/boost/predef/architecture/convex.h @@ -11,23 +11,24 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_CONVEX`] +/* tag::reference[] += `BOOST_ARCH_CONVEX` -[@http://en.wikipedia.org/wiki/Convex_Computer Convex Computer] architecture. +http://en.wikipedia.org/wiki/Convex_Computer[Convex Computer] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__convex__`] [__predef_detection__]] +| `+__convex__+` | {predef_detection} - [[`__convex_c1__`] [1.0.0]] - [[`__convex_c2__`] [2.0.0]] - [[`__convex_c32__`] [3.2.0]] - [[`__convex_c34__`] [3.4.0]] - [[`__convex_c38__`] [3.8.0]] - ] - */ +| `+__convex_c1__+` | 1.0.0 +| `+__convex_c2__+` | 2.0.0 +| `+__convex_c32__+` | 3.2.0 +| `+__convex_c34__+` | 3.4.0 +| `+__convex_c38__+` | 3.8.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_CONVEX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/ia64.h b/ThirdParty/boost/predef/architecture/ia64.h index 9b1972bd3984e0ce6346fceb571c9aa648409cbb..12a08d14ed364fac442ccd4b068eeb4bb94de5de 100644 --- a/ThirdParty/boost/predef/architecture/ia64.h +++ b/ThirdParty/boost/predef/architecture/ia64.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_IA64`] - -[@http://en.wikipedia.org/wiki/Ia64 Intel Itanium 64] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__ia64__`] [__predef_detection__]] - [[`_IA64`] [__predef_detection__]] - [[`__IA64__`] [__predef_detection__]] - [[`__ia64`] [__predef_detection__]] - [[`_M_IA64`] [__predef_detection__]] - [[`__itanium__`] [__predef_detection__]] - ] - */ +/* tag::reference[] += `BOOST_ARCH_IA64` + +http://en.wikipedia.org/wiki/Ia64[Intel Itanium 64] architecture. + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `+__ia64__+` | {predef_detection} +| `+_IA64+` | {predef_detection} +| `+__IA64__+` | {predef_detection} +| `+__ia64+` | {predef_detection} +| `+_M_IA64+` | {predef_detection} +| `+__itanium__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_IA64 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/m68k.h b/ThirdParty/boost/predef/architecture/m68k.h index 63ed5f8479bfa6fb1cd0549c0108d0ce289bebeb..2d877452193d1b0f690efe8c86b4fe4faeb1fc95 100644 --- a/ThirdParty/boost/predef/architecture/m68k.h +++ b/ThirdParty/boost/predef/architecture/m68k.h @@ -11,37 +11,38 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_M68K`] +/* tag::reference[] += `BOOST_ARCH_M68K` -[@http://en.wikipedia.org/wiki/M68k Motorola 68k] architecture. +http://en.wikipedia.org/wiki/M68k[Motorola 68k] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__m68k__`] [__predef_detection__]] - [[`M68000`] [__predef_detection__]] +| `+__m68k__+` | {predef_detection} +| `M68000` | {predef_detection} - [[`__mc68060__`] [6.0.0]] - [[`mc68060`] [6.0.0]] - [[`__mc68060`] [6.0.0]] - [[`__mc68040__`] [4.0.0]] - [[`mc68040`] [4.0.0]] - [[`__mc68040`] [4.0.0]] - [[`__mc68030__`] [3.0.0]] - [[`mc68030`] [3.0.0]] - [[`__mc68030`] [3.0.0]] - [[`__mc68020__`] [2.0.0]] - [[`mc68020`] [2.0.0]] - [[`__mc68020`] [2.0.0]] - [[`__mc68010__`] [1.0.0]] - [[`mc68010`] [1.0.0]] - [[`__mc68010`] [1.0.0]] - [[`__mc68000__`] [0.0.1]] - [[`mc68000`] [0.0.1]] - [[`__mc68000`] [0.0.1]] - ] - */ +| `+__mc68060__+` | 6.0.0 +| `mc68060` | 6.0.0 +| `+__mc68060+` | 6.0.0 +| `+__mc68040__+` | 4.0.0 +| `mc68040` | 4.0.0 +| `+__mc68040+` | 4.0.0 +| `+__mc68030__+` | 3.0.0 +| `mc68030` | 3.0.0 +| `+__mc68030+` | 3.0.0 +| `+__mc68020__+` | 2.0.0 +| `mc68020` | 2.0.0 +| `+__mc68020+` | 2.0.0 +| `+__mc68010__+` | 1.0.0 +| `mc68010` | 1.0.0 +| `+__mc68010+` | 1.0.0 +| `+__mc68000__+` | 0.0.1 +| `mc68000` | 0.0.1 +| `+__mc68000+` | 0.0.1 +|=== +*/ // end::reference[] #define BOOST_ARCH_M68K BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/mips.h b/ThirdParty/boost/predef/architecture/mips.h index 0189d7dbd654efe2d4be930dcc17498a90c5b578..490c5e59030777bf09c836fd8c5ef756ca780eaf 100644 --- a/ThirdParty/boost/predef/architecture/mips.h +++ b/ThirdParty/boost/predef/architecture/mips.h @@ -11,30 +11,31 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_MIPS`] +/* tag::reference[] += `BOOST_ARCH_MIPS` -[@http://en.wikipedia.org/wiki/MIPS_architecture MIPS] architecture. +http://en.wikipedia.org/wiki/MIPS_architecture[MIPS] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__mips__`] [__predef_detection__]] - [[`__mips`] [__predef_detection__]] - [[`__MIPS__`] [__predef_detection__]] +| `+__mips__+` | {predef_detection} +| `+__mips+` | {predef_detection} +| `+__MIPS__+` | {predef_detection} - [[`__mips`] [V.0.0]] - [[`_MIPS_ISA_MIPS1`] [1.0.0]] - [[`_R3000`] [1.0.0]] - [[`_MIPS_ISA_MIPS2`] [2.0.0]] - [[`__MIPS_ISA2__`] [2.0.0]] - [[`_R4000`] [2.0.0]] - [[`_MIPS_ISA_MIPS3`] [3.0.0]] - [[`__MIPS_ISA3__`] [3.0.0]] - [[`_MIPS_ISA_MIPS4`] [4.0.0]] - [[`__MIPS_ISA4__`] [4.0.0]] - ] - */ +| `+__mips+` | V.0.0 +| `+_MIPS_ISA_MIPS1+` | 1.0.0 +| `+_R3000+` | 1.0.0 +| `+_MIPS_ISA_MIPS2+` | 2.0.0 +| `+__MIPS_ISA2__+` | 2.0.0 +| `+_R4000+` | 2.0.0 +| `+_MIPS_ISA_MIPS3+` | 3.0.0 +| `+__MIPS_ISA3__+` | 3.0.0 +| `+_MIPS_ISA_MIPS4+` | 4.0.0 +| `+__MIPS_ISA4__+` | 4.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_MIPS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/parisc.h b/ThirdParty/boost/predef/architecture/parisc.h index c75a1f388924df9beebdace7d1928397eb53203b..0825445a34b2154fc552fb90af2d6ad34e156e75 100644 --- a/ThirdParty/boost/predef/architecture/parisc.h +++ b/ThirdParty/boost/predef/architecture/parisc.h @@ -11,28 +11,29 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_PARISC`] +/* tag::reference[] += `BOOST_ARCH_PARISC` -[@http://en.wikipedia.org/wiki/PA-RISC_family HP/PA RISC] architecture. +http://en.wikipedia.org/wiki/PA-RISC_family[HP/PA RISC] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__hppa__`] [__predef_detection__]] - [[`__hppa`] [__predef_detection__]] - [[`__HPPA__`] [__predef_detection__]] +| `+__hppa__+` | {predef_detection} +| `+__hppa+` | {predef_detection} +| `+__HPPA__+` | {predef_detection} - [[`_PA_RISC1_0`] [1.0.0]] - [[`_PA_RISC1_1`] [1.1.0]] - [[`__HPPA11__`] [1.1.0]] - [[`__PA7100__`] [1.1.0]] - [[`_PA_RISC2_0`] [2.0.0]] - [[`__RISC2_0__`] [2.0.0]] - [[`__HPPA20__`] [2.0.0]] - [[`__PA8000__`] [2.0.0]] - ] - */ +| `+_PA_RISC1_0+` | 1.0.0 +| `+_PA_RISC1_1+` | 1.1.0 +| `+__HPPA11__+` | 1.1.0 +| `+__PA7100__+` | 1.1.0 +| `+_PA_RISC2_0+` | 2.0.0 +| `+__RISC2_0__+` | 2.0.0 +| `+__HPPA20__+` | 2.0.0 +| `+__PA8000__+` | 2.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_PARISC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/ppc.h b/ThirdParty/boost/predef/architecture/ppc.h index e8c57c91f2c074d3476d5d8bbdba6230e7b3728f..019e11be81f023d9878962690f666cf84356ec9b 100644 --- a/ThirdParty/boost/predef/architecture/ppc.h +++ b/ThirdParty/boost/predef/architecture/ppc.h @@ -11,32 +11,33 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_PPC`] +/* tag::reference[] += `BOOST_ARCH_PPC` -[@http://en.wikipedia.org/wiki/PowerPC PowerPC] architecture. +http://en.wikipedia.org/wiki/PowerPC[PowerPC] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__powerpc`] [__predef_detection__]] - [[`__powerpc__`] [__predef_detection__]] - [[`__POWERPC__`] [__predef_detection__]] - [[`__ppc__`] [__predef_detection__]] - [[`_M_PPC`] [__predef_detection__]] - [[`_ARCH_PPC`] [__predef_detection__]] - [[`__PPCGECKO__`] [__predef_detection__]] - [[`__PPCBROADWAY__`] [__predef_detection__]] - [[`_XENON`] [__predef_detection__]] +| `+__powerpc+` | {predef_detection} +| `+__powerpc__+` | {predef_detection} +| `+__POWERPC__+` | {predef_detection} +| `+__ppc__+` | {predef_detection} +| `+_M_PPC+` | {predef_detection} +| `+_ARCH_PPC+` | {predef_detection} +| `+__PPCGECKO__+` | {predef_detection} +| `+__PPCBROADWAY__+` | {predef_detection} +| `+_XENON+` | {predef_detection} - [[`__ppc601__`] [6.1.0]] - [[`_ARCH_601`] [6.1.0]] - [[`__ppc603__`] [6.3.0]] - [[`_ARCH_603`] [6.3.0]] - [[`__ppc604__`] [6.4.0]] - [[`__ppc604__`] [6.4.0]] - ] - */ +| `+__ppc601__+` | 6.1.0 +| `+_ARCH_601+` | 6.1.0 +| `+__ppc603__+` | 6.3.0 +| `+_ARCH_603+` | 6.3.0 +| `+__ppc604__+` | 6.4.0 +| `+__ppc604__+` | 6.4.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/ptx.h b/ThirdParty/boost/predef/architecture/ptx.h index 335517b276e3641ceff00f2e2ae4884dacdc60fe..a3310943ee4ba95b4bae0aab11820deebd196367 100644 --- a/ThirdParty/boost/predef/architecture/ptx.h +++ b/ThirdParty/boost/predef/architecture/ptx.h @@ -11,19 +11,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_PTX`] +/* tag::reference[] += `BOOST_ARCH_PTX` -[@https://en.wikipedia.org/wiki/Parallel_Thread_Execution PTX] architecture. +https://en.wikipedia.org/wiki/Parallel_Thread_Execution[PTX] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__CUDA_ARCH__`] [__predef_detection__]] +| `+__CUDA_ARCH__+` | {predef_detection} - [[`__CUDA_ARCH__`] [V.R.0]] - ] - */ +| `+__CUDA_ARCH__+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_PTX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/pyramid.h b/ThirdParty/boost/predef/architecture/pyramid.h index 4f13253807a81baeda6be65af7dff7784fc0e74a..afcd1a96e50c632e10ce9fc49ff7afbf2ff5d2e3 100644 --- a/ThirdParty/boost/predef/architecture/pyramid.h +++ b/ThirdParty/boost/predef/architecture/pyramid.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_PYRAMID`] +/* tag::reference[] += `BOOST_ARCH_PYRAMID` Pyramid 9810 architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`pyr`] [__predef_detection__]] - ] - */ +| `pyr` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_PYRAMID BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/riscv.h b/ThirdParty/boost/predef/architecture/riscv.h new file mode 100644 index 0000000000000000000000000000000000000000..7c3a7ba0587aa04917be44280cb3b7cb8ff1d52d --- /dev/null +++ b/ThirdParty/boost/predef/architecture/riscv.h @@ -0,0 +1,43 @@ +/* +Copyright Andreas Schwab 2019 +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) +*/ + +#ifndef BOOST_PREDEF_ARCHITECTURE_RISCV_H +#define BOOST_PREDEF_ARCHITECTURE_RISCV_H + +#include <boost/predef/version_number.h> +#include <boost/predef/make.h> + +/* tag::reference[] += `BOOST_ARCH_RISCV` + +http://en.wikipedia.org/wiki/RISC-V[RISC-V] architecture. + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `+__riscv+` | {predef_detection} +|=== +*/ // end::reference[] + +#define BOOST_ARCH_RISCV BOOST_VERSION_NUMBER_NOT_AVAILABLE + +#if defined(__riscv) +# undef BOOST_ARCH_RISCV +# define BOOST_ARCH_RISCV BOOST_VERSION_NUMBER_AVAILABLE +#endif + +#if BOOST_ARCH_RISCV +# define BOOST_ARCH_RISCV_AVAILABLE +#endif + +#define BOOST_ARCH_RISCV_NAME "RISC-V" + +#endif + +#include <boost/predef/detail/test.h> +BOOST_PREDEF_DECLARE_TEST(BOOST_ARCH_RISCV,BOOST_ARCH_RISCV_NAME) diff --git a/ThirdParty/boost/predef/architecture/rs6k.h b/ThirdParty/boost/predef/architecture/rs6k.h index 8a6e9b6b5342ba1860618bf3807729bf331e2f79..e33c7935e9c6f5344297ad5f8eb8dd506c962aed 100644 --- a/ThirdParty/boost/predef/architecture/rs6k.h +++ b/ThirdParty/boost/predef/architecture/rs6k.h @@ -11,21 +11,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_RS6000`] - -[@http://en.wikipedia.org/wiki/RS/6000 RS/6000] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__THW_RS6000`] [__predef_detection__]] - [[`_IBMR2`] [__predef_detection__]] - [[`_POWER`] [__predef_detection__]] - [[`_ARCH_PWR`] [__predef_detection__]] - [[`_ARCH_PWR2`] [__predef_detection__]] - ] - */ +/* tag::reference[] += `BOOST_ARCH_RS6000` + +http://en.wikipedia.org/wiki/RS/6000[RS/6000] architecture. + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `+__THW_RS6000+` | {predef_detection} +| `+_IBMR2+` | {predef_detection} +| `+_POWER+` | {predef_detection} +| `+_ARCH_PWR+` | {predef_detection} +| `+_ARCH_PWR2+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_RS6000 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/sparc.h b/ThirdParty/boost/predef/architecture/sparc.h index a89a5100b8ff13e7cba91459b1f0ff3599277e46..31551e393e2272ba8d2719bc191f8084bcaf6fa2 100644 --- a/ThirdParty/boost/predef/architecture/sparc.h +++ b/ThirdParty/boost/predef/architecture/sparc.h @@ -11,21 +11,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_SPARC`] +/* tag::reference[] += `BOOST_ARCH_SPARC` -[@http://en.wikipedia.org/wiki/SPARC SPARC] architecture. +http://en.wikipedia.org/wiki/SPARC[SPARC] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__sparc__`] [__predef_detection__]] - [[`__sparc`] [__predef_detection__]] +| `+__sparc__+` | {predef_detection} +| `+__sparc+` | {predef_detection} - [[`__sparcv9`] [9.0.0]] - [[`__sparcv8`] [8.0.0]] - ] - */ +| `+__sparcv9+` | 9.0.0 +| `+__sparcv8+` | 8.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_SPARC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/superh.h b/ThirdParty/boost/predef/architecture/superh.h index da0529e5e03fc5d3ca4c9b9baa6334f0811228ad..5034d90b37b34f465ab07531e2556481611b87d4 100644 --- a/ThirdParty/boost/predef/architecture/superh.h +++ b/ThirdParty/boost/predef/architecture/superh.h @@ -11,25 +11,26 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_SH`] +/* tag::reference[] += `BOOST_ARCH_SH` -[@http://en.wikipedia.org/wiki/SuperH SuperH] architecture: -If available versions \[1-5\] are specifically detected. +http://en.wikipedia.org/wiki/SuperH[SuperH] architecture: +If available versions [1-5] are specifically detected. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__sh__`] [__predef_detection__]] +| `+__sh__+` | {predef_detection} - [[`__SH5__`] [5.0.0]] - [[`__SH4__`] [4.0.0]] - [[`__sh3__`] [3.0.0]] - [[`__SH3__`] [3.0.0]] - [[`__sh2__`] [2.0.0]] - [[`__sh1__`] [1.0.0]] - ] - */ +| `+__SH5__+` | 5.0.0 +| `+__SH4__+` | 4.0.0 +| `+__sh3__+` | 3.0.0 +| `+__SH3__+` | 3.0.0 +| `+__sh2__+` | 2.0.0 +| `+__sh1__+` | 1.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_SH BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/sys370.h b/ThirdParty/boost/predef/architecture/sys370.h index cfd85dc803b802e68f6f0df78ca8c8623811b5c0..265d0f05557b365e1c4838839d0a92e1b58e6cbd 100644 --- a/ThirdParty/boost/predef/architecture/sys370.h +++ b/ThirdParty/boost/predef/architecture/sys370.h @@ -11,18 +11,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_SYS370`] +/* tag::reference[] += `BOOST_ARCH_SYS370` -[@http://en.wikipedia.org/wiki/System/370 System/370] architecture. +http://en.wikipedia.org/wiki/System/370[System/370] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__370__`] [__predef_detection__]] - [[`__THW_370__`] [__predef_detection__]] - ] - */ +| `+__370__+` | {predef_detection} +| `+__THW_370__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_SYS370 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/sys390.h b/ThirdParty/boost/predef/architecture/sys390.h index 47aff6acd63f6566a37c5499d502888073d1beae..155c9beac6854a5fae0b659dfc6475691cd42b23 100644 --- a/ThirdParty/boost/predef/architecture/sys390.h +++ b/ThirdParty/boost/predef/architecture/sys390.h @@ -11,18 +11,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_SYS390`] +/* tag::reference[] += `BOOST_ARCH_SYS390` -[@http://en.wikipedia.org/wiki/System/390 System/390] architecture. +http://en.wikipedia.org/wiki/System/390[System/390] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__s390__`] [__predef_detection__]] - [[`__s390x__`] [__predef_detection__]] - ] - */ +| `+__s390__+` | {predef_detection} +| `+__s390x__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_SYS390 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/x86.h b/ThirdParty/boost/predef/architecture/x86.h index 0ef3ef45efd50e77053426b3ed75b57d7275b3aa..9827ef3ab5d871c96c9b9de59397ce2fb8cbd398 100644 --- a/ThirdParty/boost/predef/architecture/x86.h +++ b/ThirdParty/boost/predef/architecture/x86.h @@ -11,13 +11,13 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_ARCHITECTURE_X86_H #define BOOST_PREDEF_ARCHITECTURE_X86_H -/*` -[heading `BOOST_ARCH_X86`] +/* tag::reference[] += `BOOST_ARCH_X86` -[@http://en.wikipedia.org/wiki/X86 Intel x86] architecture. This is +http://en.wikipedia.org/wiki/X86[Intel x86] architecture. This is a category to indicate that either `BOOST_ARCH_X86_32` or `BOOST_ARCH_X86_64` is detected. - */ +*/ // end::reference[] #define BOOST_ARCH_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/x86/32.h b/ThirdParty/boost/predef/architecture/x86/32.h index 17fbff554a8ac53dac6e39f2e89210692bd77b73..cd2e7504f63575ecc0e951b32ccd15b1b86a3732 100644 --- a/ThirdParty/boost/predef/architecture/x86/32.h +++ b/ThirdParty/boost/predef/architecture/x86/32.h @@ -11,35 +11,36 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_X86_32`] +/* tag::reference[] += `BOOST_ARCH_X86_32` -[@http://en.wikipedia.org/wiki/X86 Intel x86] architecture: -If available versions \[3-6\] are specifically detected. +http://en.wikipedia.org/wiki/X86[Intel x86] architecture: +If available versions [3-6] are specifically detected. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`i386`] [__predef_detection__]] - [[`__i386__`] [__predef_detection__]] - [[`__i486__`] [__predef_detection__]] - [[`__i586__`] [__predef_detection__]] - [[`__i686__`] [__predef_detection__]] - [[`__i386`] [__predef_detection__]] - [[`_M_IX86`] [__predef_detection__]] - [[`_X86_`] [__predef_detection__]] - [[`__THW_INTEL__`] [__predef_detection__]] - [[`__I86__`] [__predef_detection__]] - [[`__INTEL__`] [__predef_detection__]] +| `i386` | {predef_detection} +| `+__i386__+` | {predef_detection} +| `+__i486__+` | {predef_detection} +| `+__i586__+` | {predef_detection} +| `+__i686__+` | {predef_detection} +| `+__i386+` | {predef_detection} +| `+_M_IX86+` | {predef_detection} +| `+_X86_+` | {predef_detection} +| `+__THW_INTEL__+` | {predef_detection} +| `+__I86__+` | {predef_detection} +| `+__INTEL__+` | {predef_detection} - [[`__I86__`] [V.0.0]] - [[`_M_IX86`] [V.0.0]] - [[`__i686__`] [6.0.0]] - [[`__i586__`] [5.0.0]] - [[`__i486__`] [4.0.0]] - [[`__i386__`] [3.0.0]] - ] - */ +| `+__I86__+` | V.0.0 +| `+_M_IX86+` | V.0.0 +| `+__i686__+` | 6.0.0 +| `+__i586__+` | 5.0.0 +| `+__i486__+` | 4.0.0 +| `+__i386__+` | 3.0.0 +|=== +*/ // end::reference[] #define BOOST_ARCH_X86_32 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/x86/64.h b/ThirdParty/boost/predef/architecture/x86/64.h index f761c92596c8c9a7c3ad513de415c7def98ca09b..ebd80fb5e8fc4e0ae9cc9104abf973ecfdd3e404 100644 --- a/ThirdParty/boost/predef/architecture/x86/64.h +++ b/ThirdParty/boost/predef/architecture/x86/64.h @@ -11,21 +11,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_X86_64`] - -[@http://en.wikipedia.org/wiki/Ia64 Intel IA-64] architecture. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__x86_64`] [__predef_detection__]] - [[`__x86_64__`] [__predef_detection__]] - [[`__amd64__`] [__predef_detection__]] - [[`__amd64`] [__predef_detection__]] - [[`_M_X64`] [__predef_detection__]] - ] - */ +/* tag::reference[] += `BOOST_ARCH_X86_64` + +http://en.wikipedia.org/wiki/Ia64[Intel IA-64] architecture. + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `+__x86_64+` | {predef_detection} +| `+__x86_64__+` | {predef_detection} +| `+__amd64__+` | {predef_detection} +| `+__amd64+` | {predef_detection} +| `+_M_X64+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_X86_64 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/architecture/z.h b/ThirdParty/boost/predef/architecture/z.h index 3d218aa2644393a0bfbf9c8a7ac2f70c516a4cef..d2d8e95f44105687235771b1c0c12a75ae53cfd1 100644 --- a/ThirdParty/boost/predef/architecture/z.h +++ b/ThirdParty/boost/predef/architecture/z.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_ARCH_Z`] +/* tag::reference[] += `BOOST_ARCH_Z` -[@http://en.wikipedia.org/wiki/Z/Architecture z/Architecture] architecture. +http://en.wikipedia.org/wiki/Z/Architecture[z/Architecture] architecture. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SYSC_ZARCH__`] [__predef_detection__]] - ] - */ +| `+__SYSC_ZARCH__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_ARCH_Z BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/borland.h b/ThirdParty/boost/predef/compiler/borland.h index 3677cca7fda6b15af39ff01c6e0fbe3300174909..64daf909bad65bd7989a38ccd1c1fe17da9b0920 100644 --- a/ThirdParty/boost/predef/compiler/borland.h +++ b/ThirdParty/boost/predef/compiler/borland.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_BORLAND`] +/* tag::reference[] += `BOOST_COMP_BORLAND` -[@http://en.wikipedia.org/wiki/C_plus_plus_builder Borland C++] compiler. +http://en.wikipedia.org/wiki/C_plus_plus_builder[Borland {CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__BORLANDC__`] [__predef_detection__]] - [[`__CODEGEARC__`] [__predef_detection__]] +| `+__BORLANDC__+` | {predef_detection} +| `+__CODEGEARC__+` | {predef_detection} - [[`__BORLANDC__`] [V.R.P]] - [[`__CODEGEARC__`] [V.R.P]] - ] - */ +| `+__BORLANDC__+` | V.R.P +| `+__CODEGEARC__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_BORLAND BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/clang.h b/ThirdParty/boost/predef/compiler/clang.h index 56678fe6a5e0fab840e68f932352c8152ac0b685..5e62da256b7b37e3775fa22ec3e31274f6d0f6ae 100644 --- a/ThirdParty/boost/predef/compiler/clang.h +++ b/ThirdParty/boost/predef/compiler/clang.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_CLANG`] +/* tag::reference[] += `BOOST_COMP_CLANG` -[@http://en.wikipedia.org/wiki/Clang Clang] compiler. +http://en.wikipedia.org/wiki/Clang[Clang] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__clang__`] [__predef_detection__]] +| `+__clang__+` | {predef_detection} - [[`__clang_major__`, `__clang_minor__`, `__clang_patchlevel__`] [V.R.P]] - ] - */ +| `+__clang_major__+`, `+__clang_minor__+`, `+__clang_patchlevel__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_CLANG BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/comeau.h b/ThirdParty/boost/predef/compiler/comeau.h index 15a456489613654212652b334c8e621f10083bbc..749694d0721c0ff57bd56227a775d8d617c15463 100644 --- a/ThirdParty/boost/predef/compiler/comeau.h +++ b/ThirdParty/boost/predef/compiler/comeau.h @@ -13,20 +13,21 @@ http://www.boost.org/LICENSE_1_0.txt) #define BOOST_COMP_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE -/*` -[heading `BOOST_COMP_COMO`] +/* tag::reference[] += `BOOST_COMP_COMO` -[@http://en.wikipedia.org/wiki/Comeau_C/C%2B%2B Comeau C++] compiler. +http://en.wikipedia.org/wiki/Comeau_C/C%2B%2B[Comeau {CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__COMO__`] [__predef_detection__]] +| `+__COMO__+` | {predef_detection} - [[`__COMO_VERSION__`] [V.R.P]] - ] - */ +| `+__COMO_VERSION__+` | V.R.P +|=== +*/ // end::reference[] #if defined(__COMO__) # if !defined(BOOST_COMP_COMO_DETECTION) && defined(__COMO_VERSION__) diff --git a/ThirdParty/boost/predef/compiler/compaq.h b/ThirdParty/boost/predef/compiler/compaq.h index c6a83ffd0d5c5e3fbe5ca3f5f3239bce1b7d1023..a2a403ff288ed6c5926440db372eef61eb82c5f0 100644 --- a/ThirdParty/boost/predef/compiler/compaq.h +++ b/ThirdParty/boost/predef/compiler/compaq.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_DEC`] +/* tag::reference[] += `BOOST_COMP_DEC` -[@http://www.openvms.compaq.com/openvms/brochures/deccplus/ Compaq C/C++] compiler. +http://www.openvms.compaq.com/openvms/brochures/deccplus/[Compaq C/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__DECCXX`] [__predef_detection__]] - [[`__DECC`] [__predef_detection__]] +| `+__DECCXX+` | {predef_detection} +| `+__DECC+` | {predef_detection} - [[`__DECCXX_VER`] [V.R.P]] - [[`__DECC_VER`] [V.R.P]] - ] - */ +| `+__DECCXX_VER+` | V.R.P +| `+__DECC_VER+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_DEC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/diab.h b/ThirdParty/boost/predef/compiler/diab.h index f5a37de7d3f604c048f6f2266638364e3c81185f..9be1d1aee0fa5a4d6549d8b9b3f7981ab93fe366 100644 --- a/ThirdParty/boost/predef/compiler/diab.h +++ b/ThirdParty/boost/predef/compiler/diab.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_DIAB`] +/* tag::reference[] += `BOOST_COMP_DIAB` -[@http://www.windriver.com/products/development_suite/wind_river_compiler/ Diab C/C++] compiler. +http://www.windriver.com/products/development_suite/wind_river_compiler/[Diab C/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__DCC__`] [__predef_detection__]] +| `+__DCC__+` | {predef_detection} - [[`__VERSION_NUMBER__`] [V.R.P]] - ] - */ +| `+__VERSION_NUMBER__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_DIAB BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/digitalmars.h b/ThirdParty/boost/predef/compiler/digitalmars.h index 9bd58502e0f465462db765f6df1c88bfe64bdd97..3b2d53f7190048f68a3130637e82395941e922ad 100644 --- a/ThirdParty/boost/predef/compiler/digitalmars.h +++ b/ThirdParty/boost/predef/compiler/digitalmars.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_DMC`] +/* tag::reference[] += `BOOST_COMP_DMC` -[@http://en.wikipedia.org/wiki/Digital_Mars Digital Mars] compiler. +http://en.wikipedia.org/wiki/Digital_Mars[Digital Mars] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__DMC__`] [__predef_detection__]] +| `+__DMC__+` | {predef_detection} - [[`__DMC__`] [V.R.P]] - ] - */ +| `+__DMC__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_DMC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/dignus.h b/ThirdParty/boost/predef/compiler/dignus.h index c65d3dc7648936d9cd985c128e0c6a4186b88f96..8177cc76ee8685c1ebc99cf3b2192fac72783bdb 100644 --- a/ThirdParty/boost/predef/compiler/dignus.h +++ b/ThirdParty/boost/predef/compiler/dignus.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_SYSC`] +/* tag::reference[] += `BOOST_COMP_SYSC` -[@http://www.dignus.com/dcxx/ Dignus Systems/C++] compiler. +http://www.dignus.com/dcxx/[Dignus Systems/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SYSC__`] [__predef_detection__]] +| `+__SYSC__+` | {predef_detection} - [[`__SYSC_VER__`] [V.R.P]] - ] - */ +| `+__SYSC_VER__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_SYSC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/edg.h b/ThirdParty/boost/predef/compiler/edg.h index 2ffb9b0a6d323c1565f0b9c69fa35a87c307b6ca..6e0f97a2bb9f9106aff30b2e8764ba5e5f4b17d1 100644 --- a/ThirdParty/boost/predef/compiler/edg.h +++ b/ThirdParty/boost/predef/compiler/edg.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_EDG`] +/* tag::reference[] += `BOOST_COMP_EDG` -[@http://en.wikipedia.org/wiki/Edison_Design_Group EDG C++ Frontend] compiler. +http://en.wikipedia.org/wiki/Edison_Design_Group[EDG {CPP} Frontend] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__EDG__`] [__predef_detection__]] +| `+__EDG__+` | {predef_detection} - [[`__EDG_VERSION__`] [V.R.0]] - ] - */ +| `+__EDG_VERSION__+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_COMP_EDG BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/ekopath.h b/ThirdParty/boost/predef/compiler/ekopath.h index e5cde36752cbd16addb9803675388e506cec36d1..f91c9dceffe2d996d29170a876291aa7d144dd7e 100644 --- a/ThirdParty/boost/predef/compiler/ekopath.h +++ b/ThirdParty/boost/predef/compiler/ekopath.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_PATH`] +/* tag::reference[] += `BOOST_COMP_PATH` -[@http://en.wikipedia.org/wiki/PathScale EKOpath] compiler. +http://en.wikipedia.org/wiki/PathScale[EKOpath] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__PATHCC__`] [__predef_detection__]] +| `+__PATHCC__+` | {predef_detection} - [[`__PATHCC__`, `__PATHCC_MINOR__`, `__PATHCC_PATCHLEVEL__`] [V.R.P]] - ] - */ +| `+__PATHCC__+`, `+__PATHCC_MINOR__+`, `+__PATHCC_PATCHLEVEL__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_PATH BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/gcc.h b/ThirdParty/boost/predef/compiler/gcc.h index c2d7fff178bdd08d91b76a3f3f4fad04e112375f..88698d21e900ef1d923f8815cba4d919f981cbab 100644 --- a/ThirdParty/boost/predef/compiler/gcc.h +++ b/ThirdParty/boost/predef/compiler/gcc.h @@ -15,21 +15,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_GNUC`] +/* tag::reference[] += `BOOST_COMP_GNUC` -[@http://en.wikipedia.org/wiki/GNU_Compiler_Collection Gnu GCC C/C++] compiler. +http://en.wikipedia.org/wiki/GNU_Compiler_Collection[Gnu GCC C/{CPP}] compiler. Version number available as major, minor, and patch (if available). -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__GNUC__`] [__predef_detection__]] +| `+__GNUC__+` | {predef_detection} - [[`__GNUC__`, `__GNUC_MINOR__`, `__GNUC_PATCHLEVEL__`] [V.R.P]] - [[`__GNUC__`, `__GNUC_MINOR__`] [V.R.0]] - ] - */ +| `+__GNUC__+`, `+__GNUC_MINOR__+`, `+__GNUC_PATCHLEVEL__+` | V.R.P +| `+__GNUC__+`, `+__GNUC_MINOR__+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_COMP_GNUC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/gcc_xml.h b/ThirdParty/boost/predef/compiler/gcc_xml.h index acae600c8120e1c4840bf50df9f631f90d5eb422..a9253370120660e49b9c38fbe1debda3bae51ed6 100644 --- a/ThirdParty/boost/predef/compiler/gcc_xml.h +++ b/ThirdParty/boost/predef/compiler/gcc_xml.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_GCCXML`] +/* tag::reference[] += `BOOST_COMP_GCCXML` -[@http://www.gccxml.org/ GCC XML] compiler. +http://www.gccxml.org/[GCC XML] compiler. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__GCCXML__`] [__predef_detection__]] - ] - */ +| `+__GCCXML__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_COMP_GCCXML BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/greenhills.h b/ThirdParty/boost/predef/compiler/greenhills.h index 23b8f017d8bf0dc3198ff5debd72139f5b5764f1..9bf5bf17baea85b116a6a8707bb90be95537c17f 100644 --- a/ThirdParty/boost/predef/compiler/greenhills.h +++ b/ThirdParty/boost/predef/compiler/greenhills.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_GHS`] +/* tag::reference[] += `BOOST_COMP_GHS` -[@http://en.wikipedia.org/wiki/Green_Hills_Software Green Hills C/C++] compiler. +http://en.wikipedia.org/wiki/Green_Hills_Software[Green Hills C/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__ghs`] [__predef_detection__]] - [[`__ghs__`] [__predef_detection__]] +| `+__ghs+` | {predef_detection} +| `+__ghs__+` | {predef_detection} - [[`__GHS_VERSION_NUMBER__`] [V.R.P]] - [[`__ghs`] [V.R.P]] - ] - */ +| `+__GHS_VERSION_NUMBER__+` | V.R.P +| `+__ghs+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_GHS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/hp_acc.h b/ThirdParty/boost/predef/compiler/hp_acc.h index 7b3ffe9068ab69d730ea38e5e007e0bc85d5926f..7a825cd51f07065d4b4abe905f5746ce2160c603 100644 --- a/ThirdParty/boost/predef/compiler/hp_acc.h +++ b/ThirdParty/boost/predef/compiler/hp_acc.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_HPACC`] +/* tag::reference[] += `BOOST_COMP_HPACC` -HP aC++ compiler. +HP a{CPP} compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__HP_aCC`] [__predef_detection__]] +| `+__HP_aCC+` | {predef_detection} - [[`__HP_aCC`] [V.R.P]] - ] - */ +| `+__HP_aCC+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_HPACC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/iar.h b/ThirdParty/boost/predef/compiler/iar.h index 237f492e29156aa8c5c7dee75af9681b01fec766..1140b0b4dda82a976123b36f69907e1293441280 100644 --- a/ThirdParty/boost/predef/compiler/iar.h +++ b/ThirdParty/boost/predef/compiler/iar.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_IAR`] +/* tag::reference[] += `BOOST_COMP_IAR` -IAR C/C++ compiler. +IAR C/{CPP} compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__IAR_SYSTEMS_ICC__`] [__predef_detection__]] +| `+__IAR_SYSTEMS_ICC__+` | {predef_detection} - [[`__VER__`] [V.R.P]] - ] - */ +| `+__VER__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_IAR BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/ibm.h b/ThirdParty/boost/predef/compiler/ibm.h index 6931ebd884083351406a649a585f59c3cabbdcd6..6820677f90656e28987f7ac51a28970f035d7d77 100644 --- a/ThirdParty/boost/predef/compiler/ibm.h +++ b/ThirdParty/boost/predef/compiler/ibm.h @@ -11,25 +11,26 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_IBM`] +/* tag::reference[] += `BOOST_COMP_IBM` -[@http://en.wikipedia.org/wiki/VisualAge IBM XL C/C++] compiler. +http://en.wikipedia.org/wiki/VisualAge[IBM XL C/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__IBMCPP__`] [__predef_detection__]] - [[`__xlC__`] [__predef_detection__]] - [[`__xlc__`] [__predef_detection__]] +| `+__IBMCPP__+` | {predef_detection} +| `+__xlC__+` | {predef_detection} +| `+__xlc__+` | {predef_detection} - [[`__COMPILER_VER__`] [V.R.P]] - [[`__xlC__`] [V.R.P]] - [[`__xlc__`] [V.R.P]] - [[`__IBMCPP__`] [V.R.P]] - ] - */ +| `+__COMPILER_VER__+` | V.R.P +| `+__xlC__+` | V.R.P +| `+__xlc__+` | V.R.P +| `+__IBMCPP__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/intel.h b/ThirdParty/boost/predef/compiler/intel.h index f8a17ef437ed7e791f125d04dac17b5eadefbbb9..62d510ab62100c26ac99bdc68752af6238d04dff 100644 --- a/ThirdParty/boost/predef/compiler/intel.h +++ b/ThirdParty/boost/predef/compiler/intel.h @@ -11,33 +11,34 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_INTEL`] +/* tag::reference[] += `BOOST_COMP_INTEL` -[@http://en.wikipedia.org/wiki/Intel_C%2B%2B Intel C/C++] compiler. +http://en.wikipedia.org/wiki/Intel_C%2B%2B[Intel C/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__INTEL_COMPILER`] [__predef_detection__]] - [[`__ICL`] [__predef_detection__]] - [[`__ICC`] [__predef_detection__]] - [[`__ECC`] [__predef_detection__]] +| `+__INTEL_COMPILER+` | {predef_detection} +| `+__ICL+` | {predef_detection} +| `+__ICC+` | {predef_detection} +| `+__ECC+` | {predef_detection} - [[`__INTEL_COMPILER`] [V.R]] - [[`__INTEL_COMPILER` and `__INTEL_COMPILER_UPDATE`] [V.R.P]] - ] - */ +| `+__INTEL_COMPILER+` | V.R +| `+__INTEL_COMPILER+` and `+__INTEL_COMPILER_UPDATE+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_INTEL BOOST_VERSION_NUMBER_NOT_AVAILABLE #if defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || \ defined(__ECC) -/*` -[note Because of an Intel mistake in the release version numbering when -`__INTEL_COMPILER` is `9999` it is detected as version 12.1.0.] - */ +/* tag::reference[] +NOTE: Because of an Intel mistake in the release version numbering when +`__INTEL_COMPILER` is `9999` it is detected as version 12.1.0. +*/ // end::reference[] # if !defined(BOOST_COMP_INTEL_DETECTION) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER == 9999) # define BOOST_COMP_INTEL_DETECTION BOOST_VERSION_NUMBER(12,1,0) # endif diff --git a/ThirdParty/boost/predef/compiler/kai.h b/ThirdParty/boost/predef/compiler/kai.h index 68ce84e1466f1f2812a8e02b8831ec184d0e20b3..1980cc8406b5d5f18c0b947f1879e390d1154370 100644 --- a/ThirdParty/boost/predef/compiler/kai.h +++ b/ThirdParty/boost/predef/compiler/kai.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_KCC`] +/* tag::reference[] += `BOOST_COMP_KCC` -Kai C++ compiler. +Kai {CPP} compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__KCC`] [__predef_detection__]] +| `+__KCC+` | {predef_detection} - [[`__KCC_VERSION`] [V.R.P]] - ] - */ +| `+__KCC_VERSION+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_KCC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/llvm.h b/ThirdParty/boost/predef/compiler/llvm.h index de654eb8cec071f9f1e8978d83b3be98d064a90d..09f2b8044b2aa44227d5b872fa3c956bde7ac36d 100644 --- a/ThirdParty/boost/predef/compiler/llvm.h +++ b/ThirdParty/boost/predef/compiler/llvm.h @@ -15,17 +15,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_LLVM`] +/* tag::reference[] += `BOOST_COMP_LLVM` -[@http://en.wikipedia.org/wiki/LLVM LLVM] compiler. +http://en.wikipedia.org/wiki/LLVM[LLVM] compiler. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__llvm__`] [__predef_detection__]] - ] - */ +| `+__llvm__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_COMP_LLVM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/metaware.h b/ThirdParty/boost/predef/compiler/metaware.h index 1a32039cef5257261a4dd700c85fae47b0b54bab..e210943d770e6d58b9d6598bb7fb9f06a5eb3c27 100644 --- a/ThirdParty/boost/predef/compiler/metaware.h +++ b/ThirdParty/boost/predef/compiler/metaware.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_HIGHC`] +/* tag::reference[] += `BOOST_COMP_HIGHC` -MetaWare High C/C++ compiler. +MetaWare High C/{CPP} compiler. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__HIGHC__`] [__predef_detection__]] - ] - */ +| `+__HIGHC__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_COMP_HIGHC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/metrowerks.h b/ThirdParty/boost/predef/compiler/metrowerks.h index f2d739b958b14631185743184cad9a619b2cf759..98cb751d2978092fdc6a686364bdbb7c0da0e818 100644 --- a/ThirdParty/boost/predef/compiler/metrowerks.h +++ b/ThirdParty/boost/predef/compiler/metrowerks.h @@ -11,24 +11,25 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_MWERKS`] +/* tag::reference[] += `BOOST_COMP_MWERKS` -[@http://en.wikipedia.org/wiki/CodeWarrior Metrowerks CodeWarrior] compiler. +http://en.wikipedia.org/wiki/CodeWarrior[Metrowerks CodeWarrior] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MWERKS__`] [__predef_detection__]] - [[`__CWCC__`] [__predef_detection__]] +| `+__MWERKS__+` | {predef_detection} +| `+__CWCC__+` | {predef_detection} - [[`__CWCC__`] [V.R.P]] - [[`__MWERKS__`] [V.R.P >= 4.2.0]] - [[`__MWERKS__`] [9.R.0]] - [[`__MWERKS__`] [8.R.0]] - ] - */ +| `+__CWCC__+` | V.R.P +| `+__MWERKS__+` | V.R.P >= 4.2.0 +| `+__MWERKS__+` | 9.R.0 +| `+__MWERKS__+` | 8.R.0 +|=== +*/ // end::reference[] #define BOOST_COMP_MWERKS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/microtec.h b/ThirdParty/boost/predef/compiler/microtec.h index 066a6d2ad9e16df504b5de0dc26f34fac22573bf..93c7e91086bfbc759912c033dc96d6a35abdb3c8 100644 --- a/ThirdParty/boost/predef/compiler/microtec.h +++ b/ThirdParty/boost/predef/compiler/microtec.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_MRI`] +/* tag::reference[] += `BOOST_COMP_MRI` -[@http://www.mentor.com/microtec/ Microtec C/C++] compiler. +http://www.mentor.com/microtec/[Microtec C/{CPP}] compiler. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`_MRI`] [__predef_detection__]] - ] - */ +| `+_MRI+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_COMP_MRI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/mpw.h b/ThirdParty/boost/predef/compiler/mpw.h index 118330646e03286f62c05d24f98f3c5ef79186e2..963f756718060a3f02358ca2b8c6abdb8f8b63cc 100644 --- a/ThirdParty/boost/predef/compiler/mpw.h +++ b/ThirdParty/boost/predef/compiler/mpw.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_MPW`] +/* tag::reference[] += `BOOST_COMP_MPW` -[@http://en.wikipedia.org/wiki/Macintosh_Programmer%27s_Workshop MPW C++] compiler. +http://en.wikipedia.org/wiki/Macintosh_Programmer%27s_Workshop[MPW {CPP}] compiler. Version number available as major, and minor. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MRC__`] [__predef_detection__]] - [[`MPW_C`] [__predef_detection__]] - [[`MPW_CPLUS`] [__predef_detection__]] +| `+__MRC__+` | {predef_detection} +| `MPW_C` | {predef_detection} +| `MPW_CPLUS` | {predef_detection} - [[`__MRC__`] [V.R.0]] - ] - */ +| `+__MRC__+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_COMP_MPW BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/nvcc.h b/ThirdParty/boost/predef/compiler/nvcc.h index 4130539958d0ec52da84358fb3f48d6e9a93e29e..3690c53557225d89cd78c2c3b93b5a56a33832ed 100644 --- a/ThirdParty/boost/predef/compiler/nvcc.h +++ b/ThirdParty/boost/predef/compiler/nvcc.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_NVCC`] +/* tag::reference[] += `BOOST_COMP_NVCC` -[@https://en.wikipedia.org/wiki/NVIDIA_CUDA_Compiler NVCC] compiler. +https://en.wikipedia.org/wiki/NVIDIA_CUDA_Compiler[NVCC] compiler. Version number available as major, minor, and patch beginning with version 7.5. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__NVCC__`] [__predef_detection__]] +| `+__NVCC__+` | {predef_detection} - [[`__CUDACC_VER_MAJOR__`, `__CUDACC_VER_MINOR__`, `__CUDACC_VER_BUILD__`] [V.R.P]] - ] - */ +| `+__CUDACC_VER_MAJOR__+`, `+__CUDACC_VER_MINOR__+`, `+__CUDACC_VER_BUILD__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_NVCC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/palm.h b/ThirdParty/boost/predef/compiler/palm.h index 707925a6511f1d66a15900483e12518dc998c464..7f1821519ad27a22de01f03493a566a0cca39dbe 100644 --- a/ThirdParty/boost/predef/compiler/palm.h +++ b/ThirdParty/boost/predef/compiler/palm.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_PALM`] +/* tag::reference[] += `BOOST_COMP_PALM` -Palm C/C++ compiler. +Palm C/{CPP} compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`_PACC_VER`] [__predef_detection__]] +| `+_PACC_VER+` | {predef_detection} - [[`_PACC_VER`] [V.R.P]] - ] - */ +| `+_PACC_VER+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_PALM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/pgi.h b/ThirdParty/boost/predef/compiler/pgi.h index e016aeb0806aa7356d29a66012764e42f8c33ac2..649e87add32623d67ddaf22a1e92257b143ca3d6 100644 --- a/ThirdParty/boost/predef/compiler/pgi.h +++ b/ThirdParty/boost/predef/compiler/pgi.h @@ -11,19 +11,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_PGI`] +/* tag::reference[] += `BOOST_COMP_PGI` -[@http://en.wikipedia.org/wiki/The_Portland_Group Portland Group C/C++] compiler. +http://en.wikipedia.org/wiki/The_Portland_Group[Portland Group C/{CPP}] compiler. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__PGI`] [__predef_detection__]] +| `+__PGI+` | {predef_detection} - [[`__PGIC__`, `__PGIC_MINOR__`, `__PGIC_PATCHLEVEL__`] [V.R.P]] - ] - */ +| `+__PGIC__+`, `+__PGIC_MINOR__+`, `+__PGIC_PATCHLEVEL__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_PGI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/sgi_mipspro.h b/ThirdParty/boost/predef/compiler/sgi_mipspro.h index 00739f0c3c8c6de8c272073681a4f682f636c1b1..7bfdc9c68bff746d32c98f0f2c3600f62bfcc873 100644 --- a/ThirdParty/boost/predef/compiler/sgi_mipspro.h +++ b/ThirdParty/boost/predef/compiler/sgi_mipspro.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_SGI`] +/* tag::reference[] += `BOOST_COMP_SGI` -[@http://en.wikipedia.org/wiki/MIPSpro SGI MIPSpro] compiler. +http://en.wikipedia.org/wiki/MIPSpro[SGI MIPSpro] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__sgi`] [__predef_detection__]] - [[`sgi`] [__predef_detection__]] +| `+__sgi+` | {predef_detection} +| `sgi` | {predef_detection} - [[`_SGI_COMPILER_VERSION`] [V.R.P]] - [[`_COMPILER_VERSION`] [V.R.P]] - ] - */ +| `+_SGI_COMPILER_VERSION+` | V.R.P +| `+_COMPILER_VERSION+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_SGI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/sunpro.h b/ThirdParty/boost/predef/compiler/sunpro.h index 92c39260136ef68ce10e27c16b5f6a11086e4bd9..b44d0bb338c8e68e9c19e59ca2ad045041e334f8 100644 --- a/ThirdParty/boost/predef/compiler/sunpro.h +++ b/ThirdParty/boost/predef/compiler/sunpro.h @@ -11,24 +11,25 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_SUNPRO`] +/* tag::reference[] += `BOOST_COMP_SUNPRO` -[@http://en.wikipedia.org/wiki/Oracle_Solaris_Studio Oracle Solaris Studio] compiler. +http://en.wikipedia.org/wiki/Oracle_Solaris_Studio[Oracle Solaris Studio] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SUNPRO_CC`] [__predef_detection__]] - [[`__SUNPRO_C`] [__predef_detection__]] +| `+__SUNPRO_CC+` | {predef_detection} +| `+__SUNPRO_C+` | {predef_detection} - [[`__SUNPRO_CC`] [V.R.P]] - [[`__SUNPRO_C`] [V.R.P]] - [[`__SUNPRO_CC`] [VV.RR.P]] - [[`__SUNPRO_C`] [VV.RR.P]] - ] - */ +| `+__SUNPRO_CC+` | V.R.P +| `+__SUNPRO_C+` | V.R.P +| `+__SUNPRO_CC+` | VV.RR.P +| `+__SUNPRO_C+` | VV.RR.P +|=== +*/ // end::reference[] #define BOOST_COMP_SUNPRO BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/tendra.h b/ThirdParty/boost/predef/compiler/tendra.h index c2bc5e4ef566f069f5b30b18c6d7cb8cd1e06226..bb896c0782eba8e5cea6d4a243eff9cf861ee53b 100644 --- a/ThirdParty/boost/predef/compiler/tendra.h +++ b/ThirdParty/boost/predef/compiler/tendra.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_TENDRA`] +/* tag::reference[] += `BOOST_COMP_TENDRA` -[@http://en.wikipedia.org/wiki/TenDRA_Compiler TenDRA C/C++] compiler. +http://en.wikipedia.org/wiki/TenDRA_Compiler[TenDRA C/{CPP}] compiler. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__TenDRA__`] [__predef_detection__]] - ] - */ +| `+__TenDRA__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_COMP_TENDRA BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/visualc.h b/ThirdParty/boost/predef/compiler/visualc.h index f81e61ed5227f4dbc10b65d41030d8eebd69d041..5b0f2b8366bf8a04b53ccefea89c968cc95d8770 100644 --- a/ThirdParty/boost/predef/compiler/visualc.h +++ b/ThirdParty/boost/predef/compiler/visualc.h @@ -15,25 +15,26 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_MSVC`] +/* tag::reference[] += `BOOST_COMP_MSVC` -[@http://en.wikipedia.org/wiki/Visual_studio Microsoft Visual C/C++] compiler. +http://en.wikipedia.org/wiki/Visual_studio[Microsoft Visual C/{CPP}] compiler. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`_MSC_VER`] [__predef_detection__]] +| `+_MSC_VER+` | {predef_detection} - [[`_MSC_FULL_VER`] [V.R.P]] - [[`_MSC_VER`] [V.R.0]] - ] +| `+_MSC_FULL_VER+` | V.R.P +| `+_MSC_VER+` | V.R.0 +|=== -[note Release of Visual Studio after 2015 will no longer be identified +NOTE: Release of Visual Studio after 2015 will no longer be identified by Boost Predef as the marketing version number. Instead we use the -compiler version number directly, i.e. the _MSC_VER number.] - */ +compiler version number directly, i.e. the _MSC_VER number. +*/ // end::reference[] #define BOOST_COMP_MSVC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/compiler/watcom.h b/ThirdParty/boost/predef/compiler/watcom.h index b0e7776d0641050f6deab7b590dca33a8fe770a2..1f8c069dc16dcf0b784643cdd7f8de883d039454 100644 --- a/ThirdParty/boost/predef/compiler/watcom.h +++ b/ThirdParty/boost/predef/compiler/watcom.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_COMP_WATCOM`] +/* tag::reference[] += `BOOST_COMP_WATCOM` -[@http://en.wikipedia.org/wiki/Watcom Watcom C++] compiler. +http://en.wikipedia.org/wiki/Watcom[Watcom {CPP}] compiler. Version number available as major, and minor. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__WATCOMC__`] [__predef_detection__]] +| `+__WATCOMC__+` | {predef_detection} - [[`__WATCOMC__`] [V.R.P]] - ] - */ +| `+__WATCOMC__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_COMP_WATCOM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/hardware/simd.h b/ThirdParty/boost/predef/hardware/simd.h index ac5c9da2cab23a0b609d0eb5760cc0c861f4fe03..b671fa3be9129b87979176aeab51a4b89e2c1725 100644 --- a/ThirdParty/boost/predef/hardware/simd.h +++ b/ThirdParty/boost/predef/hardware/simd.h @@ -16,55 +16,104 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> -/*` - [section Using the `BOOST_HW_SIMD_*` predefs] - [include ../doc/hardware_simd.qbk] - [endsect] - - [/ --------------------------- ] - - [section `BOOST_HW_SIMD_*`] - - [heading `BOOST_HW_SIMD`] - - The SIMD extension detected for a specific architectures. - Version number depends on the detected extension. - - [table - [[__predef_symbol__] [__predef_version__]] - - [[`BOOST_HW_SIMD_X86_AVAILABLE`] [__predef_detection__]] - [[`BOOST_HW_SIMD_X86_AMD_AVAILABLE`] [__predef_detection__]] - [[`BOOST_HW_SIMD_ARM_AVAILABLE`] [__predef_detection__]] - [[`BOOST_HW_SIMD_PPC_AVAILABLE`] [__predef_detection__]] - ] - - [include ../include/boost/predef/hardware/simd/x86.h] - [include ../include/boost/predef/hardware/simd/x86_amd.h] - [include ../include/boost/predef/hardware/simd/arm.h] - [include ../include/boost/predef/hardware/simd/ppc.h] - - [endsect] - - [/ --------------------------- ] - - [section `BOOST_HW_SIMD_X86_*_VERSION`] - [include ../include/boost/predef/hardware/simd/x86/versions.h] - [endsect] - - [section `BOOST_HW_SIMD_X86_AMD_*_VERSION`] - [include ../include/boost/predef/hardware/simd/x86_amd/versions.h] - [endsect] +/* tag::reference[] += Using the `BOOST_HW_SIMD_*` predefs + +SIMD predefs depend on compiler options. For example, you will have to add the +option `-msse3` to clang or gcc to enable SSE3. SIMD predefs are also inclusive. +This means that if SSE3 is enabled, then every other extensions with a lower +version number will implicitly be enabled and detected. However, some extensions +are CPU specific, they may not be detected nor enabled when an upper version is +enabled. + +NOTE: SSE(1) and SSE2 are automatically enabled by default when using x86-64 +architecture. + +To check if any SIMD extension has been enabled, you can use: + +[source] +---- +#include <boost/predef/hardware/simd.h> +#include <iostream> + +int main() +{ +#if defined(BOOST_HW_SIMD_AVAILABLE) + std::cout << "SIMD detected!" << std::endl; +#endif + return 0; +} +---- + +When writing SIMD specific code, you may want to check if a particular extension +has been detected. To do so you have to use the right architecture predef and +compare it. Those predef are of the form `BOOST_HW_SIMD_"ARCH"` (where `"ARCH"` +is either `ARM`, `PPC`, or `X86`). For example, if you compile code for x86 +architecture, you will have to use `BOOST_HW_SIMD_X86`. Its value will be the +version number of the most recent SIMD extension detected for the architecture. + +To check if an extension has been enabled: + +[source] +---- +#include <boost/predef/hardware/simd.h> +#include <iostream> + +int main() +{ +#if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_SSE3_VERSION + std::cout << "This is SSE3!" << std::endl; +#endif + return 0; +} +---- + +NOTE: The *_VERSION* defines that map version number to actual real +identifiers. This way it is easier to write comparisons without messing up with +version numbers. + +To *"strictly"* check the most recent detected extension: + +[source] +---- +#include <boost/predef/hardware/simd.h> +#include <iostream> + +int main() +{ +#if BOOST_HW_SIMD_X86 == BOOST_HW_SIMD_X86_SSE3_VERSION + std::cout << "This is SSE3 and this is the most recent enabled extension!" + << std::endl; +#endif + return 0; +} +---- + +Because of the version systems of predefs and of the inclusive property of SIMD +extensions macros, you can easily check for ranges of supported extensions: + +[source] +---- +#include <boost/predef/hardware/simd.h> +#include <iostream> + +int main() +{ +#if BOOST_HW_SIMD_X86 >= BOOST_HW_SIMD_X86_SSE2_VERSION &&\ + BOOST_HW_SIMD_X86 <= BOOST_HW_SIMD_X86_SSSE3_VERSION + std::cout << "This is SSE2, SSE3 and SSSE3!" << std::endl; +#endif + return 0; +} +---- - [section `BOOST_HW_SIMD_ARM_*_VERSION`] - [include ../include/boost/predef/hardware/simd/arm/versions.h] - [endsect] +NOTE: Unlike gcc and clang, Visual Studio does not allow you to specify precisely +the SSE variants you want to use, the only detections that will take place are +SSE, SSE2, AVX and AVX2. For more informations, + see [@https://msdn.microsoft.com/en-us/library/b0084kay.aspx here]. - [section `BOOST_HW_SIMD_PPC_*_VERSION`] - [include ../include/boost/predef/hardware/simd/ppc/versions.h] - [endsect] - */ +*/ // end::reference[] // We check if SIMD extension of multiples architectures have been detected, // if yes, then this is an error! diff --git a/ThirdParty/boost/predef/hardware/simd/arm.h b/ThirdParty/boost/predef/hardware/simd/arm.h index 3b3fc3fa366bb88c936b41b6f704d7181b8b0ee8..24e4c1b0910b02114a850fcf5fcd2112fd4d83b4 100644 --- a/ThirdParty/boost/predef/hardware/simd/arm.h +++ b/ThirdParty/boost/predef/hardware/simd/arm.h @@ -12,31 +12,33 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/hardware/simd/arm/versions.h> -/*` - [heading `BOOST_HW_SIMD_ARM`] +/* tag::reference[] += `BOOST_HW_SIMD_ARM` - The SIMD extension for ARM (*if detected*). - Version number depends on the most recent detected extension. +The SIMD extension for ARM (*if detected*). +Version number depends on the most recent detected extension. - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__ARM_NEON__`] [__predef_detection__]] - [[`__aarch64__`] [__predef_detection__]] - [[`_M_ARM`] [__predef_detection__]] - [[`_M_ARM64`] [__predef_detection__]] - ] +| `+__ARM_NEON__+` | {predef_detection} +| `+__aarch64__+` | {predef_detection} +| `+_M_ARM+` | {predef_detection} +| `+_M_ARM64+` | {predef_detection} +|=== - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__ARM_NEON__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - [[`__aarch64__`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - [[`_M_ARM`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - [[`_M_ARM64`] [BOOST_HW_SIMD_ARM_NEON_VERSION]] - ] +| `+__ARM_NEON__+` | BOOST_HW_SIMD_ARM_NEON_VERSION +| `+__aarch64__+` | BOOST_HW_SIMD_ARM_NEON_VERSION +| `+_M_ARM+` | BOOST_HW_SIMD_ARM_NEON_VERSION +| `+_M_ARM64+` | BOOST_HW_SIMD_ARM_NEON_VERSION +|=== - */ +*/ // end::reference[] #define BOOST_HW_SIMD_ARM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/hardware/simd/arm/versions.h b/ThirdParty/boost/predef/hardware/simd/arm/versions.h index 8425b318628990ac4216bb093b6a06bbc961c35a..92071a6b36e075589f99ecd3596d28216e2c0ef6 100644 --- a/ThirdParty/boost/predef/hardware/simd/arm/versions.h +++ b/ThirdParty/boost/predef/hardware/simd/arm/versions.h @@ -11,22 +11,28 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> -/*` - Those defines represent ARM SIMD extensions versions. +/* tag::reference[] += `BOOST_HW_SIMD_ARM_*_VERSION` - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_ARM`.] - */ +Those defines represent ARM SIMD extensions versions. + +NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_ARM`. +*/ // end::reference[] // --------------------------------- -/*` - [heading `BOOST_HW_SIMD_ARM_NEON_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_ARM_NEON_VERSION` - The [@https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29 NEON] - ARM extension version number. +The https://en.wikipedia.org/wiki/ARM_architecture#Advanced_SIMD_.28NEON.29[NEON] +ARM extension version number. - Version number is: *1.0.0*. - */ +Version number is: *1.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_ARM_NEON_VERSION BOOST_VERSION_NUMBER(1, 0, 0) +/* tag::reference[] + +*/ // end::reference[] + #endif diff --git a/ThirdParty/boost/predef/hardware/simd/ppc.h b/ThirdParty/boost/predef/hardware/simd/ppc.h index eef25c2d2693a15d5ea0fd0b02112731ad541637..bf30cc1e81b84e1ab360279da616428ea5bb8427 100644 --- a/ThirdParty/boost/predef/hardware/simd/ppc.h +++ b/ThirdParty/boost/predef/hardware/simd/ppc.h @@ -12,35 +12,37 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/hardware/simd/ppc/versions.h> -/*` - [heading `BOOST_HW_SIMD_PPC`] +/* tag::reference[] += `BOOST_HW_SIMD_PPC` - The SIMD extension for PowerPC (*if detected*). - Version number depends on the most recent detected extension. +The SIMD extension for PowerPC (*if detected*). +Version number depends on the most recent detected extension. - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__VECTOR4DOUBLE__`] [__predef_detection__]] +| `+__VECTOR4DOUBLE__+` | {predef_detection} - [[`__ALTIVEC__`] [__predef_detection__]] - [[`__VEC__`] [__predef_detection__]] +| `+__ALTIVEC__+` | {predef_detection} +| `+__VEC__+` | {predef_detection} - [[`__VSX__`] [__predef_detection__]] - ] +| `+__VSX__+` | {predef_detection} +|=== - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__VECTOR4DOUBLE__`] [BOOST_HW_SIMD_PPC_QPX_VERSION]] +| `+__VECTOR4DOUBLE__+` | BOOST_HW_SIMD_PPC_QPX_VERSION - [[`__ALTIVEC__`] [BOOST_HW_SIMD_PPC_VMX_VERSION]] - [[`__VEC__`] [BOOST_HW_SIMD_PPC_VMX_VERSION]] +| `+__ALTIVEC__+` | BOOST_HW_SIMD_PPC_VMX_VERSION +| `+__VEC__+` | BOOST_HW_SIMD_PPC_VMX_VERSION - [[`__VSX__`] [BOOST_HW_SIMD_PPC_VSX_VERSION]] - ] +| `+__VSX__+` | BOOST_HW_SIMD_PPC_VSX_VERSION +|=== - */ +*/ // end::reference[] #define BOOST_HW_SIMD_PPC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/hardware/simd/ppc/versions.h b/ThirdParty/boost/predef/hardware/simd/ppc/versions.h index ffe3f0b1e5a4e16bbea9cf47f47e1f40247ac6e0..3cf8319c2460181deedfc5ba3dfd34e74200355c 100644 --- a/ThirdParty/boost/predef/hardware/simd/ppc/versions.h +++ b/ThirdParty/boost/predef/hardware/simd/ppc/versions.h @@ -11,41 +11,47 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> -/*` - Those defines represent Power PC SIMD extensions versions. +/* tag::reference[] += `BOOST_HW_SIMD_PPC_*_VERSION` - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_PPC`.] - */ +Those defines represent Power PC SIMD extensions versions. + +NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_PPC`. +*/ // end::reference[] // --------------------------------- -/*` - [heading `BOOST_HW_SIMD_PPC_VMX_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_PPC_VMX_VERSION` - The [@https://en.wikipedia.org/wiki/AltiVec#VMX128 VMX] powerpc extension - version number. +The https://en.wikipedia.org/wiki/AltiVec#VMX128[VMX] powerpc extension +version number. - Version number is: *1.0.0*. - */ +Version number is: *1.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_PPC_VMX_VERSION BOOST_VERSION_NUMBER(1, 0, 0) -/*` - [heading `BOOST_HW_SIMD_PPC_VSX_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_PPC_VSX_VERSION` - The [@https://en.wikipedia.org/wiki/AltiVec#VSX VSX] powerpc extension version - number. +The https://en.wikipedia.org/wiki/AltiVec#VSX[VSX] powerpc extension version +number. - Version number is: *1.1.0*. - */ +Version number is: *1.1.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_PPC_VSX_VERSION BOOST_VERSION_NUMBER(1, 1, 0) -/*` - [heading `BOOST_HW_SIMD_PPC_QPX_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_PPC_QPX_VERSION` - The QPX powerpc extension version number. +The QPX powerpc extension version number. - Version number is: *2.0.0*. - */ +Version number is: *2.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_PPC_QPX_VERSION BOOST_VERSION_NUMBER(2, 0, 0) +/* tag::reference[] + +*/ // end::reference[] + #endif diff --git a/ThirdParty/boost/predef/hardware/simd/x86.h b/ThirdParty/boost/predef/hardware/simd/x86.h index 88bd81e362b0cd8958c2e16e6b353052149a9ca3..6c9a0fb8ab2608ee0ab0cbca6a2e527c7fe6f266 100644 --- a/ThirdParty/boost/predef/hardware/simd/x86.h +++ b/ThirdParty/boost/predef/hardware/simd/x86.h @@ -12,65 +12,67 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/hardware/simd/x86/versions.h> -/*` - [heading `BOOST_HW_SIMD_X86`] +/* tag::reference[] += `BOOST_HW_SIMD_X86` - The SIMD extension for x86 (*if detected*). - Version number depends on the most recent detected extension. +The SIMD extension for x86 (*if detected*). +Version number depends on the most recent detected extension. - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SSE__`] [__predef_detection__]] - [[`_M_X64`] [__predef_detection__]] - [[`_M_IX86_FP >= 1`] [__predef_detection__]] +| `+__SSE__+` | {predef_detection} +| `+_M_X64+` | {predef_detection} +| `_M_IX86_FP >= 1` | {predef_detection} - [[`__SSE2__`] [__predef_detection__]] - [[`_M_X64`] [__predef_detection__]] - [[`_M_IX86_FP >= 2`] [__predef_detection__]] +| `+__SSE2__+` | {predef_detection} +| `+_M_X64+` | {predef_detection} +| `_M_IX86_FP >= 2` | {predef_detection} - [[`__SSE3__`] [__predef_detection__]] +| `+__SSE3__+` | {predef_detection} - [[`__SSSE3__`] [__predef_detection__]] +| `+__SSSE3__+` | {predef_detection} - [[`__SSE4_1__`] [__predef_detection__]] +| `+__SSE4_1__+` | {predef_detection} - [[`__SSE4_2__`] [__predef_detection__]] +| `+__SSE4_2__+` | {predef_detection} - [[`__AVX__`] [__predef_detection__]] +| `+__AVX__+` | {predef_detection} - [[`__FMA__`] [__predef_detection__]] +| `+__FMA__+` | {predef_detection} - [[`__AVX2__`] [__predef_detection__]] - ] +| `+__AVX2__+` | {predef_detection} +|=== - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SSE__`] [BOOST_HW_SIMD_X86_SSE_VERSION]] - [[`_M_X64`] [BOOST_HW_SIMD_X86_SSE_VERSION]] - [[`_M_IX86_FP >= 1`] [BOOST_HW_SIMD_X86_SSE_VERSION]] +| `+__SSE__+` | BOOST_HW_SIMD_X86_SSE_VERSION +| `+_M_X64+` | BOOST_HW_SIMD_X86_SSE_VERSION +| `_M_IX86_FP >= 1` | BOOST_HW_SIMD_X86_SSE_VERSION - [[`__SSE2__`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] - [[`_M_X64`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] - [[`_M_IX86_FP >= 2`] [BOOST_HW_SIMD_X86_SSE2_VERSION]] +| `+__SSE2__+` | BOOST_HW_SIMD_X86_SSE2_VERSION +| `+_M_X64+` | BOOST_HW_SIMD_X86_SSE2_VERSION +| `_M_IX86_FP >= 2` | BOOST_HW_SIMD_X86_SSE2_VERSION - [[`__SSE3__`] [BOOST_HW_SIMD_X86_SSE3_VERSION]] +| `+__SSE3__+` | BOOST_HW_SIMD_X86_SSE3_VERSION - [[`__SSSE3__`] [BOOST_HW_SIMD_X86_SSSE3_VERSION]] +| `+__SSSE3__+` | BOOST_HW_SIMD_X86_SSSE3_VERSION - [[`__SSE4_1__`] [BOOST_HW_SIMD_X86_SSE4_1_VERSION]] +| `+__SSE4_1__+` | BOOST_HW_SIMD_X86_SSE4_1_VERSION - [[`__SSE4_2__`] [BOOST_HW_SIMD_X86_SSE4_2_VERSION]] +| `+__SSE4_2__+` | BOOST_HW_SIMD_X86_SSE4_2_VERSION - [[`__AVX__`] [BOOST_HW_SIMD_X86_AVX_VERSION]] +| `+__AVX__+` | BOOST_HW_SIMD_X86_AVX_VERSION - [[`__FMA__`] [BOOST_HW_SIMD_X86_FMA3_VERSION]] +| `+__FMA__+` | BOOST_HW_SIMD_X86_FMA3_VERSION - [[`__AVX2__`] [BOOST_HW_SIMD_X86_AVX2_VERSION]] - ] +| `+__AVX2__+` | BOOST_HW_SIMD_X86_AVX2_VERSION +|=== - */ +*/ // end::reference[] #define BOOST_HW_SIMD_X86 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/hardware/simd/x86/versions.h b/ThirdParty/boost/predef/hardware/simd/x86/versions.h index 0c7a4d381328a0a1acedbbcc76bee7244fc442cb..ef5b002d4141e0ec58b52be030b98ed5671ce6c0 100644 --- a/ThirdParty/boost/predef/hardware/simd/x86/versions.h +++ b/ThirdParty/boost/predef/hardware/simd/x86/versions.h @@ -11,119 +11,125 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> -/*` - Those defines represent x86 SIMD extensions versions. +/* tag::reference[] += `BOOST_HW_SIMD_X86_*_VERSION` - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_X86`.] - */ +Those defines represent x86 SIMD extensions versions. + +NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_X86`. +*/ // end::reference[] // --------------------------------- -/*` - [heading `BOOST_HW_SIMD_X86_MMX_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_MMX_VERSION` - The [@https://en.wikipedia.org/wiki/MMX_(instruction_set) MMX] x86 extension - version number. +The https://en.wikipedia.org/wiki/MMX_(instruction_set)[MMX] x86 extension +version number. - Version number is: *0.99.0*. - */ +Version number is: *0.99.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_MMX_VERSION BOOST_VERSION_NUMBER(0, 99, 0) -/*` - [heading `BOOST_HW_SIMD_X86_SSE_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_SSE_VERSION` - The [@https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions SSE] x86 extension - version number. +The https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions[SSE] x86 extension +version number. - Version number is: *1.0.0*. - */ +Version number is: *1.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_SSE_VERSION BOOST_VERSION_NUMBER(1, 0, 0) -/*` - [heading `BOOST_HW_SIMD_X86_SSE2_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_SSE2_VERSION` - The [@https://en.wikipedia.org/wiki/SSE2 SSE2] x86 extension version number. +The https://en.wikipedia.org/wiki/SSE2[SSE2] x86 extension version number. - Version number is: *2.0.0*. - */ +Version number is: *2.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_SSE2_VERSION BOOST_VERSION_NUMBER(2, 0, 0) -/*` - [heading `BOOST_HW_SIMD_X86_SSE3_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_SSE3_VERSION` - The [@https://en.wikipedia.org/wiki/SSE3 SSE3] x86 extension version number. +The https://en.wikipedia.org/wiki/SSE3[SSE3] x86 extension version number. - Version number is: *3.0.0*. - */ +Version number is: *3.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_SSE3_VERSION BOOST_VERSION_NUMBER(3, 0, 0) -/*` - [heading `BOOST_HW_SIMD_X86_SSSE3_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_SSSE3_VERSION` - The [@https://en.wikipedia.org/wiki/SSSE3 SSSE3] x86 extension version number. +The https://en.wikipedia.org/wiki/SSSE3[SSSE3] x86 extension version number. - Version number is: *3.1.0*. - */ +Version number is: *3.1.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_SSSE3_VERSION BOOST_VERSION_NUMBER(3, 1, 0) -/*` - [heading `BOOST_HW_SIMD_X86_SSE4_1_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_SSE4_1_VERSION` - The [@https://en.wikipedia.org/wiki/SSE4#SSE4.1 SSE4_1] x86 extension version - number. +The https://en.wikipedia.org/wiki/SSE4#SSE4.1[SSE4_1] x86 extension version +number. - Version number is: *4.1.0*. - */ +Version number is: *4.1.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_SSE4_1_VERSION BOOST_VERSION_NUMBER(4, 1, 0) -/*` - [heading `BOOST_HW_SIMD_X86_SSE4_2_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_SSE4_2_VERSION` - The [@https://en.wikipedia.org/wiki/SSE4##SSE4.2 SSE4_2] x86 extension version - number. +The https://en.wikipedia.org/wiki/SSE4##SSE4.2[SSE4_2] x86 extension version +number. - Version number is: *4.2.0*. - */ +Version number is: *4.2.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_SSE4_2_VERSION BOOST_VERSION_NUMBER(4, 2, 0) -/*` - [heading `BOOST_HW_SIMD_X86_AVX_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_AVX_VERSION` - The [@https://en.wikipedia.org/wiki/Advanced_Vector_Extensions AVX] x86 - extension version number. +The https://en.wikipedia.org/wiki/Advanced_Vector_Extensions[AVX] x86 +extension version number. - Version number is: *5.0.0*. - */ +Version number is: *5.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_AVX_VERSION BOOST_VERSION_NUMBER(5, 0, 0) -/*` - [heading `BOOST_HW_SIMD_X86_FMA3_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_FMA3_VERSION` - The [@https://en.wikipedia.org/wiki/FMA_instruction_set FMA3] x86 extension - version number. +The https://en.wikipedia.org/wiki/FMA_instruction_set[FMA3] x86 extension +version number. - Version number is: *5.2.0*. - */ +Version number is: *5.2.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_FMA3_VERSION BOOST_VERSION_NUMBER(5, 2, 0) -/*` - [heading `BOOST_HW_SIMD_X86_AVX2_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_AVX2_VERSION` - The [@https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2 AVX2] - x86 extension version number. +The https://en.wikipedia.org/wiki/Advanced_Vector_Extensions#Advanced_Vector_Extensions_2[AVX2] +x86 extension version number. - Version number is: *5.3.0*. - */ +Version number is: *5.3.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_AVX2_VERSION BOOST_VERSION_NUMBER(5, 3, 0) -/*` - [heading `BOOST_HW_SIMD_X86_MIC_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_MIC_VERSION` - The [@https://en.wikipedia.org/wiki/Xeon_Phi MIC] (Xeon Phi) x86 extension - version number. +The https://en.wikipedia.org/wiki/Xeon_Phi[MIC] (Xeon Phi) x86 extension +version number. - Version number is: *9.0.0*. - */ +Version number is: *9.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_MIC_VERSION BOOST_VERSION_NUMBER(9, 0, 0) +/* tag::reference[] + +*/ // end::reference[] + #endif diff --git a/ThirdParty/boost/predef/hardware/simd/x86_amd.h b/ThirdParty/boost/predef/hardware/simd/x86_amd.h index c80d1ce2b775d4e70b2fae717cb46e8dbcf03458..ed96af35730f39a7f8d5a8bf3d75eb0c968567ff 100644 --- a/ThirdParty/boost/predef/hardware/simd/x86_amd.h +++ b/ThirdParty/boost/predef/hardware/simd/x86_amd.h @@ -12,42 +12,44 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/hardware/simd/x86_amd/versions.h> -/*` - [heading `BOOST_HW_SIMD_X86_AMD`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_AMD` - The SIMD extension for x86 (AMD) (*if detected*). - Version number depends on the most recent detected extension. +The SIMD extension for x86 (AMD) (*if detected*). +Version number depends on the most recent detected extension. - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SSE4A__`] [__predef_detection__]] +| `+__SSE4A__+` | {predef_detection} - [[`__FMA4__`] [__predef_detection__]] +| `+__FMA4__+` | {predef_detection} - [[`__XOP__`] [__predef_detection__]] +| `+__XOP__+` | {predef_detection} - [[`BOOST_HW_SIMD_X86`] [__predef_detection__]] - ] +| `BOOST_HW_SIMD_X86` | {predef_detection} +|=== - [table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SSE4A__`] [BOOST_HW_SIMD_X86_SSE4A_VERSION]] +| `+__SSE4A__+` | BOOST_HW_SIMD_X86_SSE4A_VERSION - [[`__FMA4__`] [BOOST_HW_SIMD_X86_FMA4_VERSION]] +| `+__FMA4__+` | BOOST_HW_SIMD_X86_FMA4_VERSION - [[`__XOP__`] [BOOST_HW_SIMD_X86_XOP_VERSION]] +| `+__XOP__+` | BOOST_HW_SIMD_X86_XOP_VERSION - [[`BOOST_HW_SIMD_X86`] [BOOST_HW_SIMD_X86]] - ] +| `BOOST_HW_SIMD_X86` | BOOST_HW_SIMD_X86 +|=== - [note This predef includes every other x86 SIMD extensions and also has other - more specific extensions (FMA4, XOP, SSE4a). You should use this predef - instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have - been detected.] +NOTE: This predef includes every other x86 SIMD extensions and also has other +more specific extensions (FMA4, XOP, SSE4a). You should use this predef +instead of `BOOST_HW_SIMD_X86` to test if those specific extensions have +been detected. - */ +*/ // end::reference[] #define BOOST_HW_SIMD_X86_AMD BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/hardware/simd/x86_amd/versions.h b/ThirdParty/boost/predef/hardware/simd/x86_amd/versions.h index 1f9e96c500c522bb71eab5937fea813f5acc64e3..aa54a5cb17e6f90abb5e905a8ac067822d45d447 100644 --- a/ThirdParty/boost/predef/hardware/simd/x86_amd/versions.h +++ b/ThirdParty/boost/predef/hardware/simd/x86_amd/versions.h @@ -11,41 +11,46 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> -/*` - Those defines represent x86 (AMD specific) SIMD extensions versions. +/* tag::reference[] += `BOOST_HW_SIMD_X86_AMD_*_VERSION` - [note You *MUST* compare them with the predef `BOOST_HW_SIMD_X86_AMD`.] - */ +Those defines represent x86 (AMD specific) SIMD extensions versions. + +NOTE: You *MUST* compare them with the predef `BOOST_HW_SIMD_X86_AMD`. +*/ // end::reference[] // --------------------------------- -/*` - [heading `BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION` - [@https://en.wikipedia.org/wiki/SSE4##SSE4A SSE4A] x86 extension (AMD specific). +https://en.wikipedia.org/wiki/SSE4##SSE4A[SSE4A] x86 extension (AMD specific). - Version number is: *4.0.0*. - */ +Version number is: *4.0.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_AMD_SSE4A_VERSION BOOST_VERSION_NUMBER(4, 0, 0) -/*` - [heading `BOOST_HW_SIMD_X86_AMD_FMA4_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_AMD_FMA4_VERSION` - [@https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set FMA4] x86 extension (AMD specific). +https://en.wikipedia.org/wiki/FMA_instruction_set#FMA4_instruction_set[FMA4] x86 extension (AMD specific). - Version number is: *5.1.0*. - */ +Version number is: *5.1.0*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_AMD_FMA4_VERSION BOOST_VERSION_NUMBER(5, 1, 0) -/*` - [heading `BOOST_HW_SIMD_X86_AMD_XOP_VERSION`] +/* tag::reference[] += `BOOST_HW_SIMD_X86_AMD_XOP_VERSION` - [@https://en.wikipedia.org/wiki/XOP_instruction_set XOP] x86 extension (AMD specific). +https://en.wikipedia.org/wiki/XOP_instruction_set[XOP] x86 extension (AMD specific). - Version number is: *5.1.1*. - */ +Version number is: *5.1.1*. +*/ // end::reference[] #define BOOST_HW_SIMD_X86_AMD_XOP_VERSION BOOST_VERSION_NUMBER(5, 1, 1) +/* tag::reference[] + +*/ // end::reference[] #endif diff --git a/ThirdParty/boost/predef/language/cuda.h b/ThirdParty/boost/predef/language/cuda.h index 5c5fed308104d9692ce80b3f01cd9af8c93d88fa..1159af4986dd34017d489a7ec87f474eb20a536d 100644 --- a/ThirdParty/boost/predef/language/cuda.h +++ b/ThirdParty/boost/predef/language/cuda.h @@ -11,21 +11,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LANG_CUDA`] +/* tag::reference[] += `BOOST_LANG_CUDA` -[@https://en.wikipedia.org/wiki/CUDA CUDA C/C++] language. +https://en.wikipedia.org/wiki/CUDA[CUDA C/{CPP}] language. If available, the version is detected as VV.RR.P. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__CUDACC__`] [__predef_detection__]] - [[`__CUDA__`] [__predef_detection__]] +| `+__CUDACC__+` | {predef_detection} +| `+__CUDA__+` | {predef_detection} - [[`CUDA_VERSION`] [VV.RR.P]] - ] - */ +| `CUDA_VERSION` | VV.RR.P +|=== +*/ // end::reference[] #define BOOST_LANG_CUDA BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/language/objc.h b/ThirdParty/boost/predef/language/objc.h index 24e3ad3c5c07cf644c8b9ba1ad1485deb3aa201d..c521371daa91d8b60cec49de3535619c02cabea3 100644 --- a/ThirdParty/boost/predef/language/objc.h +++ b/ThirdParty/boost/predef/language/objc.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LANG_OBJC`] +/* tag::reference[] += `BOOST_LANG_OBJC` -[@http://en.wikipedia.org/wiki/Objective-C Objective-C] language. +http://en.wikipedia.org/wiki/Objective-C[Objective-C] language. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__OBJC__`] [__predef_detection__]] - ] - */ +| `+__OBJC__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_LANG_OBJC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/language/stdc.h b/ThirdParty/boost/predef/language/stdc.h index db25c12dc0866a768fc3e6cb5e26342ab20af758..94e30fe6c62d119dc05b6187c0a0ff7487c9d028 100644 --- a/ThirdParty/boost/predef/language/stdc.h +++ b/ThirdParty/boost/predef/language/stdc.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LANG_STDC`] +/* tag::reference[] += `BOOST_LANG_STDC` -[@http://en.wikipedia.org/wiki/C_(programming_language) Standard C] language. +http://en.wikipedia.org/wiki/C_(programming_language)[Standard C] language. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__STDC__`] [__predef_detection__]] +| `+__STDC__+` | {predef_detection} - [[`__STDC_VERSION__`] [V.R.P]] - ] - */ +| `+__STDC_VERSION__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LANG_STDC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/language/stdcpp.h b/ThirdParty/boost/predef/language/stdcpp.h index 34dc8c7deb79f8d50558505352c1e76ce672a3ef..fc83431ced5c74e1ee34b0b7c360a678d51346a8 100644 --- a/ThirdParty/boost/predef/language/stdcpp.h +++ b/ThirdParty/boost/predef/language/stdcpp.h @@ -11,29 +11,34 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LANG_STDCPP`] +/* tag::reference[] += `BOOST_LANG_STDCPP` -[@http://en.wikipedia.org/wiki/C%2B%2B Standard C++] language. +http://en.wikipedia.org/wiki/C%2B%2B[Standard {CPP}] language. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. -Because of the way the C++ standardization process works the +Because of the way the {CPP} standardization process works the defined version year will not be the commonly known year of the standard. Specifically the defined versions are: -[table Detected Version Number vs. C++ Standard Year - [[Detected Version Number] [Standard Year] [C++ Standard]] - [[27.11.1] [1998] [ISO/IEC 14882:1998]] - [[41.12.1] [2011] [ISO/IEC 14882:2011]] -] +.Detected Version Number vs. {CPP} Standard Year +[options="header"] +|=== +| Detected Version Number | Standard Year | {CPP} Standard +| 27.11.1 | 1998 | ISO/IEC 14882:1998 +| 41.3.1 | 2011 | ISO/IEC 14882:2011 +| 44.2.1 | 2014 | ISO/IEC 14882:2014 +| 47.3.1 | 2017 | ISO/IEC 14882:2017 +|=== -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__cplusplus`] [__predef_detection__]] +| `+__cplusplus+` | {predef_detection} - [[`__cplusplus`] [YYYY.MM.1]] - ] - */ +| `+__cplusplus+` | YYYY.MM.1 +|=== +*/ // end::reference[] #define BOOST_LANG_STDCPP BOOST_VERSION_NUMBER_NOT_AVAILABLE @@ -52,20 +57,21 @@ Specifically the defined versions are: #define BOOST_LANG_STDCPP_NAME "Standard C++" -/*` -[heading `BOOST_LANG_STDCPPCLI`] +/* tag::reference[] += `BOOST_LANG_STDCPPCLI` -[@http://en.wikipedia.org/wiki/C%2B%2B/CLI Standard C++/CLI] language. +http://en.wikipedia.org/wiki/C%2B%2B/CLI[Standard {CPP}/CLI] language. If available, the year of the standard is detected as YYYY.MM.1 from the Epoc date. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__cplusplus_cli`] [__predef_detection__]] +| `+__cplusplus_cli+` | {predef_detection} - [[`__cplusplus_cli`] [YYYY.MM.1]] - ] - */ +| `+__cplusplus_cli+` | YYYY.MM.1 +|=== +*/ // end::reference[] #define BOOST_LANG_STDCPPCLI BOOST_VERSION_NUMBER_NOT_AVAILABLE @@ -84,17 +90,18 @@ If available, the year of the standard is detected as YYYY.MM.1 from the Epoc da #define BOOST_LANG_STDCPPCLI_NAME "Standard C++/CLI" -/*` -[heading `BOOST_LANG_STDECPP`] +/* tag::reference[] += `BOOST_LANG_STDECPP` -[@http://en.wikipedia.org/wiki/Embedded_C%2B%2B Standard Embedded C++] language. +http://en.wikipedia.org/wiki/Embedded_C%2B%2B[Standard Embedded {CPP}] language. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__embedded_cplusplus`] [__predef_detection__]] - ] - */ +| `+__embedded_cplusplus+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_LANG_STDECPP BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/c/cloudabi.h b/ThirdParty/boost/predef/library/c/cloudabi.h index e6acaee65d3a9a43af1956d3c68fb6f16dc4268a..80ce81caefd58a4f7aa29450be5c578a51addae4 100644 --- a/ThirdParty/boost/predef/library/c/cloudabi.h +++ b/ThirdParty/boost/predef/library/c/cloudabi.h @@ -18,20 +18,21 @@ #include <stddef.h> #endif -/*` -[heading `BOOST_LIB_C_CLOUDABI`] +/* tag::reference[] += `BOOST_LIB_C_CLOUDABI` -[@https://github.com/NuxiNL/cloudlibc cloudlibc] - CloudABI's standard C library. +https://github.com/NuxiNL/cloudlibc[cloudlibc] - CloudABI's standard C library. Version number available as major, and minor. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__cloudlibc__`] [__predef_detection__]] +| `+__cloudlibc__+` | {predef_detection} - [[`__cloudlibc_major__`, `__cloudlibc_minor__`] [V.R.0]] - ] - */ +| `+__cloudlibc_major__+`, `+__cloudlibc_minor__+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_LIB_C_CLOUDABI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/c/gnu.h b/ThirdParty/boost/predef/library/c/gnu.h index 9e4ca89d6426143d7d127fa13d88c985fa7786af..dd7a2052bedd8ab67f46d84d3e4253167a6eb59a 100644 --- a/ThirdParty/boost/predef/library/c/gnu.h +++ b/ThirdParty/boost/predef/library/c/gnu.h @@ -19,22 +19,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <cstddef> #endif -/*` -[heading `BOOST_LIB_C_GNU`] +/* tag::reference[] += `BOOST_LIB_C_GNU` -[@http://en.wikipedia.org/wiki/Glibc GNU glibc] Standard C library. +http://en.wikipedia.org/wiki/Glibc[GNU glibc] Standard C library. Version number available as major, and minor. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__GLIBC__`] [__predef_detection__]] - [[`__GNU_LIBRARY__`] [__predef_detection__]] +| `+__GLIBC__+` | {predef_detection} +| `+__GNU_LIBRARY__+` | {predef_detection} - [[`__GLIBC__`, `__GLIBC_MINOR__`] [V.R.0]] - [[`__GNU_LIBRARY__`, `__GNU_LIBRARY_MINOR__`] [V.R.0]] - ] - */ +| `+__GLIBC__+`, `+__GLIBC_MINOR__+` | V.R.0 +| `+__GNU_LIBRARY__+`, `+__GNU_LIBRARY_MINOR__+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_LIB_C_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/c/uc.h b/ThirdParty/boost/predef/library/c/uc.h index 03081e94c625b930308ae3c37e4ac28b339a6455..6eb22f0c0731142292afb340fad630f04e3eb0b9 100644 --- a/ThirdParty/boost/predef/library/c/uc.h +++ b/ThirdParty/boost/predef/library/c/uc.h @@ -13,19 +13,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_C_UC`] +/* tag::reference[] += `BOOST_LIB_C_UC` -[@http://en.wikipedia.org/wiki/Uclibc uClibc] Standard C library. +http://en.wikipedia.org/wiki/Uclibc[uClibc] Standard C library. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__UCLIBC__`] [__predef_detection__]] +| `+__UCLIBC__+` | {predef_detection} - [[`__UCLIBC_MAJOR__`, `__UCLIBC_MINOR__`, `__UCLIBC_SUBLEVEL__`] [V.R.P]] - ] - */ +| `+__UCLIBC_MAJOR__+`, `+__UCLIBC_MINOR__+`, `+__UCLIBC_SUBLEVEL__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_C_UC BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/c/vms.h b/ThirdParty/boost/predef/library/c/vms.h index 685f1a77d6cfdbd56e1c83d37685fde0f6042d14..ca9050f8c86ba0bcddd4fa0e6984f30184a7a6ba 100644 --- a/ThirdParty/boost/predef/library/c/vms.h +++ b/ThirdParty/boost/predef/library/c/vms.h @@ -13,20 +13,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_C_VMS`] +/* tag::reference[] += `BOOST_LIB_C_VMS` VMS libc Standard C library. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__CRTL_VER`] [__predef_detection__]] +| `+__CRTL_VER+` | {predef_detection} - [[`__CRTL_VER`] [V.R.P]] - ] - */ +| `+__CRTL_VER+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_C_VMS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/c/zos.h b/ThirdParty/boost/predef/library/c/zos.h index 222d35539f53261a2e380a13a5d47106960d4b7f..8390762103b2e6ea3540c13aeac711d9549646f5 100644 --- a/ThirdParty/boost/predef/library/c/zos.h +++ b/ThirdParty/boost/predef/library/c/zos.h @@ -13,21 +13,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_C_ZOS`] +/* tag::reference[] += `BOOST_LIB_C_ZOS` z/OS libc Standard C library. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__LIBREL__`] [__predef_detection__]] +| `+__LIBREL__+` | {predef_detection} - [[`__LIBREL__`] [V.R.P]] - [[`__TARGET_LIB__`] [V.R.P]] - ] - */ +| `+__LIBREL__+` | V.R.P +| `+__TARGET_LIB__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_C_ZOS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/cxx.h b/ThirdParty/boost/predef/library/std/cxx.h index 07b52cd6af8231c24f1e10a0ea0dda69878fc7dc..61a09a8c3322e5703e7eec904b0de6631d65806a 100644 --- a/ThirdParty/boost/predef/library/std/cxx.h +++ b/ThirdParty/boost/predef/library/std/cxx.h @@ -13,19 +13,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_CXX`] +/* tag::reference[] += `BOOST_LIB_STD_CXX` -[@http://libcxx.llvm.org/ libc++] C++ Standard Library. +http://libcxx.llvm.org/[libc++] {CPP} Standard Library. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`_LIBCPP_VERSION`] [__predef_detection__]] +| `+_LIBCPP_VERSION+` | {predef_detection} - [[`_LIBCPP_VERSION`] [V.0.P]] - ] - */ +| `+_LIBCPP_VERSION+` | V.0.P +|=== +*/ // end::reference[] #define BOOST_LIB_STD_CXX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/dinkumware.h b/ThirdParty/boost/predef/library/std/dinkumware.h index 0fc077605d6d4c86c3f065408fe2389007c20469..5a4bc57a5bfe386e68eae367b22e15aae5fdfcd9 100644 --- a/ThirdParty/boost/predef/library/std/dinkumware.h +++ b/ThirdParty/boost/predef/library/std/dinkumware.h @@ -13,21 +13,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_DINKUMWARE`] +/* tag::reference[] += `BOOST_LIB_STD_DINKUMWARE` -[@http://en.wikipedia.org/wiki/Dinkumware Dinkumware] Standard C++ Library. +http://en.wikipedia.org/wiki/Dinkumware[Dinkumware] Standard {CPP} Library. If available version number as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`_YVALS`, `__IBMCPP__`] [__predef_detection__]] - [[`_CPPLIB_VER`] [__predef_detection__]] +| `+_YVALS+`, `+__IBMCPP__+` | {predef_detection} +| `+_CPPLIB_VER+` | {predef_detection} - [[`_CPPLIB_VER`] [V.R.0]] - ] - */ +| `+_CPPLIB_VER+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_LIB_STD_DINKUMWARE BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/libcomo.h b/ThirdParty/boost/predef/library/std/libcomo.h index 97d4a53d6f6108990d19ba82ea9e9e923c022cc2..a2116c85eb4816c815f34f72a4ac07128be7fac2 100644 --- a/ThirdParty/boost/predef/library/std/libcomo.h +++ b/ThirdParty/boost/predef/library/std/libcomo.h @@ -13,20 +13,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_COMO`] +/* tag::reference[] += `BOOST_LIB_STD_COMO` -[@http://www.comeaucomputing.com/libcomo/ Comeau Computing] Standard C++ Library. +http://www.comeaucomputing.com/libcomo/[Comeau Computing] Standard {CPP} Library. Version number available as major. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__LIBCOMO__`] [__predef_detection__]] +| `+__LIBCOMO__+` | {predef_detection} - [[`__LIBCOMO_VERSION__`] [V.0.0]] - ] - */ +| `+__LIBCOMO_VERSION__+` | V.0.0 +|=== +*/ // end::reference[] #define BOOST_LIB_STD_COMO BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/modena.h b/ThirdParty/boost/predef/library/std/modena.h index b67ac62f17b8bad274471bbe77bede41c47e691c..4ce1cfcd7ae9bccf2f8c7a8b45a95ad5754a24dc 100644 --- a/ThirdParty/boost/predef/library/std/modena.h +++ b/ThirdParty/boost/predef/library/std/modena.h @@ -13,18 +13,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_MSIPL`] +/* tag::reference[] += `BOOST_LIB_STD_MSIPL` -[@http://modena.us/ Modena Software Lib++] Standard C++ Library. +http://modena.us/[Modena Software Lib++] Standard {CPP} Library. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`MSIPL_COMPILE_H`] [__predef_detection__]] - [[`__MSIPL_COMPILE_H`] [__predef_detection__]] - ] - */ +| `MSIPL_COMPILE_H` | {predef_detection} +| `+__MSIPL_COMPILE_H+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_LIB_STD_MSIPL BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/msl.h b/ThirdParty/boost/predef/library/std/msl.h index d73c74c6d84b4db8cbb5431590a7a817ae11ac40..932da795b5bca1379e8f625b7038ee1240f06db6 100644 --- a/ThirdParty/boost/predef/library/std/msl.h +++ b/ThirdParty/boost/predef/library/std/msl.h @@ -13,22 +13,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_MSL`] +/* tag::reference[] += `BOOST_LIB_STD_MSL` -[@http://www.freescale.com/ Metrowerks] Standard C++ Library. +http://www.freescale.com/[Metrowerks] Standard {CPP} Library. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MSL_CPP__`] [__predef_detection__]] - [[`__MSL__`] [__predef_detection__]] +| `+__MSL_CPP__+` | {predef_detection} +| `+__MSL__+` | {predef_detection} - [[`__MSL_CPP__`] [V.R.P]] - [[`__MSL__`] [V.R.P]] - ] - */ +| `+__MSL_CPP__+` | V.R.P +| `+__MSL__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_STD_MSL BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/roguewave.h b/ThirdParty/boost/predef/library/std/roguewave.h index 9c3f288b6f9e1e2a17709b3560af785591a7a513..c64cb061d89fa93455deec43f0acdaed8aa82fed 100644 --- a/ThirdParty/boost/predef/library/std/roguewave.h +++ b/ThirdParty/boost/predef/library/std/roguewave.h @@ -13,21 +13,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_RW`] +/* tag::reference[] += `BOOST_LIB_STD_RW` -[@http://stdcxx.apache.org/ Roguewave] Standard C++ library. +http://stdcxx.apache.org/[Roguewave] Standard {CPP} library. If available version number as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__STD_RWCOMPILER_H__`] [__predef_detection__]] - [[`_RWSTD_VER`] [__predef_detection__]] +| `+__STD_RWCOMPILER_H__+` | {predef_detection} +| `+_RWSTD_VER+` | {predef_detection} - [[`_RWSTD_VER`] [V.R.P]] - ] - */ +| `+_RWSTD_VER+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_STD_RW BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/sgi.h b/ThirdParty/boost/predef/library/std/sgi.h index 5d19bbac4d92b7af7ca652f9956d9c0ac3b562ff..3d11dd43c7534a173707d58340316e8b75381c69 100644 --- a/ThirdParty/boost/predef/library/std/sgi.h +++ b/ThirdParty/boost/predef/library/std/sgi.h @@ -13,20 +13,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_SGI`] +/* tag::reference[] += `BOOST_LIB_STD_SGI` -[@http://www.sgi.com/tech/stl/ SGI] Standard C++ library. +http://www.sgi.com/tech/stl/[SGI] Standard {CPP} library. If available version number as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__STL_CONFIG_H`] [__predef_detection__]] +| `+__STL_CONFIG_H+` | {predef_detection} - [[`__SGI_STL`] [V.R.P]] - ] - */ +| `+__SGI_STL+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_STD_SGI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/stdcpp3.h b/ThirdParty/boost/predef/library/std/stdcpp3.h index c9802924a7b7fd9a9992ea60c885113b3397213c..bc9717a2c8dfe0536fc60e48be74a6152cfd3509 100644 --- a/ThirdParty/boost/predef/library/std/stdcpp3.h +++ b/ThirdParty/boost/predef/library/std/stdcpp3.h @@ -13,22 +13,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_GNU`] +/* tag::reference[] += `BOOST_LIB_STD_GNU` -[@http://gcc.gnu.org/libstdc++/ GNU libstdc++] Standard C++ library. +http://gcc.gnu.org/libstdc++/[GNU libstdc++] Standard {CPP} library. Version number available as year (from 1970), month, and day. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__GLIBCXX__`] [__predef_detection__]] - [[`__GLIBCPP__`] [__predef_detection__]] +| `+__GLIBCXX__+` | {predef_detection} +| `+__GLIBCPP__+` | {predef_detection} - [[`__GLIBCXX__`] [V.R.P]] - [[`__GLIBCPP__`] [V.R.P]] - ] - */ +| `+__GLIBCXX__+` | V.R.P +| `+__GLIBCPP__+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_STD_GNU BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/stlport.h b/ThirdParty/boost/predef/library/std/stlport.h index c09483bd9fa39d482c3a831359a0576da71cc417..9d7f14f8afa5ef21c008cbd069ae0bb7b7ac11d7 100644 --- a/ThirdParty/boost/predef/library/std/stlport.h +++ b/ThirdParty/boost/predef/library/std/stlport.h @@ -13,23 +13,24 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_STLPORT`] +/* tag::reference[] += `BOOST_LIB_STD_STLPORT` -[@http://sourceforge.net/projects/stlport/ STLport Standard C++] library. +http://sourceforge.net/projects/stlport/[STLport Standard {CPP}] library. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__SGI_STL_PORT`] [__predef_detection__]] - [[`_STLPORT_VERSION`] [__predef_detection__]] +| `+__SGI_STL_PORT+` | {predef_detection} +| `+_STLPORT_VERSION+` | {predef_detection} - [[`_STLPORT_MAJOR`, `_STLPORT_MINOR`, `_STLPORT_PATCHLEVEL`] [V.R.P]] - [[`_STLPORT_VERSION`] [V.R.P]] - [[`__SGI_STL_PORT`] [V.R.P]] - ] - */ +| `+_STLPORT_MAJOR+`, `+_STLPORT_MINOR+`, `+_STLPORT_PATCHLEVEL+` | V.R.P +| `+_STLPORT_VERSION+` | V.R.P +| `+__SGI_STL_PORT+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_LIB_STD_STLPORT BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/library/std/vacpp.h b/ThirdParty/boost/predef/library/std/vacpp.h index 632f846c20168defcd7f25583047de6a178c67e7..6165feffeb2e46cf74e43e3d7ca83b2ac1b029ce 100644 --- a/ThirdParty/boost/predef/library/std/vacpp.h +++ b/ThirdParty/boost/predef/library/std/vacpp.h @@ -13,17 +13,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_LIB_STD_IBM`] +/* tag::reference[] += `BOOST_LIB_STD_IBM` -[@http://www.ibm.com/software/awdtools/xlcpp/ IBM VACPP Standard C++] library. +http://www.ibm.com/software/awdtools/xlcpp/[IBM VACPP Standard {CPP}] library. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__IBMCPP__`] [__predef_detection__]] - ] - */ +| `+__IBMCPP__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_LIB_STD_IBM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/make.h b/ThirdParty/boost/predef/make.h index fccd2d3cc94f35f484bf0e4f7d09d26f68ed175d..810ba456e39fbbac6d40e5b8ec969f2d09d7d0a1 100644 --- a/ThirdParty/boost/predef/make.h +++ b/ThirdParty/boost/predef/make.h @@ -13,8 +13,8 @@ http://www.boost.org/LICENSE_1_0.txt) Shorthands for the common version number formats used by vendors... */ -/*` -[heading `BOOST_PREDEF_MAKE_..` macros] +/* tag::reference[] += `BOOST_PREDEF_MAKE_..` macros These set of macros decompose common vendor version number macros which are composed version, revision, and patch digits. @@ -27,71 +27,133 @@ The naming convention indicates: indicates an ignored digit. Macros are: -*/ -/*` `BOOST_PREDEF_MAKE_0X_VRP(V)` */ + +*/ // end::reference[] +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VRP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VRP(V) BOOST_VERSION_NUMBER((V&0xF00)>>8,(V&0xF0)>>4,(V&0xF)) -/*` `BOOST_PREDEF_MAKE_0X_VVRP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VVRP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VVRP(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xF0)>>4,(V&0xF)) -/*` `BOOST_PREDEF_MAKE_0X_VRPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VRPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VRPP(V) BOOST_VERSION_NUMBER((V&0xF000)>>12,(V&0xF00)>>8,(V&0xFF)) -/*` `BOOST_PREDEF_MAKE_0X_VVRR(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VVRR(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VVRR(V) BOOST_VERSION_NUMBER((V&0xFF00)>>8,(V&0xFF),0) -/*` `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VRRPPPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VRRPPPP(V) BOOST_VERSION_NUMBER((V&0xF000000)>>24,(V&0xFF0000)>>16,(V&0xFFFF)) -/*` `BOOST_PREDEF_MAKE_0X_VVRRP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VVRRP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VVRRP(V) BOOST_VERSION_NUMBER((V&0xFF000)>>12,(V&0xFF0)>>4,(V&0xF)) -/*` `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VRRPP000(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VRRPP000(V) BOOST_VERSION_NUMBER((V&0xF0000000)>>28,(V&0xFF00000)>>20,(V&0xFF000)>>12) -/*` `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_0X_VVRRPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_0X_VVRRPP(V) BOOST_VERSION_NUMBER((V&0xFF0000)>>16,(V&0xFF00)>>8,(V&0xFF)) -/*` `BOOST_PREDEF_MAKE_10_VPPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VPPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VPPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,0,(V)%1000) -/*` `BOOST_PREDEF_MAKE_10_VR0(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VR0(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VR0(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,0) -/*` `BOOST_PREDEF_MAKE_10_VRP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRP(V) BOOST_VERSION_NUMBER(((V)/100)%10,((V)/10)%10,(V)%10) -/*` `BOOST_PREDEF_MAKE_10_VRP000(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRP000(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRP000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,((V)/1000)%10) -/*` `BOOST_PREDEF_MAKE_10_VRPPPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRPPPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRPPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/10000)%10,(V)%10000) -/*` `BOOST_PREDEF_MAKE_10_VRPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRPP(V) BOOST_VERSION_NUMBER(((V)/1000)%10,((V)/100)%10,(V)%100) -/*` `BOOST_PREDEF_MAKE_10_VRR(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRR(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRR(V) BOOST_VERSION_NUMBER(((V)/100)%10,(V)%100,0) -/*` `BOOST_PREDEF_MAKE_10_VRRPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRRPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%10,((V)/100)%100,(V)%100) -/*` `BOOST_PREDEF_MAKE_10_VRR000(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VRR000(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VRR000(V) BOOST_VERSION_NUMBER(((V)/100000)%10,((V)/1000)%100,0) -/*` `BOOST_PREDEF_MAKE_10_VV00(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VV00(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VV00(V) BOOST_VERSION_NUMBER(((V)/100)%100,0,0) -/*` `BOOST_PREDEF_MAKE_10_VVRR(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRR(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRR(V) BOOST_VERSION_NUMBER(((V)/100)%100,(V)%100,0) -/*` `BOOST_PREDEF_MAKE_10_VVRRP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRRP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRRP(V) BOOST_VERSION_NUMBER(((V)/1000)%100,((V)/10)%100,(V)%10) -/*` `BOOST_PREDEF_MAKE_10_VVRRPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRRPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRRPP(V) BOOST_VERSION_NUMBER(((V)/10000)%100,((V)/100)%100,(V)%100) -/*` `BOOST_PREDEF_MAKE_10_VVRRPPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRRPPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRRPPP(V) BOOST_VERSION_NUMBER(((V)/100000)%100,((V)/1000)%100,(V)%1000) -/*` `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRR0PP00(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRR0PP00(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,((V)/100)%100) -/*` `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRR0PPPP(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRR0PPPP(V) BOOST_VERSION_NUMBER(((V)/10000000)%100,((V)/100000)%100,(V)%10000) -/*` `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_10_VVRR00PP00(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_10_VVRR00PP00(V) BOOST_VERSION_NUMBER(((V)/100000000)%100,((V)/1000000)%100,((V)/100)%100) -/*` -[heading `BOOST_PREDEF_MAKE_*..` date macros] + +/* tag::reference[] + += `BOOST_PREDEF_MAKE_*..` date macros Date decomposition macros return a date in the relative to the 1970 Epoch date. If the month is not available, January 1st is used as the month and day. If the day is not available, but the month is, the 1st of the month is used as the day. -*/ -/*` `BOOST_PREDEF_MAKE_DATE(Y,M,D)` */ + +*/ // end::reference[] +/* tag::reference[] +* `BOOST_PREDEF_MAKE_DATE(Y,M,D)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_DATE(Y,M,D) BOOST_VERSION_NUMBER((Y)%10000-1970,(M)%100,(D)%100) -/*` `BOOST_PREDEF_MAKE_YYYYMMDD(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_YYYYMMDD(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_YYYYMMDD(V) BOOST_PREDEF_MAKE_DATE(((V)/10000)%10000,((V)/100)%100,(V)%100) -/*` `BOOST_PREDEF_MAKE_YYYY(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_YYYY(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_YYYY(V) BOOST_PREDEF_MAKE_DATE(V,1,1) -/*` `BOOST_PREDEF_MAKE_YYYYMM(V)` */ +/* tag::reference[] +* `BOOST_PREDEF_MAKE_YYYYMM(V)` +*/ // end::reference[] #define BOOST_PREDEF_MAKE_YYYYMM(V) BOOST_PREDEF_MAKE_DATE((V)/100,(V)%100,1) #endif diff --git a/ThirdParty/boost/predef/os.h b/ThirdParty/boost/predef/os.h index 9a9f9c68aba355cbdc6657a9fea87d6cd118c33d..da28e1c47e5310f42df6a19c5b42099c8407ee39 100644 --- a/ThirdParty/boost/predef/os.h +++ b/ThirdParty/boost/predef/os.h @@ -29,6 +29,4 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/vms.h> #include <boost/predef/os/windows.h> -#include <boost/predef/os/android.h> - #endif diff --git a/ThirdParty/boost/predef/os/aix.h b/ThirdParty/boost/predef/os/aix.h index 3e5a953f1bd5cdc501fe20776d616c53e6035526..9bfe740c40f4033f7d15ca5dc09ee4ab3d3899d5 100644 --- a/ThirdParty/boost/predef/os/aix.h +++ b/ThirdParty/boost/predef/os/aix.h @@ -11,24 +11,25 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_AIX`] +/* tag::reference[] += `BOOST_OS_AIX` -[@http://en.wikipedia.org/wiki/AIX_operating_system IBM AIX] operating system. +http://en.wikipedia.org/wiki/AIX_operating_system[IBM AIX] operating system. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`_AIX`] [__predef_detection__]] - [[`__TOS_AIX__`] [__predef_detection__]] +| `+_AIX+` | {predef_detection} +| `+__TOS_AIX__+` | {predef_detection} - [[`_AIX43`] [4.3.0]] - [[`_AIX41`] [4.1.0]] - [[`_AIX32`] [3.2.0]] - [[`_AIX3`] [3.0.0]] - ] - */ +| `+_AIX43+` | 4.3.0 +| `+_AIX41+` | 4.1.0 +| `+_AIX32+` | 3.2.0 +| `+_AIX3+` | 3.0.0 +|=== +*/ // end::reference[] #define BOOST_OS_AIX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/amigaos.h b/ThirdParty/boost/predef/os/amigaos.h index 7b32ddf59ca2f087c7499b8ede00acb4d6c81da8..c6a1f71ac0684822278a2803329e74536f3dbac6 100644 --- a/ThirdParty/boost/predef/os/amigaos.h +++ b/ThirdParty/boost/predef/os/amigaos.h @@ -11,18 +11,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_AMIGAOS`] +/* tag::reference[] += `BOOST_OS_AMIGAOS` -[@http://en.wikipedia.org/wiki/AmigaOS AmigaOS] operating system. +http://en.wikipedia.org/wiki/AmigaOS[AmigaOS] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`AMIGA`] [__predef_detection__]] - [[`__amigaos__`] [__predef_detection__]] - ] - */ +| `AMIGA` | {predef_detection} +| `+__amigaos__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_AMIGAOS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/android.h b/ThirdParty/boost/predef/os/android.h deleted file mode 100644 index 564423f369632864c0531fbefc66ed9cc214cd29..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/predef/os/android.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright Rene Rivera 2015 -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) -*/ - -#ifndef BOOST_PREDEF_OS_ANDROID_H -#define BOOST_PREDEF_OS_ANDROID_H - -#include <boost/predef/version_number.h> -#include <boost/predef/make.h> - -/*` -[heading `BOOST_OS_ANDROID`] - -NOTE: `BOOST_OS_ANDROID` is deprecated, and will be removed in a following release. -Please use `BOOST_PLAT_ANDROID` instead. - -[@http://en.wikipedia.org/wiki/Android_%28operating_system%29 Android] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`__ANDROID__`] [__predef_detection__]] - ] - */ - -#define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_NOT_AVAILABLE - -#if !defined(BOOST_PREDEF_DETAIL_OS_DETECTED) && ( \ - defined(__ANDROID__) \ - ) -# undef BOOST_OS_ANDROID -# define BOOST_OS_ANDROID BOOST_VERSION_NUMBER_AVAILABLE -#endif - -#if BOOST_OS_ANDROID -# define BOOST_OS_ANDROID_AVAILABLE -# include <boost/predef/detail/os_detected.h> -#endif - -#define BOOST_OS_ANDROID_NAME "Android" - -#endif - -#include <boost/predef/detail/test.h> -BOOST_PREDEF_DECLARE_TEST(BOOST_OS_ANDROID,BOOST_OS_ANDROID_NAME) diff --git a/ThirdParty/boost/predef/os/beos.h b/ThirdParty/boost/predef/os/beos.h index 19f4cb71e3f24d09b41693932c75b7471564abb9..8f764875e4f66f076372265c855dca5614b0c79b 100644 --- a/ThirdParty/boost/predef/os/beos.h +++ b/ThirdParty/boost/predef/os/beos.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_BEOS`] +/* tag::reference[] += `BOOST_OS_BEOS` -[@http://en.wikipedia.org/wiki/BeOS BeOS] operating system. +http://en.wikipedia.org/wiki/BeOS[BeOS] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__BEOS__`] [__predef_detection__]] - ] - */ +| `+__BEOS__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_BEOS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/bsd.h b/ThirdParty/boost/predef/os/bsd.h index 81d2c08bf493b91a630d0c3b67e25fe0e4a59da2..528a5972bfbefdcd4f3cebd26eb4446e3a96941b 100644 --- a/ThirdParty/boost/predef/os/bsd.h +++ b/ThirdParty/boost/predef/os/bsd.h @@ -18,36 +18,37 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_BSD`] +/* tag::reference[] += `BOOST_OS_BSD` -[@http://en.wikipedia.org/wiki/Berkeley_Software_Distribution BSD] operating system. +http://en.wikipedia.org/wiki/Berkeley_Software_Distribution[BSD] operating system. BSD has various branch operating systems possible and each detected individually. This detects the following variations and sets a specific version number macro to match: -* `BOOST_OS_BSD_DRAGONFLY` [@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] -* `BOOST_OS_BSD_FREE` [@http://en.wikipedia.org/wiki/Freebsd FreeBSD] -* `BOOST_OS_BSD_BSDI` [@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] -* `BOOST_OS_BSD_NET` [@http://en.wikipedia.org/wiki/Netbsd NetBSD] -* `BOOST_OS_BSD_OPEN` [@http://en.wikipedia.org/wiki/Openbsd OpenBSD] +* `BOOST_OS_BSD_DRAGONFLY` http://en.wikipedia.org/wiki/DragonFly_BSD[DragonFly BSD] +* `BOOST_OS_BSD_FREE` http://en.wikipedia.org/wiki/Freebsd[FreeBSD] +* `BOOST_OS_BSD_BSDI` http://en.wikipedia.org/wiki/BSD/OS[BSDi BSD/OS] +* `BOOST_OS_BSD_NET` http://en.wikipedia.org/wiki/Netbsd[NetBSD] +* `BOOST_OS_BSD_OPEN` http://en.wikipedia.org/wiki/Openbsd[OpenBSD] -[note The general `BOOST_OS_BSD` is set in all cases to indicate some form -of BSD. If the above variants is detected the corresponding macro is also set.] +NOTE: The general `BOOST_OS_BSD` is set in all cases to indicate some form +of BSD. If the above variants is detected the corresponding macro is also set. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`BSD`] [__predef_detection__]] - [[`_SYSTYPE_BSD`] [__predef_detection__]] +| `BSD` | {predef_detection} +| `+_SYSTYPE_BSD+` | {predef_detection} - [[`BSD4_2`] [4.2.0]] - [[`BSD4_3`] [4.3.0]] - [[`BSD4_4`] [4.4.0]] - [[`BSD`] [V.R.0]] - ] - */ +| `BSD4_2` | 4.2.0 +| `BSD4_3` | 4.3.0 +| `BSD4_4` | 4.4.0 +| `BSD` | V.R.0 +|=== +*/ // end::reference[] #include <boost/predef/os/bsd/bsdi.h> #include <boost/predef/os/bsd/dragonfly.h> diff --git a/ThirdParty/boost/predef/os/bsd/bsdi.h b/ThirdParty/boost/predef/os/bsd/bsdi.h index afdcd3eb7c4f2fd203f13f4c056767282712f3a5..0c90f6d41dfdabb5f819eaea822e9908028f8dd1 100644 --- a/ThirdParty/boost/predef/os/bsd/bsdi.h +++ b/ThirdParty/boost/predef/os/bsd/bsdi.h @@ -10,17 +10,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/bsd.h> -/*` -[heading `BOOST_OS_BSD_BSDI`] +/* tag::reference[] += `BOOST_OS_BSD_BSDI` -[@http://en.wikipedia.org/wiki/BSD/OS BSDi BSD/OS] operating system. +http://en.wikipedia.org/wiki/BSD/OS[BSDi BSD/OS] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__bsdi__`] [__predef_detection__]] - ] - */ +| `+__bsdi__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_BSD_BSDI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/bsd/dragonfly.h b/ThirdParty/boost/predef/os/bsd/dragonfly.h index 1d075798a1e35f5e45d3ababd0b4aaeb4f9413e3..253f0e24e4c3d5b8ade7bc9cb323edd4cf2d2ad1 100644 --- a/ThirdParty/boost/predef/os/bsd/dragonfly.h +++ b/ThirdParty/boost/predef/os/bsd/dragonfly.h @@ -10,17 +10,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/bsd.h> -/*` -[heading `BOOST_OS_BSD_DRAGONFLY`] +/* tag::reference[] += `BOOST_OS_BSD_DRAGONFLY` -[@http://en.wikipedia.org/wiki/DragonFly_BSD DragonFly BSD] operating system. +http://en.wikipedia.org/wiki/DragonFly_BSD[DragonFly BSD] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__DragonFly__`] [__predef_detection__]] - ] - */ +| `+__DragonFly__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_BSD_DRAGONFLY BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/bsd/free.h b/ThirdParty/boost/predef/os/bsd/free.h index 81c002109dcf4ab9d820b86af8d87c00623c1dc2..0cf82ae9d6d9e894a0c918a4008897f43ea0a309 100644 --- a/ThirdParty/boost/predef/os/bsd/free.h +++ b/ThirdParty/boost/predef/os/bsd/free.h @@ -10,19 +10,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/bsd.h> -/*` -[heading `BOOST_OS_BSD_FREE`] +/* tag::reference[] += `BOOST_OS_BSD_FREE` -[@http://en.wikipedia.org/wiki/Freebsd FreeBSD] operating system. +http://en.wikipedia.org/wiki/Freebsd[FreeBSD] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__FreeBSD__`] [__predef_detection__]] +| `+__FreeBSD__+` | {predef_detection} - [[`__FreeBSD_version`] [V.R.P]] - ] - */ +| `+__FreeBSD_version+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_OS_BSD_FREE BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/bsd/net.h b/ThirdParty/boost/predef/os/bsd/net.h index 3fe5589e7f2056091104e306de767442da5ffab9..c4e3c92ba6e1f5e12924f7cef485f7142c5b95f8 100644 --- a/ThirdParty/boost/predef/os/bsd/net.h +++ b/ThirdParty/boost/predef/os/bsd/net.h @@ -10,24 +10,25 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/bsd.h> -/*` -[heading `BOOST_OS_BSD_NET`] +/* tag::reference[] += `BOOST_OS_BSD_NET` -[@http://en.wikipedia.org/wiki/Netbsd NetBSD] operating system. +http://en.wikipedia.org/wiki/Netbsd[NetBSD] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__NETBSD__`] [__predef_detection__]] - [[`__NetBSD__`] [__predef_detection__]] +| `+__NETBSD__+` | {predef_detection} +| `+__NetBSD__+` | {predef_detection} - [[`__NETBSD_version`] [V.R.P]] - [[`NetBSD0_8`] [0.8.0]] - [[`NetBSD0_9`] [0.9.0]] - [[`NetBSD1_0`] [1.0.0]] - [[`__NetBSD_Version`] [V.R.P]] - ] - */ +| `+__NETBSD_version+` | V.R.P +| `NetBSD0_8` | 0.8.0 +| `NetBSD0_9` | 0.9.0 +| `NetBSD1_0` | 1.0.0 +| `+__NetBSD_Version+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_OS_BSD_NET BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/bsd/open.h b/ThirdParty/boost/predef/os/bsd/open.h index f6ccd24a9b7f33781a7a75855cbbfa1a241c4e14..3a9081c8534d17ff9b380fd34d134388b0264a89 100644 --- a/ThirdParty/boost/predef/os/bsd/open.h +++ b/ThirdParty/boost/predef/os/bsd/open.h @@ -10,68 +10,69 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/bsd.h> -/*` -[heading `BOOST_OS_BSD_OPEN`] +/* tag::reference[] += `BOOST_OS_BSD_OPEN` -[@http://en.wikipedia.org/wiki/Openbsd OpenBSD] operating system. +http://en.wikipedia.org/wiki/Openbsd[OpenBSD] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__OpenBSD__`] [__predef_detection__]] +| `+__OpenBSD__+` | {predef_detection} - [[`OpenBSD2_0`] [2.0.0]] - [[`OpenBSD2_1`] [2.1.0]] - [[`OpenBSD2_2`] [2.2.0]] - [[`OpenBSD2_3`] [2.3.0]] - [[`OpenBSD2_4`] [2.4.0]] - [[`OpenBSD2_5`] [2.5.0]] - [[`OpenBSD2_6`] [2.6.0]] - [[`OpenBSD2_7`] [2.7.0]] - [[`OpenBSD2_8`] [2.8.0]] - [[`OpenBSD2_9`] [2.9.0]] - [[`OpenBSD3_0`] [3.0.0]] - [[`OpenBSD3_1`] [3.1.0]] - [[`OpenBSD3_2`] [3.2.0]] - [[`OpenBSD3_3`] [3.3.0]] - [[`OpenBSD3_4`] [3.4.0]] - [[`OpenBSD3_5`] [3.5.0]] - [[`OpenBSD3_6`] [3.6.0]] - [[`OpenBSD3_7`] [3.7.0]] - [[`OpenBSD3_8`] [3.8.0]] - [[`OpenBSD3_9`] [3.9.0]] - [[`OpenBSD4_0`] [4.0.0]] - [[`OpenBSD4_1`] [4.1.0]] - [[`OpenBSD4_2`] [4.2.0]] - [[`OpenBSD4_3`] [4.3.0]] - [[`OpenBSD4_4`] [4.4.0]] - [[`OpenBSD4_5`] [4.5.0]] - [[`OpenBSD4_6`] [4.6.0]] - [[`OpenBSD4_7`] [4.7.0]] - [[`OpenBSD4_8`] [4.8.0]] - [[`OpenBSD4_9`] [4.9.0]] - [[`OpenBSD5_0`] [5.0.0]] - [[`OpenBSD5_1`] [5.1.0]] - [[`OpenBSD5_2`] [5.2.0]] - [[`OpenBSD5_3`] [5.3.0]] - [[`OpenBSD5_4`] [5.4.0]] - [[`OpenBSD5_5`] [5.5.0]] - [[`OpenBSD5_6`] [5.6.0]] - [[`OpenBSD5_7`] [5.7.0]] - [[`OpenBSD5_8`] [5.8.0]] - [[`OpenBSD5_9`] [5.9.0]] - [[`OpenBSD6_0`] [6.0.0]] - [[`OpenBSD6_1`] [6.1.0]] - [[`OpenBSD6_2`] [6.2.0]] - [[`OpenBSD6_3`] [6.3.0]] - [[`OpenBSD6_4`] [6.4.0]] - [[`OpenBSD6_5`] [6.5.0]] - [[`OpenBSD6_6`] [6.6.0]] - [[`OpenBSD6_7`] [6.7.0]] - [[`OpenBSD6_8`] [6.8.0]] - [[`OpenBSD6_9`] [6.9.0]] - ] - */ +| `OpenBSD2_0` | 2.0.0 +| `OpenBSD2_1` | 2.1.0 +| `OpenBSD2_2` | 2.2.0 +| `OpenBSD2_3` | 2.3.0 +| `OpenBSD2_4` | 2.4.0 +| `OpenBSD2_5` | 2.5.0 +| `OpenBSD2_6` | 2.6.0 +| `OpenBSD2_7` | 2.7.0 +| `OpenBSD2_8` | 2.8.0 +| `OpenBSD2_9` | 2.9.0 +| `OpenBSD3_0` | 3.0.0 +| `OpenBSD3_1` | 3.1.0 +| `OpenBSD3_2` | 3.2.0 +| `OpenBSD3_3` | 3.3.0 +| `OpenBSD3_4` | 3.4.0 +| `OpenBSD3_5` | 3.5.0 +| `OpenBSD3_6` | 3.6.0 +| `OpenBSD3_7` | 3.7.0 +| `OpenBSD3_8` | 3.8.0 +| `OpenBSD3_9` | 3.9.0 +| `OpenBSD4_0` | 4.0.0 +| `OpenBSD4_1` | 4.1.0 +| `OpenBSD4_2` | 4.2.0 +| `OpenBSD4_3` | 4.3.0 +| `OpenBSD4_4` | 4.4.0 +| `OpenBSD4_5` | 4.5.0 +| `OpenBSD4_6` | 4.6.0 +| `OpenBSD4_7` | 4.7.0 +| `OpenBSD4_8` | 4.8.0 +| `OpenBSD4_9` | 4.9.0 +| `OpenBSD5_0` | 5.0.0 +| `OpenBSD5_1` | 5.1.0 +| `OpenBSD5_2` | 5.2.0 +| `OpenBSD5_3` | 5.3.0 +| `OpenBSD5_4` | 5.4.0 +| `OpenBSD5_5` | 5.5.0 +| `OpenBSD5_6` | 5.6.0 +| `OpenBSD5_7` | 5.7.0 +| `OpenBSD5_8` | 5.8.0 +| `OpenBSD5_9` | 5.9.0 +| `OpenBSD6_0` | 6.0.0 +| `OpenBSD6_1` | 6.1.0 +| `OpenBSD6_2` | 6.2.0 +| `OpenBSD6_3` | 6.3.0 +| `OpenBSD6_4` | 6.4.0 +| `OpenBSD6_5` | 6.5.0 +| `OpenBSD6_6` | 6.6.0 +| `OpenBSD6_7` | 6.7.0 +| `OpenBSD6_8` | 6.8.0 +| `OpenBSD6_9` | 6.9.0 +|=== +*/ // end::reference[] #define BOOST_OS_BSD_OPEN BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/cygwin.h b/ThirdParty/boost/predef/os/cygwin.h index 207809c0ea888ceb2482f4bce2c91adef8dad92b..3ca73d26d5f8db1d39f2ec8230bd462e94ae086b 100644 --- a/ThirdParty/boost/predef/os/cygwin.h +++ b/ThirdParty/boost/predef/os/cygwin.h @@ -11,19 +11,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_CYGWIN`] +/* tag::reference[] += `BOOST_OS_CYGWIN` -[@http://en.wikipedia.org/wiki/Cygwin Cygwin] evironment. +http://en.wikipedia.org/wiki/Cygwin[Cygwin] evironment. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__CYGWIN__`] [__predef_detection__]] +| `+__CYGWIN__+` | {predef_detection} - [[`CYGWIN_VERSION_API_MAJOR`, `CYGWIN_VERSION_API_MINOR`] [V.R.0]] - ] - */ +| `CYGWIN_VERSION_API_MAJOR`, `CYGWIN_VERSION_API_MINOR` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_OS_CYGWIN BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/haiku.h b/ThirdParty/boost/predef/os/haiku.h index d79dbeac88daa721ebdd7a7970384006b9e743f8..4ae31583de2ebf38cbffd06043782249d96e516d 100644 --- a/ThirdParty/boost/predef/os/haiku.h +++ b/ThirdParty/boost/predef/os/haiku.h @@ -12,17 +12,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_HAIKU`] +/* tag::reference[] += `BOOST_OS_HAIKU` -[@http://en.wikipedia.org/wiki/Haiku_(operating_system) Haiku] operating system. +http://en.wikipedia.org/wiki/Haiku_(operating_system)[Haiku] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__HAIKU__`] [__predef_detection__]] - ] - */ +| `+__HAIKU__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_HAIKU BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/hpux.h b/ThirdParty/boost/predef/os/hpux.h index 29243f487907d0e682a6875367627d669cf8b018..7901914824ed20121ebfab027b13c7cc894266af 100644 --- a/ThirdParty/boost/predef/os/hpux.h +++ b/ThirdParty/boost/predef/os/hpux.h @@ -11,19 +11,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_HPUX`] +/* tag::reference[] += `BOOST_OS_HPUX` -[@http://en.wikipedia.org/wiki/HP-UX HP-UX] operating system. +http://en.wikipedia.org/wiki/HP-UX[HP-UX] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`hpux`] [__predef_detection__]] - [[`_hpux`] [__predef_detection__]] - [[`__hpux`] [__predef_detection__]] - ] - */ +| `hpux` | {predef_detection} +| `+_hpux+` | {predef_detection} +| `+__hpux+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_HPUX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/ios.h b/ThirdParty/boost/predef/os/ios.h index f853815a6d1783be7ede75c5db6d7a8a434079e2..138963afaa2046d584497575cb724c5138255f0e 100644 --- a/ThirdParty/boost/predef/os/ios.h +++ b/ThirdParty/boost/predef/os/ios.h @@ -12,21 +12,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_IOS`] +/* tag::reference[] += `BOOST_OS_IOS` -[@http://en.wikipedia.org/wiki/iOS iOS] operating system. +http://en.wikipedia.org/wiki/iOS[iOS] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__APPLE__`] [__predef_detection__]] - [[`__MACH__`] [__predef_detection__]] - [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__predef_detection__]] +| `+__APPLE__+` | {predef_detection} +| `+__MACH__+` | {predef_detection} +| `+__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__+` | {predef_detection} - [[`__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__`] [__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__*1000]] - ] - */ +| `+__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__+` | +__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__+*1000 +|=== +*/ // end::reference[] #define BOOST_OS_IOS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/irix.h b/ThirdParty/boost/predef/os/irix.h index fa6ac41dcdd052cb0f3f4228d090e1576bfcb44e..7c0bab04eaf64a9fe33b326ca4fec049c53be8c3 100644 --- a/ThirdParty/boost/predef/os/irix.h +++ b/ThirdParty/boost/predef/os/irix.h @@ -11,18 +11,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_IRIX`] +/* tag::reference[] += `BOOST_OS_IRIX` -[@http://en.wikipedia.org/wiki/Irix IRIX] operating system. +http://en.wikipedia.org/wiki/Irix[IRIX] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`sgi`] [__predef_detection__]] - [[`__sgi`] [__predef_detection__]] - ] - */ +| `sgi` | {predef_detection} +| `+__sgi+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_IRIX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/linux.h b/ThirdParty/boost/predef/os/linux.h index f945f01ea309c21a1459a804ea8579de706f697b..bab64fc4a8b74cef7d8f6aca9283df223925fee4 100644 --- a/ThirdParty/boost/predef/os/linux.h +++ b/ThirdParty/boost/predef/os/linux.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_LINUX`] +/* tag::reference[] += `BOOST_OS_LINUX` -[@http://en.wikipedia.org/wiki/Linux Linux] operating system. +http://en.wikipedia.org/wiki/Linux[Linux] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`linux`] [__predef_detection__]] - [[`__linux`] [__predef_detection__]] - [[`__linux__`] [__predef_detection__]] - [[`__gnu_linux__`] [__predef_detection__]] - ] - */ +| `linux` | {predef_detection} +| `+__linux+` | {predef_detection} +| `+__linux__+` | {predef_detection} +| `+__gnu_linux__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_LINUX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/macos.h b/ThirdParty/boost/predef/os/macos.h index 4afb30d087903e308e78c87e9de2863656219f6a..1a443184622a2bf1327b46193e8d96ef4e50e2bb 100644 --- a/ThirdParty/boost/predef/os/macos.h +++ b/ThirdParty/boost/predef/os/macos.h @@ -19,23 +19,24 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_MACOS`] +/* tag::reference[] += `BOOST_OS_MACOS` -[@http://en.wikipedia.org/wiki/Mac_OS Mac OS] operating system. +http://en.wikipedia.org/wiki/Mac_OS[Mac OS] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`macintosh`] [__predef_detection__]] - [[`Macintosh`] [__predef_detection__]] - [[`__APPLE__`] [__predef_detection__]] - [[`__MACH__`] [__predef_detection__]] +| `macintosh` | {predef_detection} +| `Macintosh` | {predef_detection} +| `+__APPLE__+` | {predef_detection} +| `+__MACH__+` | {predef_detection} - [[`__APPLE__`, `__MACH__`] [10.0.0]] - [[ /otherwise/ ] [9.0.0]] - ] - */ +| `+__APPLE__+`, `+__MACH__+` | 10.0.0 +| `_otherwise_` | 9.0.0 +|=== +*/ // end::reference[] #define BOOST_OS_MACOS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/os400.h b/ThirdParty/boost/predef/os/os400.h index b3446c26c933b9e7e98bbff7fa90fdf4eab3dc24..209638d114e57ff50366223ce66c12fcc7e9714a 100644 --- a/ThirdParty/boost/predef/os/os400.h +++ b/ThirdParty/boost/predef/os/os400.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_OS400`] +/* tag::reference[] += `BOOST_OS_OS400` -[@http://en.wikipedia.org/wiki/IBM_i IBM OS/400] operating system. +http://en.wikipedia.org/wiki/IBM_i[IBM OS/400] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__OS400__`] [__predef_detection__]] - ] - */ +| `+__OS400__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_OS400 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/qnxnto.h b/ThirdParty/boost/predef/os/qnxnto.h index e76fbf278169975e31579bc810b52c6bc13faac4..7507cd08f5052317568b8a86addd54e802632430 100644 --- a/ThirdParty/boost/predef/os/qnxnto.h +++ b/ThirdParty/boost/predef/os/qnxnto.h @@ -11,23 +11,24 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_QNX`] +/* tag::reference[] += `BOOST_OS_QNX` -[@http://en.wikipedia.org/wiki/QNX QNX] operating system. +http://en.wikipedia.org/wiki/QNX[QNX] operating system. Version number available as major, and minor if possible. And version 4 is specifically detected. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__QNX__`] [__predef_detection__]] - [[`__QNXNTO__`] [__predef_detection__]] +| `+__QNX__+` | {predef_detection} +| `+__QNXNTO__+` | {predef_detection} - [[`_NTO_VERSION`] [V.R.0]] - [[`__QNX__`] [4.0.0]] - ] - */ +| `+_NTO_VERSION+` | V.R.0 +| `+__QNX__+` | 4.0.0 +|=== +*/ // end::reference[] #define BOOST_OS_QNX BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/solaris.h b/ThirdParty/boost/predef/os/solaris.h index 75ddc91dae5ed2dfb74e5c18a2e5ec68362662d5..529af2b3b41ec50e4fecc9cf03167d85e8b679f6 100644 --- a/ThirdParty/boost/predef/os/solaris.h +++ b/ThirdParty/boost/predef/os/solaris.h @@ -11,18 +11,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_SOLARIS`] +/* tag::reference[] += `BOOST_OS_SOLARIS` -[@http://en.wikipedia.org/wiki/Solaris_Operating_Environment Solaris] operating system. +http://en.wikipedia.org/wiki/Solaris_Operating_Environment[Solaris] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`sun`] [__predef_detection__]] - [[`__sun`] [__predef_detection__]] - ] - */ +| `sun` | {predef_detection} +| `+__sun+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_SOLARIS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/unix.h b/ThirdParty/boost/predef/os/unix.h index a60710427a3e2e51944d2efbce41ac82f3ce0169..b86051dd5f7586b76ea469869fb25740a2c9febe 100644 --- a/ThirdParty/boost/predef/os/unix.h +++ b/ThirdParty/boost/predef/os/unix.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_UNIX`] +/* tag::reference[] += `BOOST_OS_UNIX` -[@http://en.wikipedia.org/wiki/Unix Unix Environment] operating system. +http://en.wikipedia.org/wiki/Unix[Unix Environment] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`unix`] [__predef_detection__]] - [[`__unix`] [__predef_detection__]] - [[`_XOPEN_SOURCE`] [__predef_detection__]] - [[`_POSIX_SOURCE`] [__predef_detection__]] - ] - */ +| `unix` | {predef_detection} +| `+__unix+` | {predef_detection} +| `+_XOPEN_SOURCE+` | {predef_detection} +| `+_POSIX_SOURCE+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_UNIX BOOST_VERSION_NUMBER_NOT_AVAILABLE @@ -40,20 +41,21 @@ http://www.boost.org/LICENSE_1_0.txt) #define BOOST_OS_UNIX_NAME "Unix Environment" -/*` -[heading `BOOST_OS_SVR4`] +/* tag::reference[] += `BOOST_OS_SVR4` -[@http://en.wikipedia.org/wiki/UNIX_System_V SVR4 Environment] operating system. +http://en.wikipedia.org/wiki/UNIX_System_V[SVR4 Environment] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__sysv__`] [__predef_detection__]] - [[`__SVR4`] [__predef_detection__]] - [[`__svr4__`] [__predef_detection__]] - [[`_SYSTYPE_SVR4`] [__predef_detection__]] - ] - */ +| `+__sysv__+` | {predef_detection} +| `+__SVR4+` | {predef_detection} +| `+__svr4__+` | {predef_detection} +| `+_SYSTYPE_SVR4+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_SVR4 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/vms.h b/ThirdParty/boost/predef/os/vms.h index 2f8f786d4eecb63700d91abbece13b03b64e91c4..7db611816940bcdf834b9e8af1c0275e042ff14a 100644 --- a/ThirdParty/boost/predef/os/vms.h +++ b/ThirdParty/boost/predef/os/vms.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_VMS`] +/* tag::reference[] += `BOOST_OS_VMS` -[@http://en.wikipedia.org/wiki/Vms VMS] operating system. +http://en.wikipedia.org/wiki/Vms[VMS] operating system. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`VMS`] [__predef_detection__]] - [[`__VMS`] [__predef_detection__]] +| `VMS` | {predef_detection} +| `+__VMS+` | {predef_detection} - [[`__VMS_VER`] [V.R.P]] - ] - */ +| `+__VMS_VER+` | V.R.P +|=== +*/ // end::reference[] #define BOOST_OS_VMS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/os/windows.h b/ThirdParty/boost/predef/os/windows.h index 9db4390950562454641b886caca2aa797315a533..d8d2d2b2d3668f5258f6d1f62706e007193454ce 100644 --- a/ThirdParty/boost/predef/os/windows.h +++ b/ThirdParty/boost/predef/os/windows.h @@ -11,21 +11,22 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_OS_WINDOWS`] - -[@http://en.wikipedia.org/wiki/Category:Microsoft_Windows Microsoft Windows] operating system. - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`_WIN32`] [__predef_detection__]] - [[`_WIN64`] [__predef_detection__]] - [[`__WIN32__`] [__predef_detection__]] - [[`__TOS_WIN__`] [__predef_detection__]] - [[`__WINDOWS__`] [__predef_detection__]] - ] - */ +/* tag::reference[] += `BOOST_OS_WINDOWS` + +http://en.wikipedia.org/wiki/Category:Microsoft_Windows[Microsoft Windows] operating system. + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `+_WIN32+` | {predef_detection} +| `+_WIN64+` | {predef_detection} +| `+__WIN32__+` | {predef_detection} +| `+__TOS_WIN__+` | {predef_detection} +| `+__WINDOWS__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_OS_WINDOWS BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/other/endian.h b/ThirdParty/boost/predef/other/endian.h index b42da53803d30da93681801b77b8850c9801e991..0281e4a3f99570d05bf5f690a7cc4af632e030b4 100644 --- a/ThirdParty/boost/predef/other/endian.h +++ b/ThirdParty/boost/predef/other/endian.h @@ -13,10 +13,10 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/library/c/gnu.h> #include <boost/predef/os/macos.h> #include <boost/predef/os/bsd.h> -#include <boost/predef/os/android.h> +#include <boost/predef/platform/android.h> -/*` -[heading `BOOST_ENDIAN_*`] +/* tag::reference[] += `BOOST_ENDIAN_*` Detection of endian memory ordering. There are four defined macros in this header that define the various generally possible endian @@ -37,12 +37,12 @@ programatic bi-endianness is available. This implementation is a compilation of various publicly available information and acquired knowledge: -# The indispensable documentation of "Pre-defined Compiler Macros" - [@http://sourceforge.net/p/predef/wiki/Endianness Endianness]. -# The various endian specifications available in the - [@http://wikipedia.org/ Wikipedia] computer architecture pages. -# Generally available searches for headers that define endianness. - */ +. The indispensable documentation of "Pre-defined Compiler Macros" + http://sourceforge.net/p/predef/wiki/Endianness[Endianness]. +. The various endian specifications available in the + http://wikipedia.org/[Wikipedia] computer architecture pages. +. Generally available searches for headers that define endianness. +*/ // end::reference[] #define BOOST_ENDIAN_BIG_BYTE BOOST_VERSION_NUMBER_NOT_AVAILABLE #define BOOST_ENDIAN_BIG_WORD BOOST_VERSION_NUMBER_NOT_AVAILABLE @@ -54,7 +54,7 @@ information and acquired knowledge: */ #if !BOOST_ENDIAN_BIG_BYTE && !BOOST_ENDIAN_BIG_WORD && \ !BOOST_ENDIAN_LITTLE_BYTE && !BOOST_ENDIAN_LITTLE_WORD -# if BOOST_LIB_C_GNU || BOOST_OS_ANDROID +# if BOOST_LIB_C_GNU || BOOST_PLAT_ANDROID # include <endian.h> # else # if BOOST_OS_MACOS @@ -127,7 +127,8 @@ information and acquired knowledge: defined(__AARCH64EL__) || \ defined(_MIPSEL) || \ defined(__MIPSEL) || \ - defined(__MIPSEL__) + defined(__MIPSEL__) || \ + defined(__riscv) # undef BOOST_ENDIAN_LITTLE_BYTE # define BOOST_ENDIAN_LITTLE_BYTE BOOST_VERSION_NUMBER_AVAILABLE # endif diff --git a/ThirdParty/boost/predef/platform/android.h b/ThirdParty/boost/predef/platform/android.h index 485382f6a9418d354550b844cc69142ded451394..5acfcd386ea3b87afc0acc98370de3e7389934be 100644 --- a/ThirdParty/boost/predef/platform/android.h +++ b/ThirdParty/boost/predef/platform/android.h @@ -11,17 +11,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_PLAT_ANDROID`] +/* tag::reference[] += `BOOST_PLAT_ANDROID` -[@http://en.wikipedia.org/wiki/Android_%28operating_system%29 Android] platform. +http://en.wikipedia.org/wiki/Android_%28operating_system%29[Android] platform. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__ANDROID__`] [__predef_detection__]] - ] - */ +| `+__ANDROID__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_ANDROID BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/cloudabi.h b/ThirdParty/boost/predef/platform/cloudabi.h index c44f689454dec0ecfdcdca307be5d5cd3cdebea8..a951c0ef23449e15b5c3e44e07f8581ca65aa451 100644 --- a/ThirdParty/boost/predef/platform/cloudabi.h +++ b/ThirdParty/boost/predef/platform/cloudabi.h @@ -11,17 +11,18 @@ #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_PLAT_CLOUDABI`] +/* tag::reference[] += `BOOST_PLAT_CLOUDABI` -[@https://github.com/NuxiNL/cloudabi CloudABI] platform. +https://github.com/NuxiNL/cloudabi[CloudABI] platform. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__CloudABI__`] [__predef_detection__]] - ] - */ +| `+__CloudABI__+` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_CLOUDABI BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/ios.h b/ThirdParty/boost/predef/platform/ios.h index 83ba3c40e2a04f71b0daa63b76afcde505ae51ee..7d7c815f8edf2ddb9c9490245ff3e76305a92693 100644 --- a/ThirdParty/boost/predef/platform/ios.h +++ b/ThirdParty/boost/predef/platform/ios.h @@ -12,17 +12,18 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/ios.h> // BOOST_OS_IOS #include <boost/predef/version_number.h> // BOOST_VERSION_NUMBER_NOT_AVAILABLE -/*` -[heading `BOOST_PLAT_IOS_DEVICE`] -[heading `BOOST_PLAT_IOS_SIMULATOR`] - -[table - [[__predef_symbol__] [__predef_version__]] - - [[`TARGET_IPHONE_SIMULATOR`] [__predef_detection__]] - [[`TARGET_OS_SIMULATOR`] [__predef_detection__]] - ] - */ +/* tag::reference[] += `BOOST_PLAT_IOS_DEVICE` += `BOOST_PLAT_IOS_SIMULATOR` + +[options="header"] +|=== +| {predef_symbol} | {predef_version} + +| `TARGET_IPHONE_SIMULATOR` | {predef_detection} +| `TARGET_OS_SIMULATOR` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_IOS_DEVICE BOOST_VERSION_NUMBER_NOT_AVAILABLE #define BOOST_PLAT_IOS_SIMULATOR BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/mingw.h b/ThirdParty/boost/predef/platform/mingw.h index c52827d7d8be0fc81f076917c22b2c31d2718eac..0be00c61ea98b0cba65238e67efdf96b4a486944 100644 --- a/ThirdParty/boost/predef/platform/mingw.h +++ b/ThirdParty/boost/predef/platform/mingw.h @@ -11,22 +11,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_PLAT_MINGW`] +/* tag::reference[] += `BOOST_PLAT_MINGW` -[@http://en.wikipedia.org/wiki/MinGW MinGW] platform, either variety. +http://en.wikipedia.org/wiki/MinGW[MinGW] platform, either variety. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MINGW32__`] [__predef_detection__]] - [[`__MINGW64__`] [__predef_detection__]] +| `+__MINGW32__+` | {predef_detection} +| `+__MINGW64__+` | {predef_detection} - [[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]] - [[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]] - ] - */ +| `+__MINGW64_VERSION_MAJOR+`, `+__MINGW64_VERSION_MINOR+` | V.R.0 +| `+__MINGW32_VERSION_MAJOR+`, `+__MINGW32_VERSION_MINOR+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_PLAT_MINGW BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/mingw32.h b/ThirdParty/boost/predef/platform/mingw32.h index ff90038b4c46d510e26a5575934cf6155fb3fcf9..73e99e685ddb8335c814cf98b0ded5f3e7b9651b 100644 --- a/ThirdParty/boost/predef/platform/mingw32.h +++ b/ThirdParty/boost/predef/platform/mingw32.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_PLAT_MINGW32`] +/* tag::reference[] += `BOOST_PLAT_MINGW32` -[@http://www.mingw.org/ MinGW] platform. +http://www.mingw.org/[MinGW] platform. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MINGW32__`] [__predef_detection__]] +| `+__MINGW32__+` | {predef_detection} - [[`__MINGW32_VERSION_MAJOR`, `__MINGW32_VERSION_MINOR`] [V.R.0]] - ] - */ +| `+__MINGW32_VERSION_MAJOR+`, `+__MINGW32_VERSION_MINOR+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_PLAT_MINGW32 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/mingw64.h b/ThirdParty/boost/predef/platform/mingw64.h index a35dd3e016e0162862f55dd88490d855379a882c..a49b195f4e2bc11550ba5c0a74c6e8cb5e60eeee 100644 --- a/ThirdParty/boost/predef/platform/mingw64.h +++ b/ThirdParty/boost/predef/platform/mingw64.h @@ -11,20 +11,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> #include <boost/predef/make.h> -/*` -[heading `BOOST_PLAT_MINGW64`] +/* tag::reference[] += `BOOST_PLAT_MINGW64` -[@https://mingw-w64.org/ MinGW-w64] platform. +https://mingw-w64.org/[MinGW-w64] platform. Version number available as major, minor, and patch. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MINGW64__`] [__predef_detection__]] +| `+__MINGW64__+` | {predef_detection} - [[`__MINGW64_VERSION_MAJOR`, `__MINGW64_VERSION_MINOR`] [V.R.0]] - ] - */ +| `+__MINGW64_VERSION_MAJOR+`, `+__MINGW64_VERSION_MINOR+` | V.R.0 +|=== +*/ // end::reference[] #define BOOST_PLAT_MINGW64 BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_desktop.h b/ThirdParty/boost/predef/platform/windows_desktop.h index afb39079a61ee4bf787804fc44fe4f0a9b9cc34a..917c3395ef1d8d704019654d763b68c865985878 100644 --- a/ThirdParty/boost/predef/platform/windows_desktop.h +++ b/ThirdParty/boost/predef/platform/windows_desktop.h @@ -14,20 +14,21 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/platform/windows_uwp.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_DESKTOP`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_DESKTOP` -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide[UWP] for Windows Desktop development. Also available if the Platform SDK is too old to support UWP. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP`] [__predef_detection__]] - [[`!BOOST_PLAT_WINDOWS_UWP`] [__predef_detection__]] - ] - */ +| `WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP` | {predef_detection} +| `!BOOST_PLAT_WINDOWS_UWP` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_DESKTOP BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_phone.h b/ThirdParty/boost/predef/platform/windows_phone.h index 0ebc76d2769ce693b5b2058da40cd7b35b4a3c1c..cfb1b65e2e241b7eee29d93a62af88c75cdf71fd 100644 --- a/ThirdParty/boost/predef/platform/windows_phone.h +++ b/ThirdParty/boost/predef/platform/windows_phone.h @@ -14,18 +14,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/platform/windows_uwp.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_PHONE`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_PHONE` -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide[UWP] for Windows Phone development. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP`] [__predef_detection__]] - ] - */ +| `WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_PHONE BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_runtime.h b/ThirdParty/boost/predef/platform/windows_runtime.h index e7978d7525e62317e6a77b0fe45ed92144b63d11..44542d61aabdf749e4995039a56f0f2b51b2c588 100644 --- a/ThirdParty/boost/predef/platform/windows_runtime.h +++ b/ThirdParty/boost/predef/platform/windows_runtime.h @@ -15,22 +15,23 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/platform/windows_store.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_RUNTIME`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_RUNTIME` Deprecated. -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide[UWP] for Windows Phone or Store development. This does not align to the existing development model for UWP and is deprecated. Use one of the other `BOOST_PLAT_WINDOWS_*`definitions instead. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`BOOST_PLAT_WINDOWS_PHONE`] [__predef_detection__]] - [[`BOOST_PLAT_WINDOWS_STORE`] [__predef_detection__]] - ] - */ +| `BOOST_PLAT_WINDOWS_PHONE` | {predef_detection} +| `BOOST_PLAT_WINDOWS_STORE` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_RUNTIME BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_server.h b/ThirdParty/boost/predef/platform/windows_server.h index 7bd629da34b73a14c417a26e016f5500e103a06a..f0e3dc0bbb918fcfe0b5ae537ce77ca92472f1ac 100644 --- a/ThirdParty/boost/predef/platform/windows_server.h +++ b/ThirdParty/boost/predef/platform/windows_server.h @@ -13,18 +13,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/platform/windows_uwp.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_SERVER`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_SERVER` -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide[UWP] for Windows Server development. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`WINAPI_FAMILY == WINAPI_FAMILY_SERVER`] [__predef_detection__]] - ] - */ +| `WINAPI_FAMILY == WINAPI_FAMILY_SERVER` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_SERVER BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_store.h b/ThirdParty/boost/predef/platform/windows_store.h index 3a3fd8e982db7a01baf1223e099a040cd11a0c2b..ac5ff519951ecc5161021bf5f1e32eababaf697c 100644 --- a/ThirdParty/boost/predef/platform/windows_store.h +++ b/ThirdParty/boost/predef/platform/windows_store.h @@ -14,19 +14,20 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/platform/windows_uwp.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_STORE`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_STORE` -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide[UWP] for Windows Store development. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`WINAPI_FAMILY == WINAPI_FAMILY_PC_APP`] [__predef_detection__]] - [[`WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated)] [__predef_detection__]] -] - */ +| `WINAPI_FAMILY == WINAPI_FAMILY_PC_APP` | {predef_detection} +| `WINAPI_FAMILY == WINAPI_FAMILY_APP` (deprecated) | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_STORE BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_system.h b/ThirdParty/boost/predef/platform/windows_system.h index 92f424fe7f58b73f559f058dc84740dc6fdb146b..71a0c2c62b98d212d6eb155612cefbe8e5387320 100644 --- a/ThirdParty/boost/predef/platform/windows_system.h +++ b/ThirdParty/boost/predef/platform/windows_system.h @@ -13,18 +13,19 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/platform/windows_uwp.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_SYSTEM`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_SYSTEM` -[@https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide UWP] +https://docs.microsoft.com/en-us/windows/uwp/get-started/universal-application-platform-guide[UWP] for Windows System development. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM`] [__predef_detection__]] - ] - */ +| `WINAPI_FAMILY == WINAPI_FAMILY_SYSTEM` | {predef_detection} +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_SYSTEM BOOST_VERSION_NUMBER_NOT_AVAILABLE diff --git a/ThirdParty/boost/predef/platform/windows_uwp.h b/ThirdParty/boost/predef/platform/windows_uwp.h index e4c6647f4130533446a45c8cbd8b82950ea94c2f..8dc1380bbf8eabd390ffc6034728e0d5ed858080 100644 --- a/ThirdParty/boost/predef/platform/windows_uwp.h +++ b/ThirdParty/boost/predef/platform/windows_uwp.h @@ -12,27 +12,28 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/os/windows.h> #include <boost/predef/version_number.h> -/*` -[heading `BOOST_PLAT_WINDOWS_UWP`] +/* tag::reference[] += `BOOST_PLAT_WINDOWS_UWP` -[@http://docs.microsoft.com/windows/uwp/ Universal Windows Platform] +http://docs.microsoft.com/windows/uwp/[Universal Windows Platform] is available if the current development environment is capable of targeting UWP development. -[table - [[__predef_symbol__] [__predef_version__]] +[options="header"] +|=== +| {predef_symbol} | {predef_version} - [[`__MINGW64_VERSION_MAJOR` from `_mingw.h`] [`>= 3`]] - [[`VER_PRODUCTBUILD` from `ntverp.h`] [`>= 9200`]] -] -*/ +| `+__MINGW64_VERSION_MAJOR+` from `+_mingw.h+` | `>= 3` +| `VER_PRODUCTBUILD` from `ntverp.h` | `>= 9200` +|=== +*/ // end::reference[] #define BOOST_PLAT_WINDOWS_UWP BOOST_VERSION_NUMBER_NOT_AVAILABLE #define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER_NOT_AVAILABLE #if BOOST_OS_WINDOWS -// MinGW (32-bit) has no ntverp.h header -#if !defined(__MINGW32__) +// MinGW (32-bit), WinCE, and wineg++ don't have a ntverp.h header +#if !defined(__MINGW32__) && !defined(_WIN32_WCE) && !defined(__WINE__) # include <ntverp.h> # undef BOOST_PLAT_WINDOWS_SDK_VERSION # define BOOST_PLAT_WINDOWS_SDK_VERSION BOOST_VERSION_NUMBER(0, 0, VER_PRODUCTBUILD) diff --git a/ThirdParty/boost/predef/version.h b/ThirdParty/boost/predef/version.h index 6406d795fec164020e94effd274feeb53ae062f9..39ef2b49a58a5a4e462c16a1e4b8da209fd4491b 100644 --- a/ThirdParty/boost/predef/version.h +++ b/ThirdParty/boost/predef/version.h @@ -10,6 +10,6 @@ http://www.boost.org/LICENSE_1_0.txt) #include <boost/predef/version_number.h> -#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,10,0) +#define BOOST_PREDEF_VERSION BOOST_VERSION_NUMBER(1,11,0) #endif diff --git a/ThirdParty/boost/predef/version_number.h b/ThirdParty/boost/predef/version_number.h index 44942709c7fe1ccbbcb844cfaf609104b94f4803..903578245b72ce31ce082599aaeb71d78283eb3e 100644 --- a/ThirdParty/boost/predef/version_number.h +++ b/ThirdParty/boost/predef/version_number.h @@ -8,21 +8,22 @@ http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_PREDEF_VERSION_NUMBER_H #define BOOST_PREDEF_VERSION_NUMBER_H -/*` -[heading `BOOST_VERSION_NUMBER`] +/* tag::reference[] += `BOOST_VERSION_NUMBER` -`` +[source] +---- BOOST_VERSION_NUMBER(major,minor,patch) -`` +---- Defines standard version numbers, with these properties: -* Decimal base whole numbers in the range \[0,1000000000). +* Decimal base whole numbers in the range [0,1000000000). The number range is designed to allow for a (2,2,5) triplet. Which fits within a 32 bit value. -* The `major` number can be in the \[0,99\] range. -* The `minor` number can be in the \[0,99\] range. -* The `patch` number can be in the \[0,99999\] range. +* The `major` number can be in the [0,99] range. +* The `minor` number can be in the [0,99] range. +* The `patch` number can be in the [0,99999] range. * Values can be specified in any base. As the defined value is an constant expression. * Value can be directly used in both preprocessor and compiler @@ -31,7 +32,7 @@ Defines standard version numbers, with these properties: major, minor, and patch numbers. And values over the ranges are truncated (modulo). -*/ +*/ // end::reference[] #define BOOST_VERSION_NUMBER(major,minor,patch) \ ( (((major)%100)*10000000) + (((minor)%100)*100000) + ((patch)%100000) ) @@ -50,16 +51,17 @@ Defines standard version numbers, with these properties: #define BOOST_VERSION_NUMBER_NOT_AVAILABLE \ BOOST_VERSION_NUMBER_ZERO -/*` -`` +/* tag::reference[] +[source] +---- BOOST_VERSION_NUMBER_MAJOR(N), BOOST_VERSION_NUMBER_MINOR(N), BOOST_VERSION_NUMBER_PATCH(N) -`` +---- The macros extract the major, minor, and patch portion from a well formed version number resulting in a preprocessor expression in the range of -\[0,99\] or \[0,99999\] for the major and minor, or patch numbers +[0,99] or [0,99999] for the major and minor, or patch numbers respectively. -*/ +*/ // end::reference[] #define BOOST_VERSION_NUMBER_MAJOR(N) \ ( ((N)/10000000)%100 ) diff --git a/ThirdParty/boost/preprocessor/config/config.hpp b/ThirdParty/boost/preprocessor/config/config.hpp index 2c1e72f907b69bd8a970e19face3ff4ccab63ea1..2c7ece92e34df0a3475912d6b921d56a9f9933b2 100644 --- a/ThirdParty/boost/preprocessor/config/config.hpp +++ b/ThirdParty/boost/preprocessor/config/config.hpp @@ -80,7 +80,7 @@ # if !defined BOOST_PP_VARIADICS # /* variadic support explicitly disabled for all untested compilers */ -# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || (defined(__PGI) && !defined(__EDG__)) +# if defined __GCCXML__ || (defined __NVCC__ && defined __CUDACC__) || defined __PATHSCALE__ || defined __DMC__ || (defined __CODEGEARC__ && !defined(__clang__)) || (defined __BORLANDC__ && !defined(__clang__)) || defined __MWERKS__ || ( defined __SUNPRO_CC && __SUNPRO_CC < 0x5120 ) || (defined __HP_aCC && !defined __EDG__) || defined __MRC__ || defined __SC__ || (defined(__PGI) && !defined(__EDG__)) # define BOOST_PP_VARIADICS 0 # elif defined(_MSC_VER) && defined(__clang__) # define BOOST_PP_VARIADICS 1 @@ -103,7 +103,7 @@ # elif !BOOST_PP_VARIADICS + 1 < 2 # undef BOOST_PP_VARIADICS # define BOOST_PP_VARIADICS 1 -# if defined _MSC_VER && _MSC_VER >= 1400 && !defined(__clang__) && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) +# if defined _MSC_VER && _MSC_VER >= 1400 && !defined(__clang__) && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || (defined __NVCC__ && defined __CUDACC__) || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) # undef BOOST_PP_VARIADICS_MSVC # define BOOST_PP_VARIADICS_MSVC 1 # endif diff --git a/ThirdParty/boost/preprocessor/facilities/detail/is_empty.hpp b/ThirdParty/boost/preprocessor/facilities/detail/is_empty.hpp index e0449701e827c71508768027425d098dcb5abd98..ce167325279589b81553dd331dcd5dffb19a0af1 100644 --- a/ThirdParty/boost/preprocessor/facilities/detail/is_empty.hpp +++ b/ThirdParty/boost/preprocessor/facilities/detail/is_empty.hpp @@ -31,8 +31,8 @@ #if BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400 #define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(param) \ - BOOST_PP_IS_BEGIN_PARENS \ - ( \ + BOOST_PP_IS_BEGIN_PARENS \ + ( \ BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C param () \ ) \ /**/ @@ -40,7 +40,7 @@ #else #define BOOST_PP_DETAIL_IS_EMPTY_PROCESS(...) \ - BOOST_PP_IS_BEGIN_PARENS \ + BOOST_PP_IS_BEGIN_PARENS \ ( \ BOOST_PP_DETAIL_IS_EMPTY_NON_FUNCTION_C __VA_ARGS__ () \ ) \ diff --git a/ThirdParty/boost/preprocessor/facilities/is_empty_variadic.hpp b/ThirdParty/boost/preprocessor/facilities/is_empty_variadic.hpp index eee4062d792c9770f70213d7003d9128a8f58ff7..77ebf6d323fe8f43c374e518d01a97aeccd2e5b9 100644 --- a/ThirdParty/boost/preprocessor/facilities/is_empty_variadic.hpp +++ b/ThirdParty/boost/preprocessor/facilities/is_empty_variadic.hpp @@ -1,6 +1,6 @@ # /* ************************************************************************** # * * -# * (C) Copyright Edward Diener 2014. +# * (C) Copyright Edward Diener 2014,2019. # * 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) @@ -37,7 +37,34 @@ /**/ #define BOOST_PP_IS_EMPTY_ZERO(param) 0 # else +# if defined(__cplusplus) && __cplusplus > 201703L +# include <boost/preprocessor/variadic/has_opt.hpp> #define BOOST_PP_IS_EMPTY(...) \ + BOOST_PP_DETAIL_IS_EMPTY_IIF \ + ( \ + BOOST_PP_VARIADIC_HAS_OPT() \ + ) \ + ( \ + BOOST_PP_IS_EMPTY_OPT, \ + BOOST_PP_IS_EMPTY_NO_OPT \ + ) \ + (__VA_ARGS__) \ +/**/ +#define BOOST_PP_IS_EMPTY_FUNCTION2(...) \ + __VA_OPT__(0,) 1 \ +/**/ +#define BOOST_PP_IS_EMPTY_FUNCTION(...) \ + BOOST_PP_IS_EMPTY_FUNCTION2(__VA_ARGS__) \ +/**/ +#define BOOST_PP_IS_EMPTY_OPT(...) \ + BOOST_PP_VARIADIC_HAS_OPT_ELEM0(BOOST_PP_IS_EMPTY_FUNCTION(__VA_ARGS__),) \ +/**/ +# else +#define BOOST_PP_IS_EMPTY(...) \ + BOOST_PP_IS_EMPTY_NO_OPT(__VA_ARGS__) \ +/**/ +# endif /* defined(__cplusplus) && __cplusplus > 201703L */ +#define BOOST_PP_IS_EMPTY_NO_OPT(...) \ BOOST_PP_DETAIL_IS_EMPTY_IIF \ ( \ BOOST_PP_IS_BEGIN_PARENS \ diff --git a/ThirdParty/boost/preprocessor/repetition/for.hpp b/ThirdParty/boost/preprocessor/repetition/for.hpp index c38946bb555fac5ac96f850d01152eeb93d3209f..3c5048ad01fd816c00a5969cfe40cfff889c48a3 100644 --- a/ThirdParty/boost/preprocessor/repetition/for.hpp +++ b/ThirdParty/boost/preprocessor/repetition/for.hpp @@ -52,13 +52,13 @@ # define BOOST_PP_FOR_257_ERROR() BOOST_PP_ERROR(0x0002) # define BOOST_PP_FOR_257(s, p, o, m) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_FOR_257_PR(s,p), \ - BOOST_PP_FOR_257_ERROR, \ - BOOST_PP_EMPTY \ - ) \ - () \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_FOR_257_PR(s,p), \ + BOOST_PP_FOR_257_ERROR, \ + BOOST_PP_EMPTY \ + ) \ + () \ /**/ // # define BOOST_PP_FOR_257(s, p, o, m) BOOST_PP_ERROR(0x0002) # diff --git a/ThirdParty/boost/preprocessor/seq/detail/is_empty.hpp b/ThirdParty/boost/preprocessor/seq/detail/is_empty.hpp index 1a80a2f6117570fd6b438a536d258f5e3f4068d0..14461ba48e19ec0f058f381e880948ae8403fcb3 100644 --- a/ThirdParty/boost/preprocessor/seq/detail/is_empty.hpp +++ b/ThirdParty/boost/preprocessor/seq/detail/is_empty.hpp @@ -21,29 +21,29 @@ /* An empty seq is one that is just BOOST_PP_SEQ_NIL */ # # define BOOST_PP_SEQ_DETAIL_IS_EMPTY(seq) \ - BOOST_PP_COMPL \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \ - ) \ + BOOST_PP_COMPL \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \ + ) \ /**/ # # define BOOST_PP_SEQ_DETAIL_IS_EMPTY_SIZE(size) \ - BOOST_PP_COMPL \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \ - ) \ + BOOST_PP_COMPL \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \ + ) \ /**/ # # define BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq) \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq)) \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq)) \ /**/ # # define BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size) \ - BOOST_PP_BOOL(size) \ + BOOST_PP_BOOL(size) \ /**/ # # define BOOST_PP_SEQ_DETAIL_EMPTY_SIZE(seq) \ - BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq (nil))) \ + BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq (nil))) \ /**/ # # endif diff --git a/ThirdParty/boost/preprocessor/seq/for_each.hpp b/ThirdParty/boost/preprocessor/seq/for_each.hpp index 3f9c0d781b97cf098efb9b679527eedf89263d1d..00a83d4d790250c7fae48b833bf9d1fe214986bb 100644 --- a/ThirdParty/boost/preprocessor/seq/for_each.hpp +++ b/ThirdParty/boost/preprocessor/seq/for_each.hpp @@ -36,13 +36,13 @@ # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY(macro, data, seq) # # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK(macro, data, seq) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ - BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC, \ - BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY \ - ) \ - (macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC, \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY \ + ) \ + (macro, data, seq) \ /**/ # # define BOOST_PP_SEQ_FOR_EACH_P(r, x) BOOST_PP_TUPLE_ELEM(4, 3, x) @@ -54,21 +54,21 @@ # endif # # define BOOST_PP_SEQ_FOR_EACH_O_I(macro, data, seq, sz) \ - BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, BOOST_PP_DEC(sz)) \ + BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, BOOST_PP_DEC(sz)) \ /**/ # define BOOST_PP_SEQ_FOR_EACH_O_I_DEC(macro, data, seq, sz) \ - ( \ - macro, \ - data, \ - BOOST_PP_IF \ - ( \ - sz, \ - BOOST_PP_SEQ_FOR_EACH_O_I_TAIL, \ - BOOST_PP_SEQ_FOR_EACH_O_I_NIL \ - ) \ - (seq), \ - sz \ - ) \ + ( \ + macro, \ + data, \ + BOOST_PP_IF \ + ( \ + sz, \ + BOOST_PP_SEQ_FOR_EACH_O_I_TAIL, \ + BOOST_PP_SEQ_FOR_EACH_O_I_NIL \ + ) \ + (seq), \ + sz \ + ) \ /**/ # define BOOST_PP_SEQ_FOR_EACH_O_I_TAIL(seq) BOOST_PP_SEQ_TAIL(seq) # define BOOST_PP_SEQ_FOR_EACH_O_I_NIL(seq) BOOST_PP_NIL @@ -95,13 +95,13 @@ # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R(r, macro, data, seq) # # define BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_R(r, macro, data, seq) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ - BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC_R, \ - BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R \ - ) \ - (r, macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EXEC_R, \ + BOOST_PP_SEQ_FOR_EACH_DETAIL_CHECK_EMPTY_R \ + ) \ + (r, macro, data, seq) \ /**/ # # endif diff --git a/ThirdParty/boost/preprocessor/seq/for_each_i.hpp b/ThirdParty/boost/preprocessor/seq/for_each_i.hpp index 81028d77de7c2da6ab75cd12fb0c6dcceafcd98e..d29d4c1a2d35b9c77f1bdbffd6e7f70ad785b591 100644 --- a/ThirdParty/boost/preprocessor/seq/for_each_i.hpp +++ b/ThirdParty/boost/preprocessor/seq/for_each_i.hpp @@ -37,13 +37,13 @@ # define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY(macro, data, seq) # # define BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK(macro, data, seq) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ - BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EXEC, \ - BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY \ - ) \ - (macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EXEC, \ + BOOST_PP_SEQ_FOR_EACH_I_DETAIL_CHECK_EMPTY \ + ) \ + (macro, data, seq) \ /**/ # # define BOOST_PP_SEQ_FOR_EACH_I_P(r, x) BOOST_PP_TUPLE_ELEM(5, 4, x) @@ -55,22 +55,22 @@ # endif # # define BOOST_PP_SEQ_FOR_EACH_I_O_I(macro, data, seq, i, sz) \ - BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, BOOST_PP_DEC(sz)) \ + BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, BOOST_PP_DEC(sz)) \ /**/ # define BOOST_PP_SEQ_FOR_EACH_I_O_I_DEC(macro, data, seq, i, sz) \ - ( \ - macro, \ - data, \ - BOOST_PP_IF \ - ( \ - sz, \ - BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL, \ - BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL \ - ) \ - (seq), \ - BOOST_PP_INC(i), \ - sz \ - ) \ + ( \ + macro, \ + data, \ + BOOST_PP_IF \ + ( \ + sz, \ + BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL, \ + BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL \ + ) \ + (seq), \ + BOOST_PP_INC(i), \ + sz \ + ) \ /**/ # define BOOST_PP_SEQ_FOR_EACH_I_O_I_TAIL(seq) BOOST_PP_SEQ_TAIL(seq) # define BOOST_PP_SEQ_FOR_EACH_I_O_I_NIL(seq) BOOST_PP_NIL @@ -97,13 +97,13 @@ # define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY(r, macro, data, seq) # # define BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK(r, macro, data, seq) \ - BOOST_PP_IIF \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ - BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EXEC, \ - BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY \ - ) \ - (r, macro, data, seq) \ + BOOST_PP_IIF \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY(seq), \ + BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EXEC, \ + BOOST_PP_SEQ_FOR_EACH_I_R_DETAIL_CHECK_EMPTY \ + ) \ + (r, macro, data, seq) \ /**/ # # endif diff --git a/ThirdParty/boost/preprocessor/seq/rest_n.hpp b/ThirdParty/boost/preprocessor/seq/rest_n.hpp index 4aefba4fa1ff1f0976fb06614f685c67021596b1..cac52cff76af445db59d26ed2eaf2e344420bf02 100644 --- a/ThirdParty/boost/preprocessor/seq/rest_n.hpp +++ b/ThirdParty/boost/preprocessor/seq/rest_n.hpp @@ -32,15 +32,15 @@ # endif # # define BOOST_PP_SEQ_REST_N_DETAIL_EXEC(n, seq, size) \ - BOOST_PP_EXPR_IIF \ - ( \ - BOOST_PP_BITAND \ - ( \ - BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size), \ - BOOST_PP_NOT_EQUAL(n,size) \ - ), \ - BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), BOOST_PP_IDENTITY( (nil) seq )))() \ - ) \ + BOOST_PP_EXPR_IIF \ + ( \ + BOOST_PP_BITAND \ + ( \ + BOOST_PP_SEQ_DETAIL_IS_NOT_EMPTY_SIZE(size), \ + BOOST_PP_NOT_EQUAL(n,size) \ + ), \ + BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_SEQ_SPLIT(BOOST_PP_INC(n), BOOST_PP_IDENTITY( (nil) seq )))() \ + ) \ /**/ # # endif diff --git a/ThirdParty/boost/preprocessor/tuple/detail/is_single_return.hpp b/ThirdParty/boost/preprocessor/tuple/detail/is_single_return.hpp index 02a4fb207c52871798a66a678e427453abafc1d5..bcdb5449b348385fd2536b139618d5d556f959b8 100644 --- a/ThirdParty/boost/preprocessor/tuple/detail/is_single_return.hpp +++ b/ThirdParty/boost/preprocessor/tuple/detail/is_single_return.hpp @@ -20,9 +20,9 @@ # include <boost/preprocessor/control/iif.hpp> # include <boost/preprocessor/facilities/is_1.hpp> # include <boost/preprocessor/tuple/size.hpp> -# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ - BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ - /**/ +# define BOOST_PP_TUPLE_IS_SINGLE_RETURN(sr,nsr,tuple) \ + BOOST_PP_IIF(BOOST_PP_IS_1(BOOST_PP_TUPLE_SIZE(tuple)),sr,nsr) \ + /**/ # endif /* BOOST_PP_VARIADICS && BOOST_PP_VARIADICS_MSVC */ # # endif /* BOOST_PREPROCESSOR_TUPLE_DETAIL_IS_SINGLE_RETURN_HPP */ diff --git a/ThirdParty/boost/preprocessor/tuple/elem.hpp b/ThirdParty/boost/preprocessor/tuple/elem.hpp index 88044d3c7e7507a868948a3ce72dd220fdd21ed9..148e6bdcdb9a80f6a6ab88f39c78938e5e38bda3 100644 --- a/ThirdParty/boost/preprocessor/tuple/elem.hpp +++ b/ThirdParty/boost/preprocessor/tuple/elem.hpp @@ -33,12 +33,12 @@ else use BOOST_PP_REM. This fixes a VC++ problem with an empty tuple and BOOST_PP_TUPLE_ELEM functionality. See tuple_elem_bug_test.cxx. */ -# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ - BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_EXPAND(BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple)) \ - /**/ +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) \ + BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_EXPAND(BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple)) \ + /**/ # else # define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) # endif # define BOOST_PP_TUPLE_ELEM_O_3(size, n, tuple) BOOST_PP_TUPLE_ELEM_O_2(n, tuple) # else diff --git a/ThirdParty/boost/preprocessor/tuple/rem.hpp b/ThirdParty/boost/preprocessor/tuple/rem.hpp index c934447d5adad399a91571cafde9432796fb2af6..e99008dcdec029ac1ec5a6c20794d43a09e7bb37 100644 --- a/ThirdParty/boost/preprocessor/tuple/rem.hpp +++ b/ThirdParty/boost/preprocessor/tuple/rem.hpp @@ -22,10 +22,10 @@ # /* BOOST_PP_REM */ # # if BOOST_PP_VARIADICS -# if BOOST_PP_VARIADICS_MSVC - /* To be used internally when __VA_ARGS__ could be empty ( or is a single element ) */ -# define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) -# endif +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when __VA_ARGS__ could be empty ( or is a single element ) */ +# define BOOST_PP_REM_CAT(...) BOOST_PP_CAT(__VA_ARGS__,) +# endif # define BOOST_PP_REM(...) __VA_ARGS__ # else # define BOOST_PP_REM(x) x @@ -37,10 +37,10 @@ VC++8.0 cannot handle the variadic version of BOOST_PP_TUPLE_REM(size) */ # if BOOST_PP_VARIADICS && !(BOOST_PP_VARIADICS_MSVC && _MSC_VER <= 1400) -# if BOOST_PP_VARIADICS_MSVC - /* To be used internally when the size could be 0 ( or 1 ) */ -# define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT -# endif +# if BOOST_PP_VARIADICS_MSVC + /* To be used internally when the size could be 0 ( or 1 ) */ +# define BOOST_PP_TUPLE_REM_CAT(size) BOOST_PP_REM_CAT +# endif # define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM # else # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() @@ -124,10 +124,10 @@ # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) # define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_EXPAND(BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_EXPAND(BOOST_PP_TUPLE_IS_SINGLE_RETURN(BOOST_PP_REM_CAT,BOOST_PP_REM,tuple) tuple) # else # define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple # endif # define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else diff --git a/ThirdParty/boost/preprocessor/tuple/to_list.hpp b/ThirdParty/boost/preprocessor/tuple/to_list.hpp index da7828f7d09c2a45adea2a632d09eb4e6c14e98d..25d9b095aeaaffba5a9355e2959683a3bd3f933b 100644 --- a/ThirdParty/boost/preprocessor/tuple/to_list.hpp +++ b/ThirdParty/boost/preprocessor/tuple/to_list.hpp @@ -28,10 +28,10 @@ # define BOOST_PP_TUPLE_TO_LIST(...) BOOST_PP_TUPLE_TO_LIST_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_LIST_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_TO_LIST_I(m, args) BOOST_PP_TUPLE_TO_LIST_II(m, args) # define BOOST_PP_TUPLE_TO_LIST_II(m, args) BOOST_PP_CAT(m ## args,) -# define BOOST_PP_TUPLE_TO_LIST_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_LIST_, BOOST_PP_TUPLE_SIZE(tuple)) tuple +# define BOOST_PP_TUPLE_TO_LIST_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_LIST_, BOOST_PP_TUPLE_SIZE(tuple)) tuple # else # define BOOST_PP_TUPLE_TO_LIST(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_LIST_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_TO_LIST_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_LIST_, BOOST_PP_VARIADIC_SIZE tuple) tuple +# define BOOST_PP_TUPLE_TO_LIST_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_LIST_, BOOST_PP_VARIADIC_SIZE tuple) tuple # endif # define BOOST_PP_TUPLE_TO_LIST_O_2(size, tuple) BOOST_PP_TUPLE_TO_LIST_O_1(tuple) # else diff --git a/ThirdParty/boost/preprocessor/tuple/to_seq.hpp b/ThirdParty/boost/preprocessor/tuple/to_seq.hpp index a53f5a00e67b8e3c2b4341d431cfa8f4c3afa2f8..028ee42127526697238163b9c76fd653057422c5 100644 --- a/ThirdParty/boost/preprocessor/tuple/to_seq.hpp +++ b/ThirdParty/boost/preprocessor/tuple/to_seq.hpp @@ -26,10 +26,10 @@ # define BOOST_PP_TUPLE_TO_SEQ(...) BOOST_PP_TUPLE_TO_SEQ_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_SEQ_O_, __VA_ARGS__), (__VA_ARGS__)) # define BOOST_PP_TUPLE_TO_SEQ_I(m, args) BOOST_PP_TUPLE_TO_SEQ_II(m, args) # define BOOST_PP_TUPLE_TO_SEQ_II(m, args) BOOST_PP_CAT(m ## args,) -# define BOOST_PP_TUPLE_TO_SEQ_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_SEQ_, BOOST_PP_TUPLE_SIZE(tuple)) tuple +# define BOOST_PP_TUPLE_TO_SEQ_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_SEQ_, BOOST_PP_TUPLE_SIZE(tuple)) tuple # else # define BOOST_PP_TUPLE_TO_SEQ(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_SEQ_O_, __VA_ARGS__)(__VA_ARGS__) -# define BOOST_PP_TUPLE_TO_SEQ_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_SEQ_, BOOST_PP_VARIADIC_SIZE tuple) tuple +# define BOOST_PP_TUPLE_TO_SEQ_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_SEQ_, BOOST_PP_VARIADIC_SIZE tuple) tuple # endif # define BOOST_PP_TUPLE_TO_SEQ_O_2(size, tuple) BOOST_PP_TUPLE_TO_SEQ_O_1(tuple) # else diff --git a/ThirdParty/boost/preprocessor/variadic/detail/has_opt.hpp b/ThirdParty/boost/preprocessor/variadic/detail/has_opt.hpp new file mode 100644 index 0000000000000000000000000000000000000000..79edf3b2addcc75fa994186dc87f2f57903c73c7 --- /dev/null +++ b/ThirdParty/boost/preprocessor/variadic/detail/has_opt.hpp @@ -0,0 +1,39 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. * +# * 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) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_VARIADIC_DETAIL_HAS_OPT_HPP +# define BOOST_PREPROCESSOR_VARIADIC_DETAIL_HAS_OPT_HPP +# +# include <boost/preprocessor/config/config.hpp> +# +# if BOOST_PP_VARIADICS && defined(__cplusplus) && __cplusplus > 201703L +# +# if BOOST_PP_VARIADICS_MSVC +# include <boost/preprocessor/cat.hpp> +# endif +# +# define BOOST_PP_VARIADIC_HAS_OPT_FUNCTION(...) \ + __VA_OPT__(,) , 1, 0 \ +/**/ +# +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM0(e0, ...) BOOST_PP_CAT(BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0,__VA_ARGS__),) +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM2(e0, ...) BOOST_PP_CAT(BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0,__VA_ARGS__),) +# else +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM0(e0, ...) BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0,__VA_ARGS__) +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM2(e0, ...) BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0,__VA_ARGS__) +# endif +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM_0(e0, ...) e0 +# define BOOST_PP_VARIADIC_HAS_OPT_ELEM_2(e0, e1, e2, ...) e2 +# +# endif +# +# endif diff --git a/ThirdParty/boost/preprocessor/variadic/has_opt.hpp b/ThirdParty/boost/preprocessor/variadic/has_opt.hpp new file mode 100644 index 0000000000000000000000000000000000000000..3ab089019b647f5a5550cbc1267bdbb30e92d28e --- /dev/null +++ b/ThirdParty/boost/preprocessor/variadic/has_opt.hpp @@ -0,0 +1,28 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2019. * +# * 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) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_VARIADIC_HAS_OPT_HPP +# define BOOST_PREPROCESSOR_VARIADIC_HAS_OPT_HPP +# +# include <boost/preprocessor/config/config.hpp> +# +# /* BOOST_PP_VARIADIC_HAS_OPT */ +# +# if BOOST_PP_VARIADICS && defined(__cplusplus) && __cplusplus > 201703L +# include <boost/preprocessor/variadic/detail/has_opt.hpp> +# define BOOST_PP_VARIADIC_HAS_OPT() \ + BOOST_PP_VARIADIC_HAS_OPT_ELEM2(BOOST_PP_VARIADIC_HAS_OPT_FUNCTION(?),) \ +/**/ +# else +# define BOOST_PP_VARIADIC_HAS_OPT() 0 +# endif +# +# endif diff --git a/ThirdParty/boost/rational.hpp b/ThirdParty/boost/rational.hpp index 8cd70b3e22e2f60b550ce847d2565e981ce9e3ed..f33bc3b1f89a70ba66a4a6f698c38c11a6c7bb97 100644 --- a/ThirdParty/boost/rational.hpp +++ b/ThirdParty/boost/rational.hpp @@ -87,6 +87,7 @@ #include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_class.hpp> #include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_array.hpp> // Control whether depreciated GCD and LCM functions are included (default: yes) #ifndef BOOST_CONTROL_RATIONAL_HAS_GCD @@ -113,8 +114,11 @@ IntType lcm(IntType n, IntType m) namespace rational_detail{ + template <class FromInt, class ToInt, typename Enable = void> + struct is_compatible_integer; + template <class FromInt, class ToInt> - struct is_compatible_integer + struct is_compatible_integer<FromInt, ToInt, typename enable_if_c<!is_array<FromInt>::value>::type> { BOOST_STATIC_CONSTANT(bool, value = ((std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer && (std::numeric_limits<FromInt>::digits <= std::numeric_limits<ToInt>::digits) @@ -125,6 +129,29 @@ namespace rational_detail{ || (is_class<ToInt>::value && is_class<FromInt>::value && is_convertible<FromInt, ToInt>::value)); }; + template <class FromInt, class ToInt> + struct is_compatible_integer<FromInt, ToInt, typename enable_if_c<is_array<FromInt>::value>::type> + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; + + template <class FromInt, class ToInt, typename Enable = void> + struct is_backward_compatible_integer; + + template <class FromInt, class ToInt> + struct is_backward_compatible_integer<FromInt, ToInt, typename enable_if_c<!is_array<FromInt>::value>::type> + { + BOOST_STATIC_CONSTANT(bool, value = (std::numeric_limits<FromInt>::is_specialized && std::numeric_limits<FromInt>::is_integer + && !is_compatible_integer<FromInt, ToInt>::value + && (std::numeric_limits<FromInt>::radix == std::numeric_limits<ToInt>::radix) + && is_convertible<FromInt, ToInt>::value)); + }; + + template <class FromInt, class ToInt> + struct is_backward_compatible_integer<FromInt, ToInt, typename enable_if_c<is_array<FromInt>::value>::type> + { + BOOST_STATIC_CONSTANT(bool, value = false); + }; } class bad_rational : public std::domain_error @@ -152,10 +179,12 @@ public: BOOST_CONSTEXPR rational() : num(0), den(1) {} - template <class T> + + template <class T>//, typename enable_if_c<!is_array<T>::value>::type> BOOST_CONSTEXPR rational(const T& n, typename enable_if_c< rational_detail::is_compatible_integer<T, IntType>::value >::type const* = 0) : num(n), den(1) {} + template <class T, class U> BOOST_CXX14_CONSTEXPR rational(const T& n, const U& d, typename enable_if_c< rational_detail::is_compatible_integer<T, IntType>::value && rational_detail::is_compatible_integer<U, IntType>::value @@ -200,12 +229,9 @@ public: // conversion from T to IntType, they will throw a bad_rational // if the conversion results in loss of precision or undefined behaviour. // - template <class T> + template <class T>//, typename enable_if_c<!is_array<T>::value>::type> BOOST_CXX14_CONSTEXPR rational(const T& n, typename enable_if_c< - std::numeric_limits<T>::is_specialized && std::numeric_limits<T>::is_integer - && !rational_detail::is_compatible_integer<T, IntType>::value - && (std::numeric_limits<T>::radix == std::numeric_limits<IntType>::radix) - && is_convertible<T, IntType>::value + rational_detail::is_backward_compatible_integer<T, IntType>::value >::type const* = 0) { assign(n, static_cast<T>(1)); diff --git a/ThirdParty/boost/shared_container_iterator.hpp b/ThirdParty/boost/shared_container_iterator.hpp index e803bd654e554b630c9543756a88a0a71f4b48df..8adcaf7ec62823c16fd377bd0e17e89069ff1ff9 100644 --- a/ThirdParty/boost/shared_container_iterator.hpp +++ b/ThirdParty/boost/shared_container_iterator.hpp @@ -5,8 +5,8 @@ // See http://www.boost.org/libs/utility/shared_container_iterator.html for documentation. -#ifndef SHARED_CONTAINER_ITERATOR_RG08102002_HPP -#define SHARED_CONTAINER_ITERATOR_RG08102002_HPP +#ifndef BOOST_SHARED_CONTAINER_ITERATOR_HPP +#define BOOST_SHARED_CONTAINER_ITERATOR_HPP #include "boost/iterator_adaptors.hpp" #include "boost/shared_ptr.hpp" @@ -66,4 +66,4 @@ using iterators::make_shared_container_range; } // namespace boost -#endif // SHARED_CONTAINER_ITERATOR_RG08102002_HPP +#endif diff --git a/ThirdParty/boost/smart_ptr/allocate_shared_array.hpp b/ThirdParty/boost/smart_ptr/allocate_shared_array.hpp index 5aab81abdbc6b66b55b31565fb9265684c9252ea..bca98650d77f0755656fe5d73c79c9a2f154a130 100644 --- a/ThirdParty/boost/smart_ptr/allocate_shared_array.hpp +++ b/ThirdParty/boost/smart_ptr/allocate_shared_array.hpp @@ -8,15 +8,14 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP #define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP +#include <boost/core/alloc_construct.hpp> +#include <boost/core/first_scalar.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <boost/type_traits/alignment_of.hpp> #include <boost/type_traits/enable_if.hpp> +#include <boost/type_traits/extent.hpp> #include <boost/type_traits/is_bounded_array.hpp> #include <boost/type_traits/is_unbounded_array.hpp> -#include <boost/type_traits/has_trivial_assign.hpp> -#include <boost/type_traits/has_trivial_constructor.hpp> -#include <boost/type_traits/has_trivial_destructor.hpp> -#include <boost/type_traits/remove_all_extents.hpp> #include <boost/type_traits/remove_cv.hpp> #include <boost/type_traits/remove_extent.hpp> #include <boost/type_traits/type_with_alignment.hpp> @@ -25,15 +24,22 @@ namespace boost { namespace detail { template<class T> -struct sp_array_scalar { +struct sp_array_element { typedef typename boost::remove_cv<typename - boost::remove_all_extents<T>::type>::type type; + boost::remove_extent<T>::type>::type type; }; -template<class T, class U> +template<class T> struct sp_array_count { enum { - value = sizeof(T) / sizeof(U) + value = 1 + }; +}; + +template<class T, std::size_t N> +struct sp_array_count<T[N]> { + enum { + value = N * sp_array_count<T>::value }; }; @@ -70,154 +76,6 @@ sp_objects(std::size_t size) BOOST_SP_NOEXCEPT return (size + sizeof(T) - 1) / sizeof(T); } -template<bool E, class A, class T> -inline typename boost::enable_if_<!E && - boost::has_trivial_destructor<T>::value>::type -sp_array_destroy(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -template<bool E, class A, class T> -inline typename boost::enable_if_<!E && - !boost::has_trivial_destructor<T>::value>::type -sp_array_destroy(A&, T* ptr, std::size_t size) -{ - while (size > 0) { - ptr[--size].~T(); - } -} - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template<bool E, class A, class T> -inline typename boost::enable_if_<E>::type -sp_array_destroy(A& allocator, T* ptr, std::size_t size) -{ - while (size > 0) { - std::allocator_traits<A>::destroy(allocator, ptr + --size); - } -} -#endif - -template<bool E, class A, class T> -class sp_destroyer { -public: - sp_destroyer(A& allocator, T* ptr) BOOST_SP_NOEXCEPT - : allocator_(allocator), - ptr_(ptr), - size_(0) { } - - ~sp_destroyer() { - sp_array_destroy<E>(allocator_, ptr_, size_); - } - - std::size_t& size() BOOST_SP_NOEXCEPT { - return size_; - } - -private: - sp_destroyer(const sp_destroyer&); - sp_destroyer& operator=(const sp_destroyer&); - - A& allocator_; - T* ptr_; - std::size_t size_; -}; - -template<bool E, class A, class T> -inline typename boost::enable_if_<!E && - boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value>::type -sp_array_construct(A&, T* ptr, std::size_t size) -{ - for (std::size_t i = 0; i < size; ++i) { - ptr[i] = T(); - } -} - -template<bool E, class A, class T> -inline typename boost::enable_if_<!E && - boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value>::type -sp_array_construct(A&, T* ptr, std::size_t size, const T* list, - std::size_t count) -{ - for (std::size_t i = 0; i < size; ++i) { - ptr[i] = list[i % count]; - } -} - -template<bool E, class A, class T> -inline typename boost::enable_if_<!E && - !(boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value)>::type -sp_array_construct(A& none, T* ptr, std::size_t size) -{ - sp_destroyer<E, A, T> hold(none, ptr); - for (std::size_t& i = hold.size(); i < size; ++i) { - ::new(static_cast<void*>(ptr + i)) T(); - } - hold.size() = 0; -} - -template<bool E, class A, class T> -inline typename boost::enable_if_<!E && - !(boost::has_trivial_constructor<T>::value && - boost::has_trivial_assign<T>::value && - boost::has_trivial_destructor<T>::value)>::type -sp_array_construct(A& none, T* ptr, std::size_t size, const T* list, - std::size_t count) -{ - sp_destroyer<E, A, T> hold(none, ptr); - for (std::size_t& i = hold.size(); i < size; ++i) { - ::new(static_cast<void*>(ptr + i)) T(list[i % count]); - } - hold.size() = 0; -} - -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template<bool E, class A, class T> -inline typename boost::enable_if_<E>::type -sp_array_construct(A& allocator, T* ptr, std::size_t size) -{ - sp_destroyer<E, A, T> hold(allocator, ptr); - for (std::size_t& i = hold.size(); i < size; ++i) { - std::allocator_traits<A>::construct(allocator, ptr + i); - } - hold.size() = 0; -} - -template<bool E, class A, class T> -inline typename boost::enable_if_<E>::type -sp_array_construct(A& allocator, T* ptr, std::size_t size, const T* list, - std::size_t count) -{ - sp_destroyer<E, A, T> hold(allocator, ptr); - for (std::size_t& i = hold.size(); i < size; ++i) { - std::allocator_traits<A>::construct(allocator, ptr + i, - list[i % count]); - } - hold.size() = 0; -} -#endif - -template<class A, class T> -inline typename - boost::enable_if_<boost::has_trivial_constructor<T>::value>::type -sp_array_default(A&, T*, std::size_t) BOOST_SP_NOEXCEPT { } - -template<class A, class T> -inline typename - boost::enable_if_<!boost::has_trivial_constructor<T>::value>::type -sp_array_default(A& none, T* ptr, std::size_t size) -{ - sp_destroyer<false, A, T> hold(none, ptr); - for (std::size_t& i = hold.size(); i < size; ++i) { - ::new(static_cast<void*>(ptr + i)) T; - } - hold.size() = 0; -} - template<class A> class sp_array_state { public: @@ -262,29 +120,6 @@ private: A allocator_; }; -#if !defined(BOOST_NO_CXX11_ALLOCATOR) -template<class A> -struct sp_use_construct { - enum { - value = true - }; -}; - -template<class T> -struct sp_use_construct<std::allocator<T> > { - enum { - value = false - }; -}; -#else -template<class> -struct sp_use_construct { - enum { - value = false - }; -}; -#endif - template<class T, class U> struct sp_array_alignment { enum { @@ -300,39 +135,32 @@ struct sp_array_offset { }; }; -template<class T, class U> -struct sp_array_storage { - enum { - value = sp_array_alignment<T, U>::value - }; - typedef typename boost::type_with_alignment<value>::type type; -}; - -template<class T, class U> +template<class U, class T> inline U* -sp_array_start(void* base) BOOST_SP_NOEXCEPT +sp_array_start(T* base) BOOST_SP_NOEXCEPT { enum { size = sp_array_offset<T, U>::value }; - return reinterpret_cast<U*>(static_cast<char*>(base) + size); + return reinterpret_cast<U*>(reinterpret_cast<char*>(base) + size); } template<class A, class T> class sp_array_creator { - typedef typename A::value_type scalar; + typedef typename A::value_type element; enum { - offset = sp_array_offset<T, scalar>::value + offset = sp_array_offset<T, element>::value }; - typedef typename sp_array_storage<T, scalar>::type type; + typedef typename boost::type_with_alignment<sp_array_alignment<T, + element>::value>::type type; public: template<class U> sp_array_creator(const U& other, std::size_t size) BOOST_SP_NOEXCEPT : other_(other), - size_(sp_objects<type>(offset + sizeof(scalar) * size)) { } + size_(sp_objects<type>(offset + sizeof(element) * size)) { } T* create() { return reinterpret_cast<T*>(other_.allocate(size_)); @@ -347,9 +175,7 @@ private: std::size_t size_; }; -struct sp_default { }; - -template<class T, bool E = sp_use_construct<T>::value> +template<class T> class BOOST_SYMBOL_VISIBLE sp_array_base : public sp_counted_base { typedef typename T::type allocator; @@ -358,23 +184,22 @@ public: typedef typename allocator::value_type type; template<class A> - sp_array_base(const A& other, std::size_t size, type* start) + sp_array_base(const A& other, type* start, std::size_t size) : state_(other, size) { - sp_array_construct<E>(state_.allocator(), start, state_.size()); + boost::alloc_construct_n(state_.allocator(), + boost::first_scalar(start), + state_.size() * sp_array_count<type>::value); } - template<class A> - sp_array_base(const A& other, std::size_t size, const type* list, - std::size_t count, type* start) - : state_(other, size) { - sp_array_construct<E>(state_.allocator(), start, state_.size(), list, - count); - } - - template<class A> - sp_array_base(sp_default, const A& other, std::size_t size, type* start) + template<class A, class U> + sp_array_base(const A& other, type* start, std::size_t size, const U& list) : state_(other, size) { - sp_array_default(state_.allocator(), start, state_.size()); + enum { + count = sp_array_count<type>::value + }; + boost::alloc_construct_n(state_.allocator(), + boost::first_scalar(start), state_.size() * count, + boost::first_scalar(&list), count); } T& state() BOOST_SP_NOEXCEPT { @@ -382,8 +207,9 @@ public: } virtual void dispose() BOOST_SP_NOEXCEPT { - sp_array_destroy<E>(state_.allocator(), - sp_array_start<sp_array_base, type>(this), state_.size()); + boost::alloc_destroy_n(state_.allocator(), + boost::first_scalar(sp_array_start<type>(this)), + state_.size() * sp_array_count<type>::value); } virtual void destroy() BOOST_SP_NOEXCEPT { @@ -393,11 +219,11 @@ public: other.destroy(this); } - virtual void* get_deleter(const sp_typeinfo&) BOOST_SP_NOEXCEPT { + virtual void* get_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT { return 0; } - virtual void* get_local_deleter(const sp_typeinfo&) BOOST_SP_NOEXCEPT { + virtual void* get_local_deleter(const sp_typeinfo_&) BOOST_SP_NOEXCEPT { return 0; } @@ -423,11 +249,11 @@ public: } } - T* get() const { + T* get() const BOOST_SP_NOEXCEPT { return result_; } - void release() { + void release() BOOST_SP_NOEXCEPT { result_ = 0; } @@ -445,40 +271,37 @@ template<class T, class A> inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator, std::size_t count) { - typedef typename remove_extent<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; + typedef typename detail::sp_array_element<T>::type element; + typedef typename detail::sp_bind_allocator<A, element>::type other; typedef detail::sp_array_state<other> state; typedef detail::sp_array_base<state> base; - std::size_t size = count * detail::sp_array_count<type, scalar>::value; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator) { - typedef typename remove_extent<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; enum { - size = detail::sp_array_count<T, scalar>::value + count = extent<T>::value }; - typedef detail::sp_size_array_state<other, size> state; + typedef typename detail::sp_array_element<T>::type element; + typedef typename detail::sp_bind_allocator<A, element>::type other; + typedef detail::sp_size_array_state<other, extent<T>::value> state; typedef detail::sp_array_base<state> base; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> @@ -486,23 +309,17 @@ inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator, std::size_t count, const typename remove_extent<T>::type& value) { - typedef typename remove_extent<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; + typedef typename detail::sp_array_element<T>::type element; + typedef typename detail::sp_bind_allocator<A, element>::type other; typedef detail::sp_array_state<other> state; typedef detail::sp_array_base<state> base; - enum { - total = detail::sp_array_count<type, scalar>::value - }; - std::size_t size = count * total; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, - reinterpret_cast<const scalar*>(&value), total, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count, value); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> @@ -510,65 +327,34 @@ inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type allocate_shared(const A& allocator, const typename remove_extent<T>::type& value) { - typedef typename remove_extent<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; enum { - size = detail::sp_array_count<T, scalar>::value + count = extent<T>::value }; - typedef detail::sp_size_array_state<other, size> state; + typedef typename detail::sp_array_element<T>::type element; + typedef typename detail::sp_bind_allocator<A, element>::type other; + typedef detail::sp_size_array_state<other, extent<T>::value> state; typedef detail::sp_array_base<state> base; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(allocator, size, - reinterpret_cast<const scalar*>(&value), - detail::sp_array_count<type, scalar>::value, start); + detail::sp_array_result<other, base> result(allocator, count); + base* node = result.get(); + element* start = detail::sp_array_start<element>(node); + ::new(static_cast<void*>(node)) base(allocator, start, count, value); result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return shared_ptr<T>(detail::sp_internal_constructor_tag(), start, + detail::shared_count(static_cast<detail::sp_counted_base*>(node))); } template<class T, class A> inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type allocate_shared_noinit(const A& allocator, std::size_t count) { - typedef typename remove_extent<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; - typedef detail::sp_array_state<other> state; - typedef detail::sp_array_base<state, false> base; - std::size_t size = count * detail::sp_array_count<type, scalar>::value; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return boost::allocate_shared<T>(boost::noinit_adapt(allocator), count); } template<class T, class A> inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type allocate_shared_noinit(const A& allocator) { - typedef typename remove_extent<T>::type type; - typedef typename detail::sp_array_scalar<T>::type scalar; - typedef typename detail::sp_bind_allocator<A, scalar>::type other; - enum { - size = detail::sp_array_count<T, scalar>::value - }; - typedef detail::sp_size_array_state<other, size> state; - typedef detail::sp_array_base<state, false> base; - detail::sp_array_result<other, base> result(allocator, size); - detail::sp_counted_base* node = result.get(); - scalar* start = detail::sp_array_start<base, scalar>(node); - ::new(static_cast<void*>(node)) base(detail::sp_default(), allocator, - size, start); - result.release(); - return shared_ptr<T>(detail::sp_internal_constructor_tag(), - reinterpret_cast<type*>(start), detail::shared_count(node)); + return boost::allocate_shared<T>(boost::noinit_adapt(allocator)); } } /* boost */ diff --git a/ThirdParty/boost/smart_ptr/detail/atomic_count_std_atomic.hpp b/ThirdParty/boost/smart_ptr/detail/atomic_count_std_atomic.hpp index 55b9998e52aecc4cdf9b0c31c15718de11bf5bad..3d5fb78fcb997d757cdd79dfb10b31b752705d11 100644 --- a/ThirdParty/boost/smart_ptr/detail/atomic_count_std_atomic.hpp +++ b/ThirdParty/boost/smart_ptr/detail/atomic_count_std_atomic.hpp @@ -26,7 +26,7 @@ class atomic_count { public: - explicit atomic_count( long v ): value_( v ) + explicit atomic_count( long v ): value_( static_cast< std::int_least32_t >( v ) ) { } diff --git a/ThirdParty/boost/smart_ptr/detail/lightweight_mutex.hpp b/ThirdParty/boost/smart_ptr/detail/lightweight_mutex.hpp index d46b1932c2b862ea597d4228a758d75470d64ba2..7b098c4d9d3681d643d162cd116f462638e58367 100644 --- a/ThirdParty/boost/smart_ptr/detail/lightweight_mutex.hpp +++ b/ThirdParty/boost/smart_ptr/detail/lightweight_mutex.hpp @@ -28,15 +28,12 @@ #include <boost/config.hpp> -#if !defined(BOOST_HAS_THREADS) -# include <boost/smart_ptr/detail/lwm_nop.hpp> -#elif defined(BOOST_HAS_PTHREADS) -# include <boost/smart_ptr/detail/lwm_pthreads.hpp> -#elif defined(BOOST_HAS_WINTHREADS) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) +#if !defined(BOOST_NO_CXX11_HDR_MUTEX ) +# include <boost/smart_ptr/detail/lwm_std_mutex.hpp> +#elif defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) # include <boost/smart_ptr/detail/lwm_win32_cs.hpp> #else -// Use #define BOOST_DISABLE_THREADS to avoid the error -# error Unrecognized threading platform +# include <boost/smart_ptr/detail/lwm_pthreads.hpp> #endif #endif // #ifndef BOOST_SMART_PTR_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED diff --git a/ThirdParty/boost/smart_ptr/detail/lwm_nop.hpp b/ThirdParty/boost/smart_ptr/detail/lwm_nop.hpp deleted file mode 100644 index 521a88ec1cdba0a44c8187b4603f8658442db9cc..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/smart_ptr/detail/lwm_nop.hpp +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED -#define BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED - -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lwm_nop.hpp -// -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. -// -// 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) -// - -namespace boost -{ - -namespace detail -{ - -class lightweight_mutex -{ -public: - - typedef lightweight_mutex scoped_lock; -}; - -} // namespace detail - -} // namespace boost - -#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_NOP_HPP_INCLUDED diff --git a/ThirdParty/boost/smart_ptr/detail/lwm_std_mutex.hpp b/ThirdParty/boost/smart_ptr/detail/lwm_std_mutex.hpp new file mode 100644 index 0000000000000000000000000000000000000000..5cb7490f00254259bbac98a55e1bdc326ae626a2 --- /dev/null +++ b/ThirdParty/boost/smart_ptr/detail/lwm_std_mutex.hpp @@ -0,0 +1,62 @@ +#ifndef BOOST_SMART_PTR_DETAIL_LWM_STD_MUTEX_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_LWM_STD_MUTEX_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/assert.hpp> +#include <mutex> + +namespace boost +{ + +namespace detail +{ + +class lightweight_mutex +{ +private: + + std::mutex m_; + + lightweight_mutex(lightweight_mutex const &); + lightweight_mutex & operator=(lightweight_mutex const &); + +public: + + lightweight_mutex() + { + } + + class scoped_lock; + friend class scoped_lock; + + class scoped_lock + { + private: + + std::mutex & m_; + + scoped_lock(scoped_lock const &); + scoped_lock & operator=(scoped_lock const &); + + public: + + scoped_lock( lightweight_mutex & m ): m_( m.m_ ) + { + m_.lock(); + } + + ~scoped_lock() + { + m_.unlock(); + } + }; +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_LWM_STD_MUTEX_HPP_INCLUDED diff --git a/ThirdParty/boost/smart_ptr/detail/lwm_win32_cs.hpp b/ThirdParty/boost/smart_ptr/detail/lwm_win32_cs.hpp index d8dccb0141b3b047fc812654f686ca7e1081f579..90decb2a321120728a4f6319fb5f9fecc5b4ce61 100644 --- a/ThirdParty/boost/smart_ptr/detail/lwm_win32_cs.hpp +++ b/ThirdParty/boost/smart_ptr/detail/lwm_win32_cs.hpp @@ -11,15 +11,12 @@ // boost/detail/lwm_win32_cs.hpp // // Copyright (c) 2002, 2003 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/predef.h> - #ifdef BOOST_USE_WINDOWS_H #include <windows.h> @@ -52,11 +49,7 @@ struct critical_section #endif }; -#if BOOST_PLAT_WINDOWS_RUNTIME -extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSectionEx(::_RTL_CRITICAL_SECTION *, unsigned long, unsigned long); -#else extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(::_RTL_CRITICAL_SECTION *); -#endif extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(::_RTL_CRITICAL_SECTION *); extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(::_RTL_CRITICAL_SECTION *); extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(::_RTL_CRITICAL_SECTION *); @@ -67,11 +60,7 @@ typedef ::_RTL_CRITICAL_SECTION rtl_critical_section; typedef ::CRITICAL_SECTION critical_section; -#if BOOST_PLAT_WINDOWS_RUNTIME -using ::InitializeCriticalSectionEx; -#else using ::InitializeCriticalSection; -#endif using ::EnterCriticalSection; using ::LeaveCriticalSection; using ::DeleteCriticalSection; @@ -93,11 +82,7 @@ public: lightweight_mutex() { -#if BOOST_PLAT_WINDOWS_RUNTIME - boost::detail::InitializeCriticalSectionEx(reinterpret_cast< rtl_critical_section* >(&cs_), 4000, 0); -#else boost::detail::InitializeCriticalSection(reinterpret_cast< rtl_critical_section* >(&cs_)); -#endif } ~lightweight_mutex() diff --git a/ThirdParty/boost/smart_ptr/detail/shared_count.hpp b/ThirdParty/boost/smart_ptr/detail/shared_count.hpp index 1ce68e6b5746ca3b6f237ebf49e5670630d2185d..d56718fe7e01b15c03698c09d98660b06bdf08fd 100644 --- a/ThirdParty/boost/smart_ptr/detail/shared_count.hpp +++ b/ThirdParty/boost/smart_ptr/detail/shared_count.hpp @@ -499,12 +499,12 @@ public: return std::less<sp_counted_base *>()( a.pi_, b.pi_ ); } - void * get_deleter( sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + void * get_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pi_? pi_->get_deleter( ti ): 0; } - void * get_local_deleter( sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + void * get_local_deleter( sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pi_? pi_->get_local_deleter( ti ): 0; } diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp index aa7ea9a20a0994850d98ebfa30ce0ac58ec179fe..07c07e236bffe51a18a19d92948d365f3d3c8c5d 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp @@ -15,7 +15,7 @@ // Lock-free algorithm by Alexander Terekhov // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> #include <machine/sys/inline.h> @@ -104,8 +104,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_aix.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_aix.hpp index cbb642687e0b93745f8f310bb8e5eac27e59771f..072c667e29bc0e496b7e782d06ef2f17d10134b2 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_aix.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_aix.hpp @@ -20,7 +20,7 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> #include <builtins.h> #include <sys/atomic_op.h> @@ -96,8 +96,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_clang.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_clang.hpp index 90b6f224caa7570d3370081772dc78e469705fca..89bcfb80a744b6f337d91f28459f410f1a0aa562 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_clang.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_clang.hpp @@ -15,7 +15,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> #include <boost/config.hpp> #include <boost/cstdint.hpp> @@ -99,8 +99,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; void add_ref_copy() BOOST_SP_NOEXCEPT diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp index c43297e0e42e77dc9fa844c43a5071346770d05a..8e5a414dabb1b46737f7b922c8316eb2fd7203ec 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp @@ -24,7 +24,7 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> namespace boost @@ -124,8 +124,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp index 32642df778a3bd7a4009987c6730beb4a771b1a1..73d4533800080eb7a9d606dc5ef92cbea85e998b 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp @@ -16,7 +16,7 @@ // Lock-free algorithm by Alexander Terekhov // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> namespace boost @@ -111,8 +111,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp index c4ce0537c9611687e66e463003063c1458d00a25..f109f6579f5ec368f1c86f5c8739bd97ff773d58 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp @@ -20,7 +20,7 @@ // Lock-free algorithm by Alexander Terekhov // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> namespace boost @@ -141,8 +141,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp index 5cf5b3fa66536ea04c99b4396de3cab271470db5..5dce1cf6ac3581fa8d29b776e078e61514ba8719 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp @@ -24,7 +24,7 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> namespace boost @@ -135,8 +135,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp index 2f27b96e1e718d50699e8b2793fcfd7ad69c7ada..a3d7295865dcd93fef68c60294accf5dfba4c081 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_sparc.hpp @@ -19,7 +19,7 @@ // // Thanks to Michael van der Westhuizen -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> #include <inttypes.h> // int32_t @@ -120,8 +120,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp index ec44c7066f14d88b8dc970b76dcb877fe1e31ff5..ebbea502642e7fca912fcc91a186e98e260277d9 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp @@ -24,7 +24,7 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> namespace boost @@ -127,8 +127,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_nt.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_nt.hpp index 8d7b8e9cc818315960fc4c9c738517df80179dc8..08300505bb6742fe914a64e8d6c03d35e1b2ffb7 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_nt.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_nt.hpp @@ -18,7 +18,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> #include <boost/config.hpp> #include <boost/cstdint.hpp> @@ -61,8 +61,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; void add_ref_copy() BOOST_SP_NOEXCEPT diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_pt.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_pt.hpp index 1aa6756122ea23d994185d956fb5eb1b8e330b75..ec850fe6bdc8ea2b47327b36a93c8cd19b3de53d 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_pt.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_pt.hpp @@ -18,7 +18,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/assert.hpp> #include <boost/config.hpp> #include <boost/cstdint.hpp> @@ -72,8 +72,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp index 1b9979bfb56d36d55f8f7c94ce8212b910c01c78..f38eee65f594257307835bf6b4ae4cb81a78c4bb 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp @@ -19,7 +19,7 @@ // // Thanks to Michael van der Westhuizen -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> #include <inttypes.h> // uint32_t @@ -115,8 +115,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_spin.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_spin.hpp index b9966260cbad3d9d4698a74ab458e64f86fb118f..56911bdb09c86fe1f3a03680f40e5799faf892ff 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_spin.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_spin.hpp @@ -18,7 +18,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/spinlock_pool.hpp> #include <boost/config.hpp> @@ -84,8 +84,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp index 2246dda4b6a83b638ef7c1ea3eac41117623c8a0..338eeea718d58fc91bf9bf2e08a448dbd81f846c 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_std_atomic.hpp @@ -15,7 +15,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> #include <boost/config.hpp> #include <atomic> @@ -91,8 +91,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT = 0; virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT = 0; void add_ref_copy() BOOST_SP_NOEXCEPT diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_sync.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_sync.hpp index 17128cc97e74d5a3b0397ef174e8f4d1cccf5c7d..8446560e0ac407bb715b68bcf8fa09589fe8b1f0 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_sync.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_sync.hpp @@ -15,7 +15,7 @@ // See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> #include <limits.h> @@ -109,8 +109,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp index 088ed63972ea8775d2d9656a9f31e56ed3beba25..2467e95a17ff48de61501d4833aef5cfaf4236a2 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp @@ -21,7 +21,7 @@ // formulation // -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> #include <boost/config.hpp> extern "builtin" void __lwsync(void); @@ -104,8 +104,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_w32.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_w32.hpp index 46bd4d15a9164b88e76e05d2561be63ad70c9866..15853f9fff881afef532a1447067ff034adf0942 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_base_w32.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_base_w32.hpp @@ -25,8 +25,8 @@ // #include <boost/smart_ptr/detail/sp_interlocked.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/detail/sp_typeinfo.hpp> +#include <boost/smart_ptr/detail/sp_typeinfo_.hpp> +#include <boost/config/workaround.hpp> #include <boost/config.hpp> namespace boost @@ -67,8 +67,8 @@ public: delete this; } - virtual void * get_deleter( sp_typeinfo const & ti ) = 0; - virtual void * get_local_deleter( sp_typeinfo const & ti ) = 0; + virtual void * get_deleter( sp_typeinfo_ const & ti ) = 0; + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) = 0; virtual void * get_untyped_deleter() = 0; void add_ref_copy() diff --git a/ThirdParty/boost/smart_ptr/detail/sp_counted_impl.hpp b/ThirdParty/boost/smart_ptr/detail/sp_counted_impl.hpp index 29718b6b8c79a189552cc40ef8966768d72d1700..96c9da383070acc4a2d1f3fe87deddaf1f6a428b 100644 --- a/ThirdParty/boost/smart_ptr/detail/sp_counted_impl.hpp +++ b/ThirdParty/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -93,12 +93,12 @@ public: boost::checked_delete( px_ ); } - virtual void * get_deleter( sp_typeinfo const & ) BOOST_SP_NOEXCEPT + virtual void * get_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT { return 0; } - virtual void * get_local_deleter( sp_typeinfo const & ) BOOST_SP_NOEXCEPT + virtual void * get_local_deleter( sp_typeinfo_ const & ) BOOST_SP_NOEXCEPT { return 0; } @@ -173,14 +173,14 @@ public: del( ptr ); } - virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT { - return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0; + return ti == BOOST_SP_TYPEID_(D)? &reinterpret_cast<char&>( del ): 0; } - virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; + return ti == BOOST_SP_TYPEID_(D)? boost::detail::get_local_deleter( boost::addressof( del ) ): 0; } virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT @@ -266,14 +266,14 @@ public: a2.deallocate( this, 1 ); } - virtual void * get_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT + virtual void * get_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT { - return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0; + return ti == BOOST_SP_TYPEID_( D )? &reinterpret_cast<char&>( d_ ): 0; } - virtual void * get_local_deleter( sp_typeinfo const & ti ) BOOST_SP_NOEXCEPT + virtual void * get_local_deleter( sp_typeinfo_ const & ti ) BOOST_SP_NOEXCEPT { - return ti == BOOST_SP_TYPEID(D)? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; + return ti == BOOST_SP_TYPEID_( D )? boost::detail::get_local_deleter( boost::addressof( d_ ) ): 0; } virtual void * get_untyped_deleter() BOOST_SP_NOEXCEPT diff --git a/ThirdParty/boost/smart_ptr/detail/sp_typeinfo_.hpp b/ThirdParty/boost/smart_ptr/detail/sp_typeinfo_.hpp new file mode 100644 index 0000000000000000000000000000000000000000..287bf728189d4853bd2c000b6b52d3c4799b22f6 --- /dev/null +++ b/ThirdParty/boost/smart_ptr/detail/sp_typeinfo_.hpp @@ -0,0 +1,58 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// smart_ptr/detail/sp_typeinfo_.hpp +// +// Copyright 2007, 2019 Peter Dimov +// +// Distributed under the Boost Software License, Version 1.0. +// See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) + +#include <boost/config.hpp> + +#if defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO ) + +#include <boost/core/typeinfo.hpp> + +namespace boost +{ + +namespace detail +{ + +typedef boost::core::typeinfo sp_typeinfo_; + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID_(T) BOOST_CORE_TYPEID(T) + +#else // defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO ) + +#include <typeinfo> + +namespace boost +{ + +namespace detail +{ + +typedef std::type_info sp_typeinfo_; + +} // namespace detail + +} // namespace boost + +#define BOOST_SP_TYPEID_(T) typeid(T) + +#endif // defined( BOOST_NO_TYPEID ) || defined( BOOST_NO_STD_TYPEINFO ) + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_TYPEINFO_HPP_INCLUDED diff --git a/ThirdParty/boost/smart_ptr/detail/yield_k.hpp b/ThirdParty/boost/smart_ptr/detail/yield_k.hpp index e9c41b9581a31b5bc9719b2b7127c335e0deabf4..fa259174bd7b5dbb31dab7072c59dae090e4e69c 100644 --- a/ThirdParty/boost/smart_ptr/detail/yield_k.hpp +++ b/ThirdParty/boost/smart_ptr/detail/yield_k.hpp @@ -11,7 +11,6 @@ // yield_k.hpp // // Copyright (c) 2008 Peter Dimov -// Copyright (c) Microsoft Corporation 2014 // // void yield( unsigned k ); // @@ -25,11 +24,6 @@ // #include <boost/config.hpp> -#include <boost/predef/platform/windows_runtime.h> - -#if BOOST_PLAT_WINDOWS_RUNTIME -#include <thread> -#endif // BOOST_SMT_PAUSE @@ -59,7 +53,7 @@ namespace boost namespace detail { -#if !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME +#if !defined( BOOST_USE_WINDOWS_H ) #if defined(__clang__) && defined(__x86_64__) // clang x64 warns that __stdcall is ignored @@ -76,7 +70,7 @@ namespace detail #undef BOOST_SP_STDCALL -#endif // !defined( BOOST_USE_WINDOWS_H ) && !BOOST_PLAT_WINDOWS_RUNTIME +#endif // !defined( BOOST_USE_WINDOWS_H ) inline void yield( unsigned k ) BOOST_NOEXCEPT { @@ -89,7 +83,6 @@ inline void yield( unsigned k ) BOOST_NOEXCEPT BOOST_SMT_PAUSE } #endif -#if !BOOST_PLAT_WINDOWS_RUNTIME else if( k < 32 ) { Sleep( 0 ); @@ -98,13 +91,6 @@ inline void yield( unsigned k ) BOOST_NOEXCEPT { Sleep( 1 ); } -#else - else - { - // Sleep isn't supported on the Windows Runtime. - std::this_thread::yield(); - } -#endif } } // namespace detail diff --git a/ThirdParty/boost/smart_ptr/intrusive_ptr.hpp b/ThirdParty/boost/smart_ptr/intrusive_ptr.hpp index 0ab075d367ba08d7a79b6bdd6d62da5b44889ece..ba23e5adfbeafdd9265b4a716602ee2efe6c38f6 100644 --- a/ThirdParty/boost/smart_ptr/intrusive_ptr.hpp +++ b/ThirdParty/boost/smart_ptr/intrusive_ptr.hpp @@ -16,7 +16,7 @@ #include <boost/config.hpp> #include <boost/assert.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <boost/smart_ptr/detail/sp_convertible.hpp> #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> @@ -297,6 +297,8 @@ template<class T> T * get_pointer(intrusive_ptr<T> const & p) BOOST_SP_NOEXCEPT return p.get(); } +// pointer casts + template<class T, class U> intrusive_ptr<T> static_pointer_cast(intrusive_ptr<U> const & p) { return static_cast<T *>(p.get()); @@ -312,6 +314,31 @@ template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast(intrusive_ptr<U return dynamic_cast<T *>(p.get()); } +#if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + +template<class T, class U> intrusive_ptr<T> static_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT +{ + return intrusive_ptr<T>( static_cast<T*>( p.detach() ), false ); +} + +template<class T, class U> intrusive_ptr<T> const_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT +{ + return intrusive_ptr<T>( const_cast<T*>( p.detach() ), false ); +} + +template<class T, class U> intrusive_ptr<T> dynamic_pointer_cast( intrusive_ptr<U> && p ) BOOST_SP_NOEXCEPT +{ + T * p2 = dynamic_cast<T*>( p.get() ); + + intrusive_ptr<T> r( p2, false ); + + if( p2 ) p.detach(); + + return r; +} + +#endif // defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) + // operator<< #if !defined(BOOST_NO_IOSTREAM) diff --git a/ThirdParty/boost/smart_ptr/make_shared_array.hpp b/ThirdParty/boost/smart_ptr/make_shared_array.hpp index 1b40c4d6a849bbb6f2e1934c26b4b0a77fa22c11..785eb875fc5c0fea8f62095632a2c8165ec36e2a 100644 --- a/ThirdParty/boost/smart_ptr/make_shared_array.hpp +++ b/ThirdParty/boost/smart_ptr/make_shared_array.hpp @@ -8,6 +8,7 @@ Distributed under the Boost Software License, Version 1.0. #ifndef BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP #define BOOST_SMART_PTR_MAKE_SHARED_ARRAY_HPP +#include <boost/core/default_allocator.hpp> #include <boost/smart_ptr/allocate_shared_array.hpp> namespace boost { @@ -16,48 +17,48 @@ template<class T> inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type make_shared() { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>()); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>()); } template<class T> inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type make_shared(const typename remove_extent<T>::type& value) { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), value); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), value); } template<class T> inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type make_shared(std::size_t size) { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), size); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), size); } template<class T> inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type make_shared(std::size_t size, const typename remove_extent<T>::type& value) { - return boost::allocate_shared<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), size, value); + return boost::allocate_shared<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), size, value); } template<class T> inline typename enable_if_<is_bounded_array<T>::value, shared_ptr<T> >::type make_shared_noinit() { - return boost::allocate_shared_noinit<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>()); + return boost::allocate_shared_noinit<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>()); } template<class T> inline typename enable_if_<is_unbounded_array<T>::value, shared_ptr<T> >::type make_shared_noinit(std::size_t size) { - return boost::allocate_shared_noinit<T>(std::allocator<typename - detail::sp_array_scalar<T>::type>(), size); + return boost::allocate_shared_noinit<T>(boost::default_allocator<typename + detail::sp_array_element<T>::type>(), size); } } /* boost */ diff --git a/ThirdParty/boost/smart_ptr/scoped_array.hpp b/ThirdParty/boost/smart_ptr/scoped_array.hpp index 05dd05aea8da548c7d0de4b3ab39a45f246a4822..d56112cfa05030db9e9b8464757679c6b413b7c7 100644 --- a/ThirdParty/boost/smart_ptr/scoped_array.hpp +++ b/ThirdParty/boost/smart_ptr/scoped_array.hpp @@ -16,7 +16,7 @@ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <cstddef> // for std::ptrdiff_t diff --git a/ThirdParty/boost/smart_ptr/scoped_ptr.hpp b/ThirdParty/boost/smart_ptr/scoped_ptr.hpp index 5325eba5ffe41a873aef8c9e19b4cf11f6359eb1..9cf9566e01196df933fc885e53d580b66ed01fd3 100644 --- a/ThirdParty/boost/smart_ptr/scoped_ptr.hpp +++ b/ThirdParty/boost/smart_ptr/scoped_ptr.hpp @@ -16,7 +16,7 @@ #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> #include <boost/smart_ptr/detail/sp_noexcept.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #ifndef BOOST_NO_AUTO_PTR # include <memory> // for std::auto_ptr diff --git a/ThirdParty/boost/smart_ptr/shared_ptr.hpp b/ThirdParty/boost/smart_ptr/shared_ptr.hpp index baafc499f78363d7d8ba1856d3a3cf62efedcd27..0405ab05819ff55e5297fd759b580f74b187571a 100644 --- a/ThirdParty/boost/smart_ptr/shared_ptr.hpp +++ b/ThirdParty/boost/smart_ptr/shared_ptr.hpp @@ -26,7 +26,7 @@ #include <boost/checked_delete.hpp> #include <boost/throw_exception.hpp> #include <boost/smart_ptr/detail/shared_count.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <boost/smart_ptr/detail/sp_convertible.hpp> #include <boost/smart_ptr/detail/sp_nullptr_t.hpp> #include <boost/smart_ptr/detail/sp_disable_deprecated.hpp> @@ -777,12 +777,12 @@ public: return pn < rhs.pn; } - void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + void * _internal_get_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pn.get_deleter( ti ); } - void * _internal_get_local_deleter( boost::detail::sp_typeinfo const & ti ) const BOOST_SP_NOEXCEPT + void * _internal_get_local_deleter( boost::detail::sp_typeinfo_ const & ti ) const BOOST_SP_NOEXCEPT { return pn.get_local_deleter( ti ); } @@ -1008,7 +1008,7 @@ namespace detail template<class D, class T> D * basic_get_deleter( shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID(D)) ); + return static_cast<D *>( p._internal_get_deleter(BOOST_SP_TYPEID_(D)) ); } template<class D, class T> D * basic_get_local_deleter( D *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT; @@ -1165,16 +1165,23 @@ namespace detail template<class D, class T> D * basic_get_local_deleter( D *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter<D>) ) ); + return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID_(local_sp_deleter<D>) ) ); } template<class D, class T> D const * basic_get_local_deleter( D const *, shared_ptr<T> const & p ) BOOST_SP_NOEXCEPT { - return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID(local_sp_deleter<D>) ) ); + return static_cast<D *>( p._internal_get_local_deleter( BOOST_SP_TYPEID_(local_sp_deleter<D>) ) ); } } // namespace detail +#if defined(__cpp_deduction_guides) + +template<class T> shared_ptr( weak_ptr<T> ) -> shared_ptr<T>; +template<class T, class D> shared_ptr( std::unique_ptr<T, D> ) -> shared_ptr<T>; + +#endif + } // namespace boost #if defined( BOOST_SP_DISABLE_DEPRECATED ) diff --git a/ThirdParty/boost/system/detail/config.hpp b/ThirdParty/boost/system/detail/config.hpp index 2ad8201476eec1b66a66320384dccf9fd61a5b1a..5742a94d1403d2008e309292fe3a5d710d71702d 100644 --- a/ThirdParty/boost/system/detail/config.hpp +++ b/ThirdParty/boost/system/detail/config.hpp @@ -22,6 +22,11 @@ # undef BOOST_SYSTEM_HAS_SYSTEM_ERROR #endif +#if defined(BOOST_NO_CXX11_HDR_MUTEX) +// Required for thread-safe map manipulation +# undef BOOST_SYSTEM_HAS_SYSTEM_ERROR +#endif + // BOOST_SYSTEM_NOEXCEPT // Retained for backward compatibility @@ -43,15 +48,4 @@ # define BOOST_SYSTEM_CONSTEXPR #endif -// BOOST_SYSTEM_REQUIRE_CONST_INIT - -#define BOOST_SYSTEM_REQUIRE_CONST_INIT - -#if defined(__has_cpp_attribute) -#if __has_cpp_attribute(clang::require_constant_initialization) -# undef BOOST_SYSTEM_REQUIRE_CONST_INIT -# define BOOST_SYSTEM_REQUIRE_CONST_INIT [[clang::require_constant_initialization]] -#endif -#endif - #endif // BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED diff --git a/ThirdParty/boost/system/detail/std_interoperability.hpp b/ThirdParty/boost/system/detail/std_interoperability.hpp index b1b41d39b48da4e2251f4f8da9e46d352e9e2ac4..30a378f5aca9c57e974884a950f8760fde997107 100644 --- a/ThirdParty/boost/system/detail/std_interoperability.hpp +++ b/ThirdParty/boost/system/detail/std_interoperability.hpp @@ -10,6 +10,7 @@ #include <system_error> #include <map> #include <memory> +#include <mutex> // @@ -30,8 +31,20 @@ private: public: - explicit std_category( boost::system::error_category const * pc ): pc_( pc ) + explicit std_category( boost::system::error_category const * pc, unsigned id ): pc_( pc ) { + if( id != 0 ) + { +#if defined(_MSC_VER) && defined(_CPPLIB_VER) && _MSC_VER >= 1900 && _MSC_VER < 2000 + + // Poking into the protected _Addr member of std::error_category + // is not a particularly good programming practice, but what can + // you do + + _Addr = id; + +#endif + } } virtual const char * name() const BOOST_NOEXCEPT @@ -53,24 +66,52 @@ public: virtual bool equivalent( const std::error_code & code, int condition ) const BOOST_NOEXCEPT; }; +#if !defined(__SUNPRO_CC) // trailing __global is not supported +inline std::error_category const & to_std_category( boost::system::error_category const & cat ) BOOST_SYMBOL_VISIBLE; +#endif + +struct cat_ptr_less +{ + bool operator()( boost::system::error_category const * p1, boost::system::error_category const * p2 ) const BOOST_NOEXCEPT + { + return *p1 < *p2; + } +}; + inline std::error_category const & to_std_category( boost::system::error_category const & cat ) { - typedef std::map< boost::system::error_category const *, std::unique_ptr<std_category> > map_type; + if( cat == boost::system::system_category() ) + { + static const std_category system_instance( &cat, 0x1F4D7 ); + return system_instance; + } + else if( cat == boost::system::generic_category() ) + { + static const std_category generic_instance( &cat, 0x1F4D3 ); + return generic_instance; + } + else + { + typedef std::map< boost::system::error_category const *, std::unique_ptr<std_category>, cat_ptr_less > map_type; - static map_type map_; + static map_type map_; + static std::mutex map_mx_; - map_type::iterator i = map_.find( &cat ); + std::lock_guard<std::mutex> guard( map_mx_ ); - if( i == map_.end() ) - { - std::unique_ptr<std_category> p( new std_category( &cat ) ); + map_type::iterator i = map_.find( &cat ); - std::pair<map_type::iterator, bool> r = map_.insert( map_type::value_type( &cat, std::move( p ) ) ); + if( i == map_.end() ) + { + std::unique_ptr<std_category> p( new std_category( &cat, 0 ) ); - i = r.first; - } + std::pair<map_type::iterator, bool> r = map_.insert( map_type::value_type( &cat, std::move( p ) ) ); - return *i->second; + i = r.first; + } + + return *i->second; + } } inline bool std_category::equivalent( int code, const std::error_condition & condition ) const BOOST_NOEXCEPT diff --git a/ThirdParty/boost/system/detail/system_category_win32.hpp b/ThirdParty/boost/system/detail/system_category_win32.hpp index a46c8b2e2276c7e144a35c14ed45d30f796dc4ba..da256e1d705debc1a97aa66c2926bc28ddbfbca8 100644 --- a/ThirdParty/boost/system/detail/system_category_win32.hpp +++ b/ThirdParty/boost/system/detail/system_category_win32.hpp @@ -264,6 +264,7 @@ inline error_condition system_category_default_error_condition_win32( int ev ) B case ERROR_CANTOPEN_: return make_error_condition( io_error ); case ERROR_CANTREAD_: return make_error_condition( io_error ); case ERROR_CANTWRITE_: return make_error_condition( io_error ); + case ERROR_CONNECTION_ABORTED_: return make_error_condition( connection_aborted ); case ERROR_CURRENT_DIRECTORY_: return make_error_condition( permission_denied ); case ERROR_DEV_NOT_EXIST_: return make_error_condition( no_such_device ); case ERROR_DEVICE_IN_USE_: return make_error_condition( device_or_resource_busy ); diff --git a/ThirdParty/boost/system/error_code.hpp b/ThirdParty/boost/system/error_code.hpp index f1d7ddb745da99502b6c5730fcca3ff90cf1b7cc..df80592ea0c097664708b07cb963dedc35e59e69 100644 --- a/ThirdParty/boost/system/error_code.hpp +++ b/ThirdParty/boost/system/error_code.hpp @@ -329,14 +329,17 @@ public: namespace detail { -template<class T> struct cat_holder +template<class T> struct BOOST_SYMBOL_VISIBLE cat_holder { - BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr system_error_category system_category_instance{}; - BOOST_SYSTEM_REQUIRE_CONST_INIT static constexpr generic_error_category generic_category_instance{}; + static constexpr system_error_category system_category_instance{}; + static constexpr generic_error_category generic_category_instance{}; }; -template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr system_error_category cat_holder<T>::system_category_instance; -template<class T> BOOST_SYSTEM_REQUIRE_CONST_INIT constexpr generic_error_category cat_holder<T>::generic_category_instance; +// Before C++17 it was mandatory to redeclare all static constexpr +#if defined(BOOST_NO_CXX17_INLINE_VARIABLES) +template<class T> constexpr system_error_category cat_holder<T>::system_category_instance; +template<class T> constexpr generic_error_category cat_holder<T>::generic_category_instance; +#endif } // namespace detail @@ -352,6 +355,11 @@ constexpr error_category const & generic_category() BOOST_NOEXCEPT #else // #if defined(BOOST_SYSTEM_HAS_CONSTEXPR) +#if !defined(__SUNPRO_CC) // trailing __global is not supported +inline error_category const & system_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE; +inline error_category const & generic_category() BOOST_NOEXCEPT BOOST_SYMBOL_VISIBLE; +#endif + inline error_category const & system_category() BOOST_NOEXCEPT { static const detail::system_error_category system_category_instance; @@ -776,11 +784,11 @@ inline std::size_t hash_value( error_code const & ec ) { error_category const & cat = ec.category(); - boost::ulong_long_type id = cat.id_; + boost::ulong_long_type id_ = cat.id_; - if( id == 0 ) + if( id_ == 0 ) { - id = reinterpret_cast<boost::ulong_long_type>( &cat ); + id_ = reinterpret_cast<boost::uintptr_t>( &cat ); } boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325; @@ -788,7 +796,7 @@ inline std::size_t hash_value( error_code const & ec ) // id - hv ^= id; + hv ^= id_; hv *= prime; // value diff --git a/ThirdParty/boost/test/detail/config.hpp b/ThirdParty/boost/test/detail/config.hpp index bcdd85761376535d8b39be381e04b2bf82907f8e..8d0f7c41f1d8150b668266ecd826fd195d999783 100644 --- a/ThirdParty/boost/test/detail/config.hpp +++ b/ThirdParty/boost/test/detail/config.hpp @@ -64,10 +64,10 @@ class type_info; //____________________________________________________________________________// -#if defined(__GNUC__) || BOOST_WORKAROUND(BOOST_MSVC, == 1400) -#define BOOST_TEST_PROTECTED_VIRTUAL virtual -#else +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) #define BOOST_TEST_PROTECTED_VIRTUAL +#else +#define BOOST_TEST_PROTECTED_VIRTUAL virtual #endif //____________________________________________________________________________// @@ -112,7 +112,11 @@ class type_info; # define BOOST_TEST_DECL BOOST_SYMBOL_IMPORT BOOST_SYMBOL_VISIBLE # endif // BOOST_TEST_SOURCE #else -# define BOOST_TEST_DECL BOOST_SYMBOL_VISIBLE +# if defined(BOOST_TEST_INCLUDED) +# define BOOST_TEST_DECL +# else +# define BOOST_TEST_DECL BOOST_SYMBOL_VISIBLE +# endif #endif #if !defined(BOOST_TEST_MAIN) && defined(BOOST_AUTO_TEST_MAIN) @@ -125,7 +129,7 @@ class type_info; -#ifndef BOOST_PP_VARIADICS /* we can change this only if not already defined) */ +#ifndef BOOST_PP_VARIADICS /* we can change this only if not already defined */ #ifdef __PGI #define BOOST_PP_VARIADICS 1 @@ -139,6 +143,27 @@ class type_info; #define BOOST_PP_VARIADICS 1 #endif +#if defined(__NVCC__) +#define BOOST_PP_VARIADICS 1 +#endif + #endif /* ifndef BOOST_PP_VARIADICS */ +// some versions of VC exibit a manifest error with this BOOST_UNREACHABLE_RETURN +#if BOOST_WORKAROUND(BOOST_MSVC, < 1910) +# define BOOST_TEST_UNREACHABLE_RETURN(x) return x +#else +# define BOOST_TEST_UNREACHABLE_RETURN(x) BOOST_UNREACHABLE_RETURN(x) +#endif + +//____________________________________________________________________________// +// string_view support +//____________________________________________________________________________// +// note the code should always be compatible with compiled version of boost.test +// using a pre-c++17 compiler + +#ifndef BOOST_NO_CXX17_HDR_STRING_VIEW +#define BOOST_TEST_STRING_VIEW +#endif + #endif // BOOST_TEST_CONFIG_HPP_071894GER diff --git a/ThirdParty/boost/test/detail/suppress_warnings.hpp b/ThirdParty/boost/test/detail/suppress_warnings.hpp index 4f8de3dd8741666caa89d62f108ea8e474fd1bf2..2145da5f91574712a0835588f21ce548783e1f7c 100644 --- a/ThirdParty/boost/test/detail/suppress_warnings.hpp +++ b/ThirdParty/boost/test/detail/suppress_warnings.hpp @@ -36,5 +36,6 @@ # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wvariadic-macros" # pragma GCC diagnostic ignored "-Wmissing-declarations" +// # pragma GCC diagnostic ignored "-Wattributes" #endif diff --git a/ThirdParty/boost/test/framework.hpp b/ThirdParty/boost/test/framework.hpp index dd0756f9d4db1c8f0c00752a88052a6942dfbbaa..1a139e099c045286effba0baea9ebe418b6fd8c0 100644 --- a/ThirdParty/boost/test/framework.hpp +++ b/ThirdParty/boost/test/framework.hpp @@ -262,6 +262,12 @@ namespace impl { // exclusively for self test BOOST_TEST_DECL void setup_for_execution( test_unit const& ); BOOST_TEST_DECL void setup_loggers( ); + +// Helper for setting the name of the master test suite globally +struct BOOST_TEST_DECL master_test_suite_name_setter { + master_test_suite_name_setter( const_string name ); +}; + } // namespace impl // ************************************************************************** // diff --git a/ThirdParty/boost/test/impl/compiler_log_formatter.ipp b/ThirdParty/boost/test/impl/compiler_log_formatter.ipp index 1b2645ba12fe7f2c1c705e2dcba9ca592ee3d965..4c99a9338d8209b88b766762f1f1c297197b1b84 100644 --- a/ThirdParty/boost/test/impl/compiler_log_formatter.ipp +++ b/ThirdParty/boost/test/impl/compiler_log_formatter.ipp @@ -26,8 +26,6 @@ #include <boost/test/utils/basic_cstring/io.hpp> #include <boost/test/utils/lazy_ostream.hpp> -#include <boost/test/utils/setcolor.hpp> - // Boost #include <boost/version.hpp> @@ -184,25 +182,25 @@ compiler_log_formatter::log_entry_start( std::ostream& output, log_entry_data co switch( let ) { case BOOST_UTL_ET_INFO: print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::GREEN ); + output << setcolor( m_color_output, term_attr::BRIGHT, term_color::GREEN, term_color::ORIGINAL, &m_color_state); output << "info: "; break; case BOOST_UTL_ET_MESSAGE: - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::CYAN ); + output << setcolor( m_color_output, term_attr::BRIGHT, term_color::CYAN, term_color::ORIGINAL, &m_color_state); break; case BOOST_UTL_ET_WARNING: print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::YELLOW ); + output << setcolor( m_color_output, term_attr::BRIGHT, term_color::YELLOW, term_color::ORIGINAL, &m_color_state); output << "warning: in \"" << test_phase_identifier() << "\": "; break; case BOOST_UTL_ET_ERROR: print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::BRIGHT, term_color::RED ); + output << setcolor( m_color_output, term_attr::BRIGHT, term_color::RED, term_color::ORIGINAL, &m_color_state); output << "error: in \"" << test_phase_identifier() << "\": "; break; case BOOST_UTL_ET_FATAL_ERROR: print_prefix( output, entry_data.m_file_name, entry_data.m_line_num ); - output << setcolor( m_color_output, term_attr::UNDERLINE, term_color::RED ); + output << setcolor( m_color_output, term_attr::UNDERLINE, term_color::RED, term_color::ORIGINAL, &m_color_state); output << "fatal error: in \"" << test_phase_identifier() << "\": "; break; } @@ -230,7 +228,7 @@ void compiler_log_formatter::log_entry_finish( std::ostream& output ) { if( m_color_output ) - output << utils::setcolor(m_color_output); + output << utils::setcolor(m_color_output, &m_color_state); output << std::endl; } diff --git a/ThirdParty/boost/test/impl/debug.ipp b/ThirdParty/boost/test/impl/debug.ipp index bee956c1cbb65cffc19de1c1a5ed702c7ce76e04..8d0e258e643c90b2c03b37f1da3c6142666d696b 100644 --- a/ThirdParty/boost/test/impl/debug.ipp +++ b/ThirdParty/boost/test/impl/debug.ipp @@ -84,7 +84,7 @@ namespace std { using ::memset; using ::sprintf; } # include <procfs.h> -# elif defined(linux) || defined(__linux) +# elif defined(linux) || defined(__linux__) # define BOOST_LINUX_BASED_DEBUG @@ -422,7 +422,9 @@ prepare_gdb_cmnd_file( dbg_startup_info const& dsi ) static char cmd_file_name[] = "/tmp/btl_gdb_cmd_XXXXXX"; // !! ?? // prepare commands + const mode_t cur_umask = ::umask( S_IRWXO | S_IRWXG ); fd_holder cmd_fd( ::mkstemp( cmd_file_name ) ); + ::umask( cur_umask ); if( cmd_fd == -1 ) return 0; @@ -890,7 +892,9 @@ attach_debugger( bool break_or_continue ) #elif defined(BOOST_UNIX_BASED_DEBUG) // ********************** UNIX char init_done_lock_fn[] = "/tmp/btl_dbg_init_done_XXXXXX"; + const mode_t cur_umask = ::umask( S_IRWXO | S_IRWXG ); fd_holder init_done_lock_fd( ::mkstemp( init_done_lock_fn ) ); + ::umask( cur_umask ); if( init_done_lock_fd == -1 ) return false; diff --git a/ThirdParty/boost/test/impl/decorator.ipp b/ThirdParty/boost/test/impl/decorator.ipp index ac6cc7e278259cb45883ef6c0ea9d39da248eb33..3a0ebb7061f5ef001ed40c295e62d48ab0bcd7fd 100644 --- a/ThirdParty/boost/test/impl/decorator.ipp +++ b/ThirdParty/boost/test/impl/decorator.ipp @@ -111,7 +111,7 @@ stack_decorator::operator*() const } void -stack_decorator::apply( test_unit& tu ) +stack_decorator::apply( test_unit& /*tu*/ ) { // does nothing by definition } diff --git a/ThirdParty/boost/test/impl/execution_monitor.ipp b/ThirdParty/boost/test/impl/execution_monitor.ipp index 2c2cd3871f0844c04a584f49cdf92a9114504964..3eca20dfb9f6697aa1c675e82f272ece2441d674 100644 --- a/ThirdParty/boost/test/impl/execution_monitor.ipp +++ b/ThirdParty/boost/test/impl/execution_monitor.ipp @@ -242,6 +242,9 @@ extract( boost::exception const* ex ) //____________________________________________________________________________// static void +#if __GNUC__ >= 3 +__attribute__((__format__ (__printf__, 3, 0))) +#endif report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, va_list* args ) { static const int REPORT_ERROR_BUFFER_SIZE = 4096; @@ -260,6 +263,9 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch //____________________________________________________________________________// static void +#if __GNUC__ >= 3 +__attribute__((__format__ (__printf__, 3, 4))) +#endif report_error( execution_exception::error_code ec, boost::exception const* be, char const* format, ... ) { va_list args; @@ -273,6 +279,9 @@ report_error( execution_exception::error_code ec, boost::exception const* be, ch //____________________________________________________________________________// static void +#if __GNUC__ >= 3 +__attribute__((__format__ (__printf__, 2, 3))) +#endif report_error( execution_exception::error_code ec, char const* format, ... ) { va_list args; @@ -391,14 +400,19 @@ system_signal_exception::report() const report_error( execution_exception::system_error, "signal: the expiration of a timer set by timer_settimer()" ); break; +// OpenBSD was missing SI_ASYNCIO and SI_MESGQ +#ifdef SI_ASYNCIO case SI_ASYNCIO: report_error( execution_exception::system_error, "signal: generated by the completion of an asynchronous I/O request" ); break; +#endif +#ifdef SI_MESGQ case SI_MESGQ: report_error( execution_exception::system_error, "signal: generated by the the arrival of a message on an empty message queue" ); break; +#endif default: break; } @@ -410,48 +424,48 @@ system_signal_exception::report() const case ILL_ILLOPC: report_error( execution_exception::system_fatal_error, "signal: illegal opcode; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case ILL_ILLTRP: report_error( execution_exception::system_fatal_error, "signal: illegal trap; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case ILL_PRVREG: report_error( execution_exception::system_fatal_error, "signal: privileged register; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case ILL_BADSTK: report_error( execution_exception::system_fatal_error, "signal: internal stack error; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; #endif case ILL_ILLOPN: report_error( execution_exception::system_fatal_error, "signal: illegal operand; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case ILL_ILLADR: report_error( execution_exception::system_fatal_error, "signal: illegal addressing mode; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case ILL_PRVOPC: report_error( execution_exception::system_fatal_error, "signal: privileged opcode; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case ILL_COPROC: report_error( execution_exception::system_fatal_error, "signal: co-processor error; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; default: report_error( execution_exception::system_fatal_error, "signal: SIGILL, si_code: %d (illegal instruction; address of failing instruction: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); + m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr ); break; } break; @@ -461,47 +475,47 @@ system_signal_exception::report() const case FPE_INTDIV: report_error( execution_exception::system_error, "signal: integer divide by zero; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_INTOVF: report_error( execution_exception::system_error, "signal: integer overflow; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_FLTDIV: report_error( execution_exception::system_error, "signal: floating point divide by zero; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_FLTOVF: report_error( execution_exception::system_error, "signal: floating point overflow; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_FLTUND: report_error( execution_exception::system_error, "signal: floating point underflow; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_FLTRES: report_error( execution_exception::system_error, "signal: floating point inexact result; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_FLTINV: report_error( execution_exception::system_error, "signal: invalid floating point operation; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case FPE_FLTSUB: report_error( execution_exception::system_error, "signal: subscript out of range; address of failing instruction: 0x%08lx", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; default: report_error( execution_exception::system_error, "signal: SIGFPE, si_code: %d (errnoneous arithmetic operations; address of failing instruction: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); + m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr ); break; } break; @@ -512,18 +526,18 @@ system_signal_exception::report() const case SEGV_MAPERR: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: no mapping at fault address", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case SEGV_ACCERR: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: invalid permissions", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; #endif default: report_error( execution_exception::system_fatal_error, "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); + m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr ); break; } break; @@ -534,23 +548,23 @@ system_signal_exception::report() const case BUS_ADRALN: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: invalid address alignment", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case BUS_ADRERR: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: non-existent physical address", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; case BUS_OBJERR: report_error( execution_exception::system_fatal_error, "memory access violation at address: 0x%08lx: object specific hardware error", - m_sig_info->si_addr ); + (uintptr_t) m_sig_info->si_addr ); break; #endif default: report_error( execution_exception::system_fatal_error, "signal: SIGSEGV, si_code: %d (memory access violation at address: 0x%08lx)", - m_sig_info->si_addr, m_sig_info->si_code ); + m_sig_info->si_code, (uintptr_t) m_sig_info->si_addr ); break; } break; @@ -596,7 +610,7 @@ system_signal_exception::report() const default: report_error( execution_exception::system_error, "signal: SIGPOLL, si_code: %d (asynchronous I/O event occurred; band event %d)", - (int)m_sig_info->si_band, m_sig_info->si_code ); + m_sig_info->si_code, (int)m_sig_info->si_band ); break; } break; @@ -701,7 +715,11 @@ signal_action::~signal_action() class signal_handler { public: // Constructor - explicit signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout_microseconds, bool attach_dbg, char* alt_stack ); + explicit signal_handler( bool catch_system_errors, + bool detect_fpe, + unsigned long int timeout_microseconds, + bool attach_dbg, + char* alt_stack ); // Destructor ~signal_handler(); @@ -724,7 +742,7 @@ public: private: // Data members signal_handler* m_prev_handler; - unsigned m_timeout_microseconds; + unsigned long int m_timeout_microseconds; // Note: We intentionality do not catch SIGCHLD. Users have to deal with it themselves signal_action m_ILL_action; @@ -748,7 +766,11 @@ signal_handler* signal_handler::s_active_handler = signal_handler_ptr(); //____________________________________________________________________________// -signal_handler::signal_handler( bool catch_system_errors, bool detect_fpe, unsigned timeout_microseconds, bool attach_dbg, char* alt_stack ) +signal_handler::signal_handler( bool catch_system_errors, + bool detect_fpe, + unsigned long int timeout_microseconds, + bool attach_dbg, + char* alt_stack ) : m_prev_handler( s_active_handler ) , m_timeout_microseconds( timeout_microseconds ) , m_ILL_action ( SIGILL , catch_system_errors, attach_dbg, alt_stack ) @@ -1167,11 +1189,11 @@ execution_monitor::catch_signals( boost::function<int ()> const& F ) htimer = ::CreateWaitableTimer( NULL, TRUE, - TEXT("Boost.Test timer")); + NULL); // naming the timer might create collisions if( htimer != INVALID_HANDLE_VALUE ) { LARGE_INTEGER liDueTime; - liDueTime.QuadPart = - static_cast<signed long int>(p_timeout) * 10; // resolution of 100 ns + liDueTime.QuadPart = - static_cast<LONGLONG>(p_timeout) * 10ll; // resolution of 100 ns bTimerSuccess = ::SetWaitableTimer( htimer, @@ -1295,11 +1317,7 @@ execution_monitor::execute( boost::function<int ()> const& F ) catch( boost::exception const& ex ) { detail::report_error( execution_exception::cpp_exception_error, &ex, -#if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) - "unknown boost::exception" ); } -#else - boost::diagnostic_information(ex).c_str() ); } -#endif + "%s", boost::diagnostic_information(ex).c_str() ); } // std:: exceptions #if defined(BOOST_NO_TYPEID) || defined(BOOST_NO_RTTI) @@ -1355,7 +1373,7 @@ execution_monitor::execute( boost::function<int ()> const& F ) #endif // !BOOST_NO_EXCEPTIONS - return 0; // never reached; supplied to quiet compiler warnings + BOOST_TEST_UNREACHABLE_RETURN(0); // never reached; supplied to quiet compiler warnings } // execute //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/impl/framework.ipp b/ThirdParty/boost/test/impl/framework.ipp index c35469eeb374c7c09a9c6b445c28763defbb3654..3ee3b07f8850bcd66b2f773039c29599d98ad1fc 100644 --- a/ThirdParty/boost/test/impl/framework.ipp +++ b/ThirdParty/boost/test/impl/framework.ipp @@ -49,7 +49,7 @@ // Boost #include <boost/test/utils/timer.hpp> -#include <boost/bind.hpp> +#include <boost/bind/bind.hpp> // STL #include <limits> @@ -59,9 +59,7 @@ #include <ctime> #include <numeric> #include <cmath> -#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE #include <iterator> -#endif #ifdef BOOST_NO_STDC_NAMESPACE namespace std { using ::time; using ::srand; } @@ -441,9 +439,7 @@ parse_filters( test_unit_id master_tu_id, test_unit_id_list& tu_to_enable, test_ //____________________________________________________________________________// -#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE - -// a poor man's implementation of random_shuffle +// a poor man's implementation of random_shuffle, deprecated in C++11 template< class RandomIt, class RandomFunc > void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r ) { @@ -458,9 +454,6 @@ void random_shuffle( RandomIt first, RandomIt last, RandomFunc &r ) } } -#endif - - // A simple handle for registering the global fixtures to the master test suite // without deleting an existing static object (the global fixture itself) when the program // terminates (shared_ptr). @@ -673,8 +666,11 @@ public: execution_result result = unit_test_monitor_t::test_ok; - if( !tu.is_enabled() ) + if( !tu.is_enabled() ) { + BOOST_TEST_FOREACH( test_observer*, to, m_observers ) + to->test_unit_skipped( tu, "disabled" ); return result; + } // 10. Check preconditions, including zero time left for execution and // successful execution of all dependencies @@ -778,11 +774,7 @@ public: it++; } -#ifdef BOOST_NO_CXX98_RANDOM_SHUFFLE impl::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); -#else - std::random_shuffle( children_with_the_same_rank.begin(), children_with_the_same_rank.end(), rand_gen ); -#endif BOOST_TEST_FOREACH( test_unit_id, chld, children_with_the_same_rank ) { unsigned long int chld_timeout = child_timeout( @@ -999,6 +991,7 @@ setup_loggers() log_cleaner ); } unit_test_log.set_stream( stream_logger.ref() ); + unit_test_log.configure(); } else { @@ -1193,7 +1186,6 @@ init( init_unit_test_func init_func, int argc, char* argv[] ) // 40. Register default test observers register_observer( results_collector ); register_observer( unit_test_log ); - register_observer( framework_init_observer ); if( runtime_config::get<bool>( runtime_config::btrt_show_progress ) ) { progress_monitor.set_stream( std::cout ); // defaults to stdout @@ -1525,6 +1517,14 @@ master_test_suite() return *impl::s_frk_state().m_master_test_suite; } +namespace impl { + +master_test_suite_name_setter::master_test_suite_name_setter(const_string name) { + assign_op( master_test_suite().p_name.value, name.trim( "\"" ), 0 ); +} + +} + //____________________________________________________________________________// // ************************************************************************** // @@ -1605,6 +1605,33 @@ struct swap_on_delete { Cont& m_c2; }; +struct register_observer_helper { + register_observer_helper(test_observer& observer) + : m_observer(observer) + { + register_obs(); + } + + ~register_observer_helper() { + if(m_registered) + deregister_observer( m_observer ); + } + + void deregister_obs() { + m_registered = false; + deregister_observer( m_observer ); + } + + void register_obs() { + m_registered = true; + register_observer( m_observer ); + } + + + test_observer& m_observer; + bool m_registered; +}; + void run( test_unit_id id, bool continue_test ) { @@ -1626,6 +1653,9 @@ run( test_unit_id id, bool continue_test ) bool init_ok = true; const_string setup_error; + framework_init_observer_t local_init_observer; + register_observer_helper init_observer_helper( local_init_observer ); + if( call_start_finish ) { // indicates the framework that no test is in progress now if observers need to be notified impl::s_frk_state().m_test_in_progress = false; @@ -1633,13 +1663,13 @@ run( test_unit_id id, bool continue_test ) BOOST_TEST_FOREACH( test_observer*, to, impl::s_frk_state().m_observers ) { BOOST_TEST_I_TRY { ut_detail::test_unit_id_restore restore_current_test_unit(impl::s_frk_state().m_curr_test_unit, id); - unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count ) ); + unit_test_monitor_t::error_level result = unit_test_monitor.execute_and_translate( boost::bind( &test_observer::test_start, to, tcc.p_count, id ) ); if( init_ok ) { if( result != unit_test_monitor_t::test_ok ) { init_ok = false; } else { - if( unit_test::framework_init_observer.has_failed() ) { + if( local_init_observer.has_failed() ) { init_ok = false; } } @@ -1656,6 +1686,9 @@ run( test_unit_id id, bool continue_test ) } } + // removing this observer as it should not be of any use for the tests + init_observer_helper.deregister_obs(); + if( init_ok ) { // attaching the global fixtures to the main entry point @@ -1694,7 +1727,10 @@ run( test_unit_id id, bool continue_test ) results_reporter::make_report( INV_REPORT_LEVEL, id ); - unit_test::framework_init_observer.clear(); + // reinstalling this observer + init_observer_helper.register_obs(); + + local_init_observer.clear(); if( call_start_finish ) { // indicates the framework that no test is in progress anymore if observers need to be notified // and this is a teardown, so assertions should not raise any exception otherwise an exception @@ -1709,7 +1745,7 @@ run( test_unit_id id, bool continue_test ) impl::s_frk_state().m_test_in_progress = was_in_progress; // propagates the init/teardown error if any - BOOST_TEST_SETUP_ASSERT( init_ok && !unit_test::framework_init_observer.has_failed(), setup_error ); + BOOST_TEST_SETUP_ASSERT( init_ok && !local_init_observer.has_failed(), setup_error ); } //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/impl/junit_log_formatter.ipp b/ThirdParty/boost/test/impl/junit_log_formatter.ipp index 56b2127b09d908b07b483bf63dae93057d00a8f4..10d83527c0bb09860637ad8925c52f3b0abf690e 100644 --- a/ThirdParty/boost/test/impl/junit_log_formatter.ipp +++ b/ThirdParty/boost/test/impl/junit_log_formatter.ipp @@ -23,7 +23,6 @@ #include <boost/test/framework.hpp> #include <boost/test/tree/visitor.hpp> -#include <boost/test/tree/test_case_counter.hpp> #include <boost/test/tree/traverse.hpp> #include <boost/test/results_collector.hpp> diff --git a/ThirdParty/boost/test/impl/progress_monitor.ipp b/ThirdParty/boost/test/impl/progress_monitor.ipp index 998aa26b2875ef599408df408a88f472b67c918a..4aacb357a448de45b6be70d09f85fe12c4c2c341 100644 --- a/ThirdParty/boost/test/impl/progress_monitor.ipp +++ b/ThirdParty/boost/test/impl/progress_monitor.ipp @@ -126,7 +126,7 @@ BOOST_TEST_SINGLETON_CONS_IMPL(progress_monitor_t) //____________________________________________________________________________// void -progress_monitor_t::test_start( counter_t test_cases_amount ) +progress_monitor_t::test_start( counter_t test_cases_amount, test_unit_id ) { s_pm_impl().m_color_output = runtime_config::get<bool>( runtime_config::btrt_color_output ); diff --git a/ThirdParty/boost/test/impl/results_collector.ipp b/ThirdParty/boost/test/impl/results_collector.ipp index bda11f2d967608505f1d58a8c16b93831df68650..40d5e55c8f48ce75c80a8c5d60528f5852010d45 100644 --- a/ThirdParty/boost/test/impl/results_collector.ipp +++ b/ThirdParty/boost/test/impl/results_collector.ipp @@ -145,6 +145,27 @@ struct results_collector_impl { results_collector_impl& s_rc_impl() { static results_collector_impl the_inst; return the_inst; } +// deletes the entries of results_collector_impl +class clear_subtree_result : public test_tree_visitor { +public: + clear_subtree_result(results_collector_impl& store) + : m_store( store ) + {} + +private: + virtual bool visit( test_unit const& tu) + { + typedef std::map<test_unit_id,test_results>::iterator iterator; + iterator found = m_store.m_results_store.find(tu.p_id); + if(found != m_store.m_results_store.end()) { + m_store.m_results_store.erase( found ); + } + return true; + } + + results_collector_impl& m_store; +}; + } // local namespace //____________________________________________________________________________// @@ -154,9 +175,11 @@ BOOST_TEST_SINGLETON_CONS_IMPL( results_collector_t ) //____________________________________________________________________________// void -results_collector_t::test_start( counter_t ) +results_collector_t::test_start( counter_t, test_unit_id id ) { - s_rc_impl().m_results_store.clear(); + // deletes the results under id only + clear_subtree_result tree_clear(s_rc_impl()); + traverse_test_tree( id, tree_clear ); } //____________________________________________________________________________// @@ -189,10 +212,12 @@ public: else m_tr.p_test_cases_passed.value++; } - else if( tr.p_timed_out ) + else if( tr.p_timed_out ) { m_tr.p_test_cases_timed_out.value++; - else if( tr.p_skipped ) + } + else if( tr.p_skipped || !tc.is_enabled() ) { m_tr.p_test_cases_skipped.value++; + } else { if( tr.p_aborted ) m_tr.p_test_cases_aborted.value++; @@ -224,17 +249,12 @@ private: void results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapsed_in_microseconds ) { + test_results & tr = s_rc_impl().m_results_store[tu.p_id]; if( tu.p_type == TUT_SUITE ) { - results_collect_helper ch( s_rc_impl().m_results_store[tu.p_id], tu ); - - traverse_test_tree( tu, ch ); - - s_rc_impl().m_results_store[tu.p_id].p_duration_microseconds.value = elapsed_in_microseconds; + results_collect_helper ch( tr, tu ); + traverse_test_tree( tu, ch, true ); // true to ignore the status: we need to count the skipped/disabled tests } else { - test_results & tr = s_rc_impl().m_results_store[tu.p_id]; - tr.p_duration_microseconds.value = elapsed_in_microseconds; - bool num_failures_match = tr.p_aborted || tr.p_assertions_failed >= tr.p_expected_failures; if( !num_failures_match ) BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " has fewer failures than expected" ); @@ -243,6 +263,7 @@ results_collector_t::test_unit_finish( test_unit const& tu, unsigned long elapse if( !check_any_assertions ) BOOST_TEST_FRAMEWORK_MESSAGE( "Test case " << tu.full_name() << " did not check any assertions" ); } + tr.p_duration_microseconds.value = elapsed_in_microseconds; } //____________________________________________________________________________// @@ -256,8 +277,8 @@ results_collector_t::test_unit_skipped( test_unit const& tu, const_string /*reas tr.p_skipped.value = true; if( tu.p_type == TUT_SUITE ) { - test_case_counter tcc; - traverse_test_tree( tu, tcc ); + test_case_counter tcc(true); + traverse_test_tree( tu, tcc, true ); // true because need to count the disabled tests/units tr.p_test_cases_skipped.value = tcc.p_count; } diff --git a/ThirdParty/boost/test/impl/test_framework_init_observer.ipp b/ThirdParty/boost/test/impl/test_framework_init_observer.ipp index a44382eed501e7b799480f61e55d3b4e4e3d40b4..4e9f49f70009ed4a669970cb4fa5a1effab959dc 100644 --- a/ThirdParty/boost/test/impl/test_framework_init_observer.ipp +++ b/ThirdParty/boost/test/impl/test_framework_init_observer.ipp @@ -29,41 +29,16 @@ namespace unit_test { // ************** framework_init_observer_t ************** // // ************************************************************************** // -namespace { - -struct test_init_observer_check { - bool has_failure; - - void clear() - { - has_failure = false; - } -}; - - -test_init_observer_check& s_tioc_impl() { static test_init_observer_check the_inst; return the_inst; } - -} // local namespace - - -//____________________________________________________________________________// - -// singleton pattern -BOOST_TEST_SINGLETON_CONS_IMPL(framework_init_observer_t) - -//____________________________________________________________________________// - void framework_init_observer_t::clear() { - if(!framework::test_in_progress()) - s_tioc_impl().clear(); + m_has_failure = false; } //____________________________________________________________________________// void -framework_init_observer_t::test_start( counter_t ) +framework_init_observer_t::test_start( counter_t, test_unit_id ) { clear(); } @@ -73,11 +48,8 @@ framework_init_observer_t::test_start( counter_t ) void framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) { - test_init_observer_check& tr = s_tioc_impl(); switch( ar ) { - case AR_TRIGGERED: break; - case AR_PASSED: break; - case AR_FAILED: tr.has_failure = true; break; + case AR_FAILED: m_has_failure = true; break; default: break; } @@ -88,14 +60,13 @@ framework_init_observer_t::assertion_result( unit_test::assertion_result ar ) void framework_init_observer_t::exception_caught( execution_exception const& ) { - test_init_observer_check& tr = s_tioc_impl(); - tr.has_failure = true; + m_has_failure = true; } void framework_init_observer_t::test_aborted() { - s_tioc_impl().has_failure = true; + m_has_failure = true; } @@ -104,7 +75,7 @@ framework_init_observer_t::test_aborted() bool framework_init_observer_t::has_failed() const { - return s_tioc_impl().has_failure; + return m_has_failure; } //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/impl/test_tools.ipp b/ThirdParty/boost/test/impl/test_tools.ipp index 14934691cb23dbd2922835f917025c27f3bb18f7..025cd1a92af36a6fe1f643b1a3fccd896348596c 100644 --- a/ThirdParty/boost/test/impl/test_tools.ipp +++ b/ThirdParty/boost/test/impl/test_tools.ipp @@ -124,7 +124,7 @@ print_log_value<char const*>::operator()( std::ostream& ostr, char const* t ) void print_log_value<wchar_t const*>::operator()( std::ostream& ostr, wchar_t const* t ) { - ostr << ( t ? t : L"null string" ); + ostr << ( t ? reinterpret_cast<const void*>(t) : "null string" ); } //____________________________________________________________________________// @@ -384,7 +384,7 @@ report_assertion( assertion_result const& ar, BOOST_TEST_I_THROW( execution_aborted() ); // the previous line either throws or aborts and the return below is not reached // return false; - BOOST_UNREACHABLE_RETURN(false); + BOOST_TEST_UNREACHABLE_RETURN(false); } return true; @@ -404,7 +404,7 @@ format_assertion_result( const_string expr_val, const_string details ) if( !details.is_empty() ) { if( first_char(details) != '[' ) - res.message().stream() << ". "; + res.message().stream() << ": "; else res.message().stream() << " "; @@ -733,7 +733,7 @@ output_test_stream::match_pattern( bool flush_stream ) for( std::size_t k = 1; k < (std::max)(best_pattern_start_index, best_stream_start_index); k++ ) { // 1 is for the current char c std::string s1(pretty_print_log(std::string(1, last_elements_ordered[(std::min)(k, best_pattern_start_index)]))); std::string s2(pretty_print_log(std::string(1, sub_str_suffix[(std::min)(k, best_stream_start_index)]))); - for( int h = (std::max)(s1.size(), s2.size()); h > 0; h--) + for( int h = static_cast<int>((std::max)(s1.size(), s2.size())); h > 0; h--) result.message() << "~"; } diff --git a/ThirdParty/boost/test/impl/test_tree.ipp b/ThirdParty/boost/test/impl/test_tree.ipp index d050735ad7f755aed36fa3e1d26f1641baeb5a8c..0872682ea67acd0e887e6f0712acc188b866e4f6 100644 --- a/ThirdParty/boost/test/impl/test_tree.ipp +++ b/ThirdParty/boost/test/impl/test_tree.ipp @@ -452,7 +452,7 @@ normalize_test_case_name( const_string name ) } // sanitize all chars that might be used in runtime filters - static const char to_replace[] = { ':', '*', '@', '+', '!', '/' }; + static const char to_replace[] = { ':', '*', '@', '+', '!', '/', ',' }; for(std::size_t index = 0; index < sizeof(to_replace)/sizeof(to_replace[0]); index++) { diff --git a/ThirdParty/boost/test/impl/unit_test_log.ipp b/ThirdParty/boost/test/impl/unit_test_log.ipp index c5abfcb30484f6fe388a30a62df0a1a85d070e68..1b1e4eea9ae9f2e472294af8977faaa1d52dff67 100644 --- a/ThirdParty/boost/test/impl/unit_test_log.ipp +++ b/ThirdParty/boost/test/impl/unit_test_log.ipp @@ -131,11 +131,18 @@ struct unit_test_log_impl { typedef std::vector<unit_test_log_data_helper_impl> v_formatter_data_t; v_formatter_data_t m_log_formatter_data; + typedef std::vector<unit_test_log_data_helper_impl*> vp_formatter_data_t; + vp_formatter_data_t m_active_log_formatter_data; + // entry data log_entry_data m_entry_data; bool has_entry_in_progress() const { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl const&, current_logger_data, m_log_formatter_data ) { + for( vp_formatter_data_t::const_iterator it(m_active_log_formatter_data.begin()), ite(m_active_log_formatter_data.end()); + it < ite; + ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; if( current_logger_data.m_entry_in_progress ) return true; } @@ -155,30 +162,80 @@ struct unit_test_log_impl { unit_test_log_impl& s_log_impl() { static unit_test_log_impl the_inst; return the_inst; } + +//____________________________________________________________________________// + +void +log_entry_context( log_level l, unit_test_log_data_helper_impl& current_logger_data) +{ + framework::context_generator const& context = framework::get_context(); + if( context.is_empty() ) + return; + + const_string frame; + current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l ); + while( !(frame=context.next()).is_empty() ) + { + current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame ); + } + current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l ); +} + +//____________________________________________________________________________// + +void +clear_entry_context() +{ + framework::clear_context(); +} + +// convenience +typedef unit_test_log_impl::vp_formatter_data_t vp_logger_t; +typedef unit_test_log_impl::v_formatter_data_t v_logger_t; + } // local namespace //____________________________________________________________________________// BOOST_TEST_SINGLETON_CONS_IMPL( unit_test_log_t ) +void +unit_test_log_t::configure( ) +{ + // configure is not test_start: + // test_start pushes the necessary log information when the test module is starting, and implies configure. + // configure: should be called each time the set of loggers, stream or configuration is changed. + s_log_impl().m_active_log_formatter_data.clear(); + for( unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), + ite(s_log_impl().m_log_formatter_data.end()); + it < ite; + ++it) + { + if( !it->m_enabled || it->get_log_level() == log_nothing ) + continue; + + s_log_impl().m_active_log_formatter_data.push_back(&*it); + it->m_entry_in_progress = false; + } +} + //____________________________________________________________________________// void -unit_test_log_t::test_start( counter_t test_cases_amount ) +unit_test_log_t::test_start( counter_t test_cases_amount, test_unit_id ) { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing ) - continue; + configure(); + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; current_logger_data.m_log_formatter->log_start( current_logger_data.stream(), test_cases_amount ); - current_logger_data.m_log_formatter->log_build_info( current_logger_data.stream(), runtime_config::get<bool>( runtime_config::btrt_build_info )); //current_logger_data.stream().flush(); - - current_logger_data.m_entry_in_progress = false; } } @@ -187,12 +244,11 @@ unit_test_log_t::test_start( counter_t test_cases_amount ) void unit_test_log_t::test_finish() { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() == log_nothing ) - continue; - + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; current_logger_data.m_log_formatter->log_finish( current_logger_data.stream() ); - current_logger_data.stream().flush(); } } @@ -212,8 +268,12 @@ unit_test_log_t::test_unit_start( test_unit const& tu ) { if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( current_logger_data.get_log_level() > log_test_units ) continue; current_logger_data.m_log_formatter->test_unit_start( current_logger_data.stream(), tu ); } @@ -229,9 +289,11 @@ unit_test_log_t::test_unit_finish( test_unit const& tu, unsigned long elapsed ) if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( current_logger_data.get_log_level() > log_test_units ) continue; current_logger_data.m_log_formatter->test_unit_finish( current_logger_data.stream(), tu, elapsed ); @@ -246,8 +308,11 @@ unit_test_log_t::test_unit_skipped( test_unit const& tu, const_string reason ) if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( current_logger_data.get_log_level() > log_test_units ) continue; current_logger_data.m_log_formatter->test_unit_skipped( current_logger_data.stream(), tu, reason ); @@ -260,8 +325,11 @@ unit_test_log_t::test_unit_aborted( test_unit const& tu ) if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( current_logger_data.get_log_level() > log_test_units ) continue; current_logger_data.m_log_formatter->test_unit_aborted(current_logger_data.stream(), tu ); @@ -274,8 +342,11 @@ unit_test_log_t::test_unit_timed_out( test_unit const& tu ) if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( !current_logger_data.m_enabled || current_logger_data.get_log_level() > log_test_units ) + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( current_logger_data.get_log_level() > log_test_units ) continue; current_logger_data.m_log_formatter->test_unit_timed_out(current_logger_data.stream(), tu ); @@ -295,13 +366,16 @@ unit_test_log_t::exception_caught( execution_exception const& ex ) if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; - if( current_logger_data.m_enabled && l >= current_logger_data.get_log_level() ) { + if( l >= current_logger_data.get_log_level() ) { current_logger_data.m_log_formatter->log_exception_start( current_logger_data.stream(), s_log_impl().m_checkpoint_data, ex ); - log_entry_context( l ); + log_entry_context( l, current_logger_data ); current_logger_data.m_log_formatter->log_exception_finish( current_logger_data.stream() ); } @@ -331,10 +405,11 @@ unit_test_log_t::operator<<( log::begin const& b ) if( s_log_impl().has_entry_in_progress() ) *this << log::end(); - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_stream_state_saver->restore(); - } + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + current_logger_data.m_stream_state_saver->restore(); } s_log_impl().m_entry_data.clear(); @@ -357,10 +432,15 @@ unit_test_log_t& unit_test_log_t::operator<<( log::end const& ) { if( s_log_impl().has_entry_in_progress() ) { - log_entry_context( s_log_impl().m_entry_data.m_level ); - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled && current_logger_data.m_entry_in_progress ) { + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + log_level l = s_log_impl().m_entry_data.m_level; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( current_logger_data.m_entry_in_progress ) { + if( l >= current_logger_data.get_log_level() ) { + log_entry_context( l, current_logger_data ); + } current_logger_data.m_log_formatter->log_entry_finish( current_logger_data.stream() ); } current_logger_data.m_entry_in_progress = false; @@ -395,53 +475,42 @@ unit_test_log_t::operator()( log_level l ) //____________________________________________________________________________// bool -unit_test_log_t::log_entry_start(output_format log_format) +log_entry_start(unit_test_log_data_helper_impl ¤t_logger_data) { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - - if( current_logger_data.m_format != log_format ) - continue; - - if( current_logger_data.m_entry_in_progress ) - return true; - - if( !current_logger_data.m_enabled ) - return false; - - switch( s_log_impl().m_entry_data.m_level ) { - case log_successful_tests: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_INFO ); - break; - case log_messages: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); - break; - case log_warnings: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_WARNING ); - break; - case log_all_errors: - case log_cpp_exception_errors: - case log_system_errors: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_ERROR ); - break; - case log_fatal_errors: - current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, - unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); - break; - case log_nothing: - case log_test_units: - case invalid_log_level: - return false; - } - - current_logger_data.m_entry_in_progress = true; + if( current_logger_data.m_entry_in_progress ) return true; + + switch( s_log_impl().m_entry_data.m_level ) { + case log_successful_tests: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_INFO ); + break; + case log_messages: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_MESSAGE ); + break; + case log_warnings: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_WARNING ); + break; + case log_all_errors: + case log_cpp_exception_errors: + case log_system_errors: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_ERROR ); + break; + case log_fatal_errors: + current_logger_data.m_log_formatter->log_entry_start( current_logger_data.stream(), s_log_impl().m_entry_data, + unit_test_log_formatter::BOOST_UTL_ET_FATAL_ERROR ); + break; + case log_nothing: + case log_test_units: + case invalid_log_level: + return false; } - return false; + current_logger_data.m_entry_in_progress = true; + return true; } //____________________________________________________________________________// @@ -449,68 +518,42 @@ unit_test_log_t::log_entry_start(output_format log_format) unit_test_log_t& unit_test_log_t::operator<<( const_string value ) { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() && log_entry_start(current_logger_data.m_format) ) - current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); - + if(value.empty()) { + return *this; } - return *this; -} -//____________________________________________________________________________// - -unit_test_log_t& -unit_test_log_t::operator<<( lazy_ostream const& value ) -{ - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled && s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() && !value.empty() ) { - if( log_entry_start(current_logger_data.m_format) ) { + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = **it; + if( s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() ) + if( log_entry_start(current_logger_data) ) { current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); } - } } return *this; } //____________________________________________________________________________// -void -unit_test_log_t::log_entry_context( log_level l ) +unit_test_log_t& +unit_test_log_t::operator<<( lazy_ostream const& value ) { - framework::context_generator const& context = framework::get_context(); - if( context.is_empty() ) - return; - - const_string frame; - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_log_formatter->entry_context_start( current_logger_data.stream(), l ); - } + if(value.empty()) { + return *this; } - while( !(frame=context.next()).is_empty() ) + vp_logger_t& vloggers = s_log_impl().m_active_log_formatter_data; + for( vp_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_log_formatter->log_entry_context( current_logger_data.stream(), l, frame ); + unit_test_log_data_helper_impl& current_logger_data = **it; + if( s_log_impl().m_entry_data.m_level >= current_logger_data.get_log_level() ) { + if( log_entry_start(current_logger_data) ) { + current_logger_data.m_log_formatter->log_entry_value( current_logger_data.stream(), value ); } } } - - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { - if( current_logger_data.m_enabled ) { - current_logger_data.m_log_formatter->entry_context_finish( current_logger_data.stream(), l ); - } - } -} - -//____________________________________________________________________________// - -void -unit_test_log_t::clear_entry_context() -{ - framework::clear_context(); + return *this; } //____________________________________________________________________________// @@ -521,7 +564,11 @@ unit_test_log_t::set_stream( std::ostream& str ) if( s_log_impl().has_entry_in_progress() ) return; - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; + current_logger_data.m_stream = &str; current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); } @@ -535,7 +582,10 @@ unit_test_log_t::set_stream( output_format log_format, std::ostream& str ) if( s_log_impl().has_entry_in_progress() ) return; - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; if( current_logger_data.m_format == log_format) { current_logger_data.m_stream = &str; current_logger_data.m_stream_state_saver.reset( new io_saver_type( str ) ); @@ -547,7 +597,10 @@ unit_test_log_t::set_stream( output_format log_format, std::ostream& str ) std::ostream* unit_test_log_t::get_stream( output_format log_format ) const { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; if( current_logger_data.m_format == log_format) { return current_logger_data.m_stream; } @@ -557,31 +610,43 @@ unit_test_log_t::get_stream( output_format log_format ) const //____________________________________________________________________________// -void +log_level unit_test_log_t::set_threshold_level( log_level lev ) { if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) - return; + return invalid_log_level; - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + log_level ret = log_nothing; + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; + ret = (std::min)(ret, current_logger_data.m_log_formatter->get_log_level()); current_logger_data.m_log_formatter->set_log_level( lev ); } + return ret; } //____________________________________________________________________________// -void +log_level unit_test_log_t::set_threshold_level( output_format log_format, log_level lev ) { if( s_log_impl().has_entry_in_progress() || lev == invalid_log_level ) - return; + return invalid_log_level; - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + log_level ret = log_nothing; + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; if( current_logger_data.m_format == log_format) { + ret = current_logger_data.m_log_formatter->get_log_level(); current_logger_data.m_log_formatter->set_log_level( lev ); break; } } + return ret; } //____________________________________________________________________________// @@ -592,7 +657,10 @@ unit_test_log_t::set_format( output_format log_format ) if( s_log_impl().has_entry_in_progress() ) return; - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; current_logger_data.m_enabled = current_logger_data.m_format == log_format; } } @@ -605,7 +673,10 @@ unit_test_log_t::add_format( output_format log_format ) if( s_log_impl().has_entry_in_progress() ) return; - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; if( current_logger_data.m_format == log_format) { current_logger_data.m_enabled = true; break; @@ -617,7 +688,11 @@ unit_test_log_t::add_format( output_format log_format ) unit_test_log_formatter* unit_test_log_t::get_formatter( output_format log_format ) { - BOOST_TEST_FOREACH( unit_test_log_data_helper_impl&, current_logger_data, s_log_impl().m_log_formatter_data ) { + + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for( v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) + { + unit_test_log_data_helper_impl& current_logger_data = *it; if( current_logger_data.m_format == log_format) { return current_logger_data.m_log_formatter.get(); } @@ -630,10 +705,8 @@ void unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter ) { // remove only user defined logger - for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), - ite(s_log_impl().m_log_formatter_data.end()); - it != ite; - ++it) + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for(v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) { if( it->m_format == OF_CUSTOM_LOGGER) { s_log_impl().m_log_formatter_data.erase(it); @@ -642,21 +715,23 @@ unit_test_log_t::add_formatter( unit_test_log_formatter* the_formatter ) } if( the_formatter ) { - s_log_impl().m_log_formatter_data.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) ); + s_log_impl().m_active_log_formatter_data.clear(); // otherwise dandling references + vloggers.push_back( unit_test_log_data_helper_impl(the_formatter, OF_CUSTOM_LOGGER, true) ); } } void unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) { + if( s_log_impl().has_entry_in_progress() ) + return; + // remove only user defined logger log_level current_level = invalid_log_level; std::ostream *current_stream = 0; output_format previous_format = OF_INVALID; - for(unit_test_log_impl::v_formatter_data_t::iterator it(s_log_impl().m_log_formatter_data.begin()), - ite(s_log_impl().m_log_formatter_data.end()); - it != ite; - ++it) + v_logger_t& vloggers = s_log_impl().m_log_formatter_data; + for(v_logger_t::iterator it(vloggers.begin()), ite(vloggers.end()); it < ite; ++it) { if( it->m_enabled ) { if( current_level == invalid_log_level || it->m_format < previous_format || it->m_format == OF_CUSTOM_LOGGER) { @@ -673,6 +748,8 @@ unit_test_log_t::set_formatter( unit_test_log_formatter* the_formatter ) set_threshold_level(OF_CUSTOM_LOGGER, current_level); set_stream(OF_CUSTOM_LOGGER, *current_stream); } + + configure(); } //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/impl/unit_test_main.ipp b/ThirdParty/boost/test/impl/unit_test_main.ipp index c553c45121c8e19cf9dbcd1a288e6c3e87074fa1..4e473fba630a435498f767241a4b563af6c69e91 100644 --- a/ThirdParty/boost/test/impl/unit_test_main.ipp +++ b/ThirdParty/boost/test/impl/unit_test_main.ipp @@ -30,6 +30,7 @@ #include <boost/test/utils/basic_cstring/io.hpp> // Boost +#include <boost/core/ignore_unused.hpp> #include <boost/cstdlib.hpp> // STL @@ -200,6 +201,7 @@ unit_test_main( init_unit_test_func init_func, int argc, char* argv[] ) int result_code = 0; ut_detail::framework_shutdown_helper shutdown_helper; + boost::ignore_unused(shutdown_helper); BOOST_TEST_I_TRY { diff --git a/ThirdParty/boost/test/impl/xml_log_formatter.ipp b/ThirdParty/boost/test/impl/xml_log_formatter.ipp index e297d71fda983ed1b6f4a79fa12df3270f461185..e244d4d5f04358a21ed3e48fded02d1b7a1738d6 100644 --- a/ThirdParty/boost/test/impl/xml_log_formatter.ipp +++ b/ThirdParty/boost/test/impl/xml_log_formatter.ipp @@ -108,7 +108,7 @@ void xml_log_formatter::test_unit_skipped( std::ostream& ostr, test_unit const& tu, const_string reason ) { ostr << "<" << tu_type_name( tu ) - << " name" << utils::attr_value() << tu.p_name + << " name" << utils::attr_value() << tu.p_name.get() << " skipped" << utils::attr_value() << "yes" << " reason" << utils::attr_value() << reason << "/>"; diff --git a/ThirdParty/boost/test/minimal.hpp b/ThirdParty/boost/test/minimal.hpp index 473cc760b752ad6f9a3e0fbbee840636601ee5be..7210878bb6deec20b5b4cb663303b073aee21ab6 100644 --- a/ThirdParty/boost/test/minimal.hpp +++ b/ThirdParty/boost/test/minimal.hpp @@ -32,7 +32,10 @@ #define BOOST_TEST_MINIMAL_HPP_071894GER #include <boost/config/header_deprecated.hpp> -BOOST_HEADER_DEPRECATED( "Boost.Test minimal is deprecated. Please convert to the header only variant of Boost.Test." ) +BOOST_HEADER_DEPRECATED( "<boost/test/included/unit_test.hpp>" ) +#if defined(BOOST_ALLOW_DEPRECATED_HEADERS) +BOOST_PRAGMA_MESSAGE( "Boost.Test minimal is deprecated. Please convert to the header only variant of Boost.Test." ) +#endif #define BOOST_CHECK(exp) \ ( (exp) \ diff --git a/ThirdParty/boost/test/output/compiler_log_formatter.hpp b/ThirdParty/boost/test/output/compiler_log_formatter.hpp index 5ab0fa43c60904e76ce512220bda97ab25bd004d..cccf6151d889d3e47dfce29c53a64bdb7c43bf16 100644 --- a/ThirdParty/boost/test/output/compiler_log_formatter.hpp +++ b/ThirdParty/boost/test/output/compiler_log_formatter.hpp @@ -16,6 +16,8 @@ #include <boost/test/detail/global_typedef.hpp> #include <boost/test/unit_test_log_formatter.hpp> +#include <boost/test/utils/setcolor.hpp> + #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// @@ -31,7 +33,7 @@ namespace output { //!@brief Log formatter for the Human Readable Format (HRF) log format class BOOST_TEST_DECL compiler_log_formatter : public unit_test_log_formatter { public: - compiler_log_formatter() : m_color_output( false ) {} + compiler_log_formatter() : m_color_output( false ), m_color_state() {} // Formatter interface void log_start( std::ostream&, counter_t test_cases_amount ); @@ -59,6 +61,7 @@ protected: // Data members bool m_color_output; + utils::setcolor::state m_color_state; }; } // namespace output diff --git a/ThirdParty/boost/test/progress_monitor.hpp b/ThirdParty/boost/test/progress_monitor.hpp index 49c0b01497199cdecbab49877c0a1697441f58c6..195956abe8824fd5ff20e81eb5ff876c89d83fcf 100644 --- a/ThirdParty/boost/test/progress_monitor.hpp +++ b/ThirdParty/boost/test/progress_monitor.hpp @@ -34,7 +34,7 @@ class BOOST_TEST_DECL progress_monitor_t : public test_observer { public: /// @name Test observer interface /// @{ - virtual void test_start( counter_t test_cases_amount ); + virtual void test_start( counter_t test_cases_amount, test_unit_id ); virtual void test_aborted(); virtual void test_unit_finish( test_unit const&, unsigned long ); diff --git a/ThirdParty/boost/test/results_collector.hpp b/ThirdParty/boost/test/results_collector.hpp index 1c26a74a2a4b58046f9707c0d44da92a379f2a44..d12a8a9bf2801c962b16e388a19a78736cba921d 100644 --- a/ThirdParty/boost/test/results_collector.hpp +++ b/ThirdParty/boost/test/results_collector.hpp @@ -121,7 +121,7 @@ public: class BOOST_TEST_DECL results_collector_t : public test_observer { public: - virtual void test_start( counter_t ); + virtual void test_start( counter_t, test_unit_id ); virtual void test_unit_start( test_unit const& ); virtual void test_unit_finish( test_unit const&, unsigned long ); diff --git a/ThirdParty/boost/test/test_framework_init_observer.hpp b/ThirdParty/boost/test/test_framework_init_observer.hpp index 8bf0bb99479e4ad079ef485dbe630a657c28fad5..230fb62f914fe18c4e0ae1a919efc061f7c7f709 100644 --- a/ThirdParty/boost/test/test_framework_init_observer.hpp +++ b/ThirdParty/boost/test/test_framework_init_observer.hpp @@ -34,7 +34,7 @@ namespace unit_test { class BOOST_TEST_DECL framework_init_observer_t : public test_observer { public: - virtual void test_start( counter_t ); + virtual void test_start( counter_t, test_unit_id ); virtual void assertion_result( unit_test::assertion_result ); virtual void exception_caught( execution_exception const& ); @@ -47,12 +47,10 @@ public: /// Indicates if a failure has been recorded so far bool has_failed( ) const; - /// Singleton pattern - BOOST_TEST_SINGLETON_CONS( framework_init_observer_t ) +private: + bool m_has_failure; }; -BOOST_TEST_SINGLETON_INST( framework_init_observer ) - } // namespace unit_test } // namespace boost diff --git a/ThirdParty/boost/test/tools/assertion.hpp b/ThirdParty/boost/test/tools/assertion.hpp index 2a7d96ebb1cfdc5ba56825cd9ff2014b7a5d32bd..39eab3b03b9805b5bfb322c1746941df22eea494 100644 --- a/ThirdParty/boost/test/tools/assertion.hpp +++ b/ThirdParty/boost/test/tools/assertion.hpp @@ -65,12 +65,12 @@ namespace assertion { namespace op { #define BOOST_TEST_FOR_EACH_COMP_OP(action) \ - action( < , LT, >= ) \ - action( <=, LE, > ) \ - action( > , GT, <= ) \ - action( >=, GE, < ) \ - action( ==, EQ, != ) \ - action( !=, NE, == ) \ + action( < , LT, >=, GE ) \ + action( <=, LE, > , GT ) \ + action( > , GT, <=, LE ) \ + action( >=, GE, < , LT ) \ + action( ==, EQ, !=, NE ) \ + action( !=, NE, ==, EQ ) \ /**/ //____________________________________________________________________________// @@ -78,23 +78,23 @@ namespace op { #ifndef BOOST_NO_CXX11_DECLTYPE #define BOOST_TEST_FOR_EACH_CONST_OP(action)\ - action(->*, MEMP, ->* ) \ + action(->*, MEMP, ->*, MEMP ) \ \ - action( * , MUL, * ) \ - action( / , DIV, / ) \ - action( % , MOD, % ) \ + action( * , MUL , * , MUL ) \ + action( / , DIV , / , DIV ) \ + action( % , MOD , % , MOD ) \ \ - action( + , ADD, + ) \ - action( - , SUB, - ) \ + action( + , ADD , + , ADD ) \ + action( - , SUB , - , SUB ) \ \ - action( <<, LSH, << ) \ - action( >>, RSH, >> ) \ + action( <<, LSH , << , LSH ) \ + action( >>, RSH , >> , RSH ) \ \ BOOST_TEST_FOR_EACH_COMP_OP(action) \ \ - action( & , BAND, & ) \ - action( ^ , XOR, ^ ) \ - action( | , BOR, | ) \ + action( & , BAND, & , BAND ) \ + action( ^ , XOR , ^ , XOR ) \ + action( | , BOR , | , BOR ) \ /**/ #else @@ -108,17 +108,17 @@ namespace op { //____________________________________________________________________________// #define BOOST_TEST_FOR_EACH_MUT_OP(action) \ - action( = , SET , = ) \ - action( +=, IADD, += ) \ - action( -=, ISUB, -= ) \ - action( *=, IMUL, *= ) \ - action( /=, IDIV, /= ) \ - action( %=, IMOD, %= ) \ - action(<<=, ILSH, <<=) \ - action(>>=, IRSH, >>=) \ - action( &=, IAND, &= ) \ - action( ^=, IXOR, ^= ) \ - action( |=, IOR , |= ) \ + action( = , SET , = , SET ) \ + action( +=, IADD, += , IADD ) \ + action( -=, ISUB, -= , ISUB ) \ + action( *=, IMUL, *= , IMUL ) \ + action( /=, IDIV, /= , IDIV ) \ + action( %=, IMOD, %= , IMOD ) \ + action(<<=, ILSH, <<=, ILSH ) \ + action(>>=, IRSH, >>=, IRSH ) \ + action( &=, IAND, &= , IAND ) \ + action( ^=, IXOR, ^= , IXOR ) \ + action( |=, IOR , |= , IOR ) \ /**/ //____________________________________________________________________________// @@ -132,11 +132,20 @@ namespace op { # define DEDUCE_RESULT_TYPE( oper ) bool #endif -#define DEFINE_CONST_OPER( oper, name, rev ) \ +#define DEFINE_CONST_OPER_FWD_DECL( oper, name, rev, name_inverse ) \ template<typename Lhs, typename Rhs, \ typename Enabler=void> \ +struct name; \ +/**/ + +BOOST_TEST_FOR_EACH_CONST_OP( DEFINE_CONST_OPER_FWD_DECL ) + +#define DEFINE_CONST_OPER( oper, name, rev, name_inverse ) \ +template<typename Lhs, typename Rhs, \ + typename Enabler> \ struct name { \ typedef DEDUCE_RESULT_TYPE( oper ) result_type; \ + typedef name_inverse<Lhs, Rhs> inverse; \ \ static result_type \ eval( Lhs const& lhs, Rhs const& rhs ) \ @@ -155,6 +164,8 @@ struct name { \ << tt_detail::print_helper( rhs ); \ } \ \ + static char const* forward() \ + { return " " #oper " "; } \ static char const* revert() \ { return " " #rev " "; } \ }; \ @@ -184,7 +195,7 @@ public: template<typename T> struct RhsT : remove_const<typename remove_reference<T>::type> {}; -#define ADD_OP_SUPPORT( oper, name, _ ) \ +#define ADD_OP_SUPPORT( oper, name, _, _i ) \ template<typename T> \ binary_expr<ExprType,T, \ op::name<ValType,typename RhsT<T>::type> > \ @@ -199,7 +210,7 @@ public: /**/ #else -#define ADD_OP_SUPPORT( oper, name, _ ) \ +#define ADD_OP_SUPPORT( oper, name, _, _i ) \ template<typename T> \ binary_expr<ExprType,typename boost::decay<T const>::type, \ op::name<ValType,typename boost::decay<T const>::type> >\ @@ -281,7 +292,7 @@ public: } // Mutating operators -#define ADD_OP_SUPPORT( OPER, ID, _ ) \ +#define ADD_OP_SUPPORT( OPER, ID, _, _i)\ template<typename U> \ value_expr<T>& \ operator OPER( U const& rhs ) \ diff --git a/ThirdParty/boost/test/tools/collection_comparison_op.hpp b/ThirdParty/boost/test/tools/collection_comparison_op.hpp index ff3b37613194a2a27a51fe8d371be69b58237480..55d63301b3d72c64d55b656fa111df4632ee7edf 100644 --- a/ThirdParty/boost/test/tools/collection_comparison_op.hpp +++ b/ThirdParty/boost/test/tools/collection_comparison_op.hpp @@ -90,16 +90,19 @@ lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) if( element_ar && !reverse_ar ) return ar; // a<=b and !(b<=a) => a < b => return true - if( element_ar || !reverse_ar ) + if( element_ar || !reverse_ar ) { continue; // (a<=b and b<=a) or (!(a<b) and !(b<a)) => a == b => keep looking + } // !(a<=b) and b<=a => b < a => return false ar = false; - ar.message() << "\nFailure at position " << pos << ": " - << tt_detail::print_helper(*first1) - << OP::revert() - << tt_detail::print_helper(*first2) - << ". " << element_ar.message(); + ar.message() << "\nFailure at position " << pos << ":"; + ar.message() << "\n - condition [" << tt_detail::print_helper(*first1) << OP::forward() << tt_detail::print_helper(*first2) << "] is false"; + if(!element_ar.has_empty_message()) + ar.message() << ": " << element_ar.message(); + ar.message() << "\n - inverse condition [" << tt_detail::print_helper(*first2) << OP::forward() << tt_detail::print_helper(*first1) << "] is true"; + if(!reverse_ar.has_empty_message()) + ar.message() << ": " << reverse_ar.message(); return ar; } @@ -131,8 +134,8 @@ typename boost::enable_if_c< assertion_result>::type lexicographic_compare( Lhs const& lhs, Rhs const& rhs ) { - typedef typename unit_test::deduce_cstring<Lhs>::type lhs_char_type; - typedef typename unit_test::deduce_cstring<Rhs>::type rhs_char_type; + typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; + typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; return lexicographic_compare<OP, can_be_equal, prefer_shorter>( lhs_char_type(lhs), @@ -174,11 +177,13 @@ element_compare( Lhs const& lhs, Rhs const& rhs ) continue; ar = false; - ar.message() << "\nMismatch at position " << pos << ": " + ar.message() << "\n - mismatch at position " << pos << ": [" << tt_detail::print_helper(*left) - << OP::revert() + << OP::forward() << tt_detail::print_helper(*right) - << ". " << element_ar.message(); + << "] is false"; + if(!element_ar.has_empty_message()) + ar.message() << ": " << element_ar.message(); } return ar; @@ -192,8 +197,8 @@ typename boost::enable_if_c< assertion_result>::type element_compare( Lhs const& lhs, Rhs const& rhs ) { - typedef typename unit_test::deduce_cstring<Lhs>::type lhs_char_type; - typedef typename unit_test::deduce_cstring<Rhs>::type rhs_char_type; + typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; + typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; return element_compare<OP>(lhs_char_type(lhs), rhs_char_type(rhs)); @@ -383,15 +388,16 @@ compare_collections( Lhs const& lhs, Rhs const& rhs, boost::type<op::GE<L, R> >* // ********* specialization of comparison operators for collections ********* // // ************************************************************************** // -#define DEFINE_COLLECTION_COMPARISON( oper, name, rev ) \ +#define DEFINE_COLLECTION_COMPARISON( oper, name, rev, name_inverse ) \ template<typename Lhs,typename Rhs> \ struct name<Lhs,Rhs,typename boost::enable_if_c< \ unit_test::is_forward_iterable<Lhs>::value \ - && !unit_test::is_cstring_comparable<Lhs>::value \ + && !unit_test::is_cstring_comparable<Lhs>::value \ && unit_test::is_forward_iterable<Rhs>::value \ - && !unit_test::is_cstring_comparable<Rhs>::value>::type> { \ + && !unit_test::is_cstring_comparable<Rhs>::value>::type> { \ public: \ typedef assertion_result result_type; \ + typedef name_inverse<Lhs, Rhs> inverse; \ typedef unit_test::bt_iterator_traits<Lhs> t_Lhs_iterator_helper; \ typedef unit_test::bt_iterator_traits<Rhs> t_Rhs_iterator_helper; \ \ @@ -429,6 +435,8 @@ public: \ PrevExprType const&, \ Rhs const& ) {} \ \ + static char const* forward() \ + { return " " #oper " "; } \ static char const* revert() \ { return " " #rev " "; } \ \ diff --git a/ThirdParty/boost/test/tools/cstring_comparison_op.hpp b/ThirdParty/boost/test/tools/cstring_comparison_op.hpp index 50f181d8581dec86e0eb79597f4eba4dd4307201..04b38561ee6f91c89faa100c7c478b80a781f2f9 100644 --- a/ThirdParty/boost/test/tools/cstring_comparison_op.hpp +++ b/ThirdParty/boost/test/tools/cstring_comparison_op.hpp @@ -34,17 +34,18 @@ namespace op { // ************** string_compare ************** // // ************************************************************************** // -#define DEFINE_CSTRING_COMPARISON( oper, name, rev ) \ +#define DEFINE_CSTRING_COMPARISON( oper, name, rev, name_inverse ) \ template<typename Lhs,typename Rhs> \ struct name<Lhs,Rhs,typename boost::enable_if_c< \ ( unit_test::is_cstring_comparable<Lhs>::value \ && unit_test::is_cstring_comparable<Rhs>::value) \ >::type > \ { \ - typedef typename unit_test::deduce_cstring<Lhs>::type lhs_char_type; \ - typedef typename unit_test::deduce_cstring<Rhs>::type rhs_char_type; \ + typedef typename unit_test::deduce_cstring_transform<Lhs>::type lhs_char_type; \ + typedef typename unit_test::deduce_cstring_transform<Rhs>::type rhs_char_type; \ public: \ typedef assertion_result result_type; \ + typedef name_inverse<Lhs, Rhs> inverse; \ \ typedef name< \ typename lhs_char_type::value_type, \ @@ -67,6 +68,8 @@ public: \ << tt_detail::print_helper( rhs ); \ } \ \ + static char const* forward() \ + { return " " #oper " "; } \ static char const* revert() \ { return " " #rev " "; } \ }; \ diff --git a/ThirdParty/boost/test/tools/detail/bitwise_manip.hpp b/ThirdParty/boost/test/tools/detail/bitwise_manip.hpp index f8c9685c1074d1613f0c265fb8a3f5d70b0a2535..329a893a9a7b781171bfb450cf7362cf8050867b 100644 --- a/ThirdParty/boost/test/tools/detail/bitwise_manip.hpp +++ b/ThirdParty/boost/test/tools/detail/bitwise_manip.hpp @@ -34,12 +34,18 @@ namespace test_tools { // ************************************************************************** // //! Bitwise comparison manipulator +//! This is a terminal for the expression struct bitwise {}; //____________________________________________________________________________// -inline int -operator<<( unit_test::lazy_ostream const&, bitwise ) { return 0; } +inline unit_test::lazy_ostream & +operator<<( unit_test::lazy_ostream &o, bitwise ) { return o; } + +// needed for the lazy evaluation in lazy_ostream as bitwise is a terminal +inline std::ostream& +operator<<( std::ostream& o, bitwise ) { return o; } + //____________________________________________________________________________// @@ -106,10 +112,10 @@ operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,assertion::op::EQ<T //____________________________________________________________________________// -inline check_type +inline assertion_type operator<<( assertion_type const& , bitwise ) { - return CHECK_BUILT_ASSERTION; + return assertion_type(CHECK_BUILT_ASSERTION); } //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/tools/detail/expression_holder.hpp b/ThirdParty/boost/test/tools/detail/expression_holder.hpp deleted file mode 100644 index 694a2d5f4ec9657d3ab768c3a22ce2c7f33cf449..0000000000000000000000000000000000000000 --- a/ThirdParty/boost/test/tools/detail/expression_holder.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// (C) Copyright Gennadiy Rozental 2001. -// 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) - -// See http://www.boost.org/libs/test for the library home page. -// -// File : $RCSfile$ -// -// Version : $Revision: 74248 $ -// -// Description : toolbox implementation details -// *************************************************************************** - -#ifndef BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER -#define BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER - -#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS - -#include <boost/test/detail/suppress_warnings.hpp> - -//____________________________________________________________________________// - -namespace boost { -namespace test_tools { -namespace tt_detail { - -// ************************************************************************** // -// ************** tt_detail::expression_holder ************** // -// ************************************************************************** // - -class expression_holder { -public: - virtual ~expression_holder() {} - virtual assertion_result evaluate( bool no_message = false ) const = 0; -}; - -//____________________________________________________________________________// - -template<typename E> -class expression_holder_t: public expression_holder { -public: - explicit expression_holder_t( E const& e ) : m_expr( e ) {} - -private: - virtual assertion_result evaluate( bool no_message = false ) const { return m_expr.evaluate( no_message ); } - - E m_expr; -}; - -//____________________________________________________________________________// - -template<typename E> -expression_holder_t<E> -hold_expression( E const& e ) -{ - return expression_holder_t<E>( e ); -} - -//____________________________________________________________________________// - -} // namespace tt_detail -} // namespace test_tools -} // namespace boost - -#include <boost/test/detail/enable_warnings.hpp> - -#endif - -#endif // BOOST_TEST_TOOLS_DETAIL_EXPRESSION_HOLDER_HPP_012705GER diff --git a/ThirdParty/boost/test/tools/detail/indirections.hpp b/ThirdParty/boost/test/tools/detail/indirections.hpp index 836218d98d8932496429f7604ecc7ee3c188b1e7..2622f2a6538da3804d043d8ee171a928be1ae569 100644 --- a/ThirdParty/boost/test/tools/detail/indirections.hpp +++ b/ThirdParty/boost/test/tools/detail/indirections.hpp @@ -19,6 +19,10 @@ #include <boost/test/tools/detail/fwd.hpp> #include <boost/test/tools/assertion_result.hpp> +#include <boost/test/utils/lazy_ostream.hpp> + +#include <boost/shared_ptr.hpp> +#include <list> #include <boost/test/detail/suppress_warnings.hpp> @@ -28,16 +32,41 @@ namespace boost { namespace test_tools { namespace tt_detail { +struct assertion_evaluation_context +{ + assertion_evaluation_context(bool has_report = false) + : m_has_report(has_report) + {} + + bool m_has_report; +}; + // ************************************************************************** // // ************** assertion_evaluate indirection ************** // // ************************************************************************** // template<typename E> struct assertion_evaluate_t { - assertion_evaluate_t( E const& e ) : m_e( e ) {} - operator assertion_result() { return m_e.evaluate( true ); } + + typedef shared_ptr<assertion_evaluation_context> context_holder; + + assertion_evaluate_t( E const& e ) : m_e( e ), m_evaluate( true ) + {} + + operator assertion_result() { return m_e.evaluate( m_evaluate ); } + + assertion_evaluate_t<E> + stack_context(context_holder context) const { + assertion_evaluate_t<E> added_context(*this); + + added_context.m_context_holder.push_back(context); + added_context.m_evaluate = !context->m_has_report; + return added_context; + } E const& m_e; + std::list< context_holder > m_context_holder; + bool m_evaluate; }; //____________________________________________________________________________// @@ -58,14 +87,12 @@ operator<<( assertion_evaluate_t<E> const& ae, T const& ) { return ae; } // ************** assertion_text indirection ************** // // ************************************************************************** // -template<typename T> -inline unit_test::lazy_ostream const& -assertion_text( unit_test::lazy_ostream const& /*et*/, T const& m ) { return m; } - -//____________________________________________________________________________// - inline unit_test::lazy_ostream const& -assertion_text( unit_test::lazy_ostream const& et, int ) { return et; } +assertion_text( unit_test::lazy_ostream const& et, unit_test::lazy_ostream const& s) { + if(!s.empty()) + return s; + return et; +} //____________________________________________________________________________// @@ -74,7 +101,11 @@ assertion_text( unit_test::lazy_ostream const& et, int ) { return et; } // ************************************************************************** // struct assertion_type { - operator check_type() { return CHECK_MSG; } + assertion_type(check_type ct = CHECK_MSG) : m_check_type(ct) + {} + + operator check_type() { return m_check_type; } + check_type m_check_type; }; //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/tools/detail/lexicographic_manip.hpp b/ThirdParty/boost/test/tools/detail/lexicographic_manip.hpp index f6ffff7a34cecb70db9c7ecad1a40d74b26f1bda..30a49c09275fa9ec400ae45f2fea521ad9ff38c2 100644 --- a/ThirdParty/boost/test/tools/detail/lexicographic_manip.hpp +++ b/ThirdParty/boost/test/tools/detail/lexicographic_manip.hpp @@ -17,8 +17,11 @@ #include <boost/test/tools/detail/indirections.hpp> #include <boost/test/tools/assertion.hpp> +#include <boost/test/utils/lazy_ostream.hpp> #include <boost/test/tools/collection_comparison_op.hpp> +#include <ostream> + #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// @@ -31,12 +34,17 @@ namespace test_tools { // ************************************************************************** // //! Lexicographic comparison manipulator, for containers +//! This is a terminal that involves evaluation of the expression struct lexicographic {}; //____________________________________________________________________________// -inline int -operator<<( unit_test::lazy_ostream const&, lexicographic ) { return 0; } +inline unit_test::lazy_ostream& +operator<<( unit_test::lazy_ostream & o, lexicographic ) { return o; } + +// needed for the lazy evaluation in lazy_ostream as lexicographic is a terminal +inline std::ostream& +operator<<( std::ostream& o, lexicographic ) { return o; } //____________________________________________________________________________// @@ -52,10 +60,10 @@ operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, le //____________________________________________________________________________// -inline check_type +inline assertion_type operator<<( assertion_type const&, lexicographic ) { - return CHECK_BUILT_ASSERTION; + return assertion_type(CHECK_BUILT_ASSERTION); } //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/tools/detail/per_element_manip.hpp b/ThirdParty/boost/test/tools/detail/per_element_manip.hpp index 4a9aebbaaacbdc0a9b2d5eb1e0b149bbb1348c65..98b5703685279aad0b24a5a3c05d32f732d1dfc6 100644 --- a/ThirdParty/boost/test/tools/detail/per_element_manip.hpp +++ b/ThirdParty/boost/test/tools/detail/per_element_manip.hpp @@ -16,9 +16,12 @@ #include <boost/test/tools/detail/fwd.hpp> #include <boost/test/tools/detail/indirections.hpp> +#include <boost/test/utils/lazy_ostream.hpp> #include <boost/test/tools/assertion.hpp> #include <boost/test/tools/collection_comparison_op.hpp> +#include <ostream> + #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// @@ -31,12 +34,17 @@ namespace test_tools { // ************************************************************************** // //! Per element comparison manipulator, for containers +//! This is a terminal that involves evaluation of the expression struct per_element {}; //____________________________________________________________________________// -inline int -operator<<( unit_test::lazy_ostream const&, per_element ) { return 0; } +inline unit_test::lazy_ostream& +operator<<( unit_test::lazy_ostream &o, per_element ) { return o; } + +// needed for the lazy evaluation in lazy_ostream as per_element is a terminal +inline std::ostream& +operator<<( std::ostream& o, per_element ) { return o; } //____________________________________________________________________________// @@ -52,10 +60,10 @@ operator<<(assertion_evaluate_t<assertion::binary_expr<T1,T2,OP> > const& ae, pe //____________________________________________________________________________// -inline check_type +inline assertion_type operator<<( assertion_type const&, per_element ) { - return CHECK_BUILT_ASSERTION; + return assertion_type(CHECK_BUILT_ASSERTION); } //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/tools/detail/tolerance_manip.hpp b/ThirdParty/boost/test/tools/detail/tolerance_manip.hpp index e07b0435913588bd28f0f90237190edf58c1474c..af945cf704ae81128952aa935c4954c452fa7077 100644 --- a/ThirdParty/boost/test/tools/detail/tolerance_manip.hpp +++ b/ThirdParty/boost/test/tools/detail/tolerance_manip.hpp @@ -19,9 +19,12 @@ #include <boost/test/tools/detail/fwd.hpp> #include <boost/test/tools/detail/indirections.hpp> +#include <boost/test/utils/lazy_ostream.hpp> #include <boost/test/tools/fpc_tolerance.hpp> #include <boost/test/tools/floating_point_comparison.hpp> +#include <ostream> + #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// @@ -34,6 +37,8 @@ namespace tt_detail { // ************** fpc tolerance manipulator ************** // // ************************************************************************** // +//! Tolerance manipulator, not to be used directly +//! This is not a terminal of the expression template<typename FPT> struct tolerance_manip { explicit tolerance_manip( FPT const & tol ) : m_value( tol ) {} @@ -55,28 +60,47 @@ operator%( FPT v, tolerance_manip_delay const& ) return tolerance_manip<FPT>( FPT(v / 100) ); } +template <typename FPT> +struct tolerance_evaluation_context: assertion_evaluation_context { + tolerance_evaluation_context(FPT tol) + : assertion_evaluation_context( true ) // has report + , m_tolerance_context(tol) + {} + + local_fpc_tolerance<FPT> m_tolerance_context; +}; + //____________________________________________________________________________// template<typename E, typename FPT> -inline assertion_result +inline assertion_evaluate_t<E> operator<<(assertion_evaluate_t<E> const& ae, tolerance_manip<FPT> const& tol) { - local_fpc_tolerance<FPT> lt( tol.m_value ); - - return ae.m_e.evaluate(); + return ae.stack_context( + typename assertion_evaluate_t<E>::context_holder( + new tolerance_evaluation_context<FPT>( tol.m_value )) + ); } //____________________________________________________________________________// template<typename FPT> -inline int -operator<<( unit_test::lazy_ostream const&, tolerance_manip<FPT> const& ) { return 0; } +unit_test::lazy_ostream & +operator<<( unit_test::lazy_ostream &o, tolerance_manip<FPT> const& ) { return o; } + +// needed for the lazy evaluation in lazy_ostream as for commutativity with other arguments +template<typename FPT> +std::ostream& +operator<<( std::ostream& o, tolerance_manip<FPT> const& ) { return o; } + //____________________________________________________________________________// template<typename FPT> -inline check_type -operator<<( assertion_type const& /*at*/, tolerance_manip<FPT> const& ) { return CHECK_BUILT_ASSERTION; } +inline assertion_type +operator<<( assertion_type const& /*at*/, tolerance_manip<FPT> const& ) { + return assertion_type(CHECK_BUILT_ASSERTION); +} //____________________________________________________________________________// diff --git a/ThirdParty/boost/test/tools/floating_point_comparison.hpp b/ThirdParty/boost/test/tools/floating_point_comparison.hpp index 810840e3459a895e8286eda297401c99d626224d..1364fde8b81761db3e4c32bd3c2d82f48082a6b9 100644 --- a/ThirdParty/boost/test/tools/floating_point_comparison.hpp +++ b/ThirdParty/boost/test/tools/floating_point_comparison.hpp @@ -23,6 +23,8 @@ #include <boost/mpl/bool.hpp> #include <boost/type_traits/is_floating_point.hpp> #include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_void.hpp> #include <boost/type_traits/conditional.hpp> #include <boost/utility/enable_if.hpp> @@ -50,6 +52,23 @@ struct tolerance_based_delegate; template <typename T> struct tolerance_based_delegate<T, false> : mpl::false_ {}; +// from https://stackoverflow.com/a/16509511/1617295 +template<typename T> +class is_abstract_class_or_function +{ + typedef char (&Two)[2]; + template<typename U> static char test(U(*)[1]); + template<typename U> static Two test(...); + +public: + static const bool value = + !is_reference<T>::value + && !is_void<T>::value + && (sizeof(test<T>(0)) == sizeof(Two)); +}; + +// warning: we cannot instanciate std::numeric_limits for incomplete types, we use is_abstract_class_or_function +// prior to the specialization below template <typename T> struct tolerance_based_delegate<T, true> : mpl::bool_< @@ -68,7 +87,7 @@ struct tolerance_based_delegate<T, true> * floating point (eg. boost.multiprecision). */ template <typename T> -struct tolerance_based : tolerance_based_delegate<T, !is_array<T>::value >::type {}; +struct tolerance_based : tolerance_based_delegate<T, !is_array<T>::value && !is_abstract_class_or_function<T>::value>::type {}; // ************************************************************************** // // ************** fpc::strength ************** // @@ -160,7 +179,7 @@ safe_fpt_division( FPT f1, FPT f2 ) return fpt_limits<FPT>::max_value(); // Avoid underflow. - if( (f1 == static_cast<FPT>(0)) || + if( (fpt_abs(f1) <= fpt_limits<FPT>::min_value()) || ((f2 > static_cast<FPT>(1)) && (f1 < f2*fpt_limits<FPT>::min_value())) ) return static_cast<FPT>(0); diff --git a/ThirdParty/boost/test/tools/fpc_op.hpp b/ThirdParty/boost/test/tools/fpc_op.hpp index 18162e358a8aa25de4f9cc48f268facf93a140b9..22bfeaa31d7d312b9f94e8f8ff43bb89c0faab28 100644 --- a/ThirdParty/boost/test/tools/fpc_op.hpp +++ b/ThirdParty/boost/test/tools/fpc_op.hpp @@ -66,11 +66,33 @@ template <typename FPT, typename Lhs, typename Rhs, typename OP> inline assertion_result compare_fpv( Lhs const& lhs, Rhs const& rhs, OP* cmp_operator) { - bool result = cmp_operator->eval_direct(lhs, rhs); + assertion_result result_direct_compare = cmp_operator->eval_direct(lhs, rhs); if(fpctraits<OP>::equality_logical_disjunction) { - return result || compare_fpv<FPT>(lhs, rhs, (op::EQ<Lhs, Rhs>*)0); + // this look like this can be simplified, but combining result && compare_fpv + // looses the message in the return value of compare_fpv + if( result_direct_compare ) { + result_direct_compare.message() << "operation" << OP::forward() << "on arguments yields 'true'."; + return result_direct_compare; + } + // result || compare_fpv(EQ) + assertion_result result_eq = compare_fpv<FPT>(lhs, rhs, (op::EQ<Lhs, Rhs>*)0); + result_direct_compare = result_direct_compare || result_eq; + if( !result_eq ) { + result_direct_compare.message() << "operation" << op::EQ<Lhs, Rhs>::forward() << "on arguments yields 'false': " << result_eq.message() << "."; + } + return result_direct_compare; } - return result && compare_fpv<FPT>(lhs, rhs, (op::NE<Lhs, Rhs>*)0); + if( !result_direct_compare ) { + result_direct_compare.message() << "operation" << OP::forward() << " on arguments yields 'false'."; + return result_direct_compare; + } + // result && compare_fpv(NE) + assertion_result result_neq = compare_fpv<FPT>(lhs, rhs, (op::NE<Lhs, Rhs>*)0); + result_direct_compare = result_direct_compare && result_neq; + if( !result_neq ) { + result_direct_compare.message() << "operation" << op::NE<Lhs, Rhs>::forward() << "on arguments yields 'false': " << result_neq.message() << "."; + } + return result_direct_compare; } //____________________________________________________________________________// @@ -83,7 +105,7 @@ compare_fpv_near_zero( FPT const& fpv, op::EQ<Lhs,Rhs>* ) assertion_result ar( P( fpv ) ); if( !ar ) - ar.message() << "Absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance<FPT>() << ']'; + ar.message() << "absolute value exceeds tolerance [|" << fpv << "| > "<< fpc_tolerance<FPT>() << ']'; return ar; } @@ -98,7 +120,7 @@ compare_fpv_near_zero( FPT const& fpv, op::NE<Lhs,Rhs>* ) assertion_result ar( !P( fpv ) ); if( !ar ) - ar.message() << "Absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance<FPT>() << ']'; + ar.message() << "absolute value is within tolerance [|" << fpv << "| < "<< fpc_tolerance<FPT>() << ']'; return ar; } @@ -119,7 +141,7 @@ compare_fpv( Lhs const& lhs, Rhs const& rhs, op::EQ<Lhs,Rhs>* ) assertion_result ar( P( lhs, rhs ) ); if( !ar ) - ar.message() << "Relative difference exceeds tolerance [" + ar.message() << "relative difference exceeds tolerance [" << P.tested_rel_diff() << " > " << P.fraction_tolerance() << ']'; return ar; } @@ -142,7 +164,7 @@ compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE<Lhs,Rhs>* ) assertion_result ar( !P( lhs, rhs ) ); if( !ar ) - ar.message() << "Relative difference is within tolerance [" + ar.message() << "relative difference is within tolerance [" << P.tested_rel_diff() << " < " << fpc_tolerance<FPT>() << ']'; return ar; @@ -151,7 +173,7 @@ compare_fpv( Lhs const& lhs, Rhs const& rhs, op::NE<Lhs,Rhs>* ) //____________________________________________________________________________// -#define DEFINE_FPV_COMPARISON( oper, name, rev ) \ +#define DEFINE_FPV_COMPARISON( oper, name, rev, name_inverse ) \ template<typename Lhs,typename Rhs> \ struct name<Lhs,Rhs,typename boost::enable_if_c< \ (fpc::tolerance_based<Lhs>::value && \ @@ -164,6 +186,7 @@ struct name<Lhs,Rhs,typename boost::enable_if_c< \ public: \ typedef typename common_type<Lhs,Rhs>::type FPT; \ typedef name<Lhs,Rhs> OP; \ + typedef name_inverse<Lhs, Rhs> inverse; \ \ typedef assertion_result result_type; \ \ @@ -199,6 +222,8 @@ public: \ << tt_detail::print_helper( rhs ); \ } \ \ + static char const* forward() \ + { return " " #oper " "; } \ static char const* revert() \ { return " " #rev " "; } \ }; \ diff --git a/ThirdParty/boost/test/tools/interface.hpp b/ThirdParty/boost/test/tools/interface.hpp index 5e84f1c6d4e7d01ec78a0f836f82f5bc6aef5f77..e62ae946c02846af0517a0e3502e18a2dd89c504 100644 --- a/ThirdParty/boost/test/tools/interface.hpp +++ b/ThirdParty/boost/test/tools/interface.hpp @@ -20,9 +20,6 @@ #ifdef BOOST_TEST_TOOLS_DEBUGGABLE #include <boost/test/debug.hpp> #endif -#ifdef BOOST_NO_CXX11_AUTO_DECLARATIONS -#include <boost/test/tools/detail/expression_holder.hpp> -#endif #include <boost/test/detail/pp_variadic.hpp> diff --git a/ThirdParty/boost/test/tree/global_fixture.hpp b/ThirdParty/boost/test/tree/global_fixture.hpp index f64ddeae2dbd608dca3350711b08d8fbb5bd8cec..edd86a48456450a5c523d796ea0e4c63e98a417b 100644 --- a/ThirdParty/boost/test/tree/global_fixture.hpp +++ b/ThirdParty/boost/test/tree/global_fixture.hpp @@ -87,7 +87,7 @@ struct global_configuration_impl : public global_configuration { } // test observer interface - virtual void test_start( counter_t ) { + virtual void test_start( counter_t, test_unit_id ) { m_configuration_observer = new F; } diff --git a/ThirdParty/boost/test/tree/observer.hpp b/ThirdParty/boost/test/tree/observer.hpp index 46b26905e3fa4a009f36e731b8334c7b7a51c386..0c0a4013af3b8df324a65695fd6f6d3cadbb2631 100644 --- a/ThirdParty/boost/test/tree/observer.hpp +++ b/ThirdParty/boost/test/tree/observer.hpp @@ -44,7 +44,8 @@ public: //! //! @param[in] number_of_test_cases indicates the number of test cases. Only active //! test cases are taken into account. - virtual void test_start( counter_t /* number_of_test_cases */ ) {} + //! @param[in] root_test_unit_id the ID root of the test tree currently being tested + virtual void test_start( counter_t /* number_of_test_cases */, test_unit_id /* root_test_unit_id */ ) {} //! Called after the framework ends executing the test cases //! diff --git a/ThirdParty/boost/test/tree/test_case_counter.hpp b/ThirdParty/boost/test/tree/test_case_counter.hpp index a74f37f152e93ae0c8acae552ce6310b96834aa3..2d9b3bdddc3598a79555c33226058eb765d8644e 100644 --- a/ThirdParty/boost/test/tree/test_case_counter.hpp +++ b/ThirdParty/boost/test/tree/test_case_counter.hpp @@ -34,13 +34,19 @@ namespace unit_test { class test_case_counter : public test_tree_visitor { public: // Constructor - test_case_counter() : p_count( 0 ) {} + // @param ignore_disabled ignore the status when counting + test_case_counter(bool ignore_status = false) + : p_count( 0 ) + , m_ignore_status(ignore_status) + {} BOOST_READONLY_PROPERTY( counter_t, (test_case_counter)) p_count; private: // test tree visitor interface - virtual void visit( test_case const& tc ) { if( tc.is_enabled() ) ++p_count.value; } - virtual bool test_suite_start( test_suite const& ts ) { return ts.is_enabled(); } + virtual void visit( test_case const& tc ) { if( m_ignore_status || tc.is_enabled() ) ++p_count.value; } + virtual bool test_suite_start( test_suite const& ts ) { return m_ignore_status || ts.is_enabled(); } + + bool m_ignore_status; }; } // namespace unit_test diff --git a/ThirdParty/boost/test/tree/test_case_template.hpp b/ThirdParty/boost/test/tree/test_case_template.hpp index 6aa0bb7e3b342406219c8f373b37dbe53e6b182c..e88c2ff0b9ea81d03e728a7bdbc4dbe2f6b915c6 100644 --- a/ThirdParty/boost/test/tree/test_case_template.hpp +++ b/ThirdParty/boost/test/tree/test_case_template.hpp @@ -19,8 +19,8 @@ #include <boost/test/tree/test_unit.hpp> #include <boost/test/utils/class_properties.hpp> - #include <boost/test/tree/observer.hpp> +#include <boost/test/utils/algorithm.hpp> // Boost @@ -94,6 +94,16 @@ struct generate_test_case_4_type { #else full_name += BOOST_CURRENT_FUNCTION; #endif + + // replacing ',' by ', ' first, and then removing any double space + static const std::string to_replace[] = { "class ", "struct ", ",", " ", " <", " >"}; + static const std::string replacement[] = { "", "" , ", ", " ", "<" , ">"}; + + full_name = unit_test::utils::replace_all_occurrences_of( + full_name, + to_replace, to_replace + sizeof(to_replace)/sizeof(to_replace[0]), + replacement, replacement + sizeof(replacement)/sizeof(replacement[0])); + typedef typename boost::remove_reference<TestType>::type TestTypewoRef; if( boost::is_const<TestTypewoRef>::value ) full_name += "_const"; diff --git a/ThirdParty/boost/test/tree/test_unit.hpp b/ThirdParty/boost/test/tree/test_unit.hpp index 45956f689df77f8043c6397a931b757fa0361202..0eab1d9941dd6ddd93b899457e85575c65f5700e 100644 --- a/ThirdParty/boost/test/tree/test_unit.hpp +++ b/ThirdParty/boost/test/tree/test_unit.hpp @@ -114,8 +114,6 @@ protected: test_unit( const_string tu_name, const_string tc_file, std::size_t tc_line, test_unit_type t ); // Master test suite constructor explicit test_unit( const_string module_name ); - -private: }; // ************************************************************************** // diff --git a/ThirdParty/boost/test/unit_test_log.hpp b/ThirdParty/boost/test/unit_test_log.hpp index 5de9f433402e0326d8293de10e7ac0601cc8364d..e90c6813aa5490b340bc3a34b442cdd0340415b1 100644 --- a/ThirdParty/boost/test/unit_test_log.hpp +++ b/ThirdParty/boost/test/unit_test_log.hpp @@ -111,7 +111,7 @@ private: class BOOST_TEST_DECL unit_test_log_t : public test_observer { public: // test_observer interface implementation - virtual void test_start( counter_t test_cases_amount ); + virtual void test_start( counter_t test_cases_amount, test_unit_id ); virtual void test_finish(); virtual void test_aborted(); @@ -147,13 +147,15 @@ public: //! Sets the threshold level for all loggers/formatters. //! //! This will override the log level of all loggers, whether enabled or not. - void set_threshold_level( log_level ); + //! @return the minimum of the previous log level of all formatters (new in Boost 1.73) + log_level set_threshold_level( log_level ); //! Sets the threshold/log level of a specific format //! //! @note Has no effect if the specified format is not found //! @par Since Boost 1.62 - void set_threshold_level( output_format, log_level ); + //! @return the previous log level of the corresponding formatter (new in Boost 1.73) + log_level set_threshold_level( output_format, log_level ); //! Add a format to the set of loggers //! @@ -215,12 +217,9 @@ public: ut_detail::entry_value_collector operator()( log_level ); // initiate entry collection + //! Prepares internal states after log levels, streams and format has been set up + void configure(); private: - // Implementation helpers - bool log_entry_start(output_format log_format); - void log_entry_context( log_level l ); - void clear_entry_context(); - // Singleton BOOST_TEST_SINGLETON_CONS( unit_test_log_t ) }; // unit_test_log_t @@ -245,7 +244,7 @@ BOOST_TEST_SINGLETON_INST( unit_test_log ) (::boost::unit_test::unit_test_log \ << ::boost::unit_test::log::begin( \ "boost.test framework", \ - __LINE__ )) \ + 0 )) \ ( ::boost::unit_test::log_messages ) \ << BOOST_TEST_LAZY_MSG( M ) \ /**/ diff --git a/ThirdParty/boost/test/unit_test_log_formatter.hpp b/ThirdParty/boost/test/unit_test_log_formatter.hpp index e4648b4dabe81d15124b8b13fd890f0105b31733..6ec72cafa7ab8d3f375384224c631305354feff3 100644 --- a/ThirdParty/boost/test/unit_test_log_formatter.hpp +++ b/ThirdParty/boost/test/unit_test_log_formatter.hpp @@ -172,6 +172,7 @@ public: } /// Deprecated version of this interface + /// @deprecated virtual void test_unit_skipped( std::ostream& /* os */, test_unit const& /* tu */) {} /// Invoked when a test unit is aborted @@ -324,4 +325,3 @@ protected: #include <boost/test/detail/enable_warnings.hpp> #endif // BOOST_TEST_UNIT_TEST_LOG_FORMATTER_HPP_071894GER - diff --git a/ThirdParty/boost/test/unit_test_suite.hpp b/ThirdParty/boost/test/unit_test_suite.hpp index f55eff7291c3d466e889f2030536ffd4ace9411d..f74a4c47a55b7cc79778405ca2b34f5fa6aa51bf 100644 --- a/ThirdParty/boost/test/unit_test_suite.hpp +++ b/ThirdParty/boost/test/unit_test_suite.hpp @@ -13,6 +13,7 @@ #define BOOST_TEST_UNIT_TEST_SUITE_HPP_071894GER // Boost.Test +#include <boost/test/detail/config.hpp> #include <boost/test/framework.hpp> #include <boost/test/tree/auto_registration.hpp> #include <boost/test/tree/test_case_template.hpp> @@ -376,6 +377,12 @@ BOOST_TEST_APPEND_UNIQUE_ID( BOOST_JOIN( test_name, _registrar ) ) BOOST_ATTRIBU #if defined(BOOST_TEST_MAIN) +// initializing the master test suite name from the user defined macros +// this function should be seen exactly once. +#ifdef BOOST_TEST_MODULE +static const boost::unit_test::framework::impl::master_test_suite_name_setter mtsetter(BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" )); +#endif + #ifdef BOOST_TEST_ALTERNATIVE_INIT_API bool init_unit_test() { #else @@ -383,12 +390,6 @@ bool init_unit_test() { init_unit_test_suite( int, char* [] ) { #endif -#ifdef BOOST_TEST_MODULE - using namespace ::boost::unit_test; - assign_op( framework::master_test_suite().p_name.value, BOOST_TEST_STRINGIZE( BOOST_TEST_MODULE ).trim( "\"" ), 0 ); - -#endif - #ifdef BOOST_TEST_ALTERNATIVE_INIT_API return true; } diff --git a/ThirdParty/boost/test/utils/basic_cstring/basic_cstring.hpp b/ThirdParty/boost/test/utils/basic_cstring/basic_cstring.hpp index 3f33e826495bf653e93d8907f7f5a9af319540d1..d1953dbd36f73dbc67a73e28ff495d4f050eb1e4 100644 --- a/ThirdParty/boost/test/utils/basic_cstring/basic_cstring.hpp +++ b/ThirdParty/boost/test/utils/basic_cstring/basic_cstring.hpp @@ -26,6 +26,10 @@ // STL #include <string> +#if defined(BOOST_TEST_STRING_VIEW) +#include <string_view> +#endif + #include <boost/test/detail/suppress_warnings.hpp> //____________________________________________________________________________// @@ -166,6 +170,30 @@ private: static CharT null; }; +// ************************************************************************** // +// ************** cstring_string_view_helper ************** // +// ************************************************************************** // + + +#if defined(BOOST_TEST_STRING_VIEW) +// Helper for instanciating a subclass of cstring using a string_view. We do not +// change the API of cstring using BOOST_TEST_STRING_VIEW as the code should remain +// compatible between boost.test and test module using different compiler options. +//! @internal +template <class CharT, class string_view_t = std::basic_string_view<CharT>> +class BOOST_SYMBOL_VISIBLE stringview_cstring_helper : public basic_cstring<CharT> { +public: + stringview_cstring_helper(string_view_t const& sv) + : basic_cstring<CharT>(const_cast<CharT*>(sv.data()), sv.size()) + {} +}; +#endif + + +// ************************************************************************** // +// ************** basic_cstring::impl ************** // +// ************************************************************************** // + //____________________________________________________________________________// template<typename CharT> diff --git a/ThirdParty/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp b/ThirdParty/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp index 88c340689658c11661b14273e8e960e3bcfc5042..0401e832156e2dcf9582e47ea43b8e6df6a56684 100644 --- a/ThirdParty/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp +++ b/ThirdParty/boost/test/utils/basic_cstring/basic_cstring_fwd.hpp @@ -18,6 +18,7 @@ #include <boost/test/detail/config.hpp> + namespace boost { namespace unit_test { @@ -32,6 +33,12 @@ typedef const_string const literal_string; typedef char const* const c_literal_string; +#if defined(BOOST_TEST_STRING_VIEW) +template <class CharT, class string_view_t> +class BOOST_SYMBOL_VISIBLE stringview_cstring_helper; +#endif + + } // namespace unit_test } // namespace boost diff --git a/ThirdParty/boost/test/utils/is_cstring.hpp b/ThirdParty/boost/test/utils/is_cstring.hpp index 12326b0418769b21b08133c346c540634da9f9bf..ffec3657ac6ead948c74a2e9a5cc6dfecef22b49 100644 --- a/ThirdParty/boost/test/utils/is_cstring.hpp +++ b/ThirdParty/boost/test/utils/is_cstring.hpp @@ -5,11 +5,8 @@ // See http://www.boost.org/libs/test for the library home page. // -// File : $RCSfile$ -// -// Version : $Revision$ -// -// Description : defines the is_cstring type trait +//! @file +//! Defines the is_cstring type trait // *************************************************************************** #ifndef BOOST_TEST_UTILS_IS_CSTRING_HPP @@ -26,6 +23,10 @@ #include <boost/test/utils/basic_cstring/basic_cstring_fwd.hpp> #include <string> +#if defined(BOOST_TEST_STRING_VIEW) +#include <string_view> +#endif + //____________________________________________________________________________// namespace boost { @@ -53,16 +54,16 @@ template<> struct is_cstring_impl<wchar_t*> : public mpl::true_ {}; template <typename T, bool is_cstring = is_cstring_impl<typename boost::decay<T>::type>::value > -struct deduce_cstring_impl; +struct deduce_cstring_transform_impl; template <typename T, bool is_cstring > -struct deduce_cstring_impl<T&, is_cstring> : public deduce_cstring_impl<T, is_cstring>{}; +struct deduce_cstring_transform_impl<T&, is_cstring> : public deduce_cstring_transform_impl<T, is_cstring>{}; template <typename T, bool is_cstring > -struct deduce_cstring_impl<T const, is_cstring> : public deduce_cstring_impl<T, is_cstring>{}; +struct deduce_cstring_transform_impl<T const, is_cstring> : public deduce_cstring_transform_impl<T, is_cstring>{}; template <typename T> -struct deduce_cstring_impl<T, true> { +struct deduce_cstring_transform_impl<T, true> { typedef typename boost::add_const< typename boost::remove_pointer< typename boost::decay<T>::type @@ -72,7 +73,7 @@ struct deduce_cstring_impl<T, true> { }; template <typename T> -struct deduce_cstring_impl< T, false > { +struct deduce_cstring_transform_impl< T, false > { typedef typename boost::remove_const< typename boost::remove_reference<T>::type @@ -80,10 +81,21 @@ struct deduce_cstring_impl< T, false > { }; template <typename T> -struct deduce_cstring_impl< std::basic_string<T, std::char_traits<T> >, false > { +struct deduce_cstring_transform_impl< std::basic_string<T, std::char_traits<T> >, false > { typedef boost::unit_test::basic_cstring<typename boost::add_const<T>::type> type; }; +#if defined(BOOST_TEST_STRING_VIEW) +template <typename T> +struct deduce_cstring_transform_impl< std::basic_string_view<T, std::char_traits<T> >, false > { +private: + using sv_t = std::basic_string_view<T, std::char_traits<T> > ; + +public: + using type = stringview_cstring_helper<typename boost::add_const<T>::type, sv_t>; +}; +#endif + } // namespace ut_detail template<typename T> @@ -98,16 +110,21 @@ struct is_cstring_comparable< T, true > : public mpl::true_ {}; template<typename T> struct is_cstring_comparable< std::basic_string<T, std::char_traits<T> >, false > : public mpl::true_ {}; +#if defined(BOOST_TEST_STRING_VIEW) +template<typename T> +struct is_cstring_comparable< std::basic_string_view<T, std::char_traits<T> >, false > : public mpl::true_ {}; +#endif + template<typename T> struct is_cstring_comparable< boost::unit_test::basic_cstring<T>, false > : public mpl::true_ {}; template <class T> -struct deduce_cstring { +struct deduce_cstring_transform { typedef typename boost::remove_const< typename boost::remove_reference<T>::type >::type U; - typedef typename ut_detail::deduce_cstring_impl<typename boost::decay<U>::type>::type type; + typedef typename ut_detail::deduce_cstring_transform_impl<typename boost::decay<U>::type>::type type; }; } // namespace unit_test diff --git a/ThirdParty/boost/test/utils/runtime/cla/argv_traverser.hpp b/ThirdParty/boost/test/utils/runtime/cla/argv_traverser.hpp index d65c88e920501c9b8b5930f2b44a6d01029aafd4..476eaae2a0c297edd4ef290665122d3dce6cb422 100644 --- a/ThirdParty/boost/test/utils/runtime/cla/argv_traverser.hpp +++ b/ThirdParty/boost/test/utils/runtime/cla/argv_traverser.hpp @@ -48,7 +48,7 @@ public: /// Returns new argc int remainder() { - return m_argc; + return static_cast<int>(m_argc); } /// Returns true, if we reached end on input diff --git a/ThirdParty/boost/test/utils/setcolor.hpp b/ThirdParty/boost/test/utils/setcolor.hpp index ce3e9eee0207b80211f6f22519163a325aaf4a49..c09e188f7c41a9cacad807b17a5610f04a86e3e0 100644 --- a/ThirdParty/boost/test/utils/setcolor.hpp +++ b/ThirdParty/boost/test/utils/setcolor.hpp @@ -23,6 +23,7 @@ // STL #include <iostream> #include <cstdio> +#include <cassert> #include <boost/test/detail/suppress_warnings.hpp> @@ -78,11 +79,14 @@ struct term_color { enum _ { #ifndef _WIN32 class setcolor { public: + typedef int state; + // Constructor explicit setcolor( bool is_color_output = false, term_attr::_ attr = term_attr::NORMAL, term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) + term_color::_ bg = term_color::ORIGINAL, + state* /* unused */= NULL) : m_is_color_output(is_color_output) { m_command_size = std::sprintf( m_control_command, "%c[%c;3%c;4%cm", @@ -92,6 +96,17 @@ public: static_cast<char>(bg + '0')); } + explicit setcolor(bool is_color_output, + state* /* unused */) + : m_is_color_output(is_color_output) + { + m_command_size = std::sprintf(m_control_command, "%c[%c;3%c;4%cm", + 0x1B, + static_cast<char>(term_attr::NORMAL + '0'), + static_cast<char>(term_color::ORIGINAL + '0'), + static_cast<char>(term_color::ORIGINAL + '0')); + } + friend std::ostream& operator<<( std::ostream& os, setcolor const& sc ) { @@ -114,7 +129,7 @@ class setcolor { protected: void set_console_color(std::ostream& os, WORD *attributes = NULL) const { - if (!m_is_color_output) { + if (!m_is_color_output || m_state_saved) { return; } DWORD console_type; @@ -132,14 +147,30 @@ protected: if(hConsole == INVALID_HANDLE_VALUE || hConsole == NULL ) return; - if(attributes != NULL) { - SetConsoleTextAttribute(hConsole, *attributes); + state console_attributes; + if(attributes != NULL || (m_restore_state && m_s)) { + if (attributes != NULL) { + console_attributes = *attributes; + } + else { + console_attributes = *m_s; + *m_s = state(); + } + SetConsoleTextAttribute(hConsole, console_attributes); return; } CONSOLE_SCREEN_BUFFER_INFO consoleInfo; GetConsoleScreenBufferInfo(hConsole, &consoleInfo); - saved_attributes = consoleInfo.wAttributes; + console_attributes = consoleInfo.wAttributes; + + if (!m_state_saved && m_s) { + assert(!m_restore_state); + // we can save the state only the first time this object is used + // for modifying the console. + *m_s = console_attributes; + m_state_saved = true; + } WORD fg_attr = 0; switch(m_fg) @@ -168,9 +199,9 @@ protected: case term_color::YELLOW: fg_attr = FOREGROUND_RED | FOREGROUND_GREEN; break; - case term_color::ORIGINAL: + case term_color::ORIGINAL: default: - fg_attr = saved_attributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); + fg_attr = console_attributes & (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); break; } @@ -192,9 +223,9 @@ protected: case term_color::BLUE: bg_attr = BACKGROUND_BLUE; break; - case term_color::ORIGINAL: + case term_color::ORIGINAL: default: - bg_attr = saved_attributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); + bg_attr = console_attributes & (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE); break; } @@ -216,16 +247,34 @@ protected: } public: + typedef WORD state; + // Constructor explicit setcolor( bool is_color_output = false, term_attr::_ attr = term_attr::NORMAL, term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) + term_color::_ bg = term_color::ORIGINAL, + state* s = NULL) : m_is_color_output(is_color_output) , m_attr(attr) , m_fg(fg) , m_bg(bg) + , m_s(s) + , m_restore_state(false) + , m_state_saved(false) + {} + + explicit setcolor( + bool is_color_output, + state* s) + : m_is_color_output(is_color_output) + , m_attr(term_attr::NORMAL) + , m_fg(term_color::ORIGINAL) + , m_bg(term_color::ORIGINAL) + , m_s(s) + , m_restore_state(true) + , m_state_saved(false) {} friend std::ostream& @@ -240,10 +289,12 @@ private: term_attr::_ m_attr; term_color::_ m_fg; term_color::_ m_bg; - -protected: - // Data members - mutable WORD saved_attributes; + state* m_s; + // indicates that the instance has been initialized to restore a previously + // stored state + bool m_restore_state; + // indicates the first time we pull and set the console information. + mutable bool m_state_saved; }; #endif @@ -251,53 +302,29 @@ protected: // ************** scope_setcolor ************** // // ************************************************************************** // -#ifndef _WIN32 - struct scope_setcolor { - scope_setcolor() : m_os( 0 ) {} - explicit scope_setcolor( bool is_color_output, - std::ostream& os, - term_attr::_ attr = term_attr::NORMAL, - term_color::_ fg = term_color::ORIGINAL, - term_color::_ bg = term_color::ORIGINAL ) - : m_os( &os ) - , m_is_color_output( is_color_output ) - { - os << setcolor( is_color_output, attr, fg, bg ); - } - ~scope_setcolor() - { - if( m_os ) - *m_os << setcolor( m_is_color_output ); - } -private: - scope_setcolor(const scope_setcolor& r); - scope_setcolor& operator=(const scope_setcolor& r); - // Data members - std::ostream* m_os; - bool m_is_color_output; -}; - -#else - -struct scope_setcolor : setcolor { - scope_setcolor() : m_os( 0 ) {} - explicit scope_setcolor( + scope_setcolor() + : m_os( 0 ) + , m_state() + , m_is_color_output(false) + {} + + explicit scope_setcolor( bool is_color_output, std::ostream& os, term_attr::_ attr = term_attr::NORMAL, term_color::_ fg = term_color::ORIGINAL, term_color::_ bg = term_color::ORIGINAL ) - : setcolor(is_color_output, attr, fg, bg) - , m_os( &os ) + : m_os( &os ) + , m_is_color_output(is_color_output) { - os << *this; + os << setcolor(is_color_output, attr, fg, bg, &m_state); } ~scope_setcolor() { if (m_os) { - set_console_color(*m_os, &this->saved_attributes); + *m_os << setcolor(m_is_color_output, &m_state); } } private: @@ -305,11 +332,11 @@ private: scope_setcolor& operator=(const scope_setcolor& r); // Data members std::ostream* m_os; + setcolor::state m_state; + bool m_is_color_output; }; -#endif - #define BOOST_TEST_SCOPE_SETCOLOR( is_color_output, os, attr, color ) \ utils::scope_setcolor const sc(is_color_output, os, utils::attr, utils::color); \ boost::ignore_unused( sc ) \ diff --git a/ThirdParty/boost/test/utils/timer.hpp b/ThirdParty/boost/test/utils/timer.hpp index 035fb4fd138fb54f0c8b46614f6e7c66350e707a..1241692e4e30d73867651b5e2ffce3b4f0dcafb0 100644 --- a/ThirdParty/boost/test/utils/timer.hpp +++ b/ThirdParty/boost/test/utils/timer.hpp @@ -133,6 +133,7 @@ namespace timer { return_value.wall = static_cast<nanosecond_type>((clock * timebase.first) / timebase.second); #else struct timespec end_time; + return_value.wall = 0; if( ::clock_gettime( CLOCK_MONOTONIC, &end_time ) == 0 ) { return_value.wall = static_cast<nanosecond_type>((end_time.tv_sec - _start_time_wall.tv_sec) * 1E9 + (end_time.tv_nsec - _start_time_wall.tv_nsec)); diff --git a/ThirdParty/boost/throw_exception.hpp b/ThirdParty/boost/throw_exception.hpp index c6623e196508351a9ad97e937bc33c2b39cf4e69..17aff51c09b580fc2f74a82a2237bc2468ddcf7f 100644 --- a/ThirdParty/boost/throw_exception.hpp +++ b/ThirdParty/boost/throw_exception.hpp @@ -1,5 +1,5 @@ -#ifndef UUID_AA15E74A856F11E08B8D93F24824019B -#define UUID_AA15E74A856F11E08B8D93F24824019B +#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED +#define BOOST_THROW_EXCEPTION_HPP_INCLUDED // MS compatible compilers support #pragma once @@ -10,94 +10,173 @@ // // boost/throw_exception.hpp // -// Copyright (c) 2002 Peter Dimov and Multi Media Ltd. +// Copyright (c) 2002, 2018, 2019 Peter Dimov // Copyright (c) 2008-2009 Emil Dotchevski and Reverge Studios, Inc. // // 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) // -// http://www.boost.org/libs/utility/throw_exception.html +// http://www.boost.org/libs/throw_exception // +#include <boost/assert/source_location.hpp> #include <boost/config.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/config/workaround.hpp> #include <exception> #if !defined( BOOST_EXCEPTION_DISABLE ) && defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT(0x593) ) # define BOOST_EXCEPTION_DISABLE #endif -#if !defined( BOOST_EXCEPTION_DISABLE ) && defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, < 1310 ) -# define BOOST_EXCEPTION_DISABLE -#endif +namespace boost +{ -#if !defined( BOOST_EXCEPTION_DISABLE ) -# include <boost/exception/exception.hpp> -#if !defined(BOOST_THROW_EXCEPTION_CURRENT_FUNCTION) -# include <boost/current_function.hpp> -# define BOOST_THROW_EXCEPTION_CURRENT_FUNCTION BOOST_CURRENT_FUNCTION -#endif -# define BOOST_THROW_EXCEPTION(x) ::boost::exception_detail::throw_exception_(x,BOOST_THROW_EXCEPTION_CURRENT_FUNCTION,__FILE__,__LINE__) -#else -# define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x) -#endif +// All boost exceptions are required to derive from std::exception, +// to ensure compatibility with BOOST_NO_EXCEPTIONS. -#if defined(__GNUC__) && (__GNUC__*100+__GNUC_MINOR__>301) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma GCC system_header -#endif -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(push,1) -#endif +inline void throw_exception_assert_compatibility( std::exception const & ) {} + +} // namespace boost + +#if defined( BOOST_NO_EXCEPTIONS ) namespace boost { -#ifdef BOOST_NO_EXCEPTIONS -void throw_exception( std::exception const & e ); // user defined +BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined +BOOST_NORETURN void throw_exception( std::exception const & e, boost::source_location const & loc ); // user defined -#else +} // namespace boost -inline void throw_exception_assert_compatibility( std::exception const & ) { } +#elif defined( BOOST_EXCEPTION_DISABLE ) -template<class E> BOOST_NORETURN inline void throw_exception( E const & e ) +namespace boost { - //All boost exceptions are required to derive from std::exception, - //to ensure compatibility with BOOST_NO_EXCEPTIONS. - throw_exception_assert_compatibility(e); -#ifndef BOOST_EXCEPTION_DISABLE - throw exception_detail::enable_both( e ); -#else +template<class E> BOOST_NORETURN void throw_exception( E const & e ) +{ + throw_exception_assert_compatibility( e ); throw e; -#endif } -#endif +template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & ) +{ + throw_exception_assert_compatibility( e ); + throw e; +} + +} // namespace boost + +#else // !defined( BOOST_NO_EXCEPTIONS ) && !defined( BOOST_EXCEPTION_DISABLE ) + +#include <boost/exception/exception.hpp> + +namespace boost +{ + +// boost::wrapexcept<E> + +namespace detail +{ + +typedef char (&wrapexcept_s1)[ 1 ]; +typedef char (&wrapexcept_s2)[ 2 ]; + +template<class T> wrapexcept_s1 wrapexcept_is_convertible( T* ); +template<class T> wrapexcept_s2 wrapexcept_is_convertible( void* ); + +template<class E, class B, int I = sizeof( wrapexcept_is_convertible<B>( static_cast< E* >( 0 ) ) ) > struct wrapexcept_add_base; + +template<class E, class B> struct wrapexcept_add_base<E, B, 1> +{ + struct type {}; +}; + +template<class E, class B> struct wrapexcept_add_base<E, B, 2> +{ + typedef B type; +}; + +} // namespace detail -#if !defined( BOOST_EXCEPTION_DISABLE ) - namespace - exception_detail +template<class E> struct BOOST_SYMBOL_VISIBLE wrapexcept: + public detail::wrapexcept_add_base<E, boost::exception_detail::clone_base>::type, + public E, + public detail::wrapexcept_add_base<E, boost::exception>::type +{ +private: + + struct deleter + { + wrapexcept * p_; + ~deleter() { delete p_; } + }; + +private: + + void copy_from( void const* ) { - template <class E> - BOOST_NORETURN - void - throw_exception_( E const & x, char const * current_function, char const * file, int line ) - { - boost::throw_exception( - set_info( - set_info( - set_info( - enable_error_info(x), - throw_function(current_function)), - throw_file(file)), - throw_line(line))); - } } -#endif + + void copy_from( boost::exception const* p ) + { + static_cast<boost::exception&>( *this ) = *p; + } + +public: + + explicit wrapexcept( E const & e ): E( e ) + { + copy_from( &e ); + } + + explicit wrapexcept( E const & e, boost::source_location const & loc ): E( e ) + { + copy_from( &e ); + + set_info( *this, throw_file( loc.file_name() ) ); + set_info( *this, throw_line( loc.line() ) ); + set_info( *this, throw_function( loc.function_name() ) ); + } + + virtual boost::exception_detail::clone_base const * clone() const + { + wrapexcept * p = new wrapexcept( *this ); + deleter del = { p }; + + boost::exception_detail::copy_boost_exception( p, this ); + + del.p_ = 0; + return p; + } + + virtual void rethrow() const + { + throw *this; + } +}; + +// boost::throw_exception + +template<class E> BOOST_NORETURN void throw_exception( E const & e ) +{ + throw_exception_assert_compatibility( e ); + throw wrapexcept<E>( e ); +} + +template<class E> BOOST_NORETURN void throw_exception( E const & e, boost::source_location const & loc ) +{ + throw_exception_assert_compatibility( e ); + throw wrapexcept<E>( e, loc ); +} + } // namespace boost -#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) -#pragma warning(pop) -#endif #endif + +// BOOST_THROW_EXCEPTION + +#define BOOST_THROW_EXCEPTION(x) ::boost::throw_exception(x, BOOST_CURRENT_LOCATION) + +#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED diff --git a/ThirdParty/boost/type_index.hpp b/ThirdParty/boost/type_index.hpp index 6fccf6ee6fdf1f8b27e49a66aac858fca8af2613..8b866202961263dcdbeebf365b86650a9ffe6d86 100644 --- a/ThirdParty/boost/type_index.hpp +++ b/ThirdParty/boost/type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2012-2019 Antony Polukhin. +// Copyright 2012-2020 Antony Polukhin. // // 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) diff --git a/ThirdParty/boost/type_index/ctti_type_index.hpp b/ThirdParty/boost/type_index/ctti_type_index.hpp index 27143c48456c7c5d692d8904cf2924f5190a0355..edb57149f004b4bcddfdaf9a8aa8220785384df2 100644 --- a/ThirdParty/boost/type_index/ctti_type_index.hpp +++ b/ThirdParty/boost/type_index/ctti_type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2013-2019 Antony Polukhin. +// Copyright 2013-2020 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/ThirdParty/boost/type_index/detail/compile_time_type_info.hpp b/ThirdParty/boost/type_index/detail/compile_time_type_info.hpp index 0197a0170d45226281d773ed7fec8bd55056662d..dcc9aa99b0de887528f771846fa11a71ed50690a 100644 --- a/ThirdParty/boost/type_index/detail/compile_time_type_info.hpp +++ b/ThirdParty/boost/type_index/detail/compile_time_type_info.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2012-2019 Antony Polukhin. +// Copyright 2012-2020 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/ThirdParty/boost/type_index/detail/ctti_register_class.hpp b/ThirdParty/boost/type_index/detail/ctti_register_class.hpp index 4879cea296592d1c29923c33854f648be7a7381b..c15ec82f30274be562eab99307b898a08f0f47ae 100644 --- a/ThirdParty/boost/type_index/detail/ctti_register_class.hpp +++ b/ThirdParty/boost/type_index/detail/ctti_register_class.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2013-2019 Antony Polukhin. +// Copyright 2013-2020 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/ThirdParty/boost/type_index/detail/stl_register_class.hpp b/ThirdParty/boost/type_index/detail/stl_register_class.hpp index ab6c7cfb60a2548207b179a0c5c4bedaf4289a87..b8df8c75fc22c3d2ca8842aa2567777a306f20c2 100644 --- a/ThirdParty/boost/type_index/detail/stl_register_class.hpp +++ b/ThirdParty/boost/type_index/detail/stl_register_class.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2013-2019 Antony Polukhin. +// Copyright 2013-2020 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/ThirdParty/boost/type_index/runtime_cast.hpp b/ThirdParty/boost/type_index/runtime_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..c72b11916b1bdbc9a4d5b9a72ac269ffc934b927 --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast.hpp @@ -0,0 +1,28 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_HPP + +/// \file runtime_cast.hpp +/// \brief Contains the basic utilities necessary to fully emulate +/// dynamic_cast for language level constructs (raw pointers and references). +/// +/// boost::typeindex::runtime_cast is a drop in replacement for dynamic_cast +/// that can be used in situations where traditional rtti is either unavailable +/// or undesirable. + +#include <boost/type_index/runtime_cast/register_runtime_class.hpp> +#include <boost/type_index/runtime_cast/pointer_cast.hpp> +#include <boost/type_index/runtime_cast/reference_cast.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_HPP diff --git a/ThirdParty/boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp b/ThirdParty/boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e31f19d72868e74dd94d03537bfdd1bc8ea449f0 --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast/boost_shared_ptr_cast.hpp @@ -0,0 +1,46 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_BOOST_SHARED_PTR_CAST_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_BOOST_SHARED_PTR_CAST_HPP + +/// \file boost_shared_ptr_cast.hpp +/// \brief Contains the overload of boost::typeindex::runtime_pointer_cast for +/// boost::shared_ptr types. + +#include <boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/smart_ptr/shared_ptr.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +/// \brief Creates a new instance of std::shared_ptr whose stored pointer is obtained from u's +/// stored pointer using a runtime_cast. +/// +/// The new shared_ptr will share ownership with u, except that it is empty if the runtime_cast +/// performed by runtime_pointer_cast returns a null pointer. +/// \tparam T The desired target type to return a pointer of. +/// \tparam U A complete class type of the source instance pointed to from u. +/// \return If there exists a valid conversion from U* to T*, returns a boost::shared_ptr<T> +/// that points to an address suitably offset from u. +/// If no such conversion exists, returns boost::shared_ptr<T>(); +template<typename T, typename U> +boost::shared_ptr<T> runtime_pointer_cast(boost::shared_ptr<U> const& u) { + T* value = detail::runtime_cast_impl<T>(u.get(), boost::is_base_and_derived<T, U>()); + if(value) + return boost::shared_ptr<T>(u, value); + return boost::shared_ptr<T>(); +} + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_BOOST_SHARED_PTR_CAST_HPP diff --git a/ThirdParty/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp b/ThirdParty/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp new file mode 100644 index 0000000000000000000000000000000000000000..6181df60f5857af43a32cf0e8b1f6014074bcc9c --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp @@ -0,0 +1,57 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_DETAIL_RUNTIME_CAST_IMPL_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_DETAIL_RUNTIME_CAST_IMPL_HPP + +/// \file runtime_cast_impl.hpp +/// \brief Contains the overload of boost::typeindex::runtime_cast for +/// pointer types. +/// +/// boost::typeindex::runtime_cast can be used to emulate dynamic_cast +/// functionality on platorms that don't provide it or should the user +/// desire opt in functionality instead of enabling it system wide. + +#include <boost/type_index.hpp> +#include <boost/type_traits/integral_constant.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +namespace detail { + +template<typename T, typename U> +T* runtime_cast_impl(U* u, boost::true_type) BOOST_NOEXCEPT { + return u; +} + +template<typename T, typename U> +T const* runtime_cast_impl(U const* u, boost::true_type) BOOST_NOEXCEPT { + return u; +} + +template<typename T, typename U> +T* runtime_cast_impl(U* u, boost::false_type) BOOST_NOEXCEPT { + return const_cast<T*>(static_cast<T const*>( + u->boost_type_index_find_instance_(boost::typeindex::type_id<T>()) + )); +} + +template<typename T, typename U> +T const* runtime_cast_impl(U const* u, boost::false_type) BOOST_NOEXCEPT { + return static_cast<T const*>(u->boost_type_index_find_instance_(boost::typeindex::type_id<T>())); +} + +} // namespace detail + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_DETAIL_RUNTIME_CAST_IMPL_HPP diff --git a/ThirdParty/boost/type_index/runtime_cast/pointer_cast.hpp b/ThirdParty/boost/type_index/runtime_cast/pointer_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..49a761390ca2fa1821c34c592977d54eeb183e91 --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast/pointer_cast.hpp @@ -0,0 +1,74 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_POINTER_CAST_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_POINTER_CAST_HPP + +/// \file pointer_class.hpp +/// \brief Contains the function overloads of boost::typeindex::runtime_cast for +/// pointer types. +#include <boost/type_index.hpp> +#include <boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/remove_pointer.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +/// \brief Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy. +/// \tparam T The desired target type. Like dynamic_cast, must be a pointer to complete class type. +/// \tparam U A complete class type of the source instance, u. +/// \return If there exists a valid conversion from U* to T, returns a T that points to +/// an address suitably offset from u. If no such conversion exists, returns NULL. +template<typename T, typename U> +T runtime_cast(U* u) BOOST_NOEXCEPT { + typedef typename boost::remove_pointer<T>::type impl_type; + return detail::runtime_cast_impl<impl_type>(u, boost::is_base_and_derived<T, U>()); +} + +/// \brief Safely converts pointers to classes up, down, and sideways along the inheritance hierarchy. +/// \tparam T The desired target type. Like dynamic_cast, must be a pointer to complete class type. +/// \tparam U A complete class type of the source instance, u. +/// \return If there exists a valid conversion from U* to T, returns a T that points to +/// an address suitably offset from u. If no such conversion exists, returns NULL. +template<typename T, typename U> +T runtime_cast(U const* u) BOOST_NOEXCEPT { + typedef typename boost::remove_pointer<T>::type impl_type; + return detail::runtime_cast_impl<impl_type>(u, boost::is_base_and_derived<T, U>()); +} + +/// \brief Safely converts pointers to classes up, down, and sideways along the inheritance +/// hierarchy. +/// \tparam T The desired target type to return a pointer to. +/// \tparam U A complete class type of the source instance, u. +/// \return If there exists a valid conversion from U const* to T*, returns a T* +/// that points to an address suitably offset from u. +/// If no such conversion exists, returns NULL. +template<typename T, typename U> +T* runtime_pointer_cast(U* u) BOOST_NOEXCEPT { + return detail::runtime_cast_impl<T>(u, boost::is_base_and_derived<T, U>()); +} + +/// \brief Safely converts pointers to classes up, down, and sideways along the inheritance +/// hierarchy. +/// \tparam T The desired target type to return a pointer to. +/// \tparam U A complete class type of the source instance, u. +/// \return If there exists a valid conversion from U const* to T const*, returns a T const* +/// that points to an address suitably offset from u. +/// If no such conversion exists, returns NULL. +template<typename T, typename U> +T const* runtime_pointer_cast(U const* u) BOOST_NOEXCEPT { + return detail::runtime_cast_impl<T>(u, boost::is_base_and_derived<T, U>()); +} + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_POINTER_CAST_HPP diff --git a/ThirdParty/boost/type_index/runtime_cast/reference_cast.hpp b/ThirdParty/boost/type_index/runtime_cast/reference_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..1511f7d03138f63bbb50fa1f13283f5095c5bf3b --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast/reference_cast.hpp @@ -0,0 +1,66 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_REFERENCE_CAST_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_REFERENCE_CAST_HPP + +/// \file reference_cast.hpp +/// \brief Contains the overload of boost::typeindex::runtime_cast for +/// reference types. + +#include <boost/core/addressof.hpp> +#include <boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp> +#include <boost/throw_exception.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +/// \brief Indicates that runtime_cast was unable to perform the desired cast operation +/// because the source instance was not also an instance of the target type. +struct bad_runtime_cast : std::exception +{}; + +/// \brief Safely converts references to classes up, down, and sideways along the inheritance hierarchy. +/// \tparam T The desired target type. Like dynamic_cast, must be a pointer to complete class type. +/// \tparam U A complete class type of the source instance, u. +/// \return If there exists a valid conversion from U& to T, returns a T that references an address +/// suitably offset from u. If no such conversion exists, throws boost::typeindex::bad_runtime_cast. +template<typename T, typename U> +typename boost::add_reference<T>::type runtime_cast(U& u) { + typedef typename boost::remove_reference<T>::type impl_type; + impl_type* value = detail::runtime_cast_impl<impl_type>( + boost::addressof(u), boost::is_base_and_derived<T, U>()); + if(!value) + BOOST_THROW_EXCEPTION(bad_runtime_cast()); + return *value; +} + +/// \brief Safely converts references to classes up, down, and sideways along the inheritance hierarchy. +/// \tparam T The desired target type. Like dynamic_cast, must be a pointer to complete class type. +/// \tparam U A complete class type of the source instance, u. +/// \return If there exists a valid conversion from U const& to T const, returns a T const that references an address +/// suitably offset from u. If no such conversion exists, throws boost::typeindex::bad_runtime_cast. +template<typename T, typename U> +typename boost::add_reference<const T>::type runtime_cast(U const& u) { + typedef typename boost::remove_reference<T>::type impl_type; + impl_type* value = detail::runtime_cast_impl<impl_type>( + boost::addressof(u), boost::is_base_and_derived<T, U>()); + if(!value) + BOOST_THROW_EXCEPTION(bad_runtime_cast()); + return *value; +} + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_REFERENCE_CAST_HPP diff --git a/ThirdParty/boost/type_index/runtime_cast/register_runtime_class.hpp b/ThirdParty/boost/type_index/runtime_cast/register_runtime_class.hpp new file mode 100644 index 0000000000000000000000000000000000000000..ab758a5f171ebfeaef9ec7cd8d6413dedc7f54da --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast/register_runtime_class.hpp @@ -0,0 +1,138 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_REGISTER_RUNTIME_CLASS_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_REGISTER_RUNTIME_CLASS_HPP + +/// \file register_runtime_class.hpp +/// \brief Contains the macros BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST and +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS +#include <boost/type_index.hpp> +#include <boost/preprocessor/seq/for_each.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +namespace detail { + +template<typename T> +inline type_index runtime_class_construct_type_id(T const*) { + return type_id<T>(); +} + +} // namespace detail + +}} // namespace boost::typeindex + +/// @cond + +#define BOOST_TYPE_INDEX_CHECK_BASE_(r, data, Base) \ + if(void const* ret_val = this->Base::boost_type_index_find_instance_(idx)) return ret_val; + +/// @endcond + +/// \def BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS +/// \brief Macro used to make a class compatible with boost::typeindex::runtime_cast +/// +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS generates a virtual function +/// in the current class that, when combined with the supplied base class information, allows +/// boost::typeindex::runtime_cast to accurately convert between dynamic types of instances of +/// the current class. +/// +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS also adds support for boost::typeindex::type_id_runtime +/// by including BOOST_TYPE_INDEX_REGISTER_CLASS. It is typical that these features are used together, +/// but in the event that BOOST_TYPE_INDEX_REGISTER_CLASS is undesirable in the current class, +/// BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST is provided. +/// +/// \b Example: +/// \code +/// struct base1 { +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(BOOST_TYPE_INDEX_NO_BASE_CLASS) +/// virtual ~base1(); +/// }; +/// +/// struct base2 { +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(BOOST_TYPE_INDEX_NO_BASE_CLASS) +/// virtual ~base2(); +/// }; +/// +/// struct derived1 : base1 { +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS((base1)) +/// }; +/// +/// struct derived2 : base1, base2 { +/// BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS((base1)(base2)) +/// }; +/// +/// ... +/// +/// base1* pb1 = get_object(); +/// if(derived2* pb2 = boost::typeindex::runtime_cast<derived2*>(pb1)) { +/// assert(boost::typeindex::type_id_runtime(*pb1)) == boost::typeindex::type_id<derived2>()); +/// } +/// \endcode +/// +/// \param base_class_seq A Boost.Preprocessor sequence of the current class' direct bases, or +/// BOOST_TYPE_INDEX_NO_BASE_CLASS if this class has no direct base classes. +#define BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS(base_class_seq) \ + BOOST_TYPE_INDEX_REGISTER_CLASS \ + BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(base_class_seq) + +/// \def BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST +/// \brief Macro used to make a class compatible with boost::typeindex::runtime_cast without including +/// support for boost::typeindex::type_id_runtime. +/// +/// BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST is provided as an alternative to BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS +/// in the event that support for boost::typeindex::type_id_runtime is undesirable. +/// +/// \b Example: +/// \code +/// struct base1 { +/// BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(BOOST_TYPE_INDEX_NO_BASE_CLASS) +/// virtual ~base1(); +/// }; +/// +/// struct base2 { +/// BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(BOOST_TYPE_INDEX_NO_BASE_CLASS) +/// virtual ~base2(); +/// }; +/// +/// struct derived1 : base1 { +/// BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST((base1)) +/// }; +/// +/// struct derived2 : base1, base2 { +/// BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST((base1)(base2)) +/// }; +/// +/// ... +/// +/// base1* pb1 = get_object(); +/// if(derived2* pb2 = boost::typeindex::runtime_cast<derived2*>(pb1)) +/// { /* can't call boost::typeindex::type_id_runtime(*pb1) here */ } +/// \endcode +/// +/// \param base_class_seq A Boost.Preprocessor sequence of the current class' direct bases, or +/// BOOST_TYPE_INDEX_NO_BASE_CLASS if this class has no direct base classes. +#define BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST(base_class_seq) \ + virtual void const* boost_type_index_find_instance_(boost::typeindex::type_index const& idx) const BOOST_NOEXCEPT { \ + if(idx == boost::typeindex::detail::runtime_class_construct_type_id(this)) \ + return this; \ + BOOST_PP_SEQ_FOR_EACH(BOOST_TYPE_INDEX_CHECK_BASE_, _, base_class_seq) \ + return NULL; \ + } + +/// \def BOOST_TYPE_INDEX_NO_BASE_CLASS +/// \brief Instructs BOOST_TYPE_INDEX_REGISTER_RUNTIME_CLASS and BOOST_TYPE_INDEX_IMPLEMENT_RUNTIME_CAST +/// that this class has no base classes. +#define BOOST_TYPE_INDEX_NO_BASE_CLASS BOOST_PP_SEQ_NIL + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_REGISTER_RUNTIME_CLASS_HPP diff --git a/ThirdParty/boost/type_index/runtime_cast/std_shared_ptr_cast.hpp b/ThirdParty/boost/type_index/runtime_cast/std_shared_ptr_cast.hpp new file mode 100644 index 0000000000000000000000000000000000000000..277a52426001ef1fe8698af690e34c3abc9c27f6 --- /dev/null +++ b/ThirdParty/boost/type_index/runtime_cast/std_shared_ptr_cast.hpp @@ -0,0 +1,46 @@ +// +// Copyright (c) Chris Glover, 2016. +// +// +// 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) +// + +#ifndef BOOST_TYPE_INDEX_RUNTIME_CAST_STD_SHARED_PTR_CAST_HPP +#define BOOST_TYPE_INDEX_RUNTIME_CAST_STD_SHARED_PTR_CAST_HPP + +/// \file std_shared_ptr_cast.hpp +/// \brief Contains the overload of boost::typeindex::runtime_pointer_cast for +/// std::shared_ptr types. + +#include <boost/type_index/runtime_cast/detail/runtime_cast_impl.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> +#include <memory> + +#ifdef BOOST_HAS_PRAGMA_ONCE +# pragma once +#endif + +namespace boost { namespace typeindex { + +/// \brief Creates a new instance of std::shared_ptr whose stored pointer is obtained from u's +/// stored pointer using a runtime_cast. +/// +/// The new shared_ptr will share ownership with u, except that it is empty if the runtime_cast +/// performed by runtime_pointer_cast returns a null pointer. +/// \tparam T The desired target type to return a pointer of. +/// \tparam U A complete class type of the source instance pointed to from u. +/// \return If there exists a valid conversion from U* to T*, returns a std::shared_ptr<T> +/// that points to an address suitably offset from u. +/// If no such conversion exists, returns std::shared_ptr<T>(); +template<typename T, typename U> +std::shared_ptr<T> runtime_pointer_cast(std::shared_ptr<U> const& u) { + T* value = detail::runtime_cast_impl<T>(u.get(), boost::is_base_and_derived<T, U>()); + if(value) + return std::shared_ptr<T>(u, value); + return std::shared_ptr<T>(); +} + +}} // namespace boost::typeindex + +#endif // BOOST_TYPE_INDEX_RUNTIME_CAST_STD_SHARED_PTR_CAST_HPP diff --git a/ThirdParty/boost/type_index/stl_type_index.hpp b/ThirdParty/boost/type_index/stl_type_index.hpp index 7d39cd093509ee733b3c904563aa0c79478a1b5f..3f3177229fb38191cbdfd483073a18e42bd8a388 100644 --- a/ThirdParty/boost/type_index/stl_type_index.hpp +++ b/ThirdParty/boost/type_index/stl_type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2013-2019 Antony Polukhin. +// Copyright 2013-2020 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/ThirdParty/boost/type_index/type_index_facade.hpp b/ThirdParty/boost/type_index/type_index_facade.hpp index 1cb929f6201b34444b82f578c46a962162e5dc30..cf5ef1e9aec9d34ffa556ef6fa19844b4bc3d7bc 100644 --- a/ThirdParty/boost/type_index/type_index_facade.hpp +++ b/ThirdParty/boost/type_index/type_index_facade.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) 2013-2019 Antony Polukhin. +// Copyright 2013-2020 Antony Polukhin. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/ThirdParty/boost/type_traits/detail/config.hpp b/ThirdParty/boost/type_traits/detail/config.hpp index 00970f214f38647ec6042716e02a33cdd001bf78..7c4b4f2162deff88195d6027513adfb577e24e7d 100644 --- a/ThirdParty/boost/type_traits/detail/config.hpp +++ b/ThirdParty/boost/type_traits/detail/config.hpp @@ -93,6 +93,20 @@ # define BOOST_TT_NO_DEDUCED_NOEXCEPT_PARAM # define BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE #endif +// +// If we have the SD6 macros (check for C++11's __cpp_rvalue_references), and we don't have __cpp_noexcept_function_type +// set, then don't treat noexcept functions as seperate types. This is a fix for msvc with the /Zc:noexceptTypes- flag set. +// +#if defined(__cpp_rvalue_references) && !defined(__cpp_noexcept_function_type) && !defined(BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE) +# define BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE +#endif +// +// Check MSVC specific macro on older msvc compilers that don't support the SD6 macros, we don't rely on this +// if the SD6 macros *are* available as it appears to be undocumented. +// +#if defined(BOOST_MSVC) && !defined(__cpp_rvalue_references) && !defined(BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE) && !defined(_NOEXCEPT_TYPES_SUPPORTED) +# define BOOST_TT_NO_NOEXCEPT_SEPARATE_TYPE +#endif #endif // BOOST_TT_CONFIG_HPP_INCLUDED diff --git a/ThirdParty/boost/type_traits/detail/is_function_cxx_11.hpp b/ThirdParty/boost/type_traits/detail/is_function_cxx_11.hpp index 432af4eccdbd915346c319ab4e1ecd8718fdc920..4de74a7373027befb6261cc17664824c4a8b1491 100644 --- a/ThirdParty/boost/type_traits/detail/is_function_cxx_11.hpp +++ b/ThirdParty/boost/type_traits/detail/is_function_cxx_11.hpp @@ -376,7 +376,7 @@ namespace boost { template <class Ret, class ...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret(Args..., ...)const volatile && BOOST_TT_NOEXCEPT_DECL> : public true_type {}; -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) #ifdef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __clrcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -384,9 +384,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -399,9 +401,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)const BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)const BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)const BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -414,9 +418,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -429,9 +435,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)const volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)const volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)const volatile BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -445,9 +453,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -460,9 +470,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)const &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)const &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)const &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -475,9 +487,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -490,9 +504,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)const volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)const volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)const volatile &BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -506,9 +522,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...) && BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...) && BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...) && BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -521,9 +539,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)const &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)const &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)const &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -536,9 +556,11 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; @@ -551,15 +573,17 @@ namespace boost { #ifndef _M_AMD64 template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __stdcall(Args...)const volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; +#ifndef __CLR_VER template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __fastcall(Args...)const volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif +#endif #if !defined(__CLR_VER) && (defined(_M_IX86_FP) && (_M_IX86_FP >= 2) || defined(_M_X64)) template <class Ret, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_function<Ret __vectorcall(Args...)const volatile &&BOOST_TT_NOEXCEPT_DECL> : public true_type {}; #endif -#endif // _MSC_VER +#endif // defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) #endif diff --git a/ThirdParty/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp b/ThirdParty/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp index d88a004b2c3fca0ef94326cdcdbe00d9ca4414a0..b0502cbe8b3053abc29073cd8918b164bbcda98d 100644 --- a/ThirdParty/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp +++ b/ThirdParty/boost/type_traits/detail/is_member_function_pointer_cxx_11.hpp @@ -419,7 +419,7 @@ namespace boost { template <class Ret, class C, class ...Args BOOST_TT_NOEXCEPT_PARAM> struct is_member_function_pointer<Ret(C::*)(Args..., ...)const volatile && BOOST_TT_NOEXCEPT_DECL> : public true_type {}; -#ifdef _MSC_VER +#if defined(_MSC_VER) && !defined(_M_ARM) && !defined(_M_ARM64) #ifdef __CLR_VER template <class Ret, class C, class...Args BOOST_TT_NOEXCEPT_PARAM> struct is_member_function_pointer<Ret(__clrcall C::*)(Args...)BOOST_TT_NOEXCEPT_DECL> : public true_type {}; diff --git a/ThirdParty/boost/typeof/int_encoding.hpp b/ThirdParty/boost/typeof/int_encoding.hpp index 3984174f7d6db768d1afccce144b474b10987e27..1f00d4f1e7dd62acc24c49eb9ee83b082f5d038e 100644 --- a/ThirdParty/boost/typeof/int_encoding.hpp +++ b/ThirdParty/boost/typeof/int_encoding.hpp @@ -7,6 +7,7 @@ #include <boost/config.hpp> #include <boost/typeof/constant.hpp> +#include <cstddef> // for std::size_t namespace boost { namespace type_of { diff --git a/ThirdParty/boost/typeof/typeof_impl.hpp b/ThirdParty/boost/typeof/typeof_impl.hpp index f5397e6ab122e59804629df8187579b6b3710844..73a25dfeef9cf3542a8ec258ca5a739b7af7eb62 100644 --- a/ThirdParty/boost/typeof/typeof_impl.hpp +++ b/ThirdParty/boost/typeof/typeof_impl.hpp @@ -12,6 +12,7 @@ #include <boost/typeof/vector.hpp> #include <boost/type_traits/enable_if.hpp> #include <boost/type_traits/is_function.hpp> +#include <cstddef> // for std::size_t #define BOOST_TYPEOF_VECTOR(n) BOOST_PP_CAT(boost::type_of::vector, n) diff --git a/ThirdParty/boost/unordered/detail/fwd.hpp b/ThirdParty/boost/unordered/detail/fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..e749ce67bb6eb7117be467587971c0453c3eb2bf --- /dev/null +++ b/ThirdParty/boost/unordered/detail/fwd.hpp @@ -0,0 +1,63 @@ + +// Copyright (C) 2008-2016 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) + +#ifndef BOOST_UNORDERED_FWD_HPP_INCLUDED +#define BOOST_UNORDERED_FWD_HPP_INCLUDED + +#include <boost/config.hpp> +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once +#endif + +#include <boost/predef.h> + +#if defined(BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT) +// Already defined. +#elif defined(BOOST_LIBSTDCXX11) +// https://github.com/gcc-mirror/gcc/blob/gcc-4_6-branch/libstdc++-v3/include/bits/stl_pair.h#L70 +#if BOOST_LIBSTDCXX_VERSION > 40600 +#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1 +#endif +#elif BOOST_LIB_STD_CXX +// https://github.com/llvm-mirror/libcxx/blob/release_30/include/utility#L206 +#if BOOST_LIB_STD_CXX >= BOOST_VERSION_NUMBER(3, 0, 0) +#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1 +#endif +#elif defined(BOOST_LIB_STD_DINKUMWARE) +// Apparently C++11 standard supported in Visual Studio 2012 +// https://msdn.microsoft.com/en-us/library/hh567368.aspx#stl +// 2012 = VC+11 = BOOST_MSVC 1700 Hopefully! +// I have no idea when Dinkumware added it, probably a lot +// earlier than this check. +#if BOOST_LIB_STD_DINKUMWARE >= BOOST_VERSION_NUMBER(6, 50, 0) || \ + BOOST_COMP_MSVC >= BOOST_VERSION_NUMBER(17, 0, 0) +#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 1 +#endif +#endif + +// Assume that an unknown library does not support piecewise construction. +#if !defined(BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT) +#define BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT 0 +#endif + +#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT +#include <utility> +#endif + +namespace boost { + namespace unordered { +#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT + using std::piecewise_construct_t; + using std::piecewise_construct; +#else + struct piecewise_construct_t + { + }; + const piecewise_construct_t piecewise_construct = piecewise_construct_t(); +#endif + } +} + +#endif diff --git a/ThirdParty/boost/unordered/detail/implementation.hpp b/ThirdParty/boost/unordered/detail/implementation.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9dffde159df377ddef2e266b12e726e705646f3e --- /dev/null +++ b/ThirdParty/boost/unordered/detail/implementation.hpp @@ -0,0 +1,4952 @@ +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 2005-2016 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) + +#ifndef BOOST_UNORDERED_DETAIL_IMPLEMENTATION_HPP +#define BOOST_UNORDERED_DETAIL_IMPLEMENTATION_HPP + +#include <boost/config.hpp> +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once +#endif + +#include <boost/assert.hpp> +#include <boost/core/no_exceptions_support.hpp> +#include <boost/core/pointer_traits.hpp> +#include <boost/detail/select_type.hpp> +#include <boost/limits.hpp> +#include <boost/move/move.hpp> +#include <boost/preprocessor/arithmetic/inc.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_binary_params.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/repeat_from_to.hpp> +#include <boost/preprocessor/seq/enum.hpp> +#include <boost/preprocessor/seq/size.hpp> +#include <boost/swap.hpp> +#include <boost/throw_exception.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/type_traits/add_lvalue_reference.hpp> +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_base_of.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_empty.hpp> +#include <boost/type_traits/is_nothrow_move_assignable.hpp> +#include <boost/type_traits/is_nothrow_move_constructible.hpp> +#include <boost/type_traits/is_nothrow_swappable.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/remove_const.hpp> +#include <boost/unordered/detail/fwd.hpp> +#include <boost/utility/addressof.hpp> +#include <boost/utility/enable_if.hpp> +#include <cmath> +#include <iterator> +#include <stdexcept> +#include <utility> + +#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) +#include <type_traits> +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Configuration +// +// Unless documented elsewhere these configuration macros should be considered +// an implementation detail, I'll try not to break them, but you never know. + +// Use Sun C++ workarounds +// I'm not sure which versions of the compiler require these workarounds, so +// I'm just using them of everything older than the current test compilers +// (as of May 2017). + +#if !defined(BOOST_UNORDERED_SUN_WORKAROUNDS1) +#if BOOST_COMP_SUNPRO && BOOST_COMP_SUNPRO < BOOST_VERSION_NUMBER(5, 20, 0) +#define BOOST_UNORDERED_SUN_WORKAROUNDS1 1 +#else +#define BOOST_UNORDERED_SUN_WORKAROUNDS1 0 +#endif +#endif + +// BOOST_UNORDERED_EMPLACE_LIMIT = The maximum number of parameters in +// emplace (not including things like hints). Don't set it to a lower value, as +// that might break something. + +#if !defined BOOST_UNORDERED_EMPLACE_LIMIT +#define BOOST_UNORDERED_EMPLACE_LIMIT 10 +#endif + +// BOOST_UNORDERED_USE_ALLOCATOR_TRAITS - Pick which version of +// allocator_traits to use. +// +// 0 = Own partial implementation +// 1 = std::allocator_traits +// 2 = boost::container::allocator_traits + +#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS) +#if !defined(BOOST_NO_CXX11_ALLOCATOR) +#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 1 +#elif defined(BOOST_MSVC) +#if BOOST_MSVC < 1400 +// Use container's allocator_traits for older versions of Visual +// C++ as I don't test with them. +#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 2 +#endif +#endif +#endif + +#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS) +#define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0 +#endif + +// BOOST_UNORDERED_TUPLE_ARGS +// +// Maximum number of std::tuple members to support, or 0 if std::tuple +// isn't avaiable. More are supported when full C++11 is used. + +// Already defined, so do nothing +#if defined(BOOST_UNORDERED_TUPLE_ARGS) + +// Assume if we have C++11 tuple it's properly variadic, +// and just use a max number of 10 arguments. +#elif !defined(BOOST_NO_CXX11_HDR_TUPLE) +#define BOOST_UNORDERED_TUPLE_ARGS 10 + +// Visual C++ has a decent enough tuple for piecewise construction, +// so use that if available, using _VARIADIC_MAX for the maximum +// number of parameters. Note that this comes after the check +// for a full C++11 tuple. +#elif defined(BOOST_MSVC) +#if !BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT +#define BOOST_UNORDERED_TUPLE_ARGS 0 +#elif defined(_VARIADIC_MAX) +#define BOOST_UNORDERED_TUPLE_ARGS _VARIADIC_MAX +#else +#define BOOST_UNORDERED_TUPLE_ARGS 5 +#endif + +// Assume that we don't have std::tuple +#else +#define BOOST_UNORDERED_TUPLE_ARGS 0 +#endif + +#if BOOST_UNORDERED_TUPLE_ARGS +#include <tuple> +#endif + +// BOOST_UNORDERED_CXX11_CONSTRUCTION +// +// Use C++11 construction, requires variadic arguments, good construct support +// in allocator_traits and piecewise construction of std::pair +// Otherwise allocators aren't used for construction/destruction + +#if BOOST_UNORDERED_HAVE_PIECEWISE_CONSTRUCT && \ + !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && BOOST_UNORDERED_TUPLE_ARGS +#if BOOST_COMP_SUNPRO && BOOST_LIB_STD_GNU +// Sun C++ std::pair piecewise construction doesn't seem to be exception safe. +// (At least for Sun C++ 12.5 using libstdc++). +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 0 +#elif BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 7, 0) +// Piecewise construction in GCC 4.6 doesn't work for uncopyable types. +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 0 +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 0 && \ + !defined(BOOST_NO_SFINAE_EXPR) +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 1 +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 1 +#endif +#endif + +#if !defined(BOOST_UNORDERED_CXX11_CONSTRUCTION) +#define BOOST_UNORDERED_CXX11_CONSTRUCTION 0 +#endif + +// BOOST_UNORDERED_SUPPRESS_DEPRECATED +// +// Define to stop deprecation attributes + +#if defined(BOOST_UNORDERED_SUPPRESS_DEPRECATED) +#define BOOST_UNORDERED_DEPRECATED(msg) +#endif + +// BOOST_UNORDERED_DEPRECATED +// +// Wrapper around various depreaction attributes. + +#if defined(__has_cpp_attribute) && \ + (!defined(__cplusplus) || __cplusplus >= 201402) +#if __has_cpp_attribute(deprecated) && !defined(BOOST_UNORDERED_DEPRECATED) +#define BOOST_UNORDERED_DEPRECATED(msg) [[deprecated(msg)]] +#endif +#endif + +#if !defined(BOOST_UNORDERED_DEPRECATED) +#if defined(__GNUC__) && __GNUC__ >= 4 +#define BOOST_UNORDERED_DEPRECATED(msg) __attribute__((deprecated)) +#elif defined(_MSC_VER) && _MSC_VER >= 1400 +#define BOOST_UNORDERED_DEPRECATED(msg) __declspec(deprecated(msg)) +#elif defined(_MSC_VER) && _MSC_VER >= 1310 +#define BOOST_UNORDERED_DEPRECATED(msg) __declspec(deprecated) +#else +#define BOOST_UNORDERED_DEPRECATED(msg) +#endif +#endif + +// BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES + +#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) +#if BOOST_COMP_CLANG && __cplusplus >= 201703 +#define BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 1 +#endif +#endif + +#if !defined(BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES) +#define BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES 0 +#endif + +namespace boost { + namespace unordered { + namespace iterator_detail { + template <typename Node> struct iterator; + template <typename Node> struct c_iterator; + template <typename Node> struct l_iterator; + template <typename Node> struct cl_iterator; + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + + template <typename Types> struct table; + template <typename NodePointer> struct bucket; + struct ptr_bucket; + + template <typename A, typename T> struct node; + template <typename T> struct ptr_node; + + static const float minimum_max_load_factor = 1e-3f; + static const std::size_t default_bucket_count = 11; + + struct move_tag + { + }; + + struct empty_emplace + { + }; + + struct no_key + { + no_key() {} + template <class T> no_key(T const&) {} + }; + + namespace func { + template <class T> inline void ignore_unused_variable_warning(T const&) + { + } + } + + ////////////////////////////////////////////////////////////////////////// + // iterator SFINAE + + template <typename I> + struct is_forward : boost::is_base_of<std::forward_iterator_tag, + typename std::iterator_traits<I>::iterator_category> + { + }; + + template <typename I, typename ReturnType> + struct enable_if_forward + : boost::enable_if_c<boost::unordered::detail::is_forward<I>::value, + ReturnType> + { + }; + + template <typename I, typename ReturnType> + struct disable_if_forward + : boost::disable_if_c<boost::unordered::detail::is_forward<I>::value, + ReturnType> + { + }; + } + } +} + +//////////////////////////////////////////////////////////////////////////////// +// primes + +// clang-format off +#define BOOST_UNORDERED_PRIMES \ + (17ul)(29ul)(37ul)(53ul)(67ul)(79ul) \ + (97ul)(131ul)(193ul)(257ul)(389ul)(521ul)(769ul) \ + (1031ul)(1543ul)(2053ul)(3079ul)(6151ul)(12289ul)(24593ul) \ + (49157ul)(98317ul)(196613ul)(393241ul)(786433ul) \ + (1572869ul)(3145739ul)(6291469ul)(12582917ul)(25165843ul) \ + (50331653ul)(100663319ul)(201326611ul)(402653189ul)(805306457ul) \ + (1610612741ul)(3221225473ul)(4294967291ul) +// clang-format on + +namespace boost { + namespace unordered { + namespace detail { + template <class T> struct prime_list_template + { + static std::size_t const value[]; + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + static std::ptrdiff_t const length; +#else + static std::ptrdiff_t const length = + BOOST_PP_SEQ_SIZE(BOOST_UNORDERED_PRIMES); +#endif + }; + + template <class T> + std::size_t const prime_list_template<T>::value[] = { + BOOST_PP_SEQ_ENUM(BOOST_UNORDERED_PRIMES)}; + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + template <class T> + std::ptrdiff_t const prime_list_template<T>::length = BOOST_PP_SEQ_SIZE( + BOOST_UNORDERED_PRIMES); +#endif + +#undef BOOST_UNORDERED_PRIMES + + typedef prime_list_template<std::size_t> prime_list; + + // no throw + inline std::size_t next_prime(std::size_t num) + { + std::size_t const* const prime_list_begin = prime_list::value; + std::size_t const* const prime_list_end = + prime_list_begin + prime_list::length; + std::size_t const* bound = + std::lower_bound(prime_list_begin, prime_list_end, num); + if (bound == prime_list_end) + bound--; + return *bound; + } + + // no throw + inline std::size_t prev_prime(std::size_t num) + { + std::size_t const* const prime_list_begin = prime_list::value; + std::size_t const* const prime_list_end = + prime_list_begin + prime_list::length; + std::size_t const* bound = + std::upper_bound(prime_list_begin, prime_list_end, num); + if (bound != prime_list_begin) + bound--; + return *bound; + } + + ////////////////////////////////////////////////////////////////////////// + // insert_size/initial_size + + template <class I> + inline std::size_t insert_size(I i, I j, + typename boost::unordered::detail::enable_if_forward<I, void*>::type = + 0) + { + return static_cast<std::size_t>(std::distance(i, j)); + } + + template <class I> + inline std::size_t insert_size(I, I, + typename boost::unordered::detail::disable_if_forward<I, void*>::type = + 0) + { + return 1; + } + + template <class I> + inline std::size_t initial_size(I i, I j, + std::size_t num_buckets = + boost::unordered::detail::default_bucket_count) + { + return (std::max)( + boost::unordered::detail::insert_size(i, j), num_buckets); + } + + ////////////////////////////////////////////////////////////////////////// + // compressed + + template <typename T, int Index> struct compressed_base : private T + { + compressed_base(T const& x) : T(x) {} + compressed_base(T& x, move_tag) : T(boost::move(x)) {} + + T& get() { return *this; } + T const& get() const { return *this; } + }; + + template <typename T, int Index> struct uncompressed_base + { + uncompressed_base(T const& x) : value_(x) {} + uncompressed_base(T& x, move_tag) : value_(boost::move(x)) {} + + T& get() { return value_; } + T const& get() const { return value_; } + + private: + T value_; + }; + + template <typename T, int Index> + struct generate_base + : boost::detail::if_true< + boost::is_empty<T>::value>::BOOST_NESTED_TEMPLATE + then<boost::unordered::detail::compressed_base<T, Index>, + boost::unordered::detail::uncompressed_base<T, Index> > + { + }; + + template <typename T1, typename T2> + struct compressed + : private boost::unordered::detail::generate_base<T1, 1>::type, + private boost::unordered::detail::generate_base<T2, 2>::type + { + typedef typename generate_base<T1, 1>::type base1; + typedef typename generate_base<T2, 2>::type base2; + + typedef T1 first_type; + typedef T2 second_type; + + first_type& first() { return static_cast<base1*>(this)->get(); } + + first_type const& first() const + { + return static_cast<base1 const*>(this)->get(); + } + + second_type& second() { return static_cast<base2*>(this)->get(); } + + second_type const& second() const + { + return static_cast<base2 const*>(this)->get(); + } + + template <typename First, typename Second> + compressed(First const& x1, Second const& x2) : base1(x1), base2(x2) + { + } + + compressed(compressed const& x) : base1(x.first()), base2(x.second()) {} + + compressed(compressed& x, move_tag m) + : base1(x.first(), m), base2(x.second(), m) + { + } + + void assign(compressed const& x) + { + first() = x.first(); + second() = x.second(); + } + + void move_assign(compressed& x) + { + first() = boost::move(x.first()); + second() = boost::move(x.second()); + } + + void swap(compressed& x) + { + boost::swap(first(), x.first()); + boost::swap(second(), x.second()); + } + + private: + // Prevent assignment just to make use of assign or + // move_assign explicit. + compressed& operator=(compressed const&); + }; + + ////////////////////////////////////////////////////////////////////////// + // pair_traits + // + // Used to get the types from a pair without instantiating it. + + template <typename Pair> struct pair_traits + { + typedef typename Pair::first_type first_type; + typedef typename Pair::second_type second_type; + }; + + template <typename T1, typename T2> struct pair_traits<std::pair<T1, T2> > + { + typedef T1 first_type; + typedef T2 second_type; + }; + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable : 4512) // assignment operator could not be generated. +#pragma warning(disable : 4345) // behavior change: an object of POD type +// constructed with an initializer of the form () +// will be default-initialized. +#endif + + ////////////////////////////////////////////////////////////////////////// + // Bits and pieces for implementing traits + + template <typename T> + typename boost::add_lvalue_reference<T>::type make(); + struct choice9 + { + typedef char (&type)[9]; + }; + struct choice8 : choice9 + { + typedef char (&type)[8]; + }; + struct choice7 : choice8 + { + typedef char (&type)[7]; + }; + struct choice6 : choice7 + { + typedef char (&type)[6]; + }; + struct choice5 : choice6 + { + typedef char (&type)[5]; + }; + struct choice4 : choice5 + { + typedef char (&type)[4]; + }; + struct choice3 : choice4 + { + typedef char (&type)[3]; + }; + struct choice2 : choice3 + { + typedef char (&type)[2]; + }; + struct choice1 : choice2 + { + typedef char (&type)[1]; + }; + choice1 choose(); + + typedef choice1::type yes_type; + typedef choice2::type no_type; + + struct private_type + { + private_type const& operator,(int) const; + }; + + template <typename T> no_type is_private_type(T const&); + yes_type is_private_type(private_type const&); + + struct convert_from_anything + { + template <typename T> convert_from_anything(T const&); + }; + } + } +} + +//////////////////////////////////////////////////////////////////////////// +// emplace_args +// +// Either forwarding variadic arguments, or storing the arguments in +// emplace_args##n + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args +#define BOOST_UNORDERED_EMPLACE_ARGS BOOST_FWD_REF(Args)... args +#define BOOST_UNORDERED_EMPLACE_FORWARD boost::forward<Args>(args)... + +#else + +#define BOOST_UNORDERED_EMPLACE_TEMPLATE typename Args +#define BOOST_UNORDERED_EMPLACE_ARGS Args const& args +#define BOOST_UNORDERED_EMPLACE_FORWARD args + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + +#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ + typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, n); \ + BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); + +#else + +#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ + typedef typename boost::add_lvalue_reference<BOOST_PP_CAT(A, n)>::type \ + BOOST_PP_CAT(Arg, n); \ + BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); + +#endif + +#define BOOST_UNORDERED_FWD_PARAM(z, n, a) \ + BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(a, n) + +#define BOOST_UNORDERED_CALL_FORWARD(z, i, a) \ + boost::forward<BOOST_PP_CAT(A, i)>(BOOST_PP_CAT(a, i)) + +#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \ + BOOST_PP_CAT(a, n)(BOOST_PP_CAT(b, n)) + +#define BOOST_UNORDERED_EARGS(z, n, _) \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + struct BOOST_PP_CAT(emplace_args, n) \ + { \ + BOOST_PP_REPEAT_##z(n, BOOST_UNORDERED_EARGS_MEMBER, _) BOOST_PP_CAT( \ + emplace_args, n)(BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, Arg, b)) \ + : BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_EARGS_INIT, _) \ + { \ + } \ + }; \ + \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + inline BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> \ + create_emplace_args(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b)) \ + { \ + BOOST_PP_CAT(emplace_args, n)<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> e( \ + BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \ + return e; \ + } + +namespace boost { + namespace unordered { + namespace detail { + template <typename A0> struct emplace_args1 + { + BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) + + explicit emplace_args1(Arg0 b0) : a0(b0) {} + }; + + template <typename A0> + inline emplace_args1<A0> create_emplace_args(BOOST_FWD_REF(A0) b0) + { + emplace_args1<A0> e(b0); + return e; + } + + template <typename A0, typename A1> struct emplace_args2 + { + BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) + BOOST_UNORDERED_EARGS_MEMBER(1, 1, _) + + emplace_args2(Arg0 b0, Arg1 b1) : a0(b0), a1(b1) {} + }; + + template <typename A0, typename A1> + inline emplace_args2<A0, A1> create_emplace_args( + BOOST_FWD_REF(A0) b0, BOOST_FWD_REF(A1) b1) + { + emplace_args2<A0, A1> e(b0, b1); + return e; + } + + template <typename A0, typename A1, typename A2> struct emplace_args3 + { + BOOST_UNORDERED_EARGS_MEMBER(1, 0, _) + BOOST_UNORDERED_EARGS_MEMBER(1, 1, _) + BOOST_UNORDERED_EARGS_MEMBER(1, 2, _) + + emplace_args3(Arg0 b0, Arg1 b1, Arg2 b2) : a0(b0), a1(b1), a2(b2) {} + }; + + template <typename A0, typename A1, typename A2> + inline emplace_args3<A0, A1, A2> create_emplace_args( + BOOST_FWD_REF(A0) b0, BOOST_FWD_REF(A1) b1, BOOST_FWD_REF(A2) b2) + { + emplace_args3<A0, A1, A2> e(b0, b1, b2); + return e; + } + + BOOST_UNORDERED_EARGS(1, 4, _) + BOOST_UNORDERED_EARGS(1, 5, _) + BOOST_UNORDERED_EARGS(1, 6, _) + BOOST_UNORDERED_EARGS(1, 7, _) + BOOST_UNORDERED_EARGS(1, 8, _) + BOOST_UNORDERED_EARGS(1, 9, _) + BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), + BOOST_UNORDERED_EARGS, _) + } + } +} + +#undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS +#undef BOOST_UNORDERED_EARGS_MEMBER +#undef BOOST_UNORDERED_EARGS_INIT + +#endif + +//////////////////////////////////////////////////////////////////////////////// +// +// Some utilities for implementing allocator_traits, but useful elsewhere so +// they're always defined. + +namespace boost { + namespace unordered { + namespace detail { + +//////////////////////////////////////////////////////////////////////////// +// Integral_constrant, true_type, false_type +// +// Uses the standard versions if available. + +#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) + + using std::integral_constant; + using std::true_type; + using std::false_type; + +#else + + template <typename T, T Value> struct integral_constant + { + enum + { + value = Value + }; + }; + + typedef boost::unordered::detail::integral_constant<bool, true> true_type; + typedef boost::unordered::detail::integral_constant<bool, false> + false_type; + +#endif + +//////////////////////////////////////////////////////////////////////////// +// Explicitly call a destructor + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable : 4100) // unreferenced formal parameter +#endif + + namespace func { + template <class T> inline void destroy(T* x) { x->~T(); } + } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + + ////////////////////////////////////////////////////////////////////////// + // value_base + // + // Space used to store values. + + template <typename ValueType> struct value_base + { + typedef ValueType value_type; + + typename boost::aligned_storage<sizeof(value_type), + boost::alignment_of<value_type>::value>::type data_; + + value_base() : data_() {} + + void* address() { return this; } + + value_type& value() { return *(ValueType*)this; } + + value_type const& value() const { return *(ValueType const*)this; } + + value_type* value_ptr() { return (ValueType*)this; } + + value_type const* value_ptr() const { return (ValueType const*)this; } + + private: + value_base& operator=(value_base const&); + }; + + ////////////////////////////////////////////////////////////////////////// + // optional + // TODO: Use std::optional when available. + + template <typename T> class optional + { + BOOST_MOVABLE_BUT_NOT_COPYABLE(optional) + + boost::unordered::detail::value_base<T> value_; + bool has_value_; + + void destroy() + { + if (has_value_) { + boost::unordered::detail::func::destroy(value_.value_ptr()); + has_value_ = false; + } + } + + void move(optional<T>& x) + { + BOOST_ASSERT(!has_value_ && x.has_value_); + new (value_.value_ptr()) T(boost::move(x.value_.value())); + boost::unordered::detail::func::destroy(x.value_.value_ptr()); + has_value_ = true; + x.has_value_ = false; + } + + public: + optional() BOOST_NOEXCEPT : has_value_(false) {} + + optional(BOOST_RV_REF(optional<T>) x) : has_value_(false) + { + if (x.has_value_) { + move(x); + } + } + + explicit optional(T const& x) : has_value_(true) + { + new (value_.value_ptr()) T(x); + } + + optional& operator=(BOOST_RV_REF(optional<T>) x) + { + destroy(); + if (x.has_value_) { + move(x); + } + return *this; + } + + ~optional() { destroy(); } + + bool has_value() const { return has_value_; } + T& operator*() { return value_.value(); } + T const& operator*() const { return value_.value(); } + T* operator->() { return value_.value_ptr(); } + T const* operator->() const { return value_.value_ptr(); } + + bool operator==(optional<T> const& x) + { + return has_value_ ? x.has_value_ && value_.value() == x.value_.value() + : !x.has_value_; + } + + bool operator!=(optional<T> const& x) { return !((*this) == x); } + + void swap(optional<T>& x) + { + if (has_value_ != x.has_value_) { + if (has_value_) { + x.move(*this); + } else { + move(x); + } + } else if (has_value_) { + boost::swap(value_.value(), x.value_.value()); + } + } + + friend void swap(optional<T>& x, optional<T>& y) { x.swap(y); } + }; + } + } +} + +//////////////////////////////////////////////////////////////////////////// +// Expression test mechanism +// +// When SFINAE expressions are available, define +// BOOST_UNORDERED_HAS_FUNCTION which can check if a function call is +// supported by a class, otherwise define BOOST_UNORDERED_HAS_MEMBER which +// can detect if a class has the specified member, but not that it has the +// correct type, this is good enough for a passable impression of +// allocator_traits. + +#if !defined(BOOST_NO_SFINAE_EXPR) + +namespace boost { + namespace unordered { + namespace detail { + template <typename T, long unsigned int> struct expr_test; + template <typename T> struct expr_test<T, sizeof(char)> : T + { + }; + } + } +} + +#define BOOST_UNORDERED_CHECK_EXPRESSION(count, result, expression) \ + template <typename U> \ + static \ + typename boost::unordered::detail::expr_test<BOOST_PP_CAT(choice, result), \ + sizeof(for_expr_test(((expression), 0)))>::type \ + test(BOOST_PP_CAT(choice, count)) + +#define BOOST_UNORDERED_DEFAULT_EXPRESSION(count, result) \ + template <typename U> \ + static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count)) + +#define BOOST_UNORDERED_HAS_FUNCTION(name, thing, args, _) \ + struct BOOST_PP_CAT(has_, name) \ + { \ + template <typename U> static char for_expr_test(U const&); \ + BOOST_UNORDERED_CHECK_EXPRESSION( \ + 1, 1, boost::unordered::detail::make<thing>().name args); \ + BOOST_UNORDERED_DEFAULT_EXPRESSION(2, 2); \ + \ + enum \ + { \ + value = sizeof(test<T>(choose())) == sizeof(choice1::type) \ + }; \ + } + +#else + +namespace boost { + namespace unordered { + namespace detail { + template <typename T> struct identity + { + typedef T type; + }; + } + } +} + +#define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \ + \ + typedef \ + typename boost::unordered::detail::identity<member>::type BOOST_PP_CAT( \ + check, count); \ + \ + template <BOOST_PP_CAT(check, count) e> struct BOOST_PP_CAT(test, count) \ + { \ + typedef BOOST_PP_CAT(choice, result) type; \ + }; \ + \ + template <class U> \ + static typename BOOST_PP_CAT(test, count)<&U::name>::type test( \ + BOOST_PP_CAT(choice, count)) + +#define BOOST_UNORDERED_DEFAULT_MEMBER(count, result) \ + template <class U> \ + static BOOST_PP_CAT(choice, result)::type test(BOOST_PP_CAT(choice, count)) + +#define BOOST_UNORDERED_HAS_MEMBER(name) \ + struct BOOST_PP_CAT(has_, name) \ + { \ + struct impl \ + { \ + struct base_mixin \ + { \ + int name; \ + }; \ + struct base : public T, public base_mixin \ + { \ + }; \ + \ + BOOST_UNORDERED_CHECK_MEMBER(1, 1, name, int base_mixin::*); \ + BOOST_UNORDERED_DEFAULT_MEMBER(2, 2); \ + \ + enum \ + { \ + value = sizeof(choice2::type) == sizeof(test<base>(choose())) \ + }; \ + }; \ + \ + enum \ + { \ + value = impl::value \ + }; \ + } + +#endif + +//////////////////////////////////////////////////////////////////////////// +// TRAITS TYPE DETECTION MECHANISM +// +// Used to implement traits that use a type if present, or a +// default otherwise. + +#if defined(BOOST_MSVC) && BOOST_MSVC <= 1400 + +#define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template <typename Tp, typename Default> struct default_type_##tname \ + { \ + \ + template <typename X> \ + static choice1::type test(choice1, typename X::tname* = 0); \ + \ + template <typename X> static choice2::type test(choice2, void* = 0); \ + \ + struct DefaultWrap \ + { \ + typedef Default tname; \ + }; \ + \ + enum \ + { \ + value = (1 == sizeof(test<Tp>(choose()))) \ + }; \ + \ + typedef typename boost::detail::if_true<value>::BOOST_NESTED_TEMPLATE \ + then<Tp, DefaultWrap>::type::tname type; \ + } + +#else + +namespace boost { + namespace unordered { + namespace detail { + template <typename T, typename T2> struct sfinae : T2 + { + }; + } + } +} + +#define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template <typename Tp, typename Default> struct default_type_##tname \ + { \ + \ + template <typename X> \ + static typename boost::unordered::detail::sfinae<typename X::tname, \ + choice1>::type test(choice1); \ + \ + template <typename X> static choice2::type test(choice2); \ + \ + struct DefaultWrap \ + { \ + typedef Default tname; \ + }; \ + \ + enum \ + { \ + value = (1 == sizeof(test<Tp>(choose()))) \ + }; \ + \ + typedef typename boost::detail::if_true<value>::BOOST_NESTED_TEMPLATE \ + then<Tp, DefaultWrap>::type::tname type; \ + } + +#endif + +#define BOOST_UNORDERED_DEFAULT_TYPE(T, tname, arg) \ + typename default_type_##tname<T, arg>::type + +//////////////////////////////////////////////////////////////////////////////// +// +// Allocator traits +// +// First our implementation, then later light wrappers around the alternatives + +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 0 + +#include <boost/limits.hpp> +#include <boost/pointer_to_other.hpp> +#include <boost/utility/enable_if.hpp> + +namespace boost { + namespace unordered { + namespace detail { + + template <typename Alloc, typename T> struct rebind_alloc; + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template <template <typename, typename...> class Alloc, typename U, + typename T, typename... Args> + struct rebind_alloc<Alloc<U, Args...>, T> + { + typedef Alloc<T, Args...> type; + }; + +#else + + template <template <typename> class Alloc, typename U, typename T> + struct rebind_alloc<Alloc<U>, T> + { + typedef Alloc<T> type; + }; + + template <template <typename, typename> class Alloc, typename U, + typename T, typename A0> + struct rebind_alloc<Alloc<U, A0>, T> + { + typedef Alloc<T, A0> type; + }; + + template <template <typename, typename, typename> class Alloc, typename U, + typename T, typename A0, typename A1> + struct rebind_alloc<Alloc<U, A0, A1>, T> + { + typedef Alloc<T, A0, A1> type; + }; + +#endif + + template <typename Alloc, typename T> struct rebind_wrap + { + template <typename X> + static choice1::type test( + choice1, typename X::BOOST_NESTED_TEMPLATE rebind<T>::other* = 0); + template <typename X> static choice2::type test(choice2, void* = 0); + + enum + { + value = (1 == sizeof(test<Alloc>(choose()))) + }; + + struct fallback + { + template <typename U> struct rebind + { + typedef typename rebind_alloc<Alloc, T>::type other; + }; + }; + + typedef + typename boost::detail::if_true<value>::BOOST_NESTED_TEMPLATE then< + Alloc, fallback>::type::BOOST_NESTED_TEMPLATE rebind<T>::other type; + }; + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(void_pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_void_pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(difference_type); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(size_type); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT( + propagate_on_container_copy_assignment); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT( + propagate_on_container_move_assignment); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_swap); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(is_always_equal); + +#if !defined(BOOST_NO_SFINAE_EXPR) + + template <typename T> + BOOST_UNORDERED_HAS_FUNCTION( + select_on_container_copy_construction, U const, (), 0); + + template <typename T> + BOOST_UNORDERED_HAS_FUNCTION(max_size, U const, (), 0); + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template <typename T, typename ValueType, typename... Args> + BOOST_UNORDERED_HAS_FUNCTION(construct, U, + (boost::unordered::detail::make<ValueType*>(), + boost::unordered::detail::make<Args const>()...), + 2); + +#else + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_FUNCTION(construct, U, + (boost::unordered::detail::make<ValueType*>(), + boost::unordered::detail::make<ValueType const>()), + 2); + +#endif + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_FUNCTION( + destroy, U, (boost::unordered::detail::make<ValueType*>()), 1); + +#else + + template <typename T> + BOOST_UNORDERED_HAS_MEMBER(select_on_container_copy_construction); + + template <typename T> BOOST_UNORDERED_HAS_MEMBER(max_size); + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_MEMBER(construct); + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_MEMBER(destroy); + +#endif + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + + template <typename Alloc> + inline Alloc call_select_on_container_copy_construction( + const Alloc& rhs, + typename boost::enable_if_c< + boost::unordered::detail::has_select_on_container_copy_construction< + Alloc>::value, + void*>::type = 0) + { + return rhs.select_on_container_copy_construction(); + } + + template <typename Alloc> + inline Alloc call_select_on_container_copy_construction( + const Alloc& rhs, + typename boost::disable_if_c< + boost::unordered::detail::has_select_on_container_copy_construction< + Alloc>::value, + void*>::type = 0) + { + return rhs; + } + + template <typename SizeType, typename Alloc> + inline SizeType call_max_size(const Alloc& a, + typename boost::enable_if_c< + boost::unordered::detail::has_max_size<Alloc>::value, void*>::type = + 0) + { + return a.max_size(); + } + + template <typename SizeType, typename Alloc> + inline SizeType call_max_size(const Alloc&, + typename boost::disable_if_c< + boost::unordered::detail::has_max_size<Alloc>::value, void*>::type = + 0) + { + return (std::numeric_limits<SizeType>::max)(); + } + } // namespace func. + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + template <typename Alloc> struct allocator_traits + { + typedef Alloc allocator_type; + typedef typename Alloc::value_type value_type; + + typedef BOOST_UNORDERED_DEFAULT_TYPE( + Alloc, pointer, value_type*) pointer; + + template <typename T> + struct pointer_to_other : boost::pointer_to_other<pointer, T> + { + }; + + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, const_pointer, + typename pointer_to_other<const value_type>::type) const_pointer; + + // typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, void_pointer, + // typename pointer_to_other<void>::type) + // void_pointer; + // + // typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, const_void_pointer, + // typename pointer_to_other<const void>::type) + // const_void_pointer; + + typedef BOOST_UNORDERED_DEFAULT_TYPE( + Alloc, difference_type, std::ptrdiff_t) difference_type; + + typedef BOOST_UNORDERED_DEFAULT_TYPE( + Alloc, size_type, std::size_t) size_type; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + template <typename T> + using rebind_alloc = typename rebind_wrap<Alloc, T>::type; + + template <typename T> + using rebind_traits = + boost::unordered::detail::allocator_traits<rebind_alloc<T> >; +#endif + + static pointer allocate(Alloc& a, size_type n) { return a.allocate(n); } + + // I never use this, so I'll just comment it out for now. + // + // static pointer allocate(Alloc& a, size_type n, + // const_void_pointer hint) + // { return DEFAULT_FUNC(allocate, pointer)(a, n, hint); } + + static void deallocate(Alloc& a, pointer p, size_type n) + { + a.deallocate(p, n); + } + + public: +#if BOOST_UNORDERED_CXX11_CONSTRUCTION + + template <typename T, typename... Args> + static + typename boost::enable_if_c<boost::unordered::detail::has_construct< + Alloc, T, Args...>::value>::type + construct(Alloc& a, T* p, BOOST_FWD_REF(Args)... x) + { + a.construct(p, boost::forward<Args>(x)...); + } + + template <typename T, typename... Args> + static + typename boost::disable_if_c<boost::unordered::detail::has_construct< + Alloc, T, Args...>::value>::type + construct(Alloc&, T* p, BOOST_FWD_REF(Args)... x) + { + new (static_cast<void*>(p)) T(boost::forward<Args>(x)...); + } + + template <typename T> + static typename boost::enable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc& a, T* p) + { + a.destroy(p); + } + + template <typename T> + static typename boost::disable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc&, T* p) + { + boost::unordered::detail::func::destroy(p); + } + +#elif !defined(BOOST_NO_SFINAE_EXPR) + + template <typename T> + static typename boost::enable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value>::type + construct(Alloc& a, T* p, T const& x) + { + a.construct(p, x); + } + + template <typename T> + static typename boost::disable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value>::type + construct(Alloc&, T* p, T const& x) + { + new (static_cast<void*>(p)) T(x); + } + + template <typename T> + static typename boost::enable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc& a, T* p) + { + a.destroy(p); + } + + template <typename T> + static typename boost::disable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc&, T* p) + { + boost::unordered::detail::func::destroy(p); + } + +#else + + // If we don't have SFINAE expressions, only call construct for the + // copy constructor for the allocator's value_type - as that's + // the only construct method that old fashioned allocators support. + + template <typename T> + static void construct(Alloc& a, T* p, T const& x, + typename boost::enable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + a.construct(p, x); + } + + template <typename T> + static void construct(Alloc&, T* p, T const& x, + typename boost::disable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + new (static_cast<void*>(p)) T(x); + } + + template <typename T> + static void destroy(Alloc& a, T* p, + typename boost::enable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + a.destroy(p); + } + + template <typename T> + static void destroy(Alloc&, T* p, + typename boost::disable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + boost::unordered::detail::func::destroy(p); + } + +#endif + + static size_type max_size(const Alloc& a) + { + return boost::unordered::detail::func::call_max_size<size_type>(a); + } + + // Allocator propagation on construction + + static Alloc select_on_container_copy_construction(Alloc const& rhs) + { + return boost::unordered::detail::func:: + call_select_on_container_copy_construction(rhs); + } + + // Allocator propagation on assignment and swap. + // Return true if lhs is modified. + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, + propagate_on_container_copy_assignment, + false_type) propagate_on_container_copy_assignment; + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, + propagate_on_container_move_assignment, + false_type) propagate_on_container_move_assignment; + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, propagate_on_container_swap, + false_type) propagate_on_container_swap; + + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, is_always_equal, + typename boost::is_empty<Alloc>::type) is_always_equal; + }; + } + } +} + +#undef BOOST_UNORDERED_DEFAULT_TYPE_TMPLT +#undef BOOST_UNORDERED_DEFAULT_TYPE + +//////////////////////////////////////////////////////////////////////////////// +// +// std::allocator_traits + +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 + +#include <memory> + +namespace boost { + namespace unordered { + namespace detail { + + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(is_always_equal); + + template <typename Alloc> + struct allocator_traits : std::allocator_traits<Alloc> + { + // As is_always_equal was introduced in C++17, std::allocator_traits + // doesn't always have it. So use it when available, implement it + // ourselves when not. Would be simpler not to bother with + // std::allocator_traits, but I feel like I should try to use + // it where possible. + typedef BOOST_UNORDERED_DEFAULT_TYPE(std::allocator_traits<Alloc>, + is_always_equal, + BOOST_UNORDERED_DEFAULT_TYPE(Alloc, is_always_equal, + typename boost::is_empty<Alloc>::type)) is_always_equal; + }; + + template <typename Alloc, typename T> struct rebind_wrap + { + typedef typename std::allocator_traits<Alloc>::template rebind_alloc<T> + type; + }; + } + } +} + +//////////////////////////////////////////////////////////////////////////////// +// +// boost::container::allocator_traits + +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 2 + +#include <boost/container/allocator_traits.hpp> + +namespace boost { + namespace unordered { + namespace detail { + + template <typename Alloc> + struct allocator_traits : boost::container::allocator_traits<Alloc> + { + }; + + template <typename Alloc, typename T> + struct rebind_wrap : boost::container::allocator_traits< + Alloc>::template portable_rebind_alloc<T> + { + }; + } + } +} + +#else + +#error "Invalid BOOST_UNORDERED_USE_ALLOCATOR_TRAITS value." + +#endif + +//////////////////////////////////////////////////////////////////////////// +// Functions used to construct nodes. Emulates variadic construction, +// piecewise construction etc. + +//////////////////////////////////////////////////////////////////////////// +// construct_value +// +// Only use allocator_traits::construct, allocator_traits::destroy when full +// C++11 support is available. + +#if BOOST_UNORDERED_CXX11_CONSTRUCTION + +#define BOOST_UNORDERED_CALL_CONSTRUCT1(Traits, alloc, address, a0) \ + Traits::construct(alloc, address, a0) +#define BOOST_UNORDERED_CALL_DESTROY(Traits, alloc, x) Traits::destroy(alloc, x) + +#elif !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + template <typename T, typename... Args> + inline void construct_value(T* address, BOOST_FWD_REF(Args)... args) + { + new ((void*)address) T(boost::forward<Args>(args)...); + } + } + } + } +} + +#define BOOST_UNORDERED_CALL_CONSTRUCT1(Traits, alloc, address, a0) \ + boost::unordered::detail::func::construct_value(address, a0) +#define BOOST_UNORDERED_CALL_DESTROY(Traits, alloc, x) \ + boost::unordered::detail::func::destroy(x) + +#else + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + template <typename T> inline void construct_value(T* address) + { + new ((void*)address) T(); + } + + template <typename T, typename A0> + inline void construct_value(T* address, BOOST_FWD_REF(A0) a0) + { + new ((void*)address) T(boost::forward<A0>(a0)); + } + } + } + } +} + +#define BOOST_UNORDERED_CALL_CONSTRUCT1(Traits, alloc, address, a0) \ + boost::unordered::detail::func::construct_value(address, a0) +#define BOOST_UNORDERED_CALL_DESTROY(Traits, alloc, x) \ + boost::unordered::detail::func::destroy(x) + +#endif + +//////////////////////////////////////////////////////////////////////////// +// Construct from tuple +// +// Used to emulate piecewise construction. + +#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(z, n, namespace_) \ + template <typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + void construct_from_tuple(Alloc&, T* ptr, \ + namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \ + { \ + new ((void*)ptr) \ + T(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_)); \ + } + +#define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) namespace_::get<n>(x) + +// construct_from_tuple for boost::tuple +// The workaround for old Sun compilers comes later in the file. + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + template <typename Alloc, typename T> + void construct_from_tuple(Alloc&, T* ptr, boost::tuple<>) + { + new ((void*)ptr) T(); + } + + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 1, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 2, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 3, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 4, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 5, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 6, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 7, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 8, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 9, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 10, boost) + } + } + } +} + +#endif + +// construct_from_tuple for std::tuple + +#if !BOOST_UNORDERED_CXX11_CONSTRUCTION && BOOST_UNORDERED_TUPLE_ARGS + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + template <typename Alloc, typename T> + void construct_from_tuple(Alloc&, T* ptr, std::tuple<>) + { + new ((void*)ptr) T(); + } + + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 1, std) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 2, std) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 3, std) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 4, std) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 5, std) + +#if BOOST_UNORDERED_TUPLE_ARGS >= 6 + BOOST_PP_REPEAT_FROM_TO(6, BOOST_PP_INC(BOOST_UNORDERED_TUPLE_ARGS), + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE, std) +#endif + } + } + } +} + +#endif + +#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE +#undef BOOST_UNORDERED_GET_TUPLE_ARG + +// construct_from_tuple for boost::tuple on old versions of sunpro. +// +// Old versions of Sun C++ had problems with template overloads of +// boost::tuple, so to fix it I added a distinct type for each length to +// the overloads. That means there's no possible ambiguity between the +// different overloads, so that the compiler doesn't get confused + +#if BOOST_UNORDERED_SUN_WORKAROUNDS1 + +#define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(z, n, namespace_) \ + template <typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + void construct_from_tuple_impl(boost::unordered::detail::func::length<n>, \ + Alloc&, T* ptr, \ + namespace_::tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \ + { \ + new ((void*)ptr) \ + T(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_)); \ + } + +#define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) namespace_::get<n>(x) + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + template <int N> struct length + { + }; + + template <typename Alloc, typename T> + void construct_from_tuple_impl( + boost::unordered::detail::func::length<0>, Alloc&, T* ptr, + boost::tuple<>) + { + new ((void*)ptr) T(); + } + + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 1, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 2, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 3, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 4, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 5, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 6, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 7, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 8, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 9, boost) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(1, 10, boost) + + template <typename Alloc, typename T, typename Tuple> + void construct_from_tuple(Alloc& alloc, T* ptr, Tuple const& x) + { + construct_from_tuple_impl(boost::unordered::detail::func::length< + boost::tuples::length<Tuple>::value>(), + alloc, ptr, x); + } + } + } + } +} + +#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE +#undef BOOST_UNORDERED_GET_TUPLE_ARG + +#endif + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + //////////////////////////////////////////////////////////////////////// + // Trait to check for piecewise construction. + + template <typename A0> struct use_piecewise + { + static choice1::type test( + choice1, boost::unordered::piecewise_construct_t); + + static choice2::type test(choice2, ...); + + enum + { + value = sizeof(choice1::type) == + sizeof(test(choose(), boost::unordered::detail::make<A0>())) + }; + }; + +#if BOOST_UNORDERED_CXX11_CONSTRUCTION + + //////////////////////////////////////////////////////////////////////// + // Construct from variadic parameters + + template <typename Alloc, typename T, typename... Args> + inline void construct_from_args( + Alloc& alloc, T* address, BOOST_FWD_REF(Args)... args) + { + boost::unordered::detail::allocator_traits<Alloc>::construct( + alloc, address, boost::forward<Args>(args)...); + } + + // For backwards compatibility, implement a special case for + // piecewise_construct with boost::tuple + + template <typename A0> struct detect_boost_tuple + { + template <typename T0, typename T1, typename T2, typename T3, + typename T4, typename T5, typename T6, typename T7, typename T8, + typename T9> + static choice1::type test(choice1, + boost::tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> const&); + + static choice2::type test(choice2, ...); + + enum + { + value = sizeof(choice1::type) == + sizeof(test(choose(), boost::unordered::detail::make<A0>())) + }; + }; + + // Special case for piecewise_construct + + template <typename Alloc, typename A, typename B, typename A0, + typename A1, typename A2> + inline typename boost::enable_if_c<use_piecewise<A0>::value && + detect_boost_tuple<A1>::value && + detect_boost_tuple<A2>::value, + void>::type + construct_from_args(Alloc& alloc, std::pair<A, B>* address, + BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + boost::unordered::detail::func::construct_from_tuple( + alloc, boost::addressof(address->first), boost::forward<A1>(a1)); + BOOST_TRY + { + boost::unordered::detail::func::construct_from_tuple( + alloc, boost::addressof(address->second), boost::forward<A2>(a2)); + } + BOOST_CATCH(...) + { + boost::unordered::detail::func::destroy( + boost::addressof(address->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + } + +#elif !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + //////////////////////////////////////////////////////////////////////// + // Construct from variadic parameters + + template <typename Alloc, typename T, typename... Args> + inline void construct_from_args( + Alloc&, T* address, BOOST_FWD_REF(Args)... args) + { + new ((void*)address) T(boost::forward<Args>(args)...); + } + + // Special case for piecewise_construct + + template <typename Alloc, typename A, typename B, typename A0, + typename A1, typename A2> + inline typename enable_if<use_piecewise<A0>, void>::type + construct_from_args(Alloc& alloc, std::pair<A, B>* address, + BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + boost::unordered::detail::func::construct_from_tuple( + alloc, boost::addressof(address->first), boost::forward<A1>(a1)); + BOOST_TRY + { + boost::unordered::detail::func::construct_from_tuple( + alloc, boost::addressof(address->second), boost::forward<A2>(a2)); + } + BOOST_CATCH(...) + { + boost::unordered::detail::func::destroy( + boost::addressof(address->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + } + +#else // BOOST_NO_CXX11_VARIADIC_TEMPLATES + + //////////////////////////////////////////////////////////////////////// + // Construct from emplace_args + + // Explicitly write out first three overloads for the sake of sane + // error messages. + + template <typename Alloc, typename T, typename A0> + inline void construct_from_args( + Alloc&, T* address, emplace_args1<A0> const& args) + { + new ((void*)address) T(boost::forward<A0>(args.a0)); + } + + template <typename Alloc, typename T, typename A0, typename A1> + inline void construct_from_args( + Alloc&, T* address, emplace_args2<A0, A1> const& args) + { + new ((void*)address) + T(boost::forward<A0>(args.a0), boost::forward<A1>(args.a1)); + } + + template <typename Alloc, typename T, typename A0, typename A1, + typename A2> + inline void construct_from_args( + Alloc&, T* address, emplace_args3<A0, A1, A2> const& args) + { + new ((void*)address) T(boost::forward<A0>(args.a0), + boost::forward<A1>(args.a1), boost::forward<A2>(args.a2)); + } + +// Use a macro for the rest. + +#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ + template <typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A)> \ + inline void construct_from_args(Alloc&, T* address, \ + boost::unordered::detail::BOOST_PP_CAT(emplace_args, num_params) < \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) > const& args) \ + { \ + new ((void*)address) \ + T(BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD, args.a)); \ + } + + BOOST_UNORDERED_CONSTRUCT_IMPL(1, 4, _) + BOOST_UNORDERED_CONSTRUCT_IMPL(1, 5, _) + BOOST_UNORDERED_CONSTRUCT_IMPL(1, 6, _) + BOOST_UNORDERED_CONSTRUCT_IMPL(1, 7, _) + BOOST_UNORDERED_CONSTRUCT_IMPL(1, 8, _) + BOOST_UNORDERED_CONSTRUCT_IMPL(1, 9, _) + BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), + BOOST_UNORDERED_CONSTRUCT_IMPL, _) + +#undef BOOST_UNORDERED_CONSTRUCT_IMPL + + // Construct with piecewise_construct + + template <typename Alloc, typename A, typename B, typename A0, + typename A1, typename A2> + inline void construct_from_args(Alloc& alloc, std::pair<A, B>* address, + boost::unordered::detail::emplace_args3<A0, A1, A2> const& args, + typename enable_if<use_piecewise<A0>, void*>::type = 0) + { + boost::unordered::detail::func::construct_from_tuple( + alloc, boost::addressof(address->first), args.a1); + BOOST_TRY + { + boost::unordered::detail::func::construct_from_tuple( + alloc, boost::addressof(address->second), args.a2); + } + BOOST_CATCH(...) + { + boost::unordered::detail::func::destroy( + boost::addressof(address->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + } + +#endif // BOOST_NO_CXX11_VARIADIC_TEMPLATES + } + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + + /////////////////////////////////////////////////////////////////// + // + // Node construction + + template <typename NodeAlloc> struct node_constructor + { + typedef NodeAlloc node_allocator; + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; + typedef typename node_allocator_traits::value_type node; + typedef typename node_allocator_traits::pointer node_pointer; + typedef typename node::value_type value_type; + + node_allocator& alloc_; + node_pointer node_; + + node_constructor(node_allocator& n) : alloc_(n), node_() {} + + ~node_constructor(); + + void create_node(); + + // no throw + node_pointer release() + { + BOOST_ASSERT(node_); + node_pointer p = node_; + node_ = node_pointer(); + return p; + } + + void reclaim(node_pointer p) + { + BOOST_ASSERT(!node_); + node_ = p; + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, alloc_, node_->value_ptr()); + } + + private: + node_constructor(node_constructor const&); + node_constructor& operator=(node_constructor const&); + }; + + template <typename Alloc> node_constructor<Alloc>::~node_constructor() + { + if (node_) { + boost::unordered::detail::func::destroy(boost::to_address(node_)); + node_allocator_traits::deallocate(alloc_, node_, 1); + } + } + + template <typename Alloc> void node_constructor<Alloc>::create_node() + { + BOOST_ASSERT(!node_); + node_ = node_allocator_traits::allocate(alloc_, 1); + new ((void*)boost::to_address(node_)) node(); + } + + template <typename NodeAlloc> struct node_tmp + { + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; + typedef typename node_allocator_traits::pointer node_pointer; + typedef typename node_allocator_traits::value_type node; + + NodeAlloc& alloc_; + node_pointer node_; + + explicit node_tmp(node_pointer n, NodeAlloc& a) : alloc_(a), node_(n) {} + + ~node_tmp(); + + // no throw + node_pointer release() + { + node_pointer p = node_; + node_ = node_pointer(); + return p; + } + }; + + template <typename Alloc> node_tmp<Alloc>::~node_tmp() + { + if (node_) { + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, alloc_, node_->value_ptr()); + boost::unordered::detail::func::destroy(boost::to_address(node_)); + node_allocator_traits::deallocate(alloc_, node_, 1); + } + } + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + namespace func { + + // Some nicer construct_node functions, might try to + // improve implementation later. + + template <typename Alloc, BOOST_UNORDERED_EMPLACE_TEMPLATE> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_from_args(Alloc& alloc, BOOST_UNORDERED_EMPLACE_ARGS) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + construct_from_args( + alloc, a.node_->value_ptr(), BOOST_UNORDERED_EMPLACE_FORWARD); + return a.release(); + } + + template <typename Alloc, typename U> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node(Alloc& alloc, BOOST_FWD_REF(U) x) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + BOOST_UNORDERED_CALL_CONSTRUCT1( + boost::unordered::detail::allocator_traits<Alloc>, alloc, + a.node_->value_ptr(), boost::forward<U>(x)); + return a.release(); + } + +#if BOOST_UNORDERED_CXX11_CONSTRUCTION + + template <typename Alloc, typename Key> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + boost::unordered::detail::allocator_traits<Alloc>::construct(alloc, + a.node_->value_ptr(), std::piecewise_construct, + std::forward_as_tuple(boost::forward<Key>(k)), + std::forward_as_tuple()); + return a.release(); + } + + template <typename Alloc, typename Key, typename Mapped> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_pair( + Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + boost::unordered::detail::allocator_traits<Alloc>::construct(alloc, + a.node_->value_ptr(), std::piecewise_construct, + std::forward_as_tuple(boost::forward<Key>(k)), + std::forward_as_tuple(boost::forward<Mapped>(m))); + return a.release(); + } + + template <typename Alloc, typename Key, typename... Args> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_pair_from_args( + Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Args)... args) + { + node_constructor<Alloc> a(alloc); + a.create_node(); +#if !(BOOST_COMP_CLANG && BOOST_COMP_CLANG < BOOST_VERSION_NUMBER(3, 8, 0) && \ + defined(BOOST_LIBSTDCXX11)) + boost::unordered::detail::allocator_traits<Alloc>::construct(alloc, + a.node_->value_ptr(), std::piecewise_construct, + std::forward_as_tuple(boost::forward<Key>(k)), + std::forward_as_tuple(boost::forward<Args>(args)...)); +#else + // It doesn't seem to be possible to construct a tuple with 3 variadic + // rvalue reference members when using older versions of clang with + // libstdc++, so just use std::make_tuple instead of + // std::forward_as_tuple. + boost::unordered::detail::allocator_traits<Alloc>::construct(alloc, + a.node_->value_ptr(), std::piecewise_construct, + std::forward_as_tuple(boost::forward<Key>(k)), + std::make_tuple(boost::forward<Args>(args)...)); +#endif + return a.release(); + } + +#else + + template <typename Alloc, typename Key> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_pair(Alloc& alloc, BOOST_FWD_REF(Key) k) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + boost::unordered::detail::func::construct_value( + boost::addressof(a.node_->value_ptr()->first), + boost::forward<Key>(k)); + BOOST_TRY + { + boost::unordered::detail::func::construct_value( + boost::addressof(a.node_->value_ptr()->second)); + } + BOOST_CATCH(...) + { + boost::unordered::detail::func::destroy( + boost::addressof(a.node_->value_ptr()->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + return a.release(); + } + + template <typename Alloc, typename Key, typename Mapped> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_pair( + Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_FWD_REF(Mapped) m) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + boost::unordered::detail::func::construct_value( + boost::addressof(a.node_->value_ptr()->first), + boost::forward<Key>(k)); + BOOST_TRY + { + boost::unordered::detail::func::construct_value( + boost::addressof(a.node_->value_ptr()->second), + boost::forward<Mapped>(m)); + } + BOOST_CATCH(...) + { + boost::unordered::detail::func::destroy( + boost::addressof(a.node_->value_ptr()->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + return a.release(); + } + + template <typename Alloc, typename Key, + BOOST_UNORDERED_EMPLACE_TEMPLATE> + inline + typename boost::unordered::detail::allocator_traits<Alloc>::pointer + construct_node_pair_from_args( + Alloc& alloc, BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS) + { + node_constructor<Alloc> a(alloc); + a.create_node(); + boost::unordered::detail::func::construct_value( + boost::addressof(a.node_->value_ptr()->first), + boost::forward<Key>(k)); + BOOST_TRY + { + boost::unordered::detail::func::construct_from_args(alloc, + boost::addressof(a.node_->value_ptr()->second), + BOOST_UNORDERED_EMPLACE_FORWARD); + } + BOOST_CATCH(...) + { + boost::unordered::detail::func::destroy( + boost::addressof(a.node_->value_ptr()->first)); + BOOST_RETHROW + } + BOOST_CATCH_END + return a.release(); + } + +#endif + } + } + } +} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +// The 'iterator_detail' namespace was a misguided attempt at avoiding ADL +// in the detail namespace. It didn't work because the template parameters +// were in detail. I'm not changing it at the moment to be safe. I might +// do in the future if I change the iterator types. +namespace boost { + namespace unordered { + namespace iterator_detail { + + ////////////////////////////////////////////////////////////////////////// + // Iterators + // + // all no throw + + template <typename Node> struct l_iterator + { +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename Node2> + friend struct boost::unordered::iterator_detail::cl_iterator; + + private: +#endif + typedef typename Node::node_pointer node_pointer; + node_pointer ptr_; + std::size_t bucket_; + std::size_t bucket_count_; + + public: + typedef typename Node::value_type element_type; + typedef typename Node::value_type value_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + l_iterator() BOOST_NOEXCEPT : ptr_() {} + + l_iterator(node_pointer n, std::size_t b, std::size_t c) BOOST_NOEXCEPT + : ptr_(n), + bucket_(b), + bucket_count_(c) + { + } + + value_type& operator*() const { return ptr_->value(); } + + value_type* operator->() const { return ptr_->value_ptr(); } + + l_iterator& operator++() + { + ptr_ = static_cast<node_pointer>(ptr_->next_); + if (ptr_ && ptr_->get_bucket() != bucket_) + ptr_ = node_pointer(); + return *this; + } + + l_iterator operator++(int) + { + l_iterator tmp(*this); + ++(*this); + return tmp; + } + + bool operator==(l_iterator x) const BOOST_NOEXCEPT + { + return ptr_ == x.ptr_; + } + + bool operator!=(l_iterator x) const BOOST_NOEXCEPT + { + return ptr_ != x.ptr_; + } + }; + + template <typename Node> struct cl_iterator + { + friend struct boost::unordered::iterator_detail::l_iterator<Node>; + + private: + typedef typename Node::node_pointer node_pointer; + node_pointer ptr_; + std::size_t bucket_; + std::size_t bucket_count_; + + public: + typedef typename Node::value_type const element_type; + typedef typename Node::value_type value_type; + typedef value_type const* pointer; + typedef value_type const& reference; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + cl_iterator() BOOST_NOEXCEPT : ptr_() {} + + cl_iterator(node_pointer n, std::size_t b, std::size_t c) BOOST_NOEXCEPT + : ptr_(n), + bucket_(b), + bucket_count_(c) + { + } + + cl_iterator( + boost::unordered::iterator_detail::l_iterator<Node> const& x) + BOOST_NOEXCEPT : ptr_(x.ptr_), + bucket_(x.bucket_), + bucket_count_(x.bucket_count_) + { + } + + value_type const& operator*() const { return ptr_->value(); } + + value_type const* operator->() const { return ptr_->value_ptr(); } + + cl_iterator& operator++() + { + ptr_ = static_cast<node_pointer>(ptr_->next_); + if (ptr_ && ptr_->get_bucket() != bucket_) + ptr_ = node_pointer(); + return *this; + } + + cl_iterator operator++(int) + { + cl_iterator tmp(*this); + ++(*this); + return tmp; + } + + friend bool operator==( + cl_iterator const& x, cl_iterator const& y) BOOST_NOEXCEPT + { + return x.ptr_ == y.ptr_; + } + + friend bool operator!=( + cl_iterator const& x, cl_iterator const& y) BOOST_NOEXCEPT + { + return x.ptr_ != y.ptr_; + } + }; + + template <typename Node> struct iterator + { +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename> + friend struct boost::unordered::iterator_detail::c_iterator; + template <typename> friend struct boost::unordered::detail::table; + + private: +#endif + typedef typename Node::node_pointer node_pointer; + node_pointer node_; + + public: + typedef typename Node::value_type element_type; + typedef typename Node::value_type value_type; + typedef value_type* pointer; + typedef value_type& reference; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + iterator() BOOST_NOEXCEPT : node_() {} + + explicit iterator(typename Node::link_pointer x) BOOST_NOEXCEPT + : node_(static_cast<node_pointer>(x)) + { + } + + value_type& operator*() const { return node_->value(); } + + value_type* operator->() const { return node_->value_ptr(); } + + iterator& operator++() + { + node_ = static_cast<node_pointer>(node_->next_); + return *this; + } + + iterator operator++(int) + { + iterator tmp(node_); + node_ = static_cast<node_pointer>(node_->next_); + return tmp; + } + + bool operator==(iterator const& x) const BOOST_NOEXCEPT + { + return node_ == x.node_; + } + + bool operator!=(iterator const& x) const BOOST_NOEXCEPT + { + return node_ != x.node_; + } + }; + + template <typename Node> struct c_iterator + { + friend struct boost::unordered::iterator_detail::iterator<Node>; + +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename> friend struct boost::unordered::detail::table; + + private: +#endif + typedef typename Node::node_pointer node_pointer; + typedef boost::unordered::iterator_detail::iterator<Node> n_iterator; + node_pointer node_; + + public: + typedef typename Node::value_type const element_type; + typedef typename Node::value_type value_type; + typedef value_type const* pointer; + typedef value_type const& reference; + typedef std::ptrdiff_t difference_type; + typedef std::forward_iterator_tag iterator_category; + + c_iterator() BOOST_NOEXCEPT : node_() {} + + explicit c_iterator(typename Node::link_pointer x) BOOST_NOEXCEPT + : node_(static_cast<node_pointer>(x)) + { + } + + c_iterator(n_iterator const& x) BOOST_NOEXCEPT : node_(x.node_) {} + + value_type const& operator*() const { return node_->value(); } + + value_type const* operator->() const { return node_->value_ptr(); } + + c_iterator& operator++() + { + node_ = static_cast<node_pointer>(node_->next_); + return *this; + } + + c_iterator operator++(int) + { + c_iterator tmp(node_); + node_ = static_cast<node_pointer>(node_->next_); + return tmp; + } + + friend bool operator==( + c_iterator const& x, c_iterator const& y) BOOST_NOEXCEPT + { + return x.node_ == y.node_; + } + + friend bool operator!=( + c_iterator const& x, c_iterator const& y) BOOST_NOEXCEPT + { + return x.node_ != y.node_; + } + }; + } + } +} + +namespace boost { + namespace unordered { + namespace detail { + + /////////////////////////////////////////////////////////////////// + // + // Node Holder + // + // Temporary store for nodes. Deletes any that aren't used. + + template <typename NodeAlloc> struct node_holder + { + private: + typedef NodeAlloc node_allocator; + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; + typedef typename node_allocator_traits::value_type node; + typedef typename node_allocator_traits::pointer node_pointer; + typedef typename node::value_type value_type; + typedef typename node::link_pointer link_pointer; + typedef boost::unordered::iterator_detail::iterator<node> iterator; + + node_constructor<NodeAlloc> constructor_; + node_pointer nodes_; + + public: + template <typename Table> + explicit node_holder(Table& b) : constructor_(b.node_alloc()), nodes_() + { + if (b.size_) { + typename Table::link_pointer prev = b.get_previous_start(); + nodes_ = static_cast<node_pointer>(prev->next_); + prev->next_ = link_pointer(); + b.size_ = 0; + } + } + + ~node_holder(); + + node_pointer pop_node() + { + node_pointer n = nodes_; + nodes_ = static_cast<node_pointer>(nodes_->next_); + n->next_ = link_pointer(); + return n; + } + + template <typename T> inline node_pointer copy_of(T const& v) + { + if (nodes_) { + constructor_.reclaim(pop_node()); + } else { + constructor_.create_node(); + } + BOOST_UNORDERED_CALL_CONSTRUCT1(node_allocator_traits, + constructor_.alloc_, constructor_.node_->value_ptr(), v); + return constructor_.release(); + } + + template <typename T> inline node_pointer move_copy_of(T& v) + { + if (nodes_) { + constructor_.reclaim(pop_node()); + } else { + constructor_.create_node(); + } + BOOST_UNORDERED_CALL_CONSTRUCT1(node_allocator_traits, + constructor_.alloc_, constructor_.node_->value_ptr(), + boost::move(v)); + return constructor_.release(); + } + + iterator begin() const { return iterator(nodes_); } + }; + + template <typename Alloc> node_holder<Alloc>::~node_holder() + { + while (nodes_) { + node_pointer p = nodes_; + nodes_ = static_cast<node_pointer>(p->next_); + + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, constructor_.alloc_, p->value_ptr()); + boost::unordered::detail::func::destroy(boost::to_address(p)); + node_allocator_traits::deallocate(constructor_.alloc_, p, 1); + } + } + + /////////////////////////////////////////////////////////////////// + // + // Bucket + + template <typename NodePointer> struct bucket + { + typedef NodePointer link_pointer; + link_pointer next_; + + bucket() : next_() {} + bucket(link_pointer n) : next_(n) {} + + link_pointer first_from_start() { return next_; } + + enum + { + extra_node = true + }; + }; + + struct ptr_bucket + { + typedef ptr_bucket* link_pointer; + link_pointer next_; + + ptr_bucket() : next_(0) {} + ptr_bucket(link_pointer n) : next_(n) {} + + link_pointer first_from_start() { return this; } + + enum + { + extra_node = false + }; + }; + + /////////////////////////////////////////////////////////////////// + // + // Hash Policy + + template <typename SizeT> struct prime_policy + { + template <typename Hash, typename T> + static inline SizeT apply_hash(Hash const& hf, T const& x) + { + return hf(x); + } + + static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) + { + return hash % bucket_count; + } + + static inline SizeT new_bucket_count(SizeT min) + { + return boost::unordered::detail::next_prime(min); + } + + static inline SizeT prev_bucket_count(SizeT max) + { + return boost::unordered::detail::prev_prime(max); + } + }; + + template <typename SizeT> struct mix64_policy + { + template <typename Hash, typename T> + static inline SizeT apply_hash(Hash const& hf, T const& x) + { + SizeT key = hf(x); + key = (~key) + (key << 21); // key = (key << 21) - key - 1; + key = key ^ (key >> 24); + key = (key + (key << 3)) + (key << 8); // key * 265 + key = key ^ (key >> 14); + key = (key + (key << 2)) + (key << 4); // key * 21 + key = key ^ (key >> 28); + key = key + (key << 31); + return key; + } + + static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) + { + return hash & (bucket_count - 1); + } + + static inline SizeT new_bucket_count(SizeT min) + { + if (min <= 4) + return 4; + --min; + min |= min >> 1; + min |= min >> 2; + min |= min >> 4; + min |= min >> 8; + min |= min >> 16; + min |= min >> 32; + return min + 1; + } + + static inline SizeT prev_bucket_count(SizeT max) + { + max |= max >> 1; + max |= max >> 2; + max |= max >> 4; + max |= max >> 8; + max |= max >> 16; + max |= max >> 32; + return (max >> 1) + 1; + } + }; + + template <int digits, int radix> struct pick_policy_impl + { + typedef prime_policy<std::size_t> type; + }; + + template <> struct pick_policy_impl<64, 2> + { + typedef mix64_policy<std::size_t> type; + }; + + template <typename T> + struct pick_policy2 + : pick_policy_impl<std::numeric_limits<std::size_t>::digits, + std::numeric_limits<std::size_t>::radix> + { + }; + + // While the mix policy is generally faster, the prime policy is a lot + // faster when a large number consecutive integers are used, because + // there are no collisions. Since that is probably quite common, use + // prime policy for integeral types. But not the smaller ones, as they + // don't have enough unique values for this to be an issue. + + template <> struct pick_policy2<int> + { + typedef prime_policy<std::size_t> type; + }; + + template <> struct pick_policy2<unsigned int> + { + typedef prime_policy<std::size_t> type; + }; + + template <> struct pick_policy2<long> + { + typedef prime_policy<std::size_t> type; + }; + + template <> struct pick_policy2<unsigned long> + { + typedef prime_policy<std::size_t> type; + }; + +#if !defined(BOOST_NO_LONG_LONG) + template <> struct pick_policy2<boost::long_long_type> + { + typedef prime_policy<std::size_t> type; + }; + + template <> struct pick_policy2<boost::ulong_long_type> + { + typedef prime_policy<std::size_t> type; + }; +#endif + + template <typename T> + struct pick_policy : pick_policy2<typename boost::remove_cv<T>::type> + { + }; + + ////////////////////////////////////////////////////////////////////////// + // Functions + // + // This double buffers the storage for the hash function and key equality + // predicate in order to have exception safe copy/swap. To do so, + // use 'construct_spare' to construct in the spare space, and then when + // ready to use 'switch_functions' to switch to the new functions. + // If an exception is thrown between these two calls, use + // 'cleanup_spare_functions' to destroy the unused constructed functions. + + template <class H, class P> class functions + { + public: + static const bool nothrow_move_assignable = + boost::is_nothrow_move_assignable<H>::value && + boost::is_nothrow_move_assignable<P>::value; + static const bool nothrow_move_constructible = + boost::is_nothrow_move_constructible<H>::value && + boost::is_nothrow_move_constructible<P>::value; + static const bool nothrow_swappable = + boost::is_nothrow_swappable<H>::value && + boost::is_nothrow_swappable<P>::value; + + private: + functions& operator=(functions const&); + + typedef compressed<H, P> function_pair; + + typedef typename boost::aligned_storage<sizeof(function_pair), + boost::alignment_of<function_pair>::value>::type aligned_function; + + unsigned char current_; // 0/1 - Currently active functions + // +2 - Both constructed + aligned_function funcs_[2]; + + public: + functions(H const& hf, P const& eq) : current_(0) + { + construct_functions(current_, hf, eq); + } + + functions(functions const& bf) : current_(0) + { + construct_functions(current_, bf.current_functions()); + } + + functions(functions& bf, boost::unordered::detail::move_tag) + : current_(0) + { + construct_functions(current_, bf.current_functions(), + boost::unordered::detail::integral_constant<bool, + nothrow_move_constructible>()); + } + + ~functions() + { + BOOST_ASSERT(!(current_ & 2)); + destroy_functions(current_); + } + + H const& hash_function() const { return current_functions().first(); } + + P const& key_eq() const { return current_functions().second(); } + + function_pair const& current_functions() const + { + return *static_cast<function_pair const*>( + static_cast<void const*>(funcs_[current_ & 1].address())); + } + + function_pair& current_functions() + { + return *static_cast<function_pair*>( + static_cast<void*>(funcs_[current_ & 1].address())); + } + + void construct_spare_functions(function_pair const& f) + { + BOOST_ASSERT(!(current_ & 2)); + construct_functions(current_ ^ 1, f); + current_ |= 2; + } + + void cleanup_spare_functions() + { + if (current_ & 2) { + current_ = static_cast<unsigned char>(current_ & 1); + destroy_functions(current_ ^ 1); + } + } + + void switch_functions() + { + BOOST_ASSERT(current_ & 2); + destroy_functions(static_cast<unsigned char>(current_ & 1)); + current_ ^= 3; + } + + private: + void construct_functions(unsigned char which, H const& hf, P const& eq) + { + BOOST_ASSERT(!(which & 2)); + new ((void*)&funcs_[which]) function_pair(hf, eq); + } + + void construct_functions(unsigned char which, function_pair const& f, + boost::unordered::detail::false_type = + boost::unordered::detail::false_type()) + { + BOOST_ASSERT(!(which & 2)); + new ((void*)&funcs_[which]) function_pair(f); + } + + void construct_functions(unsigned char which, function_pair& f, + boost::unordered::detail::true_type) + { + BOOST_ASSERT(!(which & 2)); + new ((void*)&funcs_[which]) + function_pair(f, boost::unordered::detail::move_tag()); + } + + void destroy_functions(unsigned char which) + { + BOOST_ASSERT(!(which & 2)); + boost::unordered::detail::func::destroy( + (function_pair*)(&funcs_[which])); + } + }; + +//////////////////////////////////////////////////////////////////////////// +// rvalue parameters when type can't be a BOOST_RV_REF(T) parameter +// e.g. for int + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) +#define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T) +#else + struct please_ignore_this_overload + { + typedef please_ignore_this_overload type; + }; + + template <typename T> struct rv_ref_impl + { + typedef BOOST_RV_REF(T) type; + }; + + template <typename T> + struct rv_ref + : boost::detail::if_true<boost::is_class<T>::value>:: + BOOST_NESTED_TEMPLATE then<boost::unordered::detail::rv_ref_impl<T>, + please_ignore_this_overload>::type + { + }; + +#define BOOST_UNORDERED_RV_REF(T) \ + typename boost::unordered::detail::rv_ref<T>::type +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable : 4127) // conditional expression is constant +#endif + + ////////////////////////////////////////////////////////////////////////// + // convert double to std::size_t + + inline std::size_t double_to_size(double f) + { + return f >= static_cast<double>( + (std::numeric_limits<std::size_t>::max)()) + ? (std::numeric_limits<std::size_t>::max)() + : static_cast<std::size_t>(f); + } + + template <typename Types> + struct table : boost::unordered::detail::functions<typename Types::hasher, + typename Types::key_equal> + { + private: + table(table const&); + table& operator=(table const&); + + public: + typedef typename Types::node node; + typedef typename Types::bucket bucket; + typedef typename Types::hasher hasher; + typedef typename Types::key_equal key_equal; + typedef typename Types::const_key_type const_key_type; + typedef typename Types::extractor extractor; + typedef typename Types::value_type value_type; + typedef typename Types::table table_impl; + typedef typename Types::link_pointer link_pointer; + typedef typename Types::policy policy; + typedef typename Types::iterator iterator; + typedef typename Types::c_iterator c_iterator; + typedef typename Types::l_iterator l_iterator; + typedef typename Types::cl_iterator cl_iterator; + + typedef boost::unordered::detail::functions<typename Types::hasher, + typename Types::key_equal> + functions; + + typedef typename Types::value_allocator value_allocator; + typedef typename boost::unordered::detail::rebind_wrap<value_allocator, + node>::type node_allocator; + typedef typename boost::unordered::detail::rebind_wrap<value_allocator, + bucket>::type bucket_allocator; + typedef boost::unordered::detail::allocator_traits<node_allocator> + node_allocator_traits; + typedef boost::unordered::detail::allocator_traits<bucket_allocator> + bucket_allocator_traits; + typedef typename node_allocator_traits::pointer node_pointer; + typedef + typename node_allocator_traits::const_pointer const_node_pointer; + typedef typename bucket_allocator_traits::pointer bucket_pointer; + typedef boost::unordered::detail::node_constructor<node_allocator> + node_constructor; + typedef boost::unordered::detail::node_tmp<node_allocator> node_tmp; + + typedef std::pair<iterator, bool> emplace_return; + + //////////////////////////////////////////////////////////////////////// + // Members + + boost::unordered::detail::compressed<bucket_allocator, node_allocator> + allocators_; + std::size_t bucket_count_; + std::size_t size_; + float mlf_; + std::size_t max_load_; + bucket_pointer buckets_; + + //////////////////////////////////////////////////////////////////////// + // Data access + + static node_pointer get_node(c_iterator it) { return it.node_; } + + static node_pointer next_node(link_pointer n) + { + return static_cast<node_pointer>(n->next_); + } + + static node_pointer next_for_find(link_pointer n) + { + node_pointer n2 = static_cast<node_pointer>(n); + do { + n2 = next_node(n2); + } while (n2 && !n2->is_first_in_group()); + return n2; + } + + node_pointer next_group(node_pointer n) const + { + node_pointer n1 = n; + do { + n1 = next_node(n1); + } while (n1 && !n1->is_first_in_group()); + return n1; + } + + std::size_t group_count(node_pointer n) const + { + std::size_t x = 0; + node_pointer it = n; + do { + ++x; + it = next_node(it); + } while (it && !it->is_first_in_group()); + + return x; + } + + std::size_t node_bucket(node_pointer n) const + { + return n->get_bucket(); + } + + bucket_allocator const& bucket_alloc() const + { + return allocators_.first(); + } + + node_allocator const& node_alloc() const + { + return allocators_.second(); + } + + bucket_allocator& bucket_alloc() { return allocators_.first(); } + + node_allocator& node_alloc() { return allocators_.second(); } + + std::size_t max_bucket_count() const + { + // -1 to account for the start bucket. + return policy::prev_bucket_count( + bucket_allocator_traits::max_size(bucket_alloc()) - 1); + } + + bucket_pointer get_bucket_pointer(std::size_t bucket_index) const + { + BOOST_ASSERT(buckets_); + return buckets_ + static_cast<std::ptrdiff_t>(bucket_index); + } + + link_pointer get_previous_start() const + { + return get_bucket_pointer(bucket_count_)->first_from_start(); + } + + link_pointer get_previous_start(std::size_t bucket_index) const + { + return get_bucket_pointer(bucket_index)->next_; + } + + node_pointer begin() const + { + return size_ ? next_node(get_previous_start()) : node_pointer(); + } + + node_pointer begin(std::size_t bucket_index) const + { + if (!size_) + return node_pointer(); + link_pointer prev = get_previous_start(bucket_index); + return prev ? next_node(prev) : node_pointer(); + } + + std::size_t hash_to_bucket(std::size_t hash_value) const + { + return policy::to_bucket(bucket_count_, hash_value); + } + + std::size_t bucket_size(std::size_t index) const + { + node_pointer n = begin(index); + if (!n) + return 0; + + std::size_t count = 0; + while (n && node_bucket(n) == index) { + ++count; + n = next_node(n); + } + + return count; + } + + //////////////////////////////////////////////////////////////////////// + // Load methods + + void recalculate_max_load() + { + using namespace std; + + // From 6.3.1/13: + // Only resize when size >= mlf_ * count + max_load_ = buckets_ ? boost::unordered::detail::double_to_size( + ceil(static_cast<double>(mlf_) * + static_cast<double>(bucket_count_))) + : 0; + } + + void max_load_factor(float z) + { + BOOST_ASSERT(z > 0); + mlf_ = (std::max)(z, minimum_max_load_factor); + recalculate_max_load(); + } + + std::size_t min_buckets_for_size(std::size_t size) const + { + BOOST_ASSERT(mlf_ >= minimum_max_load_factor); + + using namespace std; + + // From insert/emplace requirements: + // + // size <= mlf_ * count + // => count >= size / mlf_ + // + // Or from rehash post-condition: + // + // count >= size / mlf_ + + return policy::new_bucket_count( + boost::unordered::detail::double_to_size( + floor(static_cast<double>(size) / static_cast<double>(mlf_)) + + 1)); + } + + //////////////////////////////////////////////////////////////////////// + // Constructors + + table(std::size_t num_buckets, hasher const& hf, key_equal const& eq, + node_allocator const& a) + : functions(hf, eq), allocators_(a, a), + bucket_count_(policy::new_bucket_count(num_buckets)), size_(0), + mlf_(1.0f), max_load_(0), buckets_() + { + } + + table(table const& x, node_allocator const& a) + : functions(x), allocators_(a, a), + bucket_count_(x.min_buckets_for_size(x.size_)), size_(0), + mlf_(x.mlf_), max_load_(0), buckets_() + { + } + + table(table& x, boost::unordered::detail::move_tag m) + : functions(x, m), allocators_(x.allocators_, m), + bucket_count_(x.bucket_count_), size_(x.size_), mlf_(x.mlf_), + max_load_(x.max_load_), buckets_(x.buckets_) + { + x.buckets_ = bucket_pointer(); + x.size_ = 0; + x.max_load_ = 0; + } + + table(table& x, node_allocator const& a, + boost::unordered::detail::move_tag m) + : functions(x, m), allocators_(a, a), + bucket_count_(x.bucket_count_), size_(0), mlf_(x.mlf_), + max_load_(0), buckets_() + { + } + + //////////////////////////////////////////////////////////////////////// + // Clear buckets and Create buckets + // + // IMPORTANT: If the container already contains any elements, the + // buckets will not contain any links to them. This will + // need to be dealt with, for example by: + // - deleting them + // - putting them in a 'node_holder' for future use + // (as in assignment) + // - placing them in buckets (see rehash_impl) + + // Clear the bucket pointers. + void clear_buckets() + { + bucket_pointer end = get_bucket_pointer(bucket_count_); + for (bucket_pointer it = buckets_; it != end; ++it) { + it->next_ = node_pointer(); + } + } + + // Create container buckets. If the container already contains any + // buckets + // the linked list will be transferred to the new buckets, but none + // of the bucket pointers will be set. See above note. + // + // Strong exception safety. + void create_buckets(std::size_t new_count) + { + link_pointer dummy_node; + + // Construct the new buckets and dummy node, and destroy the old + // buckets + if (buckets_) { + dummy_node = + (buckets_ + static_cast<std::ptrdiff_t>(bucket_count_))->next_; + bucket_pointer new_buckets = + bucket_allocator_traits::allocate(bucket_alloc(), new_count + 1); + destroy_buckets(); + buckets_ = new_buckets; + } else if (bucket::extra_node) { + node_constructor a(node_alloc()); + a.create_node(); + buckets_ = + bucket_allocator_traits::allocate(bucket_alloc(), new_count + 1); + dummy_node = a.release(); + } else { + dummy_node = link_pointer(); + buckets_ = + bucket_allocator_traits::allocate(bucket_alloc(), new_count + 1); + } + + // nothrow from here... + bucket_count_ = new_count; + recalculate_max_load(); + + bucket_pointer end = + buckets_ + static_cast<std::ptrdiff_t>(new_count); + for (bucket_pointer i = buckets_; i != end; ++i) { + new ((void*)boost::to_address(i)) bucket(); + } + new ((void*)boost::to_address(end)) bucket(dummy_node); + } + + //////////////////////////////////////////////////////////////////////// + // Swap and Move + + void swap_allocators(table& other, false_type) + { + boost::unordered::detail::func::ignore_unused_variable_warning(other); + + // According to 23.2.1.8, if propagate_on_container_swap is + // false the behaviour is undefined unless the allocators + // are equal. + BOOST_ASSERT(node_alloc() == other.node_alloc()); + } + + void swap_allocators(table& other, true_type) + { + allocators_.swap(other.allocators_); + } + + // Not nothrow swappable + void swap(table& x, false_type) + { + if (this == &x) { + return; + } + + this->construct_spare_functions(x.current_functions()); + BOOST_TRY { x.construct_spare_functions(this->current_functions()); } + BOOST_CATCH(...) + { + this->cleanup_spare_functions(); + BOOST_RETHROW + } + BOOST_CATCH_END + this->switch_functions(); + x.switch_functions(); + + swap_allocators( + x, boost::unordered::detail::integral_constant<bool, + allocator_traits< + node_allocator>::propagate_on_container_swap::value>()); + + boost::swap(buckets_, x.buckets_); + boost::swap(bucket_count_, x.bucket_count_); + boost::swap(size_, x.size_); + std::swap(mlf_, x.mlf_); + std::swap(max_load_, x.max_load_); + } + + // Nothrow swappable + void swap(table& x, true_type) + { + swap_allocators( + x, boost::unordered::detail::integral_constant<bool, + allocator_traits< + node_allocator>::propagate_on_container_swap::value>()); + + boost::swap(buckets_, x.buckets_); + boost::swap(bucket_count_, x.bucket_count_); + boost::swap(size_, x.size_); + std::swap(mlf_, x.mlf_); + std::swap(max_load_, x.max_load_); + this->current_functions().swap(x.current_functions()); + } + + // Only swaps the allocators if propagate_on_container_swap. + // If not propagate_on_container_swap and allocators aren't + // equal, behaviour is undefined. + void swap(table& x) + { + BOOST_ASSERT(allocator_traits< + node_allocator>::propagate_on_container_swap::value || + node_alloc() == x.node_alloc()); + swap(x, boost::unordered::detail::integral_constant<bool, + functions::nothrow_swappable>()); + } + + // Only call with nodes allocated with the currect allocator, or + // one that is equal to it. (Can't assert because other's + // allocators might have already been moved). + void move_buckets_from(table& other) + { + BOOST_ASSERT(!buckets_); + buckets_ = other.buckets_; + bucket_count_ = other.bucket_count_; + size_ = other.size_; + max_load_ = other.max_load_; + other.buckets_ = bucket_pointer(); + other.size_ = 0; + other.max_load_ = 0; + } + + // For use in the constructor when allocators might be different. + void move_construct_buckets(table& src) + { + if (this->node_alloc() == src.node_alloc()) { + move_buckets_from(src); + } else { + this->create_buckets(this->bucket_count_); + link_pointer prev = this->get_previous_start(); + std::size_t last_bucket = this->bucket_count_; + for (node_pointer n = src.begin(); n; n = next_node(n)) { + std::size_t n_bucket = n->get_bucket(); + if (n_bucket != last_bucket) { + this->get_bucket_pointer(n_bucket)->next_ = prev; + } + node_pointer n2 = boost::unordered::detail::func::construct_node( + this->node_alloc(), boost::move(n->value())); + n2->bucket_info_ = n->bucket_info_; + prev->next_ = n2; + ++size_; + prev = n2; + last_bucket = n_bucket; + } + } + } + + //////////////////////////////////////////////////////////////////////// + // Delete/destruct + + ~table() { delete_buckets(); } + + void destroy_node(node_pointer n) + { + BOOST_UNORDERED_CALL_DESTROY( + node_allocator_traits, node_alloc(), n->value_ptr()); + boost::unordered::detail::func::destroy(boost::to_address(n)); + node_allocator_traits::deallocate(node_alloc(), n, 1); + } + + void delete_buckets() + { + if (buckets_) { + node_pointer n = static_cast<node_pointer>( + get_bucket_pointer(bucket_count_)->next_); + + if (bucket::extra_node) { + node_pointer next = next_node(n); + boost::unordered::detail::func::destroy(boost::to_address(n)); + node_allocator_traits::deallocate(node_alloc(), n, 1); + n = next; + } + + while (n) { + node_pointer next = next_node(n); + destroy_node(n); + n = next; + } + + destroy_buckets(); + buckets_ = bucket_pointer(); + max_load_ = 0; + size_ = 0; + } + } + + void destroy_buckets() + { + bucket_pointer end = get_bucket_pointer(bucket_count_ + 1); + for (bucket_pointer it = buckets_; it != end; ++it) { + boost::unordered::detail::func::destroy(boost::to_address(it)); + } + + bucket_allocator_traits::deallocate( + bucket_alloc(), buckets_, bucket_count_ + 1); + } + + //////////////////////////////////////////////////////////////////////// + // Fix buckets after delete/extract + // + // (prev,next) should mark an open range of nodes in a single bucket + // which + // have either been unlinked, or are about to be. + + std::size_t fix_bucket( + std::size_t bucket_index, link_pointer prev, node_pointer next) + { + std::size_t bucket_index2 = bucket_index; + + if (next) { + bucket_index2 = node_bucket(next); + + // If next is in the same bucket, then there's nothing to do. + if (bucket_index == bucket_index2) { + return bucket_index2; + } + + // Update the bucket containing next. + get_bucket_pointer(bucket_index2)->next_ = prev; + } + + // Check if this bucket is now empty. + bucket_pointer this_bucket = get_bucket_pointer(bucket_index); + if (this_bucket->next_ == prev) { + this_bucket->next_ = link_pointer(); + } + + return bucket_index2; + } + + //////////////////////////////////////////////////////////////////////// + // Clear + + void clear_impl(); + + //////////////////////////////////////////////////////////////////////// + // Assignment + + template <typename UniqueType> + void assign(table const& x, UniqueType is_unique) + { + if (this != &x) { + assign(x, is_unique, + boost::unordered::detail::integral_constant<bool, + allocator_traits<node_allocator>:: + propagate_on_container_copy_assignment::value>()); + } + } + + template <typename UniqueType> + void assign(table const& x, UniqueType is_unique, false_type) + { + // Strong exception safety. + this->construct_spare_functions(x.current_functions()); + BOOST_TRY + { + mlf_ = x.mlf_; + recalculate_max_load(); + + if (x.size_ > max_load_) { + create_buckets(min_buckets_for_size(x.size_)); + } else if (size_) { + clear_buckets(); + } + } + BOOST_CATCH(...) + { + this->cleanup_spare_functions(); + BOOST_RETHROW + } + BOOST_CATCH_END + this->switch_functions(); + assign_buckets(x, is_unique); + } + + template <typename UniqueType> + void assign(table const& x, UniqueType is_unique, true_type) + { + if (node_alloc() == x.node_alloc()) { + allocators_.assign(x.allocators_); + assign(x, is_unique, false_type()); + } else { + this->construct_spare_functions(x.current_functions()); + this->switch_functions(); + + // Delete everything with current allocators before assigning + // the new ones. + delete_buckets(); + allocators_.assign(x.allocators_); + + // Copy over other data, all no throw. + mlf_ = x.mlf_; + bucket_count_ = min_buckets_for_size(x.size_); + + // Finally copy the elements. + if (x.size_) { + copy_buckets(x, is_unique); + } + } + } + + template <typename UniqueType> + void move_assign(table& x, UniqueType is_unique) + { + if (this != &x) { + move_assign(x, is_unique, + boost::unordered::detail::integral_constant<bool, + allocator_traits<node_allocator>:: + propagate_on_container_move_assignment::value>()); + } + } + + // Propagate allocator + template <typename UniqueType> + void move_assign(table& x, UniqueType, true_type) + { + if (!functions::nothrow_move_assignable) { + this->construct_spare_functions(x.current_functions()); + this->switch_functions(); + } else { + this->current_functions().move_assign(x.current_functions()); + } + delete_buckets(); + allocators_.move_assign(x.allocators_); + mlf_ = x.mlf_; + move_buckets_from(x); + } + + // Don't propagate allocator + template <typename UniqueType> + void move_assign(table& x, UniqueType is_unique, false_type) + { + if (node_alloc() == x.node_alloc()) { + move_assign_equal_alloc(x); + } else { + move_assign_realloc(x, is_unique); + } + } + + void move_assign_equal_alloc(table& x) + { + if (!functions::nothrow_move_assignable) { + this->construct_spare_functions(x.current_functions()); + this->switch_functions(); + } else { + this->current_functions().move_assign(x.current_functions()); + } + delete_buckets(); + mlf_ = x.mlf_; + move_buckets_from(x); + } + + template <typename UniqueType> + void move_assign_realloc(table& x, UniqueType is_unique) + { + this->construct_spare_functions(x.current_functions()); + BOOST_TRY + { + mlf_ = x.mlf_; + recalculate_max_load(); + + if (x.size_ > max_load_) { + create_buckets(min_buckets_for_size(x.size_)); + } else if (size_) { + clear_buckets(); + } + } + BOOST_CATCH(...) + { + this->cleanup_spare_functions(); + BOOST_RETHROW + } + BOOST_CATCH_END + this->switch_functions(); + move_assign_buckets(x, is_unique); + } + + // Accessors + + const_key_type& get_key(node_pointer n) const + { + return extractor::extract(n->value()); + } + + std::size_t hash(const_key_type& k) const + { + return policy::apply_hash(this->hash_function(), k); + } + + // Find Node + + node_pointer find_node(std::size_t key_hash, const_key_type& k) const + { + return this->find_node_impl(key_hash, k, this->key_eq()); + } + + node_pointer find_node(const_key_type& k) const + { + return this->find_node_impl(hash(k), k, this->key_eq()); + } + + template <class Key, class Pred> + node_pointer find_node_impl( + std::size_t key_hash, Key const& k, Pred const& eq) const + { + std::size_t bucket_index = this->hash_to_bucket(key_hash); + node_pointer n = this->begin(bucket_index); + + for (;;) { + if (!n) + return n; + + if (eq(k, this->get_key(n))) { + return n; + } else if (this->node_bucket(n) != bucket_index) { + return node_pointer(); + } + + n = next_for_find(n); + } + } + + // Find the node before the key, so that it can be erased. + link_pointer find_previous_node( + const_key_type& k, std::size_t bucket_index) + { + link_pointer prev = this->get_previous_start(bucket_index); + if (!prev) { + return prev; + } + + for (;;) { + node_pointer n = next_node(prev); + if (!n) { + return link_pointer(); + } else if (n->is_first_in_group()) { + if (node_bucket(n) != bucket_index) { + return link_pointer(); + } else if (this->key_eq()(k, this->get_key(n))) { + return prev; + } + } + prev = n; + } + } + + // Extract and erase + + inline node_pointer extract_by_key(const_key_type& k) + { + if (!this->size_) { + return node_pointer(); + } + std::size_t key_hash = this->hash(k); + std::size_t bucket_index = this->hash_to_bucket(key_hash); + link_pointer prev = this->find_previous_node(k, bucket_index); + if (!prev) { + return node_pointer(); + } + node_pointer n = next_node(prev); + node_pointer n2 = next_node(n); + if (n2) { + n2->set_first_in_group(); + } + prev->next_ = n2; + --this->size_; + this->fix_bucket(bucket_index, prev, n2); + n->next_ = link_pointer(); + + return n; + } + + // Reserve and rehash + + void reserve_for_insert(std::size_t); + void rehash(std::size_t); + void reserve(std::size_t); + void rehash_impl(std::size_t); + + //////////////////////////////////////////////////////////////////////// + // Unique keys + + // equals + + bool equals_unique(table const& other) const + { + if (this->size_ != other.size_) + return false; + + for (node_pointer n1 = this->begin(); n1; n1 = next_node(n1)) { + node_pointer n2 = other.find_node(other.get_key(n1)); + + if (!n2 || n1->value() != n2->value()) + return false; + } + + return true; + } + + // Emplace/Insert + + inline node_pointer add_node_unique( + node_pointer n, std::size_t key_hash) + { + std::size_t bucket_index = this->hash_to_bucket(key_hash); + bucket_pointer b = this->get_bucket_pointer(bucket_index); + + n->bucket_info_ = bucket_index; + n->set_first_in_group(); + + if (!b->next_) { + link_pointer start_node = this->get_previous_start(); + + if (start_node->next_) { + this->get_bucket_pointer(node_bucket(next_node(start_node))) + ->next_ = n; + } + + b->next_ = start_node; + n->next_ = start_node->next_; + start_node->next_ = n; + } else { + n->next_ = b->next_->next_; + b->next_->next_ = n; + } + + ++this->size_; + return n; + } + + inline node_pointer resize_and_add_node_unique( + node_pointer n, std::size_t key_hash) + { + node_tmp b(n, this->node_alloc()); + this->reserve_for_insert(this->size_ + 1); + return this->add_node_unique(b.release(), key_hash); + } + + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + iterator emplace_hint_unique( + c_iterator hint, const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS) + { + if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) { + return iterator(hint.node_); + } else { + return emplace_unique(k, BOOST_UNORDERED_EMPLACE_FORWARD).first; + } + } + + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + emplace_return emplace_unique( + const_key_type& k, BOOST_UNORDERED_EMPLACE_ARGS) + { + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + if (pos) { + return emplace_return(iterator(pos), false); + } else { + return emplace_return( + iterator(this->resize_and_add_node_unique( + boost::unordered::detail::func::construct_node_from_args( + this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD), + key_hash)), + true); + } + } + + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + iterator emplace_hint_unique( + c_iterator hint, no_key, BOOST_UNORDERED_EMPLACE_ARGS) + { + node_tmp b(boost::unordered::detail::func::construct_node_from_args( + this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD), + this->node_alloc()); + const_key_type& k = this->get_key(b.node_); + if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) { + return iterator(hint.node_); + } + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + if (pos) { + return iterator(pos); + } else { + return iterator( + this->resize_and_add_node_unique(b.release(), key_hash)); + } + } + + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + emplace_return emplace_unique(no_key, BOOST_UNORDERED_EMPLACE_ARGS) + { + node_tmp b(boost::unordered::detail::func::construct_node_from_args( + this->node_alloc(), BOOST_UNORDERED_EMPLACE_FORWARD), + this->node_alloc()); + const_key_type& k = this->get_key(b.node_); + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + if (pos) { + return emplace_return(iterator(pos), false); + } else { + return emplace_return( + iterator(this->resize_and_add_node_unique(b.release(), key_hash)), + true); + } + } + + template <typename Key> + emplace_return try_emplace_unique(BOOST_FWD_REF(Key) k) + { + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + if (pos) { + return emplace_return(iterator(pos), false); + } else { + return emplace_return( + iterator(this->resize_and_add_node_unique( + boost::unordered::detail::func::construct_node_pair( + this->node_alloc(), boost::forward<Key>(k)), + key_hash)), + true); + } + } + + template <typename Key> + iterator try_emplace_hint_unique(c_iterator hint, BOOST_FWD_REF(Key) k) + { + if (hint.node_ && this->key_eq()(hint->first, k)) { + return iterator(hint.node_); + } else { + return try_emplace_unique(k).first; + } + } + + template <typename Key, BOOST_UNORDERED_EMPLACE_TEMPLATE> + emplace_return try_emplace_unique( + BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS) + { + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + if (pos) { + return emplace_return(iterator(pos), false); + } else { + return emplace_return( + iterator(this->resize_and_add_node_unique( + boost::unordered::detail::func::construct_node_pair_from_args( + this->node_alloc(), boost::forward<Key>(k), + BOOST_UNORDERED_EMPLACE_FORWARD), + key_hash)), + true); + } + } + + template <typename Key, BOOST_UNORDERED_EMPLACE_TEMPLATE> + iterator try_emplace_hint_unique( + c_iterator hint, BOOST_FWD_REF(Key) k, BOOST_UNORDERED_EMPLACE_ARGS) + { + if (hint.node_ && this->key_eq()(hint->first, k)) { + return iterator(hint.node_); + } else { + return try_emplace_unique(k, BOOST_UNORDERED_EMPLACE_FORWARD).first; + } + } + + template <typename Key, typename M> + emplace_return insert_or_assign_unique( + BOOST_FWD_REF(Key) k, BOOST_FWD_REF(M) obj) + { + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + + if (pos) { + pos->value().second = boost::forward<M>(obj); + return emplace_return(iterator(pos), false); + } else { + return emplace_return( + iterator(this->resize_and_add_node_unique( + boost::unordered::detail::func::construct_node_pair( + this->node_alloc(), boost::forward<Key>(k), + boost::forward<M>(obj)), + key_hash)), + true); + } + } + + template <typename NodeType, typename InsertReturnType> + void move_insert_node_type_unique( + NodeType& np, InsertReturnType& result) + { + if (np) { + const_key_type& k = this->get_key(np.ptr_); + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + + if (pos) { + result.node = boost::move(np); + result.position = iterator(pos); + } else { + this->reserve_for_insert(this->size_ + 1); + result.position = + iterator(this->add_node_unique(np.ptr_, key_hash)); + result.inserted = true; + np.ptr_ = node_pointer(); + } + } + } + + template <typename NodeType> + iterator move_insert_node_type_with_hint_unique( + c_iterator hint, NodeType& np) + { + if (!np) { + return iterator(); + } + const_key_type& k = this->get_key(np.ptr_); + if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) { + return iterator(hint.node_); + } + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + if (!pos) { + this->reserve_for_insert(this->size_ + 1); + pos = this->add_node_unique(np.ptr_, key_hash); + np.ptr_ = node_pointer(); + } + return iterator(pos); + } + + template <typename Types2> + void merge_unique(boost::unordered::detail::table<Types2>& other) + { + typedef boost::unordered::detail::table<Types2> other_table; + BOOST_STATIC_ASSERT( + (boost::is_same<node, typename other_table::node>::value)); + BOOST_ASSERT(this->node_alloc() == other.node_alloc()); + + if (other.size_) { + link_pointer prev = other.get_previous_start(); + + while (prev->next_) { + node_pointer n = other_table::next_node(prev); + const_key_type& k = this->get_key(n); + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + + if (pos) { + prev = n; + } else { + this->reserve_for_insert(this->size_ + 1); + node_pointer n2 = next_node(n); + prev->next_ = n2; + if (n2 && n->is_first_in_group()) { + n2->set_first_in_group(); + } + --other.size_; + other.fix_bucket(other.node_bucket(n), prev, n2); + this->add_node_unique(n, key_hash); + } + } + } + } + + //////////////////////////////////////////////////////////////////////// + // Insert range methods + // + // if hash function throws, or inserting > 1 element, basic exception + // safety strong otherwise + + template <class InputIt> + void insert_range_unique(const_key_type& k, InputIt i, InputIt j) + { + insert_range_unique2(k, i, j); + + while (++i != j) { + // Note: can't use get_key as '*i' might not be value_type - it + // could be a pair with first_types as key_type without const or + // a different second_type. + insert_range_unique2(extractor::extract(*i), i, j); + } + } + + template <class InputIt> + void insert_range_unique2(const_key_type& k, InputIt i, InputIt j) + { + // No side effects in this initial code + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + + if (!pos) { + node_tmp b(boost::unordered::detail::func::construct_node( + this->node_alloc(), *i), + this->node_alloc()); + if (this->size_ + 1 > this->max_load_) + this->reserve_for_insert( + this->size_ + boost::unordered::detail::insert_size(i, j)); + this->add_node_unique(b.release(), key_hash); + } + } + + template <class InputIt> + void insert_range_unique(no_key, InputIt i, InputIt j) + { + node_constructor a(this->node_alloc()); + + do { + if (!a.node_) { + a.create_node(); + } + BOOST_UNORDERED_CALL_CONSTRUCT1( + node_allocator_traits, a.alloc_, a.node_->value_ptr(), *i); + node_tmp b(a.release(), a.alloc_); + + const_key_type& k = this->get_key(b.node_); + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + + if (pos) { + a.reclaim(b.release()); + } else { + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + this->reserve_for_insert(this->size_ + 1); + this->add_node_unique(b.release(), key_hash); + } + } while (++i != j); + } + + //////////////////////////////////////////////////////////////////////// + // Extract + + inline node_pointer extract_by_iterator_unique(c_iterator i) + { + node_pointer n = i.node_; + BOOST_ASSERT(n); + std::size_t bucket_index = this->node_bucket(n); + link_pointer prev = this->get_previous_start(bucket_index); + while (prev->next_ != n) { + prev = prev->next_; + } + node_pointer n2 = next_node(n); + prev->next_ = n2; + --this->size_; + this->fix_bucket(bucket_index, prev, n2); + n->next_ = link_pointer(); + return n; + } + + //////////////////////////////////////////////////////////////////////// + // Erase + // + // no throw + + std::size_t erase_key_unique(const_key_type& k) + { + if (!this->size_) + return 0; + std::size_t key_hash = this->hash(k); + std::size_t bucket_index = this->hash_to_bucket(key_hash); + link_pointer prev = this->find_previous_node(k, bucket_index); + if (!prev) + return 0; + node_pointer n = next_node(prev); + node_pointer n2 = next_node(n); + prev->next_ = n2; + --size_; + this->fix_bucket(bucket_index, prev, n2); + this->destroy_node(n); + return 1; + } + + void erase_nodes_unique(node_pointer i, node_pointer j) + { + std::size_t bucket_index = this->node_bucket(i); + + // Find the node before i. + link_pointer prev = this->get_previous_start(bucket_index); + while (prev->next_ != i) + prev = prev->next_; + + // Delete the nodes. + prev->next_ = j; + do { + node_pointer next = next_node(i); + destroy_node(i); + --size_; + bucket_index = this->fix_bucket(bucket_index, prev, next); + i = next; + } while (i != j); + } + + //////////////////////////////////////////////////////////////////////// + // fill_buckets_unique + + void copy_buckets(table const& src, true_type) + { + this->create_buckets(this->bucket_count_); + + for (node_pointer n = src.begin(); n; n = next_node(n)) { + std::size_t key_hash = this->hash(this->get_key(n)); + this->add_node_unique( + boost::unordered::detail::func::construct_node( + this->node_alloc(), n->value()), + key_hash); + } + } + + void assign_buckets(table const& src, true_type) + { + node_holder<node_allocator> holder(*this); + for (node_pointer n = src.begin(); n; n = next_node(n)) { + std::size_t key_hash = this->hash(this->get_key(n)); + this->add_node_unique(holder.copy_of(n->value()), key_hash); + } + } + + void move_assign_buckets(table& src, true_type) + { + node_holder<node_allocator> holder(*this); + for (node_pointer n = src.begin(); n; n = next_node(n)) { + std::size_t key_hash = this->hash(this->get_key(n)); + this->add_node_unique(holder.move_copy_of(n->value()), key_hash); + } + } + + //////////////////////////////////////////////////////////////////////// + // Equivalent keys + + // Equality + + bool equals_equiv(table const& other) const + { + if (this->size_ != other.size_) + return false; + + for (node_pointer n1 = this->begin(); n1;) { + node_pointer n2 = other.find_node(other.get_key(n1)); + if (!n2) + return false; + node_pointer end1 = next_group(n1); + node_pointer end2 = next_group(n2); + if (!group_equals_equiv(n1, end1, n2, end2)) + return false; + n1 = end1; + } + + return true; + } + + static bool group_equals_equiv(node_pointer n1, node_pointer end1, + node_pointer n2, node_pointer end2) + { + for (;;) { + if (n1->value() != n2->value()) + break; + + n1 = next_node(n1); + n2 = next_node(n2); + + if (n1 == end1) + return n2 == end2; + if (n2 == end2) + return false; + } + + for (node_pointer n1a = n1, n2a = n2;;) { + n1a = next_node(n1a); + n2a = next_node(n2a); + + if (n1a == end1) { + if (n2a == end2) + break; + else + return false; + } + + if (n2a == end2) + return false; + } + + node_pointer start = n1; + for (; n1 != end1; n1 = next_node(n1)) { + value_type const& v = n1->value(); + if (!find_equiv(start, n1, v)) { + std::size_t matches = count_equal_equiv(n2, end2, v); + if (!matches) + return false; + if (matches != 1 + count_equal_equiv(next_node(n1), end1, v)) + return false; + } + } + + return true; + } + + static bool find_equiv( + node_pointer n, node_pointer end, value_type const& v) + { + for (; n != end; n = next_node(n)) + if (n->value() == v) + return true; + return false; + } + + static std::size_t count_equal_equiv( + node_pointer n, node_pointer end, value_type const& v) + { + std::size_t count = 0; + for (; n != end; n = next_node(n)) + if (n->value() == v) + ++count; + return count; + } + + // Emplace/Insert + + inline node_pointer add_node_equiv( + node_pointer n, std::size_t key_hash, node_pointer pos) + { + std::size_t bucket_index = this->hash_to_bucket(key_hash); + n->bucket_info_ = bucket_index; + + if (pos) { + n->reset_first_in_group(); + n->next_ = pos->next_; + pos->next_ = n; + if (n->next_) { + std::size_t next_bucket = this->node_bucket(next_node(n)); + if (next_bucket != bucket_index) { + this->get_bucket_pointer(next_bucket)->next_ = n; + } + } + } else { + n->set_first_in_group(); + bucket_pointer b = this->get_bucket_pointer(bucket_index); + + if (!b->next_) { + link_pointer start_node = this->get_previous_start(); + + if (start_node->next_) { + this + ->get_bucket_pointer(this->node_bucket(next_node(start_node))) + ->next_ = n; + } + + b->next_ = start_node; + n->next_ = start_node->next_; + start_node->next_ = n; + } else { + n->next_ = b->next_->next_; + b->next_->next_ = n; + } + } + ++this->size_; + return n; + } + + inline node_pointer add_using_hint_equiv( + node_pointer n, node_pointer hint) + { + n->bucket_info_ = hint->bucket_info_; + n->reset_first_in_group(); + n->next_ = hint->next_; + hint->next_ = n; + if (n->next_) { + std::size_t next_bucket = this->node_bucket(next_node(n)); + if (next_bucket != this->node_bucket(n)) { + this->get_bucket_pointer(next_bucket)->next_ = n; + } + } + ++this->size_; + return n; + } + + iterator emplace_equiv(node_pointer n) + { + node_tmp a(n, this->node_alloc()); + const_key_type& k = this->get_key(a.node_); + std::size_t key_hash = this->hash(k); + node_pointer position = this->find_node(key_hash, k); + this->reserve_for_insert(this->size_ + 1); + return iterator( + this->add_node_equiv(a.release(), key_hash, position)); + } + + iterator emplace_hint_equiv(c_iterator hint, node_pointer n) + { + node_tmp a(n, this->node_alloc()); + const_key_type& k = this->get_key(a.node_); + if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) { + this->reserve_for_insert(this->size_ + 1); + return iterator( + this->add_using_hint_equiv(a.release(), hint.node_)); + } else { + std::size_t key_hash = this->hash(k); + node_pointer position = this->find_node(key_hash, k); + this->reserve_for_insert(this->size_ + 1); + return iterator( + this->add_node_equiv(a.release(), key_hash, position)); + } + } + + void emplace_no_rehash_equiv(node_pointer n) + { + node_tmp a(n, this->node_alloc()); + const_key_type& k = this->get_key(a.node_); + std::size_t key_hash = this->hash(k); + node_pointer position = this->find_node(key_hash, k); + this->add_node_equiv(a.release(), key_hash, position); + } + + template <typename NodeType> + iterator move_insert_node_type_equiv(NodeType& np) + { + iterator result; + + if (np) { + const_key_type& k = this->get_key(np.ptr_); + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + this->reserve_for_insert(this->size_ + 1); + result = iterator(this->add_node_equiv(np.ptr_, key_hash, pos)); + np.ptr_ = node_pointer(); + } + + return result; + } + + template <typename NodeType> + iterator move_insert_node_type_with_hint_equiv( + c_iterator hint, NodeType& np) + { + iterator result; + + if (np) { + const_key_type& k = this->get_key(np.ptr_); + + if (hint.node_ && this->key_eq()(k, this->get_key(hint.node_))) { + this->reserve_for_insert(this->size_ + 1); + result = + iterator(this->add_using_hint_equiv(np.ptr_, hint.node_)); + } else { + std::size_t key_hash = this->hash(k); + node_pointer pos = this->find_node(key_hash, k); + this->reserve_for_insert(this->size_ + 1); + result = iterator(this->add_node_equiv(np.ptr_, key_hash, pos)); + } + np.ptr_ = node_pointer(); + } + + return result; + } + + //////////////////////////////////////////////////////////////////////// + // Insert range methods + + // if hash function throws, or inserting > 1 element, basic exception + // safety. Strong otherwise + template <class I> + void insert_range_equiv(I i, I j, + typename boost::unordered::detail::enable_if_forward<I, void*>::type = + 0) + { + if (i == j) + return; + + std::size_t distance = static_cast<std::size_t>(std::distance(i, j)); + if (distance == 1) { + emplace_equiv(boost::unordered::detail::func::construct_node( + this->node_alloc(), *i)); + } else { + // Only require basic exception safety here + this->reserve_for_insert(this->size_ + distance); + + for (; i != j; ++i) { + emplace_no_rehash_equiv( + boost::unordered::detail::func::construct_node( + this->node_alloc(), *i)); + } + } + } + + template <class I> + void insert_range_equiv(I i, I j, + typename boost::unordered::detail::disable_if_forward<I, + void*>::type = 0) + { + for (; i != j; ++i) { + emplace_equiv(boost::unordered::detail::func::construct_node( + this->node_alloc(), *i)); + } + } + + //////////////////////////////////////////////////////////////////////// + // Extract + + inline node_pointer extract_by_iterator_equiv(c_iterator n) + { + node_pointer i = n.node_; + BOOST_ASSERT(i); + node_pointer j(next_node(i)); + std::size_t bucket_index = this->node_bucket(i); + + link_pointer prev = this->get_previous_start(bucket_index); + while (prev->next_ != i) { + prev = next_node(prev); + } + + prev->next_ = j; + if (j && i->is_first_in_group()) { + j->set_first_in_group(); + } + --this->size_; + this->fix_bucket(bucket_index, prev, j); + i->next_ = link_pointer(); + + return i; + } + + //////////////////////////////////////////////////////////////////////// + // Erase + // + // no throw + + std::size_t erase_key_equiv(const_key_type& k) + { + if (!this->size_) + return 0; + + std::size_t key_hash = this->hash(k); + std::size_t bucket_index = this->hash_to_bucket(key_hash); + link_pointer prev = this->find_previous_node(k, bucket_index); + if (!prev) + return 0; + + std::size_t deleted_count = 0; + node_pointer n = next_node(prev); + do { + node_pointer n2 = next_node(n); + destroy_node(n); + ++deleted_count; + n = n2; + } while (n && !n->is_first_in_group()); + size_ -= deleted_count; + prev->next_ = n; + this->fix_bucket(bucket_index, prev, n); + return deleted_count; + } + + link_pointer erase_nodes_equiv(node_pointer i, node_pointer j) + { + std::size_t bucket_index = this->node_bucket(i); + + link_pointer prev = this->get_previous_start(bucket_index); + while (prev->next_ != i) { + prev = next_node(prev); + } + + // Delete the nodes. + // Is it inefficient to call fix_bucket for every node? + bool includes_first = false; + prev->next_ = j; + do { + includes_first = includes_first || i->is_first_in_group(); + node_pointer next = next_node(i); + destroy_node(i); + --size_; + bucket_index = this->fix_bucket(bucket_index, prev, next); + i = next; + } while (i != j); + if (j && includes_first) { + j->set_first_in_group(); + } + + return prev; + } + + //////////////////////////////////////////////////////////////////////// + // fill_buckets + + void copy_buckets(table const& src, false_type) + { + this->create_buckets(this->bucket_count_); + + for (node_pointer n = src.begin(); n;) { + std::size_t key_hash = this->hash(this->get_key(n)); + node_pointer group_end(next_group(n)); + node_pointer pos = this->add_node_equiv( + boost::unordered::detail::func::construct_node( + this->node_alloc(), n->value()), + key_hash, node_pointer()); + for (n = next_node(n); n != group_end; n = next_node(n)) { + this->add_node_equiv( + boost::unordered::detail::func::construct_node( + this->node_alloc(), n->value()), + key_hash, pos); + } + } + } + + void assign_buckets(table const& src, false_type) + { + node_holder<node_allocator> holder(*this); + for (node_pointer n = src.begin(); n;) { + std::size_t key_hash = this->hash(this->get_key(n)); + node_pointer group_end(next_group(n)); + node_pointer pos = this->add_node_equiv( + holder.copy_of(n->value()), key_hash, node_pointer()); + for (n = next_node(n); n != group_end; n = next_node(n)) { + this->add_node_equiv(holder.copy_of(n->value()), key_hash, pos); + } + } + } + + void move_assign_buckets(table& src, false_type) + { + node_holder<node_allocator> holder(*this); + for (node_pointer n = src.begin(); n;) { + std::size_t key_hash = this->hash(this->get_key(n)); + node_pointer group_end(next_group(n)); + node_pointer pos = this->add_node_equiv( + holder.move_copy_of(n->value()), key_hash, node_pointer()); + for (n = next_node(n); n != group_end; n = next_node(n)) { + this->add_node_equiv( + holder.move_copy_of(n->value()), key_hash, pos); + } + } + } + }; + + ////////////////////////////////////////////////////////////////////////// + // Clear + + template <typename Types> inline void table<Types>::clear_impl() + { + if (size_) { + bucket_pointer end = get_bucket_pointer(bucket_count_); + for (bucket_pointer it = buckets_; it != end; ++it) { + it->next_ = node_pointer(); + } + + link_pointer prev = end->first_from_start(); + node_pointer n = next_node(prev); + prev->next_ = node_pointer(); + size_ = 0; + + while (n) { + node_pointer next = next_node(n); + destroy_node(n); + n = next; + } + } + } + + ////////////////////////////////////////////////////////////////////////// + // Reserve & Rehash + + // basic exception safety + template <typename Types> + inline void table<Types>::reserve_for_insert(std::size_t size) + { + if (!buckets_) { + create_buckets((std::max)(bucket_count_, min_buckets_for_size(size))); + } else if (size > max_load_) { + std::size_t num_buckets = + min_buckets_for_size((std::max)(size, size_ + (size_ >> 1))); + + if (num_buckets != bucket_count_) + this->rehash_impl(num_buckets); + } + } + + // if hash function throws, basic exception safety + // strong otherwise. + + template <typename Types> + inline void table<Types>::rehash(std::size_t min_buckets) + { + using namespace std; + + if (!size_) { + delete_buckets(); + bucket_count_ = policy::new_bucket_count(min_buckets); + } else { + min_buckets = policy::new_bucket_count((std::max)(min_buckets, + boost::unordered::detail::double_to_size( + floor(static_cast<double>(size_) / static_cast<double>(mlf_))) + + 1)); + + if (min_buckets != bucket_count_) + this->rehash_impl(min_buckets); + } + } + + template <typename Types> + inline void table<Types>::rehash_impl(std::size_t num_buckets) + { + BOOST_ASSERT(this->buckets_); + + this->create_buckets(num_buckets); + link_pointer prev = this->get_previous_start(); + BOOST_TRY + { + while (prev->next_) { + node_pointer n = next_node(prev); + std::size_t key_hash = this->hash(this->get_key(n)); + std::size_t bucket_index = this->hash_to_bucket(key_hash); + + n->bucket_info_ = bucket_index; + n->set_first_in_group(); + + // Iterator through the rest of the group of equal nodes, + // setting the bucket. + for (;;) { + node_pointer next = next_node(n); + if (!next || next->is_first_in_group()) { + break; + } + n = next; + n->bucket_info_ = bucket_index; + n->reset_first_in_group(); + } + + // n is now the last node in the group + bucket_pointer b = this->get_bucket_pointer(bucket_index); + if (!b->next_) { + b->next_ = prev; + prev = n; + } else { + link_pointer next = n->next_; + n->next_ = b->next_->next_; + b->next_->next_ = prev->next_; + prev->next_ = next; + } + } + } + BOOST_CATCH(...) + { + node_pointer n = next_node(prev); + prev->next_ = node_pointer(); + while (n) { + node_pointer next = next_node(n); + destroy_node(n); + --size_; + n = next; + } + BOOST_RETHROW + } + BOOST_CATCH_END + } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + + //////////////////////////////////////////////////////////////////////// + // key extractors + // + // no throw + // + // 'extract_key' is called with the emplace parameters to return a + // key if available or 'no_key' is one isn't and will need to be + // constructed. This could be done by overloading the emplace + // implementation + // for the different cases, but that's a bit tricky on compilers without + // variadic templates. + + template <typename Key, typename T> struct is_key + { + template <typename T2> static choice1::type test(T2 const&); + static choice2::type test(Key const&); + + enum + { + value = sizeof(test(boost::unordered::detail::make<T>())) == + sizeof(choice2::type) + }; + + typedef typename boost::detail::if_true<value>::BOOST_NESTED_TEMPLATE + then<Key const&, no_key>::type type; + }; + + template <class ValueType> struct set_extractor + { + typedef ValueType value_type; + typedef ValueType key_type; + + static key_type const& extract(value_type const& v) { return v; } + + static key_type const& extract(BOOST_UNORDERED_RV_REF(value_type) v) + { + return v; + } + + static no_key extract() { return no_key(); } + + template <class Arg> static no_key extract(Arg const&) + { + return no_key(); + } + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template <class Arg1, class Arg2, class... Args> + static no_key extract(Arg1 const&, Arg2 const&, Args const&...) + { + return no_key(); + } +#else + template <class Arg1, class Arg2> + static no_key extract(Arg1 const&, Arg2 const&) + { + return no_key(); + } +#endif + }; + + template <class ValueType> struct map_extractor + { + typedef ValueType value_type; + typedef typename boost::remove_const<typename boost::unordered::detail:: + pair_traits<ValueType>::first_type>::type key_type; + + static key_type const& extract(value_type const& v) { return v.first; } + + template <class Second> + static key_type const& extract(std::pair<key_type, Second> const& v) + { + return v.first; + } + + template <class Second> + static key_type const& extract( + std::pair<key_type const, Second> const& v) + { + return v.first; + } + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class Second> + static key_type const& extract( + boost::rv<std::pair<key_type, Second> > const& v) + { + return v.first; + } + + template <class Second> + static key_type const& extract( + boost::rv<std::pair<key_type const, Second> > const& v) + { + return v.first; + } +#endif + + template <class Arg1> + static key_type const& extract(key_type const& k, Arg1 const&) + { + return k; + } + + static no_key extract() { return no_key(); } + + template <class Arg> static no_key extract(Arg const&) + { + return no_key(); + } + + template <class Arg1, class Arg2> + static no_key extract(Arg1 const&, Arg2 const&) + { + return no_key(); + } + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + template <class Arg1, class Arg2, class Arg3, class... Args> + static no_key extract( + Arg1 const&, Arg2 const&, Arg3 const&, Args const&...) + { + return no_key(); + } +#endif + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \ + template <typename T2> \ + static no_key extract(boost::unordered::piecewise_construct_t, \ + namespace_ tuple<> const&, T2 const&) \ + { \ + return no_key(); \ + } \ + \ + template <typename T, typename T2> \ + static typename is_key<key_type, T>::type extract( \ + boost::unordered::piecewise_construct_t, namespace_ tuple<T> const& k, \ + T2 const&) \ + { \ + return typename is_key<key_type, T>::type(namespace_ get<0>(k)); \ + } + +#else + +#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \ + static no_key extract( \ + boost::unordered::piecewise_construct_t, namespace_ tuple<> const&) \ + { \ + return no_key(); \ + } \ + \ + template <typename T> \ + static typename is_key<key_type, T>::type extract( \ + boost::unordered::piecewise_construct_t, namespace_ tuple<T> const& k) \ + { \ + return typename is_key<key_type, T>::type(namespace_ get<0>(k)); \ + } + +#endif + + BOOST_UNORDERED_KEY_FROM_TUPLE(boost::) + +#if BOOST_UNORDERED_TUPLE_ARGS + BOOST_UNORDERED_KEY_FROM_TUPLE(std::) +#endif + +#undef BOOST_UNORDERED_KEY_FROM_TUPLE + }; + + //////////////////////////////////////////////////////////////////////// + // Unique nodes + + template <typename A, typename T> + struct node : boost::unordered::detail::value_base<T> + { + typedef + typename ::boost::unordered::detail::rebind_wrap<A, node<A, T> >::type + allocator; + typedef typename ::boost::unordered::detail::allocator_traits< + allocator>::pointer node_pointer; + typedef node_pointer link_pointer; + typedef typename ::boost::unordered::detail::rebind_wrap<A, + bucket<node_pointer> >::type bucket_allocator; + typedef typename ::boost::unordered::detail::allocator_traits< + bucket_allocator>::pointer bucket_pointer; + + link_pointer next_; + std::size_t bucket_info_; + + node() : next_(), bucket_info_(0) {} + + std::size_t get_bucket() const + { + return bucket_info_ & ((std::size_t)-1 >> 1); + } + + std::size_t is_first_in_group() const + { + return !(bucket_info_ & ~((std::size_t)-1 >> 1)); + } + + void set_first_in_group() + { + bucket_info_ = bucket_info_ & ((std::size_t)-1 >> 1); + } + + void reset_first_in_group() + { + bucket_info_ = bucket_info_ | ~((std::size_t)-1 >> 1); + } + + private: + node& operator=(node const&); + }; + + template <typename T> + struct ptr_node : boost::unordered::detail::ptr_bucket + { + typedef T value_type; + typedef boost::unordered::detail::ptr_bucket bucket_base; + typedef ptr_node<T>* node_pointer; + typedef ptr_bucket* link_pointer; + typedef ptr_bucket* bucket_pointer; + + std::size_t bucket_info_; + boost::unordered::detail::value_base<T> value_base_; + + ptr_node() : bucket_base(), bucket_info_(0) {} + + void* address() { return value_base_.address(); } + value_type& value() { return value_base_.value(); } + value_type* value_ptr() { return value_base_.value_ptr(); } + + std::size_t get_bucket() const + { + return bucket_info_ & ((std::size_t)-1 >> 1); + } + + std::size_t is_first_in_group() const + { + return !(bucket_info_ & ~((std::size_t)-1 >> 1)); + } + + void set_first_in_group() + { + bucket_info_ = bucket_info_ & ((std::size_t)-1 >> 1); + } + + void reset_first_in_group() + { + bucket_info_ = bucket_info_ | ~((std::size_t)-1 >> 1); + } + + private: + ptr_node& operator=(ptr_node const&); + }; + + // If the allocator uses raw pointers use ptr_node + // Otherwise use node. + + template <typename A, typename T, typename NodePtr, typename BucketPtr> + struct pick_node2 + { + typedef boost::unordered::detail::node<A, T> node; + + typedef typename boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + node>::type>::pointer node_pointer; + + typedef boost::unordered::detail::bucket<node_pointer> bucket; + typedef node_pointer link_pointer; + }; + + template <typename A, typename T> + struct pick_node2<A, T, boost::unordered::detail::ptr_node<T>*, + boost::unordered::detail::ptr_bucket*> + { + typedef boost::unordered::detail::ptr_node<T> node; + typedef boost::unordered::detail::ptr_bucket bucket; + typedef bucket* link_pointer; + }; + + template <typename A, typename T> struct pick_node + { + typedef typename boost::remove_const<T>::type nonconst; + + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + boost::unordered::detail::ptr_node<nonconst> >::type> + tentative_node_traits; + + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + boost::unordered::detail::ptr_bucket>::type> + tentative_bucket_traits; + + typedef pick_node2<A, nonconst, typename tentative_node_traits::pointer, + typename tentative_bucket_traits::pointer> + pick; + + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + }; + } + } +} + +#undef BOOST_UNORDERED_EMPLACE_TEMPLATE +#undef BOOST_UNORDERED_EMPLACE_ARGS +#undef BOOST_UNORDERED_EMPLACE_FORWARD +#undef BOOST_UNORDERED_CALL_CONSTRUCT1 +#undef BOOST_UNORDERED_CALL_DESTROY + +#endif diff --git a/ThirdParty/boost/unordered/detail/set.hpp b/ThirdParty/boost/unordered/detail/set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..b7869e3c511d09711199ec7d865dd48bcd4dbedd --- /dev/null +++ b/ThirdParty/boost/unordered/detail/set.hpp @@ -0,0 +1,66 @@ + +// Copyright (C) 2005-2016 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) + +#include <boost/unordered/detail/implementation.hpp> +#include <boost/unordered/unordered_set_fwd.hpp> + +namespace boost { + namespace unordered { + namespace detail { + template <typename A, typename T, typename H, typename P> struct set + { + typedef boost::unordered::detail::set<A, T, H, P> types; + + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef T const const_key_type; + + typedef + typename ::boost::unordered::detail::rebind_wrap<A, value_type>::type + value_allocator; + typedef boost::unordered::detail::allocator_traits<value_allocator> + value_allocator_traits; + + typedef boost::unordered::detail::pick_node<A, value_type> pick; + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + + typedef boost::unordered::detail::table<types> table; + typedef boost::unordered::detail::set_extractor<value_type> extractor; + + typedef typename boost::unordered::detail::pick_policy<T>::type policy; + + typedef boost::unordered::iterator_detail::c_iterator<node> iterator; + typedef boost::unordered::iterator_detail::c_iterator<node> c_iterator; + typedef boost::unordered::iterator_detail::cl_iterator<node> l_iterator; + typedef boost::unordered::iterator_detail::cl_iterator<node> + cl_iterator; + + typedef boost::unordered::node_handle_set<node, T, A> node_type; + typedef boost::unordered::insert_return_type_set<node, T, A> + insert_return_type; + }; + + template <typename T, typename H, typename P, typename A> + class instantiate_set + { + typedef boost::unordered_set<T, H, P, A> container; + container x; + typename container::node_type node_type; + typename container::insert_return_type insert_return_type; + }; + + template <typename T, typename H, typename P, typename A> + class instantiate_multiset + { + typedef boost::unordered_multiset<T, H, P, A> container; + container x; + typename container::node_type node_type; + }; + } + } +} diff --git a/ThirdParty/boost/unordered/unordered_set.hpp b/ThirdParty/boost/unordered/unordered_set.hpp new file mode 100644 index 0000000000000000000000000000000000000000..dfc24e85e5d6edc053383a09fd0c152cd6f6de6b --- /dev/null +++ b/ThirdParty/boost/unordered/unordered_set.hpp @@ -0,0 +1,2101 @@ + +// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. +// Copyright (C) 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) + +// See http://www.boost.org/libs/unordered for documentation + +#ifndef BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED +#define BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED + +#include <boost/config.hpp> +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once +#endif + +#include <boost/core/explicit_operator_bool.hpp> +#include <boost/functional/hash.hpp> +#include <boost/move/move.hpp> +#include <boost/unordered/detail/set.hpp> + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include <initializer_list> +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +// conditional expression is constant +#pragma warning(disable : 4127) +#if BOOST_MSVC >= 1400 +// the inline specifier cannot be used when a friend declaration refers to a +// specialization of a function template +#pragma warning(disable : 4396) +#endif +#endif + +namespace boost { + namespace unordered { + template <class T, class H, class P, class A> class unordered_set + { +#if defined(BOOST_UNORDERED_USE_MOVE) + BOOST_COPYABLE_AND_MOVABLE(unordered_set) +#endif + template <typename, typename, typename, typename> + friend class unordered_multiset; + + public: + typedef T key_type; + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef A allocator_type; + + private: + typedef boost::unordered::detail::set<A, T, H, P> types; + typedef typename types::value_allocator_traits value_allocator_traits; + typedef typename types::table table; + typedef typename table::node_pointer node_pointer; + typedef typename table::link_pointer link_pointer; + + public: + typedef typename value_allocator_traits::pointer pointer; + typedef typename value_allocator_traits::const_pointer const_pointer; + + typedef value_type& reference; + typedef value_type const& const_reference; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef typename table::iterator iterator; + typedef typename table::c_iterator const_iterator; + typedef typename table::l_iterator local_iterator; + typedef typename table::cl_iterator const_local_iterator; + typedef typename types::node_type node_type; + typedef typename types::insert_return_type insert_return_type; + + private: + table table_; + + public: + // constructors + + unordered_set(); + + explicit unordered_set(size_type, const hasher& = hasher(), + const key_equal& = key_equal(), + const allocator_type& = allocator_type()); + + template <class InputIt> + unordered_set(InputIt, InputIt, + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), const key_equal& = key_equal(), + const allocator_type& = allocator_type()); + + unordered_set(unordered_set const&); + +#if defined(BOOST_UNORDERED_USE_MOVE) || \ + !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + unordered_set(BOOST_RV_REF(unordered_set) other) + BOOST_NOEXCEPT_IF(table::nothrow_move_constructible) + : table_(other.table_, boost::unordered::detail::move_tag()) + { + // The move is done in table_ + } +#endif + + explicit unordered_set(allocator_type const&); + + unordered_set(unordered_set const&, allocator_type const&); + + unordered_set(BOOST_RV_REF(unordered_set), allocator_type const&); + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_set(std::initializer_list<value_type>, + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), const key_equal& l = key_equal(), + const allocator_type& = allocator_type()); +#endif + + explicit unordered_set(size_type, const allocator_type&); + + explicit unordered_set(size_type, const hasher&, const allocator_type&); + + template <class InputIt> + unordered_set(InputIt, InputIt, size_type, const allocator_type&); + + template <class InputIt> + unordered_set( + InputIt, InputIt, size_type, const hasher&, const allocator_type&); + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_set( + std::initializer_list<value_type>, size_type, const allocator_type&); + + unordered_set(std::initializer_list<value_type>, size_type, const hasher&, + const allocator_type&); +#endif + + // Destructor + + ~unordered_set() BOOST_NOEXCEPT; + +// Assign + +#if defined(BOOST_UNORDERED_USE_MOVE) + unordered_set& operator=(BOOST_COPY_ASSIGN_REF(unordered_set) x) + { + table_.assign(x.table_, boost::unordered::detail::true_type()); + return *this; + } + + unordered_set& operator=(BOOST_RV_REF(unordered_set) x) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_move_assignable<H>::value&& + boost::is_nothrow_move_assignable<P>::value) + { + table_.move_assign(x.table_, boost::unordered::detail::true_type()); + return *this; + } +#else + unordered_set& operator=(unordered_set const& x) + { + table_.assign(x.table_, boost::unordered::detail::true_type()); + return *this; + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + unordered_set& operator=(unordered_set&& x) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_move_assignable<H>::value&& + boost::is_nothrow_move_assignable<P>::value) + { + table_.move_assign(x.table_, boost::unordered::detail::true_type()); + return *this; + } +#endif +#endif + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_set& operator=(std::initializer_list<value_type>); +#endif + + allocator_type get_allocator() const BOOST_NOEXCEPT + { + return table_.node_alloc(); + } + + // iterators + + iterator begin() BOOST_NOEXCEPT { return iterator(table_.begin()); } + + const_iterator begin() const BOOST_NOEXCEPT + { + return const_iterator(table_.begin()); + } + + iterator end() BOOST_NOEXCEPT { return iterator(); } + + const_iterator end() const BOOST_NOEXCEPT { return const_iterator(); } + + const_iterator cbegin() const BOOST_NOEXCEPT + { + return const_iterator(table_.begin()); + } + + const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } + + // size and capacity + + bool empty() const BOOST_NOEXCEPT { return table_.size_ == 0; } + + size_type size() const BOOST_NOEXCEPT { return table_.size_; } + + size_type max_size() const BOOST_NOEXCEPT; + +// emplace + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template <class... Args> + std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args) + { + return table_.emplace_unique( + table::extractor::extract(boost::forward<Args>(args)...), + boost::forward<Args>(args)...); + } + +#else + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + + // 0 argument emplace requires special treatment in case + // the container is instantiated with a value type that + // doesn't have a default constructor. + + std::pair<iterator, bool> emplace( + boost::unordered::detail::empty_emplace = + boost::unordered::detail::empty_emplace(), + value_type v = value_type()) + { + return this->emplace(boost::move(v)); + } + +#endif + + template <typename A0> + std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0) + { + return table_.emplace_unique( + table::extractor::extract(boost::forward<A0>(a0)), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0))); + } + + template <typename A0, typename A1> + std::pair<iterator, bool> emplace( + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return table_.emplace_unique( + table::extractor::extract( + boost::forward<A0>(a0), boost::forward<A1>(a1)), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), boost::forward<A1>(a1))); + } + + template <typename A0, typename A1, typename A2> + std::pair<iterator, bool> emplace( + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + return table_.emplace_unique( + table::extractor::extract( + boost::forward<A0>(a0), boost::forward<A1>(a1)), + boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0), + boost::forward<A1>(a1), boost::forward<A2>(a2))); + } + +#endif + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template <class... Args> + iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args) + { + return table_.emplace_hint_unique(hint, + table::extractor::extract(boost::forward<Args>(args)...), + boost::forward<Args>(args)...); + } + +#else + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + + iterator emplace_hint(const_iterator hint, + boost::unordered::detail::empty_emplace = + boost::unordered::detail::empty_emplace(), + value_type v = value_type()) + { + return this->emplace_hint(hint, boost::move(v)); + } + +#endif + + template <typename A0> + iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0) + { + return table_.emplace_hint_unique(hint, + table::extractor::extract(boost::forward<A0>(a0)), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0))); + } + + template <typename A0, typename A1> + iterator emplace_hint( + const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return table_.emplace_hint_unique(hint, + table::extractor::extract( + boost::forward<A0>(a0), boost::forward<A1>(a1)), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), boost::forward<A1>(a1))); + } + + template <typename A0, typename A1, typename A2> + iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + return table_.emplace_hint_unique(hint, + table::extractor::extract( + boost::forward<A0>(a0), boost::forward<A1>(a1)), + boost::unordered::detail::create_emplace_args(boost::forward<A0>(a0), + boost::forward<A1>(a1), boost::forward<A2>(a2))); + } + +#endif + +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + std::pair<iterator, bool> emplace( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \ + { \ + return table_.emplace_unique( \ + table::extractor::extract( \ + boost::forward<A0>(a0), boost::forward<A1>(a1)), \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \ + } \ + \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + iterator emplace_hint( \ + const_iterator hint, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \ + { \ + return table_.emplace_hint_unique(hint, \ + table::extractor::extract( \ + boost::forward<A0>(a0), boost::forward<A1>(a1)), \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))); \ + } + + BOOST_UNORDERED_EMPLACE(1, 4, _) + BOOST_UNORDERED_EMPLACE(1, 5, _) + BOOST_UNORDERED_EMPLACE(1, 6, _) + BOOST_UNORDERED_EMPLACE(1, 7, _) + BOOST_UNORDERED_EMPLACE(1, 8, _) + BOOST_UNORDERED_EMPLACE(1, 9, _) + BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + std::pair<iterator, bool> insert(value_type const& x) + { + return this->emplace(x); + } + + std::pair<iterator, bool> insert(BOOST_UNORDERED_RV_REF(value_type) x) + { + return this->emplace(boost::move(x)); + } + + iterator insert(const_iterator hint, value_type const& x) + { + return this->emplace_hint(hint, x); + } + + iterator insert(const_iterator hint, BOOST_UNORDERED_RV_REF(value_type) x) + { + return this->emplace_hint(hint, boost::move(x)); + } + + template <class InputIt> void insert(InputIt, InputIt); + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type>); +#endif + + // extract + + node_type extract(const_iterator position) + { + return node_type( + table_.extract_by_iterator_unique(position), table_.node_alloc()); + } + + node_type extract(const key_type& k) + { + return node_type(table_.extract_by_key(k), table_.node_alloc()); + } + + insert_return_type insert(BOOST_RV_REF(node_type) np) + { + insert_return_type result; + table_.move_insert_node_type_unique(np, result); + return boost::move(result); + } + + iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np) + { + return table_.move_insert_node_type_with_hint_unique(hint, np); + } + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ + (BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 6, 0)) + private: + // Note: Use r-value node_type to insert. + insert_return_type insert(node_type&); + iterator insert(const_iterator, node_type& np); + + public: +#endif + + iterator erase(const_iterator); + size_type erase(const key_type&); + iterator erase(const_iterator, const_iterator); + BOOST_UNORDERED_DEPRECATED("Use erase instead") + void quick_erase(const_iterator it) { erase(it); } + BOOST_UNORDERED_DEPRECATED("Use erase instead") + void erase_return_void(const_iterator it) { erase(it); } + + void swap(unordered_set&) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_swappable<H>::value&& + boost::is_nothrow_swappable<P>::value); + void clear() BOOST_NOEXCEPT { table_.clear_impl(); } + + template <typename H2, typename P2> + void merge(boost::unordered_set<T, H2, P2, A>& source); + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <typename H2, typename P2> + void merge(boost::unordered_set<T, H2, P2, A>&& source); +#endif + + template <typename H2, typename P2> + void merge(boost::unordered_multiset<T, H2, P2, A>& source); + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <typename H2, typename P2> + void merge(boost::unordered_multiset<T, H2, P2, A>&& source); +#endif + + // observers + + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + + const_iterator find(const key_type&) const; + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + const_iterator find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&) const; + + size_type count(const key_type&) const; + + std::pair<const_iterator, const_iterator> equal_range( + const key_type&) const; + + // bucket interface + + size_type bucket_count() const BOOST_NOEXCEPT + { + return table_.bucket_count_; + } + + size_type max_bucket_count() const BOOST_NOEXCEPT + { + return table_.max_bucket_count(); + } + + size_type bucket_size(size_type) const; + + size_type bucket(const key_type& k) const + { + return table_.hash_to_bucket(table_.hash(k)); + } + + local_iterator begin(size_type n) + { + return local_iterator(table_.begin(n), n, table_.bucket_count_); + } + + const_local_iterator begin(size_type n) const + { + return const_local_iterator(table_.begin(n), n, table_.bucket_count_); + } + + local_iterator end(size_type) { return local_iterator(); } + + const_local_iterator end(size_type) const + { + return const_local_iterator(); + } + + const_local_iterator cbegin(size_type n) const + { + return const_local_iterator(table_.begin(n), n, table_.bucket_count_); + } + + const_local_iterator cend(size_type) const + { + return const_local_iterator(); + } + + // hash policy + + float load_factor() const BOOST_NOEXCEPT; + float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } + void max_load_factor(float) BOOST_NOEXCEPT; + void rehash(size_type); + void reserve(size_type); + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + friend bool operator== + <T, H, P, A>(unordered_set const&, unordered_set const&); + friend bool operator!= + <T, H, P, A>(unordered_set const&, unordered_set const&); +#endif + }; // class template unordered_set + +#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES + + template <class InputIterator, + class Hash = + boost::hash<typename std::iterator_traits<InputIterator>::value_type>, + class Pred = + std::equal_to<typename std::iterator_traits<InputIterator>::value_type>, + class Allocator = std::allocator< + typename std::iterator_traits<InputIterator>::value_type> > + unordered_set(InputIterator, InputIterator, + std::size_t = boost::unordered::detail::default_bucket_count, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + ->unordered_set<typename std::iterator_traits<InputIterator>::value_type, + Hash, Pred, Allocator>; + + template <class T, class Hash = boost::hash<T>, + class Pred = std::equal_to<T>, class Allocator = std::allocator<T> > + unordered_set(std::initializer_list<T>, + std::size_t = boost::unordered::detail::default_bucket_count, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + ->unordered_set<T, Hash, Pred, Allocator>; + + template <class InputIterator, class Allocator> + unordered_set(InputIterator, InputIterator, std::size_t, Allocator) + ->unordered_set<typename std::iterator_traits<InputIterator>::value_type, + boost::hash<typename std::iterator_traits<InputIterator>::value_type>, + std::equal_to<typename std::iterator_traits<InputIterator>::value_type>, + Allocator>; + + template <class InputIterator, class Hash, class Allocator> + unordered_set(InputIterator, InputIterator, std::size_t, Hash, Allocator) + ->unordered_set<typename std::iterator_traits<InputIterator>::value_type, + Hash, + std::equal_to<typename std::iterator_traits<InputIterator>::value_type>, + Allocator>; + + template <class T, class Allocator> + unordered_set(std::initializer_list<T>, std::size_t, Allocator) + ->unordered_set<T, boost::hash<T>, std::equal_to<T>, Allocator>; + + template <class T, class Hash, class Allocator> + unordered_set(std::initializer_list<T>, std::size_t, Hash, Allocator) + ->unordered_set<T, Hash, std::equal_to<T>, Allocator>; + +#endif + + template <class T, class H, class P, class A> class unordered_multiset + { +#if defined(BOOST_UNORDERED_USE_MOVE) + BOOST_COPYABLE_AND_MOVABLE(unordered_multiset) +#endif + template <typename, typename, typename, typename> + friend class unordered_set; + + public: + typedef T key_type; + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef A allocator_type; + + private: + typedef boost::unordered::detail::set<A, T, H, P> types; + typedef typename types::value_allocator_traits value_allocator_traits; + typedef typename types::table table; + typedef typename table::node_pointer node_pointer; + typedef typename table::link_pointer link_pointer; + + public: + typedef typename value_allocator_traits::pointer pointer; + typedef typename value_allocator_traits::const_pointer const_pointer; + + typedef value_type& reference; + typedef value_type const& const_reference; + + typedef std::size_t size_type; + typedef std::ptrdiff_t difference_type; + + typedef typename table::iterator iterator; + typedef typename table::c_iterator const_iterator; + typedef typename table::l_iterator local_iterator; + typedef typename table::cl_iterator const_local_iterator; + typedef typename types::node_type node_type; + + private: + table table_; + + public: + // constructors + + unordered_multiset(); + + explicit unordered_multiset(size_type, const hasher& = hasher(), + const key_equal& = key_equal(), + const allocator_type& = allocator_type()); + + template <class InputIt> + unordered_multiset(InputIt, InputIt, + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), const key_equal& = key_equal(), + const allocator_type& = allocator_type()); + + unordered_multiset(unordered_multiset const&); + +#if defined(BOOST_UNORDERED_USE_MOVE) || \ + !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + unordered_multiset(BOOST_RV_REF(unordered_multiset) other) + BOOST_NOEXCEPT_IF(table::nothrow_move_constructible) + : table_(other.table_, boost::unordered::detail::move_tag()) + { + // The move is done in table_ + } +#endif + + explicit unordered_multiset(allocator_type const&); + + unordered_multiset(unordered_multiset const&, allocator_type const&); + + unordered_multiset( + BOOST_RV_REF(unordered_multiset), allocator_type const&); + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_multiset(std::initializer_list<value_type>, + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), const key_equal& l = key_equal(), + const allocator_type& = allocator_type()); +#endif + + explicit unordered_multiset(size_type, const allocator_type&); + + explicit unordered_multiset( + size_type, const hasher&, const allocator_type&); + + template <class InputIt> + unordered_multiset(InputIt, InputIt, size_type, const allocator_type&); + + template <class InputIt> + unordered_multiset( + InputIt, InputIt, size_type, const hasher&, const allocator_type&); + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_multiset( + std::initializer_list<value_type>, size_type, const allocator_type&); + + unordered_multiset(std::initializer_list<value_type>, size_type, + const hasher&, const allocator_type&); +#endif + + // Destructor + + ~unordered_multiset() BOOST_NOEXCEPT; + +// Assign + +#if defined(BOOST_UNORDERED_USE_MOVE) + unordered_multiset& operator=(BOOST_COPY_ASSIGN_REF(unordered_multiset) x) + { + table_.assign(x.table_, boost::unordered::detail::false_type()); + return *this; + } + + unordered_multiset& operator=(BOOST_RV_REF(unordered_multiset) x) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_move_assignable<H>::value&& + boost::is_nothrow_move_assignable<P>::value) + { + table_.move_assign(x.table_, boost::unordered::detail::false_type()); + return *this; + } +#else + unordered_multiset& operator=(unordered_multiset const& x) + { + table_.assign(x.table_, boost::unordered::detail::false_type()); + return *this; + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + unordered_multiset& operator=(unordered_multiset&& x) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_move_assignable<H>::value&& + boost::is_nothrow_move_assignable<P>::value) + { + table_.move_assign(x.table_, boost::unordered::detail::false_type()); + return *this; + } +#endif +#endif + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_multiset& operator=(std::initializer_list<value_type>); +#endif + + allocator_type get_allocator() const BOOST_NOEXCEPT + { + return table_.node_alloc(); + } + + // iterators + + iterator begin() BOOST_NOEXCEPT { return iterator(table_.begin()); } + + const_iterator begin() const BOOST_NOEXCEPT + { + return const_iterator(table_.begin()); + } + + iterator end() BOOST_NOEXCEPT { return iterator(); } + + const_iterator end() const BOOST_NOEXCEPT { return const_iterator(); } + + const_iterator cbegin() const BOOST_NOEXCEPT + { + return const_iterator(table_.begin()); + } + + const_iterator cend() const BOOST_NOEXCEPT { return const_iterator(); } + + // size and capacity + + bool empty() const BOOST_NOEXCEPT { return table_.size_ == 0; } + + size_type size() const BOOST_NOEXCEPT { return table_.size_; } + + size_type max_size() const BOOST_NOEXCEPT; + +// emplace + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template <class... Args> iterator emplace(BOOST_FWD_REF(Args)... args) + { + return iterator(table_.emplace_equiv( + boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), boost::forward<Args>(args)...))); + } + +#else + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + + // 0 argument emplace requires special treatment in case + // the container is instantiated with a value type that + // doesn't have a default constructor. + + iterator emplace(boost::unordered::detail::empty_emplace = + boost::unordered::detail::empty_emplace(), + value_type v = value_type()) + { + return this->emplace(boost::move(v)); + } + +#endif + + template <typename A0> iterator emplace(BOOST_FWD_REF(A0) a0) + { + return iterator(table_.emplace_equiv( + boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0))))); + } + + template <typename A0, typename A1> + iterator emplace(BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return iterator(table_.emplace_equiv( + boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), boost::forward<A1>(a1))))); + } + + template <typename A0, typename A1, typename A2> + iterator emplace( + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + return iterator(table_.emplace_equiv( + boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), boost::forward<A1>(a1), + boost::forward<A2>(a2))))); + } + +#endif + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + + template <class... Args> + iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args) + { + return iterator(table_.emplace_hint_equiv( + hint, boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), boost::forward<Args>(args)...))); + } + +#else + +#if !BOOST_UNORDERED_SUN_WORKAROUNDS1 + + iterator emplace_hint(const_iterator hint, + boost::unordered::detail::empty_emplace = + boost::unordered::detail::empty_emplace(), + value_type v = value_type()) + { + return this->emplace_hint(hint, boost::move(v)); + } + +#endif + + template <typename A0> + iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0) + { + return iterator(table_.emplace_hint_equiv(hint, + boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0))))); + } + + template <typename A0, typename A1> + iterator emplace_hint( + const_iterator hint, BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1) + { + return iterator(table_.emplace_hint_equiv( + hint, boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), boost::forward<A1>(a1))))); + } + + template <typename A0, typename A1, typename A2> + iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + return iterator(table_.emplace_hint_equiv( + hint, boost::unordered::detail::func::construct_node_from_args( + table_.node_alloc(), + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), boost::forward<A1>(a1), + boost::forward<A2>(a2))))); + } + +#endif + +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + iterator emplace(BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \ + { \ + return iterator(table_.emplace_equiv( \ + boost::unordered::detail::func::construct_node_from_args( \ + table_.node_alloc(), \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))))); \ + } \ + \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + iterator emplace_hint( \ + const_iterator hint, BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a)) \ + { \ + return iterator(table_.emplace_hint_equiv( \ + hint, boost::unordered::detail::func::construct_node_from_args( \ + table_.node_alloc(), \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, a))))); \ + } + + BOOST_UNORDERED_EMPLACE(1, 4, _) + BOOST_UNORDERED_EMPLACE(1, 5, _) + BOOST_UNORDERED_EMPLACE(1, 6, _) + BOOST_UNORDERED_EMPLACE(1, 7, _) + BOOST_UNORDERED_EMPLACE(1, 8, _) + BOOST_UNORDERED_EMPLACE(1, 9, _) + BOOST_PP_REPEAT_FROM_TO(10, BOOST_PP_INC(BOOST_UNORDERED_EMPLACE_LIMIT), + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + iterator insert(value_type const& x) { return this->emplace(x); } + + iterator insert(BOOST_UNORDERED_RV_REF(value_type) x) + { + return this->emplace(boost::move(x)); + } + + iterator insert(const_iterator hint, value_type const& x) + { + return this->emplace_hint(hint, x); + } + + iterator insert(const_iterator hint, BOOST_UNORDERED_RV_REF(value_type) x) + { + return this->emplace_hint(hint, boost::move(x)); + } + + template <class InputIt> void insert(InputIt, InputIt); + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type>); +#endif + + // extract + + node_type extract(const_iterator position) + { + return node_type( + table_.extract_by_iterator_equiv(position), table_.node_alloc()); + } + + node_type extract(const key_type& k) + { + return node_type(table_.extract_by_key(k), table_.node_alloc()); + } + + iterator insert(BOOST_RV_REF(node_type) np) + { + return table_.move_insert_node_type_equiv(np); + } + + iterator insert(const_iterator hint, BOOST_RV_REF(node_type) np) + { + return table_.move_insert_node_type_with_hint_equiv(hint, np); + } + +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ + (BOOST_COMP_GNUC && BOOST_COMP_GNUC < BOOST_VERSION_NUMBER(4, 6, 0)) + private: + // Note: Use r-value node_type to insert. + iterator insert(node_type&); + iterator insert(const_iterator, node_type& np); + + public: +#endif + + iterator erase(const_iterator); + size_type erase(const key_type&); + iterator erase(const_iterator, const_iterator); + BOOST_UNORDERED_DEPRECATED("Use erase instead") + void quick_erase(const_iterator it) { erase(it); } + BOOST_UNORDERED_DEPRECATED("Use erase instead") + void erase_return_void(const_iterator it) { erase(it); } + + void swap(unordered_multiset&) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_swappable<H>::value&& + boost::is_nothrow_swappable<P>::value); + void clear() BOOST_NOEXCEPT { table_.clear_impl(); } + + template <typename H2, typename P2> + void merge(boost::unordered_multiset<T, H2, P2, A>& source); + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <typename H2, typename P2> + void merge(boost::unordered_multiset<T, H2, P2, A>&& source); +#endif + + template <typename H2, typename P2> + void merge(boost::unordered_set<T, H2, P2, A>& source); + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <typename H2, typename P2> + void merge(boost::unordered_set<T, H2, P2, A>&& source); +#endif + + // observers + + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + + const_iterator find(const key_type&) const; + + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + const_iterator find(CompatibleKey const&, CompatibleHash const&, + CompatiblePredicate const&) const; + + size_type count(const key_type&) const; + + std::pair<const_iterator, const_iterator> equal_range( + const key_type&) const; + + // bucket interface + + size_type bucket_count() const BOOST_NOEXCEPT + { + return table_.bucket_count_; + } + + size_type max_bucket_count() const BOOST_NOEXCEPT + { + return table_.max_bucket_count(); + } + + size_type bucket_size(size_type) const; + + size_type bucket(const key_type& k) const + { + return table_.hash_to_bucket(table_.hash(k)); + } + + local_iterator begin(size_type n) + { + return local_iterator(table_.begin(n), n, table_.bucket_count_); + } + + const_local_iterator begin(size_type n) const + { + return const_local_iterator(table_.begin(n), n, table_.bucket_count_); + } + + local_iterator end(size_type) { return local_iterator(); } + + const_local_iterator end(size_type) const + { + return const_local_iterator(); + } + + const_local_iterator cbegin(size_type n) const + { + return const_local_iterator(table_.begin(n), n, table_.bucket_count_); + } + + const_local_iterator cend(size_type) const + { + return const_local_iterator(); + } + + // hash policy + + float load_factor() const BOOST_NOEXCEPT; + float max_load_factor() const BOOST_NOEXCEPT { return table_.mlf_; } + void max_load_factor(float) BOOST_NOEXCEPT; + void rehash(size_type); + void reserve(size_type); + +#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) + friend bool operator== + <T, H, P, A>(unordered_multiset const&, unordered_multiset const&); + friend bool operator!= + <T, H, P, A>(unordered_multiset const&, unordered_multiset const&); +#endif + }; // class template unordered_multiset + +#if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES + + template <class InputIterator, + class Hash = + boost::hash<typename std::iterator_traits<InputIterator>::value_type>, + class Pred = + std::equal_to<typename std::iterator_traits<InputIterator>::value_type>, + class Allocator = std::allocator< + typename std::iterator_traits<InputIterator>::value_type> > + unordered_multiset(InputIterator, InputIterator, + std::size_t = boost::unordered::detail::default_bucket_count, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + ->unordered_multiset< + typename std::iterator_traits<InputIterator>::value_type, Hash, Pred, + Allocator>; + + template <class T, class Hash = boost::hash<T>, + class Pred = std::equal_to<T>, class Allocator = std::allocator<T> > + unordered_multiset(std::initializer_list<T>, + std::size_t = boost::unordered::detail::default_bucket_count, + Hash = Hash(), Pred = Pred(), Allocator = Allocator()) + ->unordered_multiset<T, Hash, Pred, Allocator>; + + template <class InputIterator, class Allocator> + unordered_multiset(InputIterator, InputIterator, std::size_t, Allocator) + ->unordered_multiset< + typename std::iterator_traits<InputIterator>::value_type, + boost::hash<typename std::iterator_traits<InputIterator>::value_type>, + std::equal_to<typename std::iterator_traits<InputIterator>::value_type>, + Allocator>; + + template <class InputIterator, class Hash, class Allocator> + unordered_multiset( + InputIterator, InputIterator, std::size_t, Hash, Allocator) + ->unordered_multiset< + typename std::iterator_traits<InputIterator>::value_type, Hash, + std::equal_to<typename std::iterator_traits<InputIterator>::value_type>, + Allocator>; + + template <class T, class Allocator> + unordered_multiset(std::initializer_list<T>, std::size_t, Allocator) + ->unordered_multiset<T, boost::hash<T>, std::equal_to<T>, Allocator>; + + template <class T, class Hash, class Allocator> + unordered_multiset(std::initializer_list<T>, std::size_t, Hash, Allocator) + ->unordered_multiset<T, Hash, std::equal_to<T>, Allocator>; + +#endif + + //////////////////////////////////////////////////////////////////////////// + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set() + : table_(boost::unordered::detail::default_bucket_count, hasher(), + key_equal(), allocator_type()) + { + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set(size_type n, const hasher& hf, + const key_equal& eql, const allocator_type& a) + : table_(n, hf, eql, a) + { + } + + template <class T, class H, class P, class A> + template <class InputIt> + unordered_set<T, H, P, A>::unordered_set(InputIt f, InputIt l, size_type n, + const hasher& hf, const key_equal& eql, const allocator_type& a) + : table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a) + { + this->insert(f, l); + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set(unordered_set const& other) + : table_(other.table_, + unordered_set::value_allocator_traits:: + select_on_container_copy_construction(other.get_allocator())) + { + if (other.table_.size_) { + table_.copy_buckets( + other.table_, boost::unordered::detail::true_type()); + } + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set(allocator_type const& a) + : table_(boost::unordered::detail::default_bucket_count, hasher(), + key_equal(), a) + { + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + unordered_set const& other, allocator_type const& a) + : table_(other.table_, a) + { + if (other.table_.size_) { + table_.copy_buckets( + other.table_, boost::unordered::detail::true_type()); + } + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + BOOST_RV_REF(unordered_set) other, allocator_type const& a) + : table_(other.table_, a, boost::unordered::detail::move_tag()) + { + table_.move_construct_buckets(other.table_); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + std::initializer_list<value_type> list, size_type n, const hasher& hf, + const key_equal& eql, const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(list.begin(), list.end(), n), + hf, eql, a) + { + this->insert(list.begin(), list.end()); + } + +#endif + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + size_type n, const allocator_type& a) + : table_(n, hasher(), key_equal(), a) + { + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + size_type n, const hasher& hf, const allocator_type& a) + : table_(n, hf, key_equal(), a) + { + } + + template <class T, class H, class P, class A> + template <class InputIt> + unordered_set<T, H, P, A>::unordered_set( + InputIt f, InputIt l, size_type n, const allocator_type& a) + : table_(boost::unordered::detail::initial_size(f, l, n), hasher(), + key_equal(), a) + { + this->insert(f, l); + } + + template <class T, class H, class P, class A> + template <class InputIt> + unordered_set<T, H, P, A>::unordered_set(InputIt f, InputIt l, size_type n, + const hasher& hf, const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(f, l, n), hf, key_equal(), a) + { + this->insert(f, l); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + std::initializer_list<value_type> list, size_type n, + const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(list.begin(), list.end(), n), + hasher(), key_equal(), a) + { + this->insert(list.begin(), list.end()); + } + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::unordered_set( + std::initializer_list<value_type> list, size_type n, const hasher& hf, + const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(list.begin(), list.end(), n), + hf, key_equal(), a) + { + this->insert(list.begin(), list.end()); + } + +#endif + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>::~unordered_set() BOOST_NOEXCEPT + { + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class T, class H, class P, class A> + unordered_set<T, H, P, A>& unordered_set<T, H, P, A>::operator=( + std::initializer_list<value_type> list) + { + this->clear(); + this->insert(list.begin(), list.end()); + return *this; + } + +#endif + + // size and capacity + + template <class T, class H, class P, class A> + std::size_t unordered_set<T, H, P, A>::max_size() const BOOST_NOEXCEPT + { + using namespace std; + + // size < mlf_ * count + return boost::unordered::detail::double_to_size( + ceil(static_cast<double>(table_.mlf_) * + static_cast<double>(table_.max_bucket_count()))) - + 1; + } + + // modifiers + + template <class T, class H, class P, class A> + template <class InputIt> + void unordered_set<T, H, P, A>::insert(InputIt first, InputIt last) + { + if (first != last) { + table_.insert_range_unique( + table::extractor::extract(*first), first, last); + } + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + template <class T, class H, class P, class A> + void unordered_set<T, H, P, A>::insert( + std::initializer_list<value_type> list) + { + this->insert(list.begin(), list.end()); + } +#endif + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::iterator + unordered_set<T, H, P, A>::erase(const_iterator position) + { + node_pointer node = table::get_node(position); + BOOST_ASSERT(node); + node_pointer next = table::next_node(node); + table_.erase_nodes_unique(node, next); + return iterator(next); + } + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::size_type + unordered_set<T, H, P, A>::erase(const key_type& k) + { + return table_.erase_key_unique(k); + } + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::iterator + unordered_set<T, H, P, A>::erase(const_iterator first, const_iterator last) + { + node_pointer last_node = table::get_node(last); + if (first == last) + return iterator(last_node); + table_.erase_nodes_unique(table::get_node(first), last_node); + return iterator(last_node); + } + + template <class T, class H, class P, class A> + void unordered_set<T, H, P, A>::swap(unordered_set& other) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_swappable<H>::value&& + boost::is_nothrow_swappable<P>::value) + { + table_.swap(other.table_); + } + + // observers + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::hasher + unordered_set<T, H, P, A>::hash_function() const + { + return table_.hash_function(); + } + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::key_equal + unordered_set<T, H, P, A>::key_eq() const + { + return table_.key_eq(); + } + + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_set<T, H, P, A>::merge( + boost::unordered_set<T, H2, P2, A>& source) + { + table_.merge_unique(source.table_); + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_set<T, H, P, A>::merge( + boost::unordered_set<T, H2, P2, A>&& source) + { + table_.merge_unique(source.table_); + } +#endif + + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_set<T, H, P, A>::merge( + boost::unordered_multiset<T, H2, P2, A>& source) + { + table_.merge_unique(source.table_); + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_set<T, H, P, A>::merge( + boost::unordered_multiset<T, H2, P2, A>&& source) + { + table_.merge_unique(source.table_); + } +#endif + + // lookup + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::const_iterator + unordered_set<T, H, P, A>::find(const key_type& k) const + { + return const_iterator(table_.find_node(k)); + } + + template <class T, class H, class P, class A> + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + typename unordered_set<T, H, P, A>::const_iterator + unordered_set<T, H, P, A>::find(CompatibleKey const& k, + CompatibleHash const& hash, CompatiblePredicate const& eq) const + { + return const_iterator( + table_.find_node_impl(table::policy::apply_hash(hash, k), k, eq)); + } + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::size_type + unordered_set<T, H, P, A>::count(const key_type& k) const + { + return table_.find_node(k) ? 1 : 0; + } + + template <class T, class H, class P, class A> + std::pair<typename unordered_set<T, H, P, A>::const_iterator, + typename unordered_set<T, H, P, A>::const_iterator> + unordered_set<T, H, P, A>::equal_range(const key_type& k) const + { + node_pointer n = table_.find_node(k); + return std::make_pair( + const_iterator(n), const_iterator(n ? table::next_node(n) : n)); + } + + template <class T, class H, class P, class A> + typename unordered_set<T, H, P, A>::size_type + unordered_set<T, H, P, A>::bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + // hash policy + + template <class T, class H, class P, class A> + float unordered_set<T, H, P, A>::load_factor() const BOOST_NOEXCEPT + { + BOOST_ASSERT(table_.bucket_count_ != 0); + return static_cast<float>(table_.size_) / + static_cast<float>(table_.bucket_count_); + } + + template <class T, class H, class P, class A> + void unordered_set<T, H, P, A>::max_load_factor(float m) BOOST_NOEXCEPT + { + table_.max_load_factor(m); + } + + template <class T, class H, class P, class A> + void unordered_set<T, H, P, A>::rehash(size_type n) + { + table_.rehash(n); + } + + template <class T, class H, class P, class A> + void unordered_set<T, H, P, A>::reserve(size_type n) + { + table_.rehash(static_cast<std::size_t>( + std::ceil(static_cast<double>(n) / table_.mlf_))); + } + + template <class T, class H, class P, class A> + inline bool operator==( + unordered_set<T, H, P, A> const& m1, unordered_set<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy + { + unordered_set<T, H, P, A> x; + }; +#endif + return m1.table_.equals_unique(m2.table_); + } + + template <class T, class H, class P, class A> + inline bool operator!=( + unordered_set<T, H, P, A> const& m1, unordered_set<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy + { + unordered_set<T, H, P, A> x; + }; +#endif + return !m1.table_.equals_unique(m2.table_); + } + + template <class T, class H, class P, class A> + inline void swap( + unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2) + BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy + { + unordered_set<T, H, P, A> x; + }; +#endif + m1.swap(m2); + } + + //////////////////////////////////////////////////////////////////////////// + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset() + : table_(boost::unordered::detail::default_bucket_count, hasher(), + key_equal(), allocator_type()) + { + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset(size_type n, + const hasher& hf, const key_equal& eql, const allocator_type& a) + : table_(n, hf, eql, a) + { + } + + template <class T, class H, class P, class A> + template <class InputIt> + unordered_multiset<T, H, P, A>::unordered_multiset(InputIt f, InputIt l, + size_type n, const hasher& hf, const key_equal& eql, + const allocator_type& a) + : table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a) + { + this->insert(f, l); + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + unordered_multiset const& other) + : table_(other.table_, + unordered_multiset::value_allocator_traits:: + select_on_container_copy_construction(other.get_allocator())) + { + if (other.table_.size_) { + table_.copy_buckets( + other.table_, boost::unordered::detail::false_type()); + } + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset(allocator_type const& a) + : table_(boost::unordered::detail::default_bucket_count, hasher(), + key_equal(), a) + { + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + unordered_multiset const& other, allocator_type const& a) + : table_(other.table_, a) + { + if (other.table_.size_) { + table_.copy_buckets( + other.table_, boost::unordered::detail::false_type()); + } + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + BOOST_RV_REF(unordered_multiset) other, allocator_type const& a) + : table_(other.table_, a, boost::unordered::detail::move_tag()) + { + table_.move_construct_buckets(other.table_); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + std::initializer_list<value_type> list, size_type n, const hasher& hf, + const key_equal& eql, const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(list.begin(), list.end(), n), + hf, eql, a) + { + this->insert(list.begin(), list.end()); + } + +#endif + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + size_type n, const allocator_type& a) + : table_(n, hasher(), key_equal(), a) + { + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + size_type n, const hasher& hf, const allocator_type& a) + : table_(n, hf, key_equal(), a) + { + } + + template <class T, class H, class P, class A> + template <class InputIt> + unordered_multiset<T, H, P, A>::unordered_multiset( + InputIt f, InputIt l, size_type n, const allocator_type& a) + : table_(boost::unordered::detail::initial_size(f, l, n), hasher(), + key_equal(), a) + { + this->insert(f, l); + } + + template <class T, class H, class P, class A> + template <class InputIt> + unordered_multiset<T, H, P, A>::unordered_multiset(InputIt f, InputIt l, + size_type n, const hasher& hf, const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(f, l, n), hf, key_equal(), a) + { + this->insert(f, l); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + std::initializer_list<value_type> list, size_type n, + const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(list.begin(), list.end(), n), + hasher(), key_equal(), a) + { + this->insert(list.begin(), list.end()); + } + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::unordered_multiset( + std::initializer_list<value_type> list, size_type n, const hasher& hf, + const allocator_type& a) + : table_( + boost::unordered::detail::initial_size(list.begin(), list.end(), n), + hf, key_equal(), a) + { + this->insert(list.begin(), list.end()); + } + +#endif + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>::~unordered_multiset() BOOST_NOEXCEPT + { + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class T, class H, class P, class A> + unordered_multiset<T, H, P, A>& unordered_multiset<T, H, P, A>::operator=( + std::initializer_list<value_type> list) + { + this->clear(); + this->insert(list.begin(), list.end()); + return *this; + } + +#endif + + // size and capacity + + template <class T, class H, class P, class A> + std::size_t unordered_multiset<T, H, P, A>::max_size() const BOOST_NOEXCEPT + { + using namespace std; + + // size < mlf_ * count + return boost::unordered::detail::double_to_size( + ceil(static_cast<double>(table_.mlf_) * + static_cast<double>(table_.max_bucket_count()))) - + 1; + } + + // modifiers + + template <class T, class H, class P, class A> + template <class InputIt> + void unordered_multiset<T, H, P, A>::insert(InputIt first, InputIt last) + { + table_.insert_range_equiv(first, last); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + template <class T, class H, class P, class A> + void unordered_multiset<T, H, P, A>::insert( + std::initializer_list<value_type> list) + { + this->insert(list.begin(), list.end()); + } +#endif + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::iterator + unordered_multiset<T, H, P, A>::erase(const_iterator position) + { + node_pointer node = table::get_node(position); + BOOST_ASSERT(node); + node_pointer next = table::next_node(node); + table_.erase_nodes_equiv(node, next); + return iterator(next); + } + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::size_type + unordered_multiset<T, H, P, A>::erase(const key_type& k) + { + return table_.erase_key_equiv(k); + } + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::iterator + unordered_multiset<T, H, P, A>::erase( + const_iterator first, const_iterator last) + { + node_pointer last_node = table::get_node(last); + if (first == last) + return iterator(last_node); + table_.erase_nodes_equiv(table::get_node(first), last_node); + return iterator(last_node); + } + + template <class T, class H, class P, class A> + void unordered_multiset<T, H, P, A>::swap(unordered_multiset& other) + BOOST_NOEXCEPT_IF(value_allocator_traits::is_always_equal::value&& + boost::is_nothrow_swappable<H>::value&& + boost::is_nothrow_swappable<P>::value) + { + table_.swap(other.table_); + } + + // observers + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::hasher + unordered_multiset<T, H, P, A>::hash_function() const + { + return table_.hash_function(); + } + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::key_equal + unordered_multiset<T, H, P, A>::key_eq() const + { + return table_.key_eq(); + } + + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_multiset<T, H, P, A>::merge( + boost::unordered_multiset<T, H2, P2, A>& source) + { + while (!source.empty()) { + insert(source.extract(source.begin())); + } + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_multiset<T, H, P, A>::merge( + boost::unordered_multiset<T, H2, P2, A>&& source) + { + while (!source.empty()) { + insert(source.extract(source.begin())); + } + } +#endif + + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_multiset<T, H, P, A>::merge( + boost::unordered_set<T, H2, P2, A>& source) + { + while (!source.empty()) { + insert(source.extract(source.begin())); + } + } + +#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) + template <class T, class H, class P, class A> + template <typename H2, typename P2> + void unordered_multiset<T, H, P, A>::merge( + boost::unordered_set<T, H2, P2, A>&& source) + { + while (!source.empty()) { + insert(source.extract(source.begin())); + } + } +#endif + + // lookup + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::const_iterator + unordered_multiset<T, H, P, A>::find(const key_type& k) const + { + return const_iterator(table_.find_node(k)); + } + + template <class T, class H, class P, class A> + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + typename unordered_multiset<T, H, P, A>::const_iterator + unordered_multiset<T, H, P, A>::find(CompatibleKey const& k, + CompatibleHash const& hash, CompatiblePredicate const& eq) const + { + return const_iterator( + table_.find_node_impl(table::policy::apply_hash(hash, k), k, eq)); + } + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::size_type + unordered_multiset<T, H, P, A>::count(const key_type& k) const + { + node_pointer n = table_.find_node(k); + return n ? table_.group_count(n) : 0; + } + + template <class T, class H, class P, class A> + std::pair<typename unordered_multiset<T, H, P, A>::const_iterator, + typename unordered_multiset<T, H, P, A>::const_iterator> + unordered_multiset<T, H, P, A>::equal_range(const key_type& k) const + { + node_pointer n = table_.find_node(k); + return std::make_pair( + const_iterator(n), const_iterator(n ? table_.next_group(n) : n)); + } + + template <class T, class H, class P, class A> + typename unordered_multiset<T, H, P, A>::size_type + unordered_multiset<T, H, P, A>::bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + // hash policy + + template <class T, class H, class P, class A> + float unordered_multiset<T, H, P, A>::load_factor() const BOOST_NOEXCEPT + { + BOOST_ASSERT(table_.bucket_count_ != 0); + return static_cast<float>(table_.size_) / + static_cast<float>(table_.bucket_count_); + } + + template <class T, class H, class P, class A> + void unordered_multiset<T, H, P, A>::max_load_factor(float m) BOOST_NOEXCEPT + { + table_.max_load_factor(m); + } + + template <class T, class H, class P, class A> + void unordered_multiset<T, H, P, A>::rehash(size_type n) + { + table_.rehash(n); + } + + template <class T, class H, class P, class A> + void unordered_multiset<T, H, P, A>::reserve(size_type n) + { + table_.rehash(static_cast<std::size_t>( + std::ceil(static_cast<double>(n) / table_.mlf_))); + } + + template <class T, class H, class P, class A> + inline bool operator==(unordered_multiset<T, H, P, A> const& m1, + unordered_multiset<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy + { + unordered_multiset<T, H, P, A> x; + }; +#endif + return m1.table_.equals_equiv(m2.table_); + } + + template <class T, class H, class P, class A> + inline bool operator!=(unordered_multiset<T, H, P, A> const& m1, + unordered_multiset<T, H, P, A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy + { + unordered_multiset<T, H, P, A> x; + }; +#endif + return !m1.table_.equals_equiv(m2.table_); + } + + template <class T, class H, class P, class A> + inline void swap( + unordered_multiset<T, H, P, A>& m1, unordered_multiset<T, H, P, A>& m2) + BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy + { + unordered_multiset<T, H, P, A> x; + }; +#endif + m1.swap(m2); + } + + template <typename N, typename T, typename A> class node_handle_set + { + BOOST_MOVABLE_BUT_NOT_COPYABLE(node_handle_set) + + template <typename Types> friend struct ::boost::unordered::detail::table; + template <class T2, class H2, class P2, class A2> + friend class unordered_set; + template <class T2, class H2, class P2, class A2> + friend class unordered_multiset; + + typedef typename boost::unordered::detail::rebind_wrap<A, T>::type + value_allocator; + typedef boost::unordered::detail::allocator_traits<value_allocator> + value_allocator_traits; + typedef N node; + typedef typename boost::unordered::detail::rebind_wrap<A, node>::type + node_allocator; + typedef boost::unordered::detail::allocator_traits<node_allocator> + node_allocator_traits; + typedef typename node_allocator_traits::pointer node_pointer; + + public: + typedef T value_type; + typedef A allocator_type; + + private: + node_pointer ptr_; + bool has_alloc_; + boost::unordered::detail::optional<value_allocator> alloc_; + + node_handle_set(node_pointer ptr, allocator_type const& a) + : ptr_(ptr), alloc_(a) + { + } + + public: + BOOST_CONSTEXPR node_handle_set() BOOST_NOEXCEPT : ptr_(), + has_alloc_(false) + { + } + + ~node_handle_set() + { + if (ptr_) { + node_allocator node_alloc(*alloc_); + boost::unordered::detail::node_tmp<node_allocator> tmp( + ptr_, node_alloc); + } + } + + node_handle_set(BOOST_RV_REF(node_handle_set) n) BOOST_NOEXCEPT + : ptr_(n.ptr_), + alloc_(boost::move(n.alloc_)) + { + n.ptr_ = node_pointer(); + } + + node_handle_set& operator=(BOOST_RV_REF(node_handle_set) n) + { + BOOST_ASSERT(!alloc_.has_value() || + value_allocator_traits:: + propagate_on_container_move_assignment::value || + (n.alloc_.has_value() && alloc_ == n.alloc_)); + + if (ptr_) { + node_allocator node_alloc(*alloc_); + boost::unordered::detail::node_tmp<node_allocator> tmp( + ptr_, node_alloc); + ptr_ = node_pointer(); + } + + if (!alloc_.has_value() || + value_allocator_traits::propagate_on_container_move_assignment:: + value) { + alloc_ = boost::move(n.alloc_); + } + ptr_ = n.ptr_; + n.ptr_ = node_pointer(); + + return *this; + } + + value_type& value() const { return ptr_->value(); } + + allocator_type get_allocator() const { return *alloc_; } + + BOOST_EXPLICIT_OPERATOR_BOOL_NOEXCEPT() + + bool operator!() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } + + bool empty() const BOOST_NOEXCEPT { return ptr_ ? 0 : 1; } + + void swap(node_handle_set& n) BOOST_NOEXCEPT_IF( + value_allocator_traits::propagate_on_container_swap::value || + value_allocator_traits::is_always_equal::value) + { + BOOST_ASSERT( + !alloc_.has_value() || !n.alloc_.has_value() || + value_allocator_traits::propagate_on_container_swap::value || + alloc_ == n.alloc_); + if (value_allocator_traits::propagate_on_container_swap::value || + !alloc_.has_value() || !n.alloc_.has_value()) { + boost::swap(alloc_, n.alloc_); + } + boost::swap(ptr_, n.ptr_); + } + }; + + template <typename N, typename T, typename A> + void swap(node_handle_set<N, T, A>& x, node_handle_set<N, T, A>& y) + BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(x.swap(y))) + { + x.swap(y); + } + + template <typename N, typename T, typename A> struct insert_return_type_set + { + private: + BOOST_MOVABLE_BUT_NOT_COPYABLE(insert_return_type_set) + + typedef typename boost::unordered::detail::rebind_wrap<A, T>::type + value_allocator; + typedef N node_; + + public: + bool inserted; + boost::unordered::iterator_detail::c_iterator<node_> position; + boost::unordered::node_handle_set<N, T, A> node; + + insert_return_type_set() : inserted(false), position(), node() {} + + insert_return_type_set(BOOST_RV_REF(insert_return_type_set) + x) BOOST_NOEXCEPT : inserted(x.inserted), + position(x.position), + node(boost::move(x.node)) + { + } + + insert_return_type_set& operator=(BOOST_RV_REF(insert_return_type_set) x) + { + inserted = x.inserted; + position = x.position; + node = boost::move(x.node); + return *this; + } + }; + + template <typename N, typename T, typename A> + void swap( + insert_return_type_set<N, T, A>& x, insert_return_type_set<N, T, A>& y) + { + boost::swap(x.node, y.node); + boost::swap(x.inserted, y.inserted); + boost::swap(x.position, y.position); + } + } // namespace unordered +} // namespace boost + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif // BOOST_UNORDERED_UNORDERED_SET_HPP_INCLUDED diff --git a/ThirdParty/boost/unordered/unordered_set_fwd.hpp b/ThirdParty/boost/unordered/unordered_set_fwd.hpp new file mode 100644 index 0000000000000000000000000000000000000000..35e2820f95fdcfaa1a3997ad77e027374868343e --- /dev/null +++ b/ThirdParty/boost/unordered/unordered_set_fwd.hpp @@ -0,0 +1,62 @@ + +// Copyright (C) 2008-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) + +#ifndef BOOST_UNORDERED_SET_FWD_HPP_INCLUDED +#define BOOST_UNORDERED_SET_FWD_HPP_INCLUDED + +#include <boost/config.hpp> +#if defined(BOOST_HAS_PRAGMA_ONCE) +#pragma once +#endif + +#include <boost/functional/hash_fwd.hpp> +#include <boost/unordered/detail/fwd.hpp> +#include <functional> +#include <memory> + +namespace boost { + namespace unordered { + template <class T, class H = boost::hash<T>, class P = std::equal_to<T>, + class A = std::allocator<T> > + class unordered_set; + + template <class T, class H, class P, class A> + inline bool operator==( + unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&); + template <class T, class H, class P, class A> + inline bool operator!=( + unordered_set<T, H, P, A> const&, unordered_set<T, H, P, A> const&); + template <class T, class H, class P, class A> + inline void swap( + unordered_set<T, H, P, A>& m1, unordered_set<T, H, P, A>& m2) + BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))); + + template <class T, class H = boost::hash<T>, class P = std::equal_to<T>, + class A = std::allocator<T> > + class unordered_multiset; + + template <class T, class H, class P, class A> + inline bool operator==(unordered_multiset<T, H, P, A> const&, + unordered_multiset<T, H, P, A> const&); + template <class T, class H, class P, class A> + inline bool operator!=(unordered_multiset<T, H, P, A> const&, + unordered_multiset<T, H, P, A> const&); + template <class T, class H, class P, class A> + inline void swap( + unordered_multiset<T, H, P, A>& m1, unordered_multiset<T, H, P, A>& m2) + BOOST_NOEXCEPT_IF(BOOST_NOEXCEPT_EXPR(m1.swap(m2))); + + template <class N, class T, class A> class node_handle_set; + template <class N, class T, class A> struct insert_return_type_set; + } + + using boost::unordered::unordered_set; + using boost::unordered::unordered_multiset; + using boost::unordered::swap; + using boost::unordered::operator==; + using boost::unordered::operator!=; +} + +#endif diff --git a/ThirdParty/boost/variant2/variant.hpp b/ThirdParty/boost/variant2/variant.hpp new file mode 100644 index 0000000000000000000000000000000000000000..9c1fba9607af503dc0cc2738be189f55f971d4d7 --- /dev/null +++ b/ThirdParty/boost/variant2/variant.hpp @@ -0,0 +1,2048 @@ +#ifndef BOOST_VARIANT2_VARIANT_HPP_INCLUDED +#define BOOST_VARIANT2_VARIANT_HPP_INCLUDED + +// Copyright 2017-2019 Peter Dimov. +// +// 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(_MSC_VER) && _MSC_VER < 1910 +# pragma warning( push ) +# pragma warning( disable: 4521 4522 ) // multiple copy operators +#endif + +#ifndef BOOST_MP11_HPP_INCLUDED +#include <boost/mp11.hpp> +#endif +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/cstdint.hpp> +#include <cstddef> +#include <type_traits> +#include <exception> +#include <cassert> +#include <initializer_list> +#include <utility> +#include <functional> // std::hash + +// + +namespace boost +{ + +#ifdef BOOST_NO_EXCEPTIONS + +BOOST_NORETURN void throw_exception( std::exception const & e ); // user defined + +#endif + +namespace variant2 +{ + +// bad_variant_access + +class bad_variant_access: public std::exception +{ +public: + + bad_variant_access() noexcept + { + } + + char const * what() const noexcept + { + return "bad_variant_access"; + } +}; + +namespace detail +{ + +BOOST_NORETURN inline void throw_bad_variant_access() +{ +#ifdef BOOST_NO_EXCEPTIONS + + boost::throw_exception( bad_variant_access() ); + +#else + + throw bad_variant_access(); + +#endif +} + +} // namespace detail + +// monostate + +struct monostate +{ +}; + +constexpr bool operator<(monostate, monostate) noexcept { return false; } +constexpr bool operator>(monostate, monostate) noexcept { return false; } +constexpr bool operator<=(monostate, monostate) noexcept { return true; } +constexpr bool operator>=(monostate, monostate) noexcept { return true; } +constexpr bool operator==(monostate, monostate) noexcept { return true; } +constexpr bool operator!=(monostate, monostate) noexcept { return false; } + +// variant forward declaration + +template<class... T> class variant; + +// variant_size + +template<class T> struct variant_size +{ +}; + +template<class T> struct variant_size<T const>: variant_size<T> +{ +}; + +template<class T> struct variant_size<T volatile>: variant_size<T> +{ +}; + +template<class T> struct variant_size<T const volatile>: variant_size<T> +{ +}; + +template<class T> struct variant_size<T&>: variant_size<T> +{ +}; + +template<class T> struct variant_size<T&&>: variant_size<T> +{ +}; + +#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) + +template <class T> /*inline*/ constexpr std::size_t variant_size_v = variant_size<T>::value; + +#endif + +template <class... T> struct variant_size<variant<T...>>: mp11::mp_size<variant<T...>> +{ +}; + +// variant_alternative + +template<std::size_t I, class T> struct variant_alternative; + +template<std::size_t I, class T> using variant_alternative_t = typename variant_alternative<I, T>::type; + +#if BOOST_WORKAROUND(BOOST_GCC, < 40900) + +namespace detail +{ + +template<std::size_t I, class T, bool E> struct variant_alternative_impl +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...>, true> +{ + using type = mp11::mp_at_c<variant<T...>, I>; +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const, true>: std::add_const< mp11::mp_at_c<variant<T...>, I> > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> volatile, true>: std::add_volatile< mp11::mp_at_c<variant<T...>, I> > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const volatile, true>: std::add_cv< mp11::mp_at_c<variant<T...>, I> > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...>&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> const > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> volatile&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> volatile > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const volatile&, true>: std::add_lvalue_reference< mp11::mp_at_c<variant<T...>, I> const volatile > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...>&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> const > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> volatile&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> volatile > +{ +}; + +template<std::size_t I, class... T> struct variant_alternative_impl<I, variant<T...> const volatile&&, true>: std::add_rvalue_reference< mp11::mp_at_c<variant<T...>, I> const volatile > +{ +}; + +} // namespace detail + +template<std::size_t I, class T> struct variant_alternative +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>>: public detail::variant_alternative_impl<I, variant<T...>, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const>: public detail::variant_alternative_impl<I, variant<T...> const, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> volatile>: public detail::variant_alternative_impl<I, variant<T...> volatile, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const volatile>: public detail::variant_alternative_impl<I, variant<T...> const volatile, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>&>: public detail::variant_alternative_impl<I, variant<T...>&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const&>: public detail::variant_alternative_impl<I, variant<T...> const&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> volatile&>: public detail::variant_alternative_impl<I, variant<T...> volatile&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const volatile&>: public detail::variant_alternative_impl<I, variant<T...> const volatile&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>&&>: public detail::variant_alternative_impl<I, variant<T...>&&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const&&>: public detail::variant_alternative_impl<I, variant<T...> const&&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> volatile&&>: public detail::variant_alternative_impl<I, variant<T...> volatile&&, (I < sizeof...(T))> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...> const volatile&&>: public detail::variant_alternative_impl<I, variant<T...> const volatile&&, (I < sizeof...(T))> +{ +}; + +#else + +namespace detail +{ + +#if defined( BOOST_MP11_VERSION ) && BOOST_MP11_VERSION >= 107000 + +template<class I, class T, class Q> using var_alt_impl = mp11::mp_invoke_q<Q, variant_alternative_t<I::value, T>>; + +#else + +template<class I, class T, class Q> using var_alt_impl = mp11::mp_invoke<Q, variant_alternative_t<I::value, T>>; + +#endif + +} // namespace detail + +template<std::size_t I, class T> struct variant_alternative +{ +}; + +template<std::size_t I, class T> struct variant_alternative<I, T const>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_const>> +{ +}; + +template<std::size_t I, class T> struct variant_alternative<I, T volatile>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_volatile>> +{ +}; + +template<std::size_t I, class T> struct variant_alternative<I, T const volatile>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_cv>> +{ +}; + +template<std::size_t I, class T> struct variant_alternative<I, T&>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_lvalue_reference>> +{ +}; + +template<std::size_t I, class T> struct variant_alternative<I, T&&>: mp11::mp_defer<detail::var_alt_impl, mp11::mp_size_t<I>, T, mp11::mp_quote_trait<std::add_rvalue_reference>> +{ +}; + +template<std::size_t I, class... T> struct variant_alternative<I, variant<T...>>: mp11::mp_defer<mp11::mp_at, variant<T...>, mp11::mp_size_t<I>> +{ +}; + +#endif + +// variant_npos + +constexpr std::size_t variant_npos = ~static_cast<std::size_t>( 0 ); + +// holds_alternative + +template<class U, class... T> constexpr bool holds_alternative( variant<T...> const& v ) noexcept +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + return v.index() == mp11::mp_find<variant<T...>, U>::value; +} + +// get (index) + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>& get(variant<T...>& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), v._get_impl( mp11::mp_size_t<I>() ); +} + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>&& get(variant<T...>&& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) + + return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), std::move( v._get_impl( mp11::mp_size_t<I>() ) ); + +#else + + if( v.index() != I ) detail::throw_bad_variant_access(); + return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); + +#endif +} + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const& get(variant<T...> const& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), v._get_impl( mp11::mp_size_t<I>() ); +} + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const&& get(variant<T...> const&& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) + + return ( v.index() != I? detail::throw_bad_variant_access(): (void)0 ), std::move( v._get_impl( mp11::mp_size_t<I>() ) ); + +#else + + if( v.index() != I ) detail::throw_bad_variant_access(); + return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); + +#endif +} + +// detail::unsafe_get (for visit) + +namespace detail +{ + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>& unsafe_get(variant<T...>& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return v._get_impl( mp11::mp_size_t<I>() ); +} + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>>&& unsafe_get(variant<T...>&& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); +} + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const& unsafe_get(variant<T...> const& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return v._get_impl( mp11::mp_size_t<I>() ); +} + +template<std::size_t I, class... T> constexpr variant_alternative_t<I, variant<T...>> const&& unsafe_get(variant<T...> const&& v) +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return std::move( v._get_impl( mp11::mp_size_t<I>() ) ); +} + +} // namespace detail + +// get (type) + +template<class U, class... T> constexpr U& get(variant<T...>& v) +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + + using I = mp11::mp_find<variant<T...>, U>; + + return ( v.index() != I::value? detail::throw_bad_variant_access(): (void)0 ), v._get_impl( I() ); +} + +template<class U, class... T> constexpr U&& get(variant<T...>&& v) +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + + using I = mp11::mp_find<variant<T...>, U>; + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) + + return ( v.index() != I::value? detail::throw_bad_variant_access(): (void)0 ), std::move( v._get_impl( I() ) ); + +#else + + if( v.index() != I::value ) detail::throw_bad_variant_access(); + return std::move( v._get_impl( I() ) ); + +#endif +} + +template<class U, class... T> constexpr U const& get(variant<T...> const& v) +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + + using I = mp11::mp_find<variant<T...>, U>; + + return ( v.index() != I::value? detail::throw_bad_variant_access(): (void)0 ), v._get_impl( I() ); +} + +template<class U, class... T> constexpr U const&& get(variant<T...> const&& v) +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + + using I = mp11::mp_find<variant<T...>, U>; + +#if !BOOST_WORKAROUND(BOOST_MSVC, < 1930) + + return ( v.index() != I::value? detail::throw_bad_variant_access(): (void)0 ), std::move( v._get_impl( I() ) ); + +#else + + if( v.index() != I::value ) detail::throw_bad_variant_access(); + return std::move( v._get_impl( I() ) ); + +#endif +} + +// get_if + +template<std::size_t I, class... T> constexpr typename std::add_pointer<variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...>* v) noexcept +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return v && v->index() == I? &v->_get_impl( mp11::mp_size_t<I>() ): 0; +} + +template<std::size_t I, class... T> constexpr typename std::add_pointer<const variant_alternative_t<I, variant<T...>>>::type get_if(variant<T...> const * v) noexcept +{ + static_assert( I < sizeof...(T), "Index out of bounds" ); + return v && v->index() == I? &v->_get_impl( mp11::mp_size_t<I>() ): 0; +} + +template<class U, class... T> constexpr typename std::add_pointer<U>::type get_if(variant<T...>* v) noexcept +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + + using I = mp11::mp_find<variant<T...>, U>; + + return v && v->index() == I::value? &v->_get_impl( I() ): 0; +} + +template<class U, class... T> constexpr typename std::add_pointer<U const>::type get_if(variant<T...> const * v) noexcept +{ + static_assert( mp11::mp_count<variant<T...>, U>::value == 1, "The type must occur exactly once in the list of variant alternatives" ); + + using I = mp11::mp_find<variant<T...>, U>; + + return v && v->index() == I::value? &v->_get_impl( I() ): 0; +} + +// + +namespace detail +{ + +// trivially_* + +#if defined( BOOST_LIBSTDCXX_VERSION ) && BOOST_LIBSTDCXX_VERSION < 50000 + +template<class T> struct is_trivially_copy_constructible: mp11::mp_bool<std::is_copy_constructible<T>::value && std::has_trivial_copy_constructor<T>::value> +{ +}; + +template<class T> struct is_trivially_copy_assignable: mp11::mp_bool<std::is_copy_assignable<T>::value && std::has_trivial_copy_assign<T>::value> +{ +}; + +template<class T> struct is_trivially_move_constructible: mp11::mp_bool<std::is_move_constructible<T>::value && std::is_trivial<T>::value> +{ +}; + +template<class T> struct is_trivially_move_assignable: mp11::mp_bool<std::is_move_assignable<T>::value && std::is_trivial<T>::value> +{ +}; + +#else + +using std::is_trivially_copy_constructible; +using std::is_trivially_copy_assignable; +using std::is_trivially_move_constructible; +using std::is_trivially_move_assignable; + +#endif + +// variant_storage + +template<class D, class... T> union variant_storage_impl; + +template<class... T> using variant_storage = variant_storage_impl<mp11::mp_all<std::is_trivially_destructible<T>...>, T...>; + +template<class D> union variant_storage_impl<D> +{ +}; + +// not all trivially destructible +template<class T1, class... T> union variant_storage_impl<mp11::mp_false, T1, T...> +{ + T1 first_; + variant_storage<T...> rest_; + + template<class... A> constexpr explicit variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... ) + { + } + + template<std::size_t I, class... A> constexpr explicit variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ) + { + } + + ~variant_storage_impl() + { + } + + template<class... A> void emplace( mp11::mp_size_t<0>, A&&... a ) + { + ::new( &first_ ) T1( std::forward<A>(a)... ); + } + + template<std::size_t I, class... A> void emplace( mp11::mp_size_t<I>, A&&... a ) + { + rest_.emplace( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ); + } + + BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<0> ) noexcept { return first_; } + constexpr T1 const& get( mp11::mp_size_t<0> ) const noexcept { return first_; } + + template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<mp11::mp_list<T...>, I-1>& get( mp11::mp_size_t<I> ) noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); } + template<std::size_t I> constexpr mp11::mp_at_c<mp11::mp_list<T...>, I-1> const& get( mp11::mp_size_t<I> ) const noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); } +}; + +// all trivially destructible +template<class T1, class... T> union variant_storage_impl<mp11::mp_true, T1, T...> +{ + T1 first_; + variant_storage<T...> rest_; + + template<class... A> constexpr explicit variant_storage_impl( mp11::mp_size_t<0>, A&&... a ): first_( std::forward<A>(a)... ) + { + } + + template<std::size_t I, class... A> constexpr explicit variant_storage_impl( mp11::mp_size_t<I>, A&&... a ): rest_( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ) + { + } + + template<class... A> void emplace_impl( mp11::mp_false, mp11::mp_size_t<0>, A&&... a ) + { + ::new( &first_ ) T1( std::forward<A>(a)... ); + } + + template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, mp11::mp_size_t<I>, A&&... a ) + { + rest_.emplace( mp11::mp_size_t<I-1>(), std::forward<A>(a)... ); + } + + template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, mp11::mp_size_t<I>, A&&... a ) + { + *this = variant_storage_impl( mp11::mp_size_t<I>(), std::forward<A>(a)... ); + } + + template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( mp11::mp_size_t<I>, A&&... a ) + { + this->emplace_impl( mp11::mp_all<detail::is_trivially_move_assignable<T1>, detail::is_trivially_move_assignable<T>...>(), mp11::mp_size_t<I>(), std::forward<A>(a)... ); + } + + BOOST_CXX14_CONSTEXPR T1& get( mp11::mp_size_t<0> ) noexcept { return first_; } + constexpr T1 const& get( mp11::mp_size_t<0> ) const noexcept { return first_; } + + template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<mp11::mp_list<T...>, I-1>& get( mp11::mp_size_t<I> ) noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); } + template<std::size_t I> constexpr mp11::mp_at_c<mp11::mp_list<T...>, I-1> const& get( mp11::mp_size_t<I> ) const noexcept { return rest_.get( mp11::mp_size_t<I-1>() ); } +}; + +// resolve_overload_* + +template<class... T> struct overload; + +template<> struct overload<> +{ + void operator()() const; +}; + +template<class T1, class... T> struct overload<T1, T...>: overload<T...> +{ + using overload<T...>::operator(); + mp11::mp_identity<T1> operator()(T1) const; +}; + +#if BOOST_WORKAROUND( BOOST_MSVC, < 1930 ) + +template<class U, class... T> using resolve_overload_type_ = decltype( overload<T...>()(std::declval<U>()) ); + +template<class U, class... T> struct resolve_overload_type_impl: mp11::mp_defer< resolve_overload_type_, U, T... > +{ +}; + +template<class U, class... T> using resolve_overload_type = typename resolve_overload_type_impl<U, T...>::type::type; + +#else + +template<class U, class... T> using resolve_overload_type = typename decltype( overload<T...>()(std::declval<U>()) )::type; + +#endif + +template<class U, class... T> using resolve_overload_index = mp11::mp_find<mp11::mp_list<T...>, resolve_overload_type<U, T...>>; + +// variant_base + +template<bool is_trivially_destructible, bool is_single_buffered, class... T> struct variant_base_impl; +template<class... T> using variant_base = variant_base_impl<mp11::mp_all<std::is_trivially_destructible<T>...>::value, mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value, T...>; + +struct none {}; + +// trivially destructible, single buffered +template<class... T> struct variant_base_impl<true, true, T...> +{ + int ix_; + variant_storage<none, T...> st1_; + + constexpr variant_base_impl(): ix_( 0 ), st1_( mp11::mp_size_t<0>() ) + { + } + + template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): ix_( I::value + 1 ), st1_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ) + { + } + + // requires: ix_ == 0 + template<class I, class... A> void _replace( I, A&&... a ) + { + ::new( &st1_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); + ix_ = I::value + 1; + } + + constexpr std::size_t index() const noexcept + { + return ix_ - 1; + } + + template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept + { + size_t const J = I+1; + + assert( ix_ == J ); + + return st1_.get( mp11::mp_size_t<J>() ); + } + + template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept + { + // size_t const J = I+1; + // assert( ix_ == I+1 ); + + return st1_.get( mp11::mp_size_t<I+1>() ); + } + + template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_true, A&&... a ) + { + static_assert( std::is_nothrow_constructible<U, A&&...>::value, "Logic error: U must be nothrow constructible from A&&..." ); + + st1_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); + ix_ = J; + } + + template<std::size_t J, class U, class... A> BOOST_CXX14_CONSTEXPR void emplace_impl( mp11::mp_false, A&&... a ) + { + static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" ); + + U tmp( std::forward<A>(a)... ); + + st1_.emplace( mp11::mp_size_t<J>(), std::move(tmp) ); + ix_ = J; + } + + template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) + { + std::size_t const J = I+1; + using U = mp11::mp_at_c<variant<T...>, I>; + + this->emplace_impl<J, U>( std::is_nothrow_constructible<U, A&&...>(), std::forward<A>(a)... ); + } +}; + +// trivially destructible, double buffered +template<class... T> struct variant_base_impl<true, false, T...> +{ + int ix_; + variant_storage<none, T...> st1_; + variant_storage<none, T...> st2_; + + constexpr variant_base_impl(): ix_( 0 ), st1_( mp11::mp_size_t<0>() ), st2_( mp11::mp_size_t<0>() ) + { + } + + template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): ix_( I::value + 1 ), st1_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ), st2_( mp11::mp_size_t<0>() ) + { + } + + // requires: ix_ == 0 + template<class I, class... A> void _replace( I, A&&... a ) + { + ::new( &st1_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); + ix_ = I::value + 1; + } + + constexpr std::size_t index() const noexcept + { + return ix_ >= 0? ix_ - 1: -ix_ - 1; + } + + template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept + { + size_t const J = I+1; + + assert( ix_ == J || -ix_ == J ); + + constexpr mp11::mp_size_t<J> j{}; + return ix_ >= 0? st1_.get( j ): st2_.get( j ); + } + + template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept + { + // size_t const J = I+1; + // assert( ix_ == J || -ix_ == J ); + // constexpr mp_size_t<J> j{}; + + return ix_ >= 0? st1_.get( mp11::mp_size_t<I+1>() ): st2_.get( mp11::mp_size_t<I+1>() ); + } + + template<std::size_t I, class... A> BOOST_CXX14_CONSTEXPR void emplace( A&&... a ) + { + size_t const J = I+1; + + if( ix_ >= 0 ) + { + st2_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); + ix_ = -static_cast<int>( J ); + } + else + { + st1_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); + ix_ = J; + } + } +}; + +// not trivially destructible, single buffered +template<class... T> struct variant_base_impl<false, true, T...> +{ + int ix_; + variant_storage<none, T...> st1_; + + constexpr variant_base_impl(): ix_( 0 ), st1_( mp11::mp_size_t<0>() ) + { + } + + template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): ix_( I::value + 1 ), st1_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ) + { + } + + // requires: ix_ == 0 + template<class I, class... A> void _replace( I, A&&... a ) + { + ::new( &st1_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); + ix_ = I::value + 1; + } + + //[&]( auto I ){ + // using U = mp_at_c<mp_list<none, T...>, I>; + // st1_.get( I ).~U(); + //} + + struct _destroy_L1 + { + variant_base_impl * this_; + + template<class I> void operator()( I ) const noexcept + { + using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; + this_->st1_.get( I() ).~U(); + } + }; + + void _destroy() noexcept + { + if( ix_ > 0 ) + { + mp11::mp_with_index<1 + sizeof...(T)>( ix_, _destroy_L1{ this } ); + } + } + + ~variant_base_impl() noexcept + { + _destroy(); + } + + constexpr std::size_t index() const noexcept + { + return ix_ - 1; + } + + template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept + { + size_t const J = I+1; + + assert( ix_ == J ); + + return st1_.get( mp11::mp_size_t<J>() ); + } + + template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept + { + // size_t const J = I+1; + // assert( ix_ == J ); + + return st1_.get( mp11::mp_size_t<I+1>() ); + } + + template<std::size_t I, class... A> void emplace( A&&... a ) + { + size_t const J = I+1; + + using U = mp11::mp_at_c<variant<T...>, I>; + + static_assert( std::is_nothrow_move_constructible<U>::value, "Logic error: U must be nothrow move constructible" ); + + U tmp( std::forward<A>(a)... ); + + _destroy(); + + st1_.emplace( mp11::mp_size_t<J>(), std::move(tmp) ); + ix_ = J; + } +}; + +// not trivially destructible, double buffered +template<class... T> struct variant_base_impl<false, false, T...> +{ + int ix_; + variant_storage<none, T...> st1_; + variant_storage<none, T...> st2_; + + constexpr variant_base_impl(): ix_( 0 ), st1_( mp11::mp_size_t<0>() ), st2_( mp11::mp_size_t<0>() ) + { + } + + template<class I, class... A> constexpr explicit variant_base_impl( I, A&&... a ): ix_( I::value + 1 ), st1_( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ), st2_( mp11::mp_size_t<0>() ) + { + } + + // requires: ix_ == 0 + template<class I, class... A> void _replace( I, A&&... a ) + { + ::new( &st1_ ) variant_storage<none, T...>( mp11::mp_size_t<I::value + 1>(), std::forward<A>(a)... ); + ix_ = I::value + 1; + } + + //[&]( auto I ){ + // using U = mp_at_c<mp_list<none, T...>, I>; + // st1_.get( I ).~U(); + //} + + struct _destroy_L1 + { + variant_base_impl * this_; + + template<class I> void operator()( I ) const noexcept + { + using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; + this_->st1_.get( I() ).~U(); + } + }; + + struct _destroy_L2 + { + variant_base_impl * this_; + + template<class I> void operator()( I ) const noexcept + { + using U = mp11::mp_at<mp11::mp_list<none, T...>, I>; + this_->st2_.get( I() ).~U(); + } + }; + + void _destroy() noexcept + { + if( ix_ > 0 ) + { + mp11::mp_with_index<1 + sizeof...(T)>( ix_, _destroy_L1{ this } ); + } + else if( ix_ < 0 ) + { + mp11::mp_with_index<1 + sizeof...(T)>( -ix_, _destroy_L2{ this } ); + } + } + + ~variant_base_impl() noexcept + { + _destroy(); + } + + constexpr std::size_t index() const noexcept + { + return ix_ >= 0? ix_ - 1: -ix_ - 1; + } + + template<std::size_t I> BOOST_CXX14_CONSTEXPR mp11::mp_at_c<variant<T...>, I>& _get_impl( mp11::mp_size_t<I> ) noexcept + { + size_t const J = I+1; + + assert( ix_ == J || -ix_ == J ); + + constexpr mp11::mp_size_t<J> j{}; + return ix_ >= 0? st1_.get( j ): st2_.get( j ); + } + + template<std::size_t I> constexpr mp11::mp_at_c<variant<T...>, I> const& _get_impl( mp11::mp_size_t<I> ) const noexcept + { + // size_t const J = I+1; + // assert( ix_ == J || -ix_ == J ); + // constexpr mp_size_t<J> j{}; + + return ix_ >= 0? st1_.get( mp11::mp_size_t<I+1>() ): st2_.get( mp11::mp_size_t<I+1>() ); + } + + template<std::size_t I, class... A> void emplace( A&&... a ) + { + size_t const J = I+1; + + if( ix_ >= 0 ) + { + st2_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); + _destroy(); + + ix_ = -static_cast<int>( J ); + } + else + { + st1_.emplace( mp11::mp_size_t<J>(), std::forward<A>(a)... ); + _destroy(); + + ix_ = J; + } + } +}; + +} // namespace detail + +// in_place_type_t + +template<class T> struct in_place_type_t +{ +}; + +#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) + +template<class T> constexpr in_place_type_t<T> in_place_type{}; + +#endif + +namespace detail +{ + +template<class T> struct is_in_place_type: std::false_type {}; +template<class T> struct is_in_place_type<in_place_type_t<T>>: std::true_type {}; + +} // namespace detail + +// in_place_index_t + +template<std::size_t I> struct in_place_index_t +{ +}; + +#if !defined(BOOST_NO_CXX14_VARIABLE_TEMPLATES) + +template<std::size_t I> constexpr in_place_index_t<I> in_place_index{}; + +#endif + +namespace detail +{ + +template<class T> struct is_in_place_index: std::false_type {}; +template<std::size_t I> struct is_in_place_index<in_place_index_t<I>>: std::true_type {}; + +} // namespace detail + +// is_nothrow_swappable + +namespace detail +{ + +namespace det2 +{ + +using std::swap; + +template<class T> using is_swappable_impl = decltype(swap(std::declval<T&>(), std::declval<T&>())); + +#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) + +template<class T> struct is_nothrow_swappable_impl_ +{ + static constexpr bool value = noexcept(swap(std::declval<T&>(), std::declval<T&>())); +}; + +template<class T> using is_nothrow_swappable_impl = mp11::mp_bool< is_nothrow_swappable_impl_<T>::value >; + +#else + +template<class T> using is_nothrow_swappable_impl = typename std::enable_if<noexcept(swap(std::declval<T&>(), std::declval<T&>()))>::type; + +#endif + +} // namespace det2 + +template<class T> struct is_swappable: mp11::mp_valid<det2::is_swappable_impl, T> +{ +}; + +#if BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) + +template<class T> struct is_nothrow_swappable: mp11::mp_eval_if<mp11::mp_not<is_swappable<T>>, mp11::mp_false, det2::is_nothrow_swappable_impl, T> +{ +}; + +#else + +template<class T> struct is_nothrow_swappable: mp11::mp_valid<det2::is_nothrow_swappable_impl, T> +{ +}; + +#endif + +// variant_cc_base + +template<bool CopyConstructible, bool TriviallyCopyConstructible, class... T> struct variant_cc_base_impl; + +template<class... T> using variant_cc_base = variant_cc_base_impl< + mp11::mp_all<std::is_copy_constructible<T>...>::value, + mp11::mp_all<detail::is_trivially_copy_constructible<T>...>::value, + T...>; + +template<class... T> struct variant_cc_base_impl<true, true, T...>: public variant_base<T...> +{ + using variant_base = detail::variant_base<T...>; + using variant_base::variant_base; + + variant_cc_base_impl() = default; + variant_cc_base_impl( variant_cc_base_impl const& ) = default; + variant_cc_base_impl( variant_cc_base_impl && ) = default; + variant_cc_base_impl& operator=( variant_cc_base_impl const& ) = default; + variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; +}; + +template<bool B, class... T> struct variant_cc_base_impl<false, B, T...>: public variant_base<T...> +{ + using variant_base = detail::variant_base<T...>; + using variant_base::variant_base; + + variant_cc_base_impl() = default; + variant_cc_base_impl( variant_cc_base_impl const& ) = delete; + variant_cc_base_impl( variant_cc_base_impl && ) = default; + variant_cc_base_impl& operator=( variant_cc_base_impl const& ) = default; + variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; +}; + +template<class... T> struct variant_cc_base_impl<true, false, T...>: public variant_base<T...> +{ + using variant_base = detail::variant_base<T...>; + using variant_base::variant_base; + +public: + + // constructors + + variant_cc_base_impl() = default; + + // copy constructor + +private: + + struct L1 + { + variant_base * this_; + variant_base const & r; + + template<class I> void operator()( I i ) const + { + this_->_replace( i, r._get_impl( i ) ); + } + }; + +public: + + variant_cc_base_impl( variant_cc_base_impl const& r ) + noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value ) + : variant_base() + { + mp11::mp_with_index<sizeof...(T)>( r.index(), L1{ this, r } ); + } + + // move constructor + + variant_cc_base_impl( variant_cc_base_impl && ) = default; + + // assignment + + variant_cc_base_impl& operator=( variant_cc_base_impl const & ) = default; + variant_cc_base_impl& operator=( variant_cc_base_impl && ) = default; +}; + +// variant_ca_base + +template<bool CopyAssignable, bool TriviallyCopyAssignable, class... T> struct variant_ca_base_impl; + +template<class... T> using variant_ca_base = variant_ca_base_impl< + mp11::mp_all<std::is_copy_constructible<T>..., std::is_copy_assignable<T>...>::value, + mp11::mp_all<std::is_trivially_destructible<T>..., detail::is_trivially_copy_constructible<T>..., detail::is_trivially_copy_assignable<T>...>::value, + T...>; + +template<class... T> struct variant_ca_base_impl<true, true, T...>: public variant_cc_base<T...> +{ + using variant_base = detail::variant_cc_base<T...>; + using variant_base::variant_base; + + variant_ca_base_impl() = default; + variant_ca_base_impl( variant_ca_base_impl const& ) = default; + variant_ca_base_impl( variant_ca_base_impl && ) = default; + variant_ca_base_impl& operator=( variant_ca_base_impl const& ) = default; + variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; +}; + +template<bool B, class... T> struct variant_ca_base_impl<false, B, T...>: public variant_cc_base<T...> +{ + using variant_base = detail::variant_cc_base<T...>; + using variant_base::variant_base; + + variant_ca_base_impl() = default; + variant_ca_base_impl( variant_ca_base_impl const& ) = default; + variant_ca_base_impl( variant_ca_base_impl && ) = default; + variant_ca_base_impl& operator=( variant_ca_base_impl const& ) = delete; + variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; +}; + +template<class... T> struct variant_ca_base_impl<true, false, T...>: public variant_cc_base<T...> +{ + using variant_base = detail::variant_cc_base<T...>; + using variant_base::variant_base; + +public: + + // constructors + + variant_ca_base_impl() = default; + variant_ca_base_impl( variant_ca_base_impl const& ) = default; + variant_ca_base_impl( variant_ca_base_impl && ) = default; + + // copy assignment + +private: + + struct L3 + { + variant_base * this_; + variant_base const & r; + + template<class I> void operator()( I i ) const + { + this_->template emplace<I::value>( r._get_impl( i ) ); + } + }; + +public: + + BOOST_CXX14_CONSTEXPR variant_ca_base_impl& operator=( variant_ca_base_impl const & r ) + noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<T>...>::value ) + { + mp11::mp_with_index<sizeof...(T)>( r.index(), L3{ this, r } ); + return *this; + } + + // move assignment + + variant_ca_base_impl& operator=( variant_ca_base_impl && ) = default; +}; + +// variant_mc_base + +template<bool MoveConstructible, bool TriviallyMoveConstructible, class... T> struct variant_mc_base_impl; + +template<class... T> using variant_mc_base = variant_mc_base_impl< + mp11::mp_all<std::is_move_constructible<T>...>::value, + mp11::mp_all<detail::is_trivially_move_constructible<T>...>::value, + T...>; + +template<class... T> struct variant_mc_base_impl<true, true, T...>: public variant_ca_base<T...> +{ + using variant_base = detail::variant_ca_base<T...>; + using variant_base::variant_base; + + variant_mc_base_impl() = default; + variant_mc_base_impl( variant_mc_base_impl const& ) = default; + variant_mc_base_impl( variant_mc_base_impl && ) = default; + variant_mc_base_impl& operator=( variant_mc_base_impl const& ) = default; + variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; +}; + +template<bool B, class... T> struct variant_mc_base_impl<false, B, T...>: public variant_ca_base<T...> +{ + using variant_base = detail::variant_ca_base<T...>; + using variant_base::variant_base; + + variant_mc_base_impl() = default; + variant_mc_base_impl( variant_mc_base_impl const& ) = default; + variant_mc_base_impl( variant_mc_base_impl && ) = delete; + variant_mc_base_impl& operator=( variant_mc_base_impl const& ) = default; + variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; +}; + +template<class... T> struct variant_mc_base_impl<true, false, T...>: public variant_ca_base<T...> +{ + using variant_base = detail::variant_ca_base<T...>; + using variant_base::variant_base; + +public: + + // constructors + + variant_mc_base_impl() = default; + variant_mc_base_impl( variant_mc_base_impl const& ) = default; + + // move constructor + +private: + + struct L2 + { + variant_base * this_; + variant_base & r; + + template<class I> void operator()( I i ) const + { + this_->_replace( i, std::move( r._get_impl( i ) ) ); + } + }; + +public: + + variant_mc_base_impl( variant_mc_base_impl && r ) + noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value ) + { + mp11::mp_with_index<sizeof...(T)>( r.index(), L2{ this, r } ); + } + + // assignment + + variant_mc_base_impl& operator=( variant_mc_base_impl const & ) = default; + variant_mc_base_impl& operator=( variant_mc_base_impl && ) = default; +}; + +// variant_ma_base + +template<bool MoveAssignable, bool TriviallyMoveAssignable, class... T> struct variant_ma_base_impl; + +template<class... T> using variant_ma_base = variant_ma_base_impl< + mp11::mp_all<std::is_move_constructible<T>..., std::is_move_assignable<T>...>::value, + mp11::mp_all<std::is_trivially_destructible<T>..., detail::is_trivially_move_constructible<T>..., detail::is_trivially_move_assignable<T>...>::value, + T...>; + +template<class... T> struct variant_ma_base_impl<true, true, T...>: public variant_mc_base<T...> +{ + using variant_base = detail::variant_mc_base<T...>; + using variant_base::variant_base; + + variant_ma_base_impl() = default; + variant_ma_base_impl( variant_ma_base_impl const& ) = default; + variant_ma_base_impl( variant_ma_base_impl && ) = default; + variant_ma_base_impl& operator=( variant_ma_base_impl const& ) = default; + variant_ma_base_impl& operator=( variant_ma_base_impl && ) = default; +}; + +template<bool B, class... T> struct variant_ma_base_impl<false, B, T...>: public variant_mc_base<T...> +{ + using variant_base = detail::variant_mc_base<T...>; + using variant_base::variant_base; + + variant_ma_base_impl() = default; + variant_ma_base_impl( variant_ma_base_impl const& ) = default; + variant_ma_base_impl( variant_ma_base_impl && ) = default; + variant_ma_base_impl& operator=( variant_ma_base_impl const& ) = default; + variant_ma_base_impl& operator=( variant_ma_base_impl && ) = delete; +}; + +template<class... T> struct variant_ma_base_impl<true, false, T...>: public variant_mc_base<T...> +{ + using variant_base = detail::variant_mc_base<T...>; + using variant_base::variant_base; + +public: + + // constructors + + variant_ma_base_impl() = default; + variant_ma_base_impl( variant_ma_base_impl const& ) = default; + variant_ma_base_impl( variant_ma_base_impl && ) = default; + + // copy assignment + + variant_ma_base_impl& operator=( variant_ma_base_impl const & ) = default; + + // move assignment + +private: + + struct L4 + { + variant_base * this_; + variant_base & r; + + template<class I> void operator()( I i ) const + { + this_->template emplace<I::value>( std::move( r._get_impl( i ) ) ); + } + }; + +public: + + variant_ma_base_impl& operator=( variant_ma_base_impl && r ) + noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>...>::value ) + { + mp11::mp_with_index<sizeof...(T)>( r.index(), L4{ this, r } ); + return *this; + } +}; + +} // namespace detail + +// variant + +template<class... T> class variant: private detail::variant_ma_base<T...> +{ +private: + + using variant_base = detail::variant_ma_base<T...>; + +public: + + // constructors + + template<class E1 = void, class E2 = mp11::mp_if<std::is_default_constructible< mp11::mp_first<variant<T...>> >, E1>> + constexpr variant() + noexcept( std::is_nothrow_default_constructible< mp11::mp_first<variant<T...>> >::value ) + : variant_base( mp11::mp_size_t<0>() ) + { + } + + // variant( variant const& ) = default; + // variant( variant && ) = default; + + template<class U, + class Ud = typename std::decay<U>::type, + class E1 = typename std::enable_if< !std::is_same<Ud, variant>::value && !detail::is_in_place_index<Ud>::value && !detail::is_in_place_type<Ud>::value >::type, + class V = detail::resolve_overload_type<U&&, T...>, + class E2 = typename std::enable_if<std::is_constructible<V, U&&>::value>::type + > + constexpr variant( U&& u ) + noexcept( std::is_nothrow_constructible<V, U&&>::value ) + : variant_base( detail::resolve_overload_index<U&&, T...>(), std::forward<U>(u) ) + { + } + + template<class U, class... A, class I = mp11::mp_find<variant<T...>, U>, class E = typename std::enable_if<std::is_constructible<U, A&&...>::value>::type> + constexpr explicit variant( in_place_type_t<U>, A&&... a ): variant_base( I(), std::forward<A>(a)... ) + { + } + + template<class U, class V, class... A, class I = mp11::mp_find<variant<T...>, U>, class E = typename std::enable_if<std::is_constructible<U, std::initializer_list<V>&, A&&...>::value>::type> + constexpr explicit variant( in_place_type_t<U>, std::initializer_list<V> il, A&&... a ): variant_base( I(), il, std::forward<A>(a)... ) + { + } + + template<std::size_t I, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, A&&...>::value>::type> + constexpr explicit variant( in_place_index_t<I>, A&&... a ): variant_base( mp11::mp_size_t<I>(), std::forward<A>(a)... ) + { + } + + template<std::size_t I, class V, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, std::initializer_list<V>&, A&&...>::value>::type> + constexpr explicit variant( in_place_index_t<I>, std::initializer_list<V> il, A&&... a ): variant_base( mp11::mp_size_t<I>(), il, std::forward<A>(a)... ) + { + } + + // assignment + + // variant& operator=( variant const& ) = default; + // variant& operator=( variant && ) = default; + + template<class U, + class E1 = typename std::enable_if<!std::is_same<typename std::decay<U>::type, variant>::value>::type, + class V = detail::resolve_overload_type<U, T...>, + class E2 = typename std::enable_if<std::is_assignable<V&, U&&>::value && std::is_constructible<V, U&&>::value>::type + > + BOOST_CXX14_CONSTEXPR variant& operator=( U&& u ) + noexcept( std::is_nothrow_constructible<V, U&&>::value ) + { + std::size_t const I = detail::resolve_overload_index<U, T...>::value; + this->template emplace<I>( std::forward<U>(u) ); + return *this; + } + + // modifiers + + template<class U, class... A, + class E = typename std::enable_if< mp11::mp_count<variant<T...>, U>::value == 1 && std::is_constructible<U, A&&...>::value >::type> + BOOST_CXX14_CONSTEXPR U& emplace( A&&... a ) + { + using I = mp11::mp_find<variant<T...>, U>; + variant_base::template emplace<I::value>( std::forward<A>(a)... ); + return _get_impl( I() ); + } + + template<class U, class V, class... A, + class E = typename std::enable_if< mp11::mp_count<variant<T...>, U>::value == 1 && std::is_constructible<U, std::initializer_list<V>&, A&&...>::value >::type> + BOOST_CXX14_CONSTEXPR U& emplace( std::initializer_list<V> il, A&&... a ) + { + using I = mp11::mp_find<variant<T...>, U>; + variant_base::template emplace<I::value>( il, std::forward<A>(a)... ); + return _get_impl( I() ); + } + + template<std::size_t I, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, A&&...>::value>::type> + BOOST_CXX14_CONSTEXPR variant_alternative_t<I, variant<T...>>& emplace( A&&... a ) + { + variant_base::template emplace<I>( std::forward<A>(a)... ); + return _get_impl( mp11::mp_size_t<I>() ); + } + + template<std::size_t I, class V, class... A, class E = typename std::enable_if<std::is_constructible<mp11::mp_at_c<variant<T...>, I>, std::initializer_list<V>&, A&&...>::value>::type> + BOOST_CXX14_CONSTEXPR variant_alternative_t<I, variant<T...>>& emplace( std::initializer_list<V> il, A&&... a ) + { + variant_base::template emplace<I>( il, std::forward<A>(a)... ); + return _get_impl( mp11::mp_size_t<I>() ); + } + + // value status + + constexpr bool valueless_by_exception() const noexcept + { + return false; + } + + using variant_base::index; + + // swap + +private: + + struct L5 + { + variant * this_; + variant & r; + + template<class I> void operator()( I i ) const + { + using std::swap; + swap( this_->_get_impl( i ), r._get_impl( i ) ); + } + }; + +public: + + void swap( variant& r ) noexcept( mp11::mp_all<std::is_nothrow_move_constructible<T>..., detail::is_nothrow_swappable<T>...>::value ) + { + if( index() == r.index() ) + { + mp11::mp_with_index<sizeof...(T)>( index(), L5{ this, r } ); + } + else + { + variant tmp( std::move(*this) ); + *this = std::move( r ); + r = std::move( tmp ); + } + } + + // private accessors + + using variant_base::_get_impl; + + // converting constructors (extension) + +private: + + template<class... U> struct L6 + { + variant_base * this_; + variant<U...> const & r; + + template<class I> void operator()( I i ) const + { + using J = mp11::mp_find<mp11::mp_list<T...>, mp11::mp_at<mp11::mp_list<U...>, I>>; + this_->_replace( J{}, r._get_impl( i ) ); + } + }; + +public: + + template<class... U, + class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > + variant( variant<U...> const& r ) + noexcept( mp11::mp_all<std::is_nothrow_copy_constructible<U>...>::value ) + { + mp11::mp_with_index<sizeof...(U)>( r.index(), L6<U...>{ this, r } ); + } + +private: + + template<class... U> struct L7 + { + variant_base * this_; + variant<U...> & r; + + template<class I> void operator()( I i ) const + { + using J = mp11::mp_find<mp11::mp_list<T...>, mp11::mp_at<mp11::mp_list<U...>, I>>; + this_->_replace( J{}, std::move( r._get_impl( i ) ) ); + } + }; + +public: + + template<class... U, + class E2 = mp11::mp_if<mp11::mp_all<std::is_move_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > + variant( variant<U...> && r ) + noexcept( mp11::mp_all<std::is_nothrow_move_constructible<U>...>::value ) + { + mp11::mp_with_index<sizeof...(U)>( r.index(), L7<U...>{ this, r } ); + } + + // subset (extension) + +private: + + template<class... U, class V, std::size_t J, class E = typename std::enable_if<J != sizeof...(U)>::type> static constexpr variant<U...> _subset_impl( mp11::mp_size_t<J>, V && v ) + { + return variant<U...>( in_place_index_t<J>(), std::forward<V>(v) ); + } + + template<class... U, class V> static variant<U...> _subset_impl( mp11::mp_size_t<sizeof...(U)>, V && /*v*/ ) + { + detail::throw_bad_variant_access(); + } + +private: + + template<class... U> struct L8 + { + variant * this_; + + template<class I> variant<U...> operator()( I i ) const + { + using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; + return this_->_subset_impl<U...>( J{}, this_->_get_impl( i ) ); + } + }; + +public: + + template<class... U, + class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > + BOOST_CXX14_CONSTEXPR variant<U...> subset() & + { + return mp11::mp_with_index<sizeof...(T)>( index(), L8<U...>{ this } ); + } + +private: + + template<class... U> struct L9 + { + variant const * this_; + + template<class I> variant<U...> operator()( I i ) const + { + using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; + return this_->_subset_impl<U...>( J{}, this_->_get_impl( i ) ); + } + }; + +public: + + template<class... U, + class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > + constexpr variant<U...> subset() const& + { + return mp11::mp_with_index<sizeof...(T)>( index(), L9<U...>{ this } ); + } + +private: + + template<class... U> struct L10 + { + variant * this_; + + template<class I> variant<U...> operator()( I i ) const + { + using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; + return this_->_subset_impl<U...>( J{}, std::move( this_->_get_impl( i ) ) ); + } + }; + +public: + + template<class... U, + class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > + BOOST_CXX14_CONSTEXPR variant<U...> subset() && + { + return mp11::mp_with_index<sizeof...(T)>( index(), L10<U...>{ this } ); + } + +#if !BOOST_WORKAROUND(BOOST_GCC, < 40900) + + // g++ 4.8 doesn't handle const&& particularly well + +private: + + template<class... U> struct L11 + { + variant const * this_; + + template<class I> variant<U...> operator()( I i ) const + { + using J = mp11::mp_find<mp11::mp_list<U...>, mp11::mp_at<mp11::mp_list<T...>, I>>; + return this_->_subset_impl<U...>( J{}, std::move( this_->_get_impl( i ) ) ); + } + }; + +public: + + template<class... U, + class E2 = mp11::mp_if<mp11::mp_all<std::is_copy_constructible<U>..., mp11::mp_contains<mp11::mp_list<T...>, U>...>, void> > + constexpr variant<U...> subset() const&& + { + return mp11::mp_with_index<sizeof...(T)>( index(), L11<U...>{ this } ); + } + +#endif +}; + +// relational operators + +namespace detail +{ + +template<class... T> struct eq_L +{ + variant<T...> const & v; + variant<T...> const & w; + + template<class I> constexpr bool operator()( I i ) const + { + return v._get_impl( i ) == w._get_impl( i ); + } +}; + +} // namespace detail + +template<class... T> constexpr bool operator==( variant<T...> const & v, variant<T...> const & w ) +{ + return v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::eq_L<T...>{ v, w } ); +} + +namespace detail +{ + +template<class... T> struct ne_L +{ + variant<T...> const & v; + variant<T...> const & w; + + template<class I> constexpr bool operator()( I i ) const + { + return v._get_impl( i ) != w._get_impl( i ); + } +}; + +} // namespace detail + +template<class... T> constexpr bool operator!=( variant<T...> const & v, variant<T...> const & w ) +{ + return v.index() != w.index() || mp11::mp_with_index<sizeof...(T)>( v.index(), detail::ne_L<T...>{ v, w } ); +} + +namespace detail +{ + +template<class... T> struct lt_L +{ + variant<T...> const & v; + variant<T...> const & w; + + template<class I> constexpr bool operator()( I i ) const + { + return v._get_impl( i ) < w._get_impl( i ); + } +}; + +} // namespace detail + +template<class... T> constexpr bool operator<( variant<T...> const & v, variant<T...> const & w ) +{ + return v.index() < w.index() || ( v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::lt_L<T...>{ v, w } ) ); +} + +template<class... T> constexpr bool operator>( variant<T...> const & v, variant<T...> const & w ) +{ + return w < v; +} + +namespace detail +{ + +template<class... T> struct le_L +{ + variant<T...> const & v; + variant<T...> const & w; + + template<class I> constexpr bool operator()( I i ) const + { + return v._get_impl( i ) <= w._get_impl( i ); + } +}; + +} // namespace detail + +template<class... T> constexpr bool operator<=( variant<T...> const & v, variant<T...> const & w ) +{ + return v.index() < w.index() || ( v.index() == w.index() && mp11::mp_with_index<sizeof...(T)>( v.index(), detail::le_L<T...>{ v, w } ) ); +} + +template<class... T> constexpr bool operator>=( variant<T...> const & v, variant<T...> const & w ) +{ + return w <= v; +} + +// visitation +namespace detail +{ + +template<class T> using remove_cv_ref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type; + +template<class T, class U> struct copy_cv_ref +{ + using type = T; +}; + +template<class T, class U> struct copy_cv_ref<T, U const> +{ + using type = T const; +}; + +template<class T, class U> struct copy_cv_ref<T, U volatile> +{ + using type = T volatile; +}; + +template<class T, class U> struct copy_cv_ref<T, U const volatile> +{ + using type = T const volatile; +}; + +template<class T, class U> struct copy_cv_ref<T, U&> +{ + using type = typename copy_cv_ref<T, U>::type&; +}; + +template<class T, class U> struct copy_cv_ref<T, U&&> +{ + using type = typename copy_cv_ref<T, U>::type&&; +}; + +template<class T, class U> using copy_cv_ref_t = typename copy_cv_ref<T, U>::type; + +template<class F> struct Qret +{ + template<class... T> using fn = decltype( std::declval<F>()( std::declval<T>()... ) ); +}; + +template<class L> using front_if_same = mp11::mp_if<mp11::mp_apply<mp11::mp_same, L>, mp11::mp_front<L>>; + +template<class V> using apply_cv_ref = mp11::mp_product<copy_cv_ref_t, remove_cv_ref_t<V>, mp11::mp_list<V>>; + +template<class F, class... V> using Vret = front_if_same<mp11::mp_product_q<Qret<F>, apply_cv_ref<V>...>>; + +} // namespace detail + +template<class F> constexpr auto visit( F&& f ) -> decltype(std::forward<F>(f)()) +{ + return std::forward<F>(f)(); +} + +namespace detail +{ + +template<class F, class V1> struct visit_L1 +{ + F&& f; + V1&& v1; + + template<class I> auto operator()( I ) const -> Vret<F, V1> + { + return std::forward<F>(f)( unsafe_get<I::value>( std::forward<V1>(v1) ) ); + } +}; + +} // namespace detail + +template<class F, class V1> constexpr auto visit( F&& f, V1&& v1 ) -> detail::Vret<F, V1> +{ + return mp11::mp_with_index<variant_size<V1>>( v1.index(), detail::visit_L1<F, V1>{ std::forward<F>(f), std::forward<V1>(v1) } ); +} + +#if defined(BOOST_NO_CXX14_GENERIC_LAMBDAS) || BOOST_WORKAROUND( BOOST_MSVC, < 1920 ) + +namespace detail +{ + +template<class F, class A> struct bind_front_ +{ + F&& f; + A&& a; + + template<class... T> auto operator()( T&&... t ) -> decltype( std::forward<F>(f)( std::forward<A>(a), std::forward<T>(t)... ) ) + { + return std::forward<F>(f)( std::forward<A>(a), std::forward<T>(t)... ); + } +}; + +template<class F, class A> bind_front_<F, A> bind_front( F&& f, A&& a ) +{ + return bind_front_<F, A>{ std::forward<F>(f), std::forward<A>(a) }; +} + +template<class F, class V1, class V2> struct visit_L2 +{ + F&& f; + + V1&& v1; + V2&& v2; + + template<class I> auto operator()( I ) const -> Vret<F, V1, V2> + { + auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); + return visit( f2, std::forward<V2>(v2) ); + } +}; + +} // namespace detail + +template<class F, class V1, class V2> constexpr auto visit( F&& f, V1&& v1, V2&& v2 ) -> detail::Vret<F, V1, V2> +{ + return mp11::mp_with_index<variant_size<V1>>( v1.index(), detail::visit_L2<F, V1, V2>{ std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2) } ); +} + +namespace detail +{ + +template<class F, class V1, class V2, class V3> struct visit_L3 +{ + F&& f; + + V1&& v1; + V2&& v2; + V3&& v3; + + template<class I> auto operator()( I ) const -> Vret<F, V1, V2, V3> + { + auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); + return visit( f2, std::forward<V2>(v2), std::forward<V3>(v3) ); + } +}; + +} // namespace detail + +template<class F, class V1, class V2, class V3> constexpr auto visit( F&& f, V1&& v1, V2&& v2, V3&& v3 ) -> detail::Vret<F, V1, V2, V3> +{ + return mp11::mp_with_index<variant_size<V1>>( v1.index(), detail::visit_L3<F, V1, V2, V3>{ std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2), std::forward<V3>(v3) } ); +} + +namespace detail +{ + +template<class F, class V1, class V2, class V3, class V4> struct visit_L4 +{ + F&& f; + + V1&& v1; + V2&& v2; + V3&& v3; + V4&& v4; + + template<class I> auto operator()( I ) const -> Vret<F, V1, V2, V3, V4> + { + auto f2 = bind_front( std::forward<F>(f), unsafe_get<I::value>( std::forward<V1>(v1) ) ); + return visit( f2, std::forward<V2>(v2), std::forward<V3>(v3), std::forward<V4>(v4) ); + } +}; + +} // namespace detail + +template<class F, class V1, class V2, class V3, class V4> constexpr auto visit( F&& f, V1&& v1, V2&& v2, V3&& v3, V4&& v4 ) -> detail::Vret<F, V1, V2, V3, V4> +{ + return mp11::mp_with_index<variant_size<V1>>( v1.index(), detail::visit_L4<F, V1, V2, V3, V4>{ std::forward<F>(f), std::forward<V1>(v1), std::forward<V2>(v2), std::forward<V3>(v3), std::forward<V4>(v4) } ); +} + +#else + +template<class F, class V1, class V2, class... V> constexpr auto visit( F&& f, V1&& v1, V2&& v2, V&&... v ) -> detail::Vret<F, V1, V2, V...> +{ + return mp11::mp_with_index<variant_size<V1>>( v1.index(), [&]( auto I ){ + + auto f2 = [&]( auto&&... a ){ return std::forward<F>(f)( detail::unsafe_get<I.value>( std::forward<V1>(v1) ), std::forward<decltype(a)>(a)... ); }; + return visit( f2, std::forward<V2>(v2), std::forward<V>(v)... ); + + }); +} + +#endif + +// specialized algorithms +template<class... T, + class E = typename std::enable_if<mp11::mp_all<std::is_move_constructible<T>..., detail::is_swappable<T>...>::value>::type> +void swap( variant<T...> & v, variant<T...> & w ) + noexcept( noexcept(v.swap(w)) ) +{ + v.swap( w ); +} + +// hashing support + +namespace detail +{ + +template<class V> struct hash_value_L +{ + V const & v; + + template<class I> std::size_t operator()( I ) const + { + boost::ulong_long_type hv = ( boost::ulong_long_type( 0xCBF29CE4 ) << 32 ) + 0x84222325; + boost::ulong_long_type const prime = ( boost::ulong_long_type( 0x00000100 ) << 32 ) + 0x000001B3; + + // index + + hv ^= I::value; + hv *= prime; + + // value + + auto const & t = unsafe_get<I::value>( v ); + + hv ^= std::hash<remove_cv_ref_t<decltype(t)>>()( t ); + hv *= prime; + + return static_cast<std::size_t>( hv ); + } +}; + +} // namespace detail + +inline std::size_t hash_value( monostate const & ) +{ + return 0xA7EE4757u; +} + +template<class... T> std::size_t hash_value( variant<T...> const & v ) +{ + return mp11::mp_with_index<sizeof...(T)>( v.index(), detail::hash_value_L< variant<T...> >{ v } ); +} + +namespace detail +{ + +template<class T> using is_hash_enabled = std::is_default_constructible< std::hash<typename std::remove_const<T>::type> >; + +template<class V, bool E = mp11::mp_all_of<V, is_hash_enabled>::value> struct std_hash_impl; + +template<class V> struct std_hash_impl<V, false> +{ + std_hash_impl() = delete; + std_hash_impl( std_hash_impl const& ) = delete; + std_hash_impl& operator=( std_hash_impl const& ) = delete; +}; + +template<class V> struct std_hash_impl<V, true> +{ + std::size_t operator()( V const & v ) const + { + return hash_value( v ); + } +}; + +} // namespace detail + +} // namespace variant2 +} // namespace boost + +namespace std +{ + +template<class... T> struct hash< ::boost::variant2::variant<T...> >: public ::boost::variant2::detail::std_hash_impl< ::boost::variant2::variant<T...> > +{ +}; + +template<> struct hash< ::boost::variant2::monostate > +{ + std::size_t operator()( ::boost::variant2::monostate const & v ) const + { + return hash_value( v ); + } +}; + +} // namespace std + +#if defined(_MSC_VER) && _MSC_VER < 1910 +# pragma warning( pop ) +#endif + +#endif // #ifndef BOOST_VARIANT2_VARIANT_HPP_INCLUDED diff --git a/ThirdParty/boost/version.hpp b/ThirdParty/boost/version.hpp index 98ce61a15e6761b7fbb5e011e6d9f46bb235f1eb..ce7aa4d6f0cb80ca88ae4ab0b27ce098fd3f2d48 100644 --- a/ThirdParty/boost/version.hpp +++ b/ThirdParty/boost/version.hpp @@ -19,7 +19,7 @@ // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 107000 +#define BOOST_VERSION 107300 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION @@ -27,6 +27,6 @@ // number, y is the minor version number, and z is the patch level if not 0. // This is used by <config/auto_link.hpp> to select which library version to link to. -#define BOOST_LIB_VERSION "1_70" +#define BOOST_LIB_VERSION "1_73" #endif diff --git a/ThirdParty/boost/winapi/basic_types.hpp b/ThirdParty/boost/winapi/basic_types.hpp index 1168054cd9215c90be8767fc290319059dbcabf4..4a0ca3cb63cfcfabc73201b377efed328aa46464 100644 --- a/ThirdParty/boost/winapi/basic_types.hpp +++ b/ThirdParty/boost/winapi/basic_types.hpp @@ -18,7 +18,6 @@ #if defined(BOOST_USE_WINDOWS_H) # include <windows.h> #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# include <winerror.h> # ifdef UNDER_CE # ifndef WINAPI # ifndef _WIN32_WCE_EMULATION