From 28b0c2a425b2a8dbd27e001020c168d241da5d2d Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 10 Jun 2017 18:26:21 -0700 Subject: [PATCH 1/4] Have build script take boost path as a parameter instead of env var --- build.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.cmd b/build.cmd index 62513a5..71b9c1a 100644 --- a/build.cmd +++ b/build.cmd @@ -4,9 +4,9 @@ bcp ^ boost/container/static_vector.hpp ^ boost/crc.hpp ^ boost/icl/interval_map.hpp ^ + boost/optional.hpp ^ boost/range/algorithm/ ^ boost/range/algorithm_ext/ ^ boost/smart_ptr/intrusive_ptr.hpp ^ - boost/optional.hpp ^ boost/variant/ ^ - --boost="%BOOST_PATH%" . + --boost="%1" . From 46a3f6dccf36d4b52d51dfd0be619dcd2727cc5a Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 10 Jun 2017 18:53:22 -0700 Subject: [PATCH 2/4] Add instructions on how to update the repo to the readme --- Readme.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Readme.md b/Readme.md index 1714124..1f27bc1 100644 --- a/Readme.md +++ b/Readme.md @@ -2,3 +2,22 @@ Boost libraries - trimmed down for Citra ======================================== This is a subset of Boost v1.63.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script. + +Updating this repo (on Windows) +=============================== + +To update the Boost version (or to add a new library) follow these steps: + + - Download Boost and extract the package, then launch Powershell and `cd` to the `boost_1_xx_0` directory. + - Build the `bcp` tool: + ``` + .\boostrap.bat + .\b2 tools\bcp + ``` + + - Store the boost directory in a variable for later use: `$boost_dir = $pwd`. + - Add bcp to your path: `$env:Path += $boost_dir\bin.v2\tools\bcp\msvc-14.1\release\link-static\threading-multi` (The correct output path should be printed by b2 during the build.) + - `cd` to this repo's directory (`...\externals\boost\`) + - Remove the existing boost from the repo: `rm -r boost` (This is only necessary if doing a Boost version upgrade, in case they removed any files in the new version.) + - Run `.\build.cmd $boost_dir` to build a new trimmed down distro. + - Add/remove all files in git and commit. From 155d20ab3c967aea5aeb7f6cbc2dc244ef7a705f Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 10 Jun 2017 18:27:31 -0700 Subject: [PATCH 3/4] Update to boost v1.64.0 --- Readme.md | 2 +- boost/config/auto_link.hpp | 11 +- boost/config/compiler/borland.hpp | 1 + boost/config/compiler/clang.hpp | 6 +- boost/config/compiler/codegear.hpp | 1 + boost/config/compiler/common_edg.hpp | 1 + boost/config/compiler/cray.hpp | 1 + boost/config/compiler/digitalmars.hpp | 1 + boost/config/compiler/gcc.hpp | 1 + boost/config/compiler/gcc_xml.hpp | 1 + boost/config/compiler/hp_acc.hpp | 1 + boost/config/compiler/intel.hpp | 25 +- boost/config/compiler/metrowerks.hpp | 1 + boost/config/compiler/mpw.hpp | 1 + boost/config/compiler/pathscale.hpp | 1 + boost/config/compiler/pgi.hpp | 1 + boost/config/compiler/sunpro_cc.hpp | 1 + boost/config/compiler/vacpp.hpp | 1 + boost/config/compiler/visualc.hpp | 29 +- boost/config/platform/cygwin.hpp | 3 +- boost/config/stdlib/dinkumware.hpp | 30 ++ boost/config/stdlib/libstdcpp3.hpp | 8 +- boost/config/suffix.hpp | 21 +- boost/container/allocator_traits.hpp | 54 +-- .../container/detail/advanced_insert_int.hpp | 4 +- boost/container/detail/workaround.hpp | 4 + boost/container/new_allocator.hpp | 6 +- boost/container/node_handle.hpp | 5 +- boost/container/vector.hpp | 10 +- boost/core/addressof.hpp | 345 ++++++++++++------ boost/core/demangle.hpp | 13 +- boost/detail/workaround.hpp | 5 + boost/intrusive/bstree.hpp | 2 +- boost/intrusive/bstree_algorithms.hpp | 3 + boost/intrusive/detail/key_nodeptr_comp.hpp | 14 +- boost/intrusive/slist.hpp | 2 +- boost/move/default_delete.hpp | 18 +- boost/move/detail/unique_ptr_meta_utils.hpp | 2 +- boost/preprocessor/cat.hpp | 2 +- boost/preprocessor/config/config.hpp | 10 +- boost/smart_ptr/detail/sp_noexcept.hpp | 30 ++ boost/smart_ptr/intrusive_ptr.hpp | 7 +- boost/type_index/stl_type_index.hpp | 4 +- boost/type_traits.hpp | 1 + .../detail/common_arithmetic_type.hpp | 6 +- boost/type_traits/is_rvalue_reference.hpp | 2 +- boost/type_traits/make_void.hpp | 52 +++ boost/utility.hpp | 4 +- boost/variant/polymorphic_get.hpp | 14 +- boost/variant/recursive_wrapper_fwd.hpp | 6 +- boost/variant/variant.hpp | 36 +- boost/variant/variant_fwd.hpp | 2 +- boost/version.hpp | 4 +- 53 files changed, 573 insertions(+), 243 deletions(-) create mode 100644 boost/smart_ptr/detail/sp_noexcept.hpp create mode 100644 boost/type_traits/make_void.hpp diff --git a/Readme.md b/Readme.md index 1f27bc1..10f2f6a 100644 --- a/Readme.md +++ b/Readme.md @@ -1,7 +1,7 @@ Boost libraries - trimmed down for Citra ======================================== -This is a subset of Boost v1.63.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script. +This is a subset of Boost v1.64.0 generated using the bcp tool. To get a list of boost modules guaranteed to exist, check the build script. Updating this repo (on Windows) =============================== diff --git a/boost/config/auto_link.hpp b/boost/config/auto_link.hpp index 56a16b0..c71e803 100644 --- a/boost/config/auto_link.hpp +++ b/boost/config/auto_link.hpp @@ -161,10 +161,15 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // vc12: # define BOOST_LIB_TOOLSET "vc120" -# elif defined(BOOST_MSVC) +# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1910) - // vc14: -# define BOOST_LIB_TOOLSET "vc140" + // vc14: +# define BOOST_LIB_TOOLSET "vc140" + +# elif defined(BOOST_MSVC) + + // vc14.1: +# define BOOST_LIB_TOOLSET "vc141" # elif defined(__BORLANDC__) diff --git a/boost/config/compiler/borland.hpp b/boost/config/compiler/borland.hpp index ccd930e..b749496 100644 --- a/boost/config/compiler/borland.hpp +++ b/boost/config/compiler/borland.hpp @@ -185,6 +185,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported #define BOOST_NO_CXX11_VARIADIC_TEMPLATES diff --git a/boost/config/compiler/clang.hpp b/boost/config/compiler/clang.hpp index 150e3c0..175229c 100644 --- a/boost/config/compiler/clang.hpp +++ b/boost/config/compiler/clang.hpp @@ -57,7 +57,7 @@ #define BOOST_HAS_NRVO // Branch prediction hints -#if defined(__has_builtin) +#if !defined (__c2__) && defined(__has_builtin) #if __has_builtin(__builtin_expect) #define BOOST_LIKELY(x) __builtin_expect(x, 1) #define BOOST_UNLIKELY(x) __builtin_expect(x, 0) @@ -282,6 +282,10 @@ # define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif +#if __cplusplus < 201103L +#define BOOST_NO_CXX11_SFINAE_EXPR +#endif + #if __cplusplus < 201400 // All versions with __cplusplus above this value seem to support this: # define BOOST_NO_CXX14_DIGIT_SEPARATORS diff --git a/boost/config/compiler/codegear.hpp b/boost/config/compiler/codegear.hpp index e2f6061..3c5262f 100644 --- a/boost/config/compiler/codegear.hpp +++ b/boost/config/compiler/codegear.hpp @@ -112,6 +112,7 @@ #define BOOST_NO_CXX11_RAW_LITERALS #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS #define BOOST_NO_CXX11_VARIADIC_TEMPLATES diff --git a/boost/config/compiler/common_edg.hpp b/boost/config/compiler/common_edg.hpp index c09faeb..eab9378 100644 --- a/boost/config/compiler/common_edg.hpp +++ b/boost/config/compiler/common_edg.hpp @@ -95,6 +95,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS diff --git a/boost/config/compiler/cray.hpp b/boost/config/compiler/cray.hpp index 837f815..eab5287 100644 --- a/boost/config/compiler/cray.hpp +++ b/boost/config/compiler/cray.hpp @@ -39,6 +39,7 @@ #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_RANGE_BASED_FOR diff --git a/boost/config/compiler/digitalmars.hpp b/boost/config/compiler/digitalmars.hpp index c344aae..e371a68 100644 --- a/boost/config/compiler/digitalmars.hpp +++ b/boost/config/compiler/digitalmars.hpp @@ -71,6 +71,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS diff --git a/boost/config/compiler/gcc.hpp b/boost/config/compiler/gcc.hpp index e319d04..c82cbc7 100644 --- a/boost/config/compiler/gcc.hpp +++ b/boost/config/compiler/gcc.hpp @@ -253,6 +253,7 @@ #if (BOOST_GCC_VERSION < 40800) || !defined(BOOST_GCC_CXX11) # define BOOST_NO_CXX11_ALIGNAS # define BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_SFINAE_EXPR #endif // C++0x features in 4.8.1 and later diff --git a/boost/config/compiler/gcc_xml.hpp b/boost/config/compiler/gcc_xml.hpp index b56c786..63b08ac 100644 --- a/boost/config/compiler/gcc_xml.hpp +++ b/boost/config/compiler/gcc_xml.hpp @@ -46,6 +46,7 @@ # define BOOST_NO_CXX11_HDR_INITIALIZER_LIST # define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_SFINAE_EXPR +# define BOOST_NO_CXX11_SFINAE_EXPR # define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS # define BOOST_NO_CXX11_LAMBDAS # define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS diff --git a/boost/config/compiler/hp_acc.hpp b/boost/config/compiler/hp_acc.hpp index a773b8c..9df18ea 100644 --- a/boost/config/compiler/hp_acc.hpp +++ b/boost/config/compiler/hp_acc.hpp @@ -114,6 +114,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS diff --git a/boost/config/compiler/intel.hpp b/boost/config/compiler/intel.hpp index 1885ea2..f55189a 100644 --- a/boost/config/compiler/intel.hpp +++ b/boost/config/compiler/intel.hpp @@ -39,15 +39,20 @@ # define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif -#else +#else // defined(_MSC_VER) #include #undef BOOST_GCC_VERSION #undef BOOST_GCC_CXX11 +// Broken in all versions up to 17 (newer versions not tested) +#if (__INTEL_COMPILER <= 1700) && !defined(BOOST_NO_CXX14_CONSTEXPR) +# define BOOST_NO_CXX14_CONSTEXPR #endif +#endif // defined(_MSC_VER) + #undef BOOST_COMPILER #if defined(__INTEL_COMPILER) @@ -92,7 +97,7 @@ # define BOOST_INTEL_LINUX BOOST_INTEL #endif -#else +#else // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) && (defined(_MSC_VER) || defined(__GNUC__)) #include @@ -410,6 +415,11 @@ template<> struct assert_intrinsic_wchar_t {}; # undef BOOST_NO_SFINAE_EXPR #endif +// BOOST_NO_CXX11_SFINAE_EXPR +#if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40800)) && !defined(_MSC_VER) +# undef BOOST_NO_CXX11_SFINAE_EXPR +#endif + // BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS #if (BOOST_INTEL_CXX_VERSION >= 1500) && (!defined(BOOST_INTEL_GCC_VERSION) || (BOOST_INTEL_GCC_VERSION >= 40500)) && (!defined(_MSC_VER) || (_MSC_FULL_VER >= 180020827)) // This is available in earlier Intel releases, but breaks Multiprecision: @@ -483,7 +493,7 @@ template<> struct assert_intrinsic_wchar_t {}; # undef BOOST_NO_CXX11_FINAL #endif -#endif +#endif // defined(BOOST_INTEL_STDCXX0X) // // Broken in all versions up to 15: @@ -500,11 +510,6 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_NO_CXX11_HDR_TUPLE #endif -// Broken in all versions up to 17: -#if !defined(BOOST_NO_CXX14_CONSTEXPR) -#define BOOST_NO_CXX14_CONSTEXPR -#endif - #if (BOOST_INTEL_CXX_VERSION < 1200) // // fenv.h appears not to work with Intel prior to 12.0: @@ -535,10 +540,10 @@ template<> struct assert_intrinsic_wchar_t {}; # define BOOST_HAS_INT128 #endif -#endif +#endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500) && (defined(_MSC_VER) || defined(__GNUC__)) // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 1500) +#if (BOOST_INTEL_CXX_VERSION > 1700) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) diff --git a/boost/config/compiler/metrowerks.hpp b/boost/config/compiler/metrowerks.hpp index 3c5e228..8d42563 100644 --- a/boost/config/compiler/metrowerks.hpp +++ b/boost/config/compiler/metrowerks.hpp @@ -113,6 +113,7 @@ #define BOOST_NO_CXX11_RAW_LITERALS #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS diff --git a/boost/config/compiler/mpw.hpp b/boost/config/compiler/mpw.hpp index 084f9e1..1b8d39e 100644 --- a/boost/config/compiler/mpw.hpp +++ b/boost/config/compiler/mpw.hpp @@ -62,6 +62,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_UNICODE_LITERALS diff --git a/boost/config/compiler/pathscale.hpp b/boost/config/compiler/pathscale.hpp index a5e65af..016ad5a 100644 --- a/boost/config/compiler/pathscale.hpp +++ b/boost/config/compiler/pathscale.hpp @@ -37,6 +37,7 @@ # define BOOST_NO_CXX11_TEMPLATE_ALIASES # define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_SFINAE_EXPR +# define BOOST_NO_CXX11_SFINAE_EXPR # define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_CXX11_RVALUE_REFERENCES # define BOOST_NO_CXX11_RANGE_BASED_FOR diff --git a/boost/config/compiler/pgi.hpp b/boost/config/compiler/pgi.hpp index fa2d5e4..af70051 100644 --- a/boost/config/compiler/pgi.hpp +++ b/boost/config/compiler/pgi.hpp @@ -88,6 +88,7 @@ #define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_NO_SWPRINTF #define BOOST_NO_CXX11_TEMPLATE_ALIASES diff --git a/boost/config/compiler/sunpro_cc.hpp b/boost/config/compiler/sunpro_cc.hpp index ac259fc..cdd30b1 100644 --- a/boost/config/compiler/sunpro_cc.hpp +++ b/boost/config/compiler/sunpro_cc.hpp @@ -141,6 +141,7 @@ // # define BOOST_HAS_LONG_LONG +#define BOOST_NO_CXX11_SFINAE_EXPR // C++ 14: #if !defined(__cpp_aggregate_nsdmi) || (__cpp_aggregate_nsdmi < 201304) diff --git a/boost/config/compiler/vacpp.hpp b/boost/config/compiler/vacpp.hpp index 3fbed9f..b75a1bd 100644 --- a/boost/config/compiler/vacpp.hpp +++ b/boost/config/compiler/vacpp.hpp @@ -114,6 +114,7 @@ # define BOOST_NO_CXX11_SCOPED_ENUMS #endif #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SFINAE_EXPR #define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if ! __IBMCPP_STATIC_ASSERT # define BOOST_NO_CXX11_STATIC_ASSERT diff --git a/boost/config/compiler/visualc.hpp b/boost/config/compiler/visualc.hpp index cdbc9b6..760e283 100644 --- a/boost/config/compiler/visualc.hpp +++ b/boost/config/compiler/visualc.hpp @@ -190,7 +190,7 @@ # define BOOST_NO_CXX11_CONSTEXPR #endif -// C++14 features supported by VC++ 15 Preview 5 +// C++14 features supported by VC++ 14.1 (Visual Studio 2017) // #if (_MSC_VER < 1910) # define BOOST_NO_CXX14_AGGREGATE_NSDMI @@ -217,6 +217,27 @@ // C++ 11: // #define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_SFINAE_EXPR + +// +// Things that don't work in clr mode: +// +#ifdef _M_CEE +#ifndef BOOST_NO_CXX11_THREAD_LOCAL +# define BOOST_NO_CXX11_THREAD_LOCAL +#endif +#ifndef BOOST_NO_SFINAE_EXPR +# define BOOST_NO_SFINAE_EXPR +#endif +#ifndef BOOST_NO_CXX11_REF_QUALIFIERS +# define BOOST_NO_CXX11_REF_QUALIFIERS +#endif +#endif +#ifdef _M_CEE_PURE +#ifndef BOOST_NO_CXX11_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR +#endif +#endif // // prefix and suffix headers: @@ -282,8 +303,10 @@ # define BOOST_COMPILER_VERSION 11.0 # elif _MSC_VER < 1900 # define BOOST_COMPILER_VERSION 12.0 -# elif _MSC_VER < 2000 +# elif _MSC_VER < 1910 # define BOOST_COMPILER_VERSION 14.0 +# elif _MSC_VER < 1920 +# define BOOST_COMPILER_VERSION 14.1 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif @@ -293,7 +316,7 @@ #endif // -// last known and checked version is 19.10.24629 (VC++ 2017 RC): +// last known and checked version is 19.10.25017 (VC++ 2017): #if (_MSC_VER > 1910) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" diff --git a/boost/config/platform/cygwin.hpp b/boost/config/platform/cygwin.hpp index b7ef572..53e23f7 100644 --- a/boost/config/platform/cygwin.hpp +++ b/boost/config/platform/cygwin.hpp @@ -23,7 +23,7 @@ # define BOOST_HAS_SCHED_YIELD # define BOOST_HAS_GETTIMEOFDAY # define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE -# define BOOST_HAS_SIGACTION +//# define BOOST_HAS_SIGACTION #else # if !defined(BOOST_HAS_WINTHREADS) # define BOOST_HAS_WINTHREADS @@ -51,7 +51,6 @@ #ifdef BOOST_HAS_NL_TYPES_H # undef BOOST_HAS_NL_TYPES_H #endif - diff --git a/boost/config/stdlib/dinkumware.hpp b/boost/config/stdlib/dinkumware.hpp index 8cf5d4d..3b95dcf 100644 --- a/boost/config/stdlib/dinkumware.hpp +++ b/boost/config/stdlib/dinkumware.hpp @@ -196,6 +196,36 @@ # endif #endif + +// +// Things not supported by the CLR: +#ifdef _M_CEE +#ifndef BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_MUTEX +#endif +#ifndef BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_HDR_ATOMIC +#endif +#ifndef BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_FUTURE +#endif +#ifndef BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#endif +#ifndef BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_THREAD +#endif +#ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX +# define BOOST_NO_CXX14_HDR_SHARED_MUTEX +#endif +#ifndef BOOST_NO_CXX14_STD_EXCHANGE +# define BOOST_NO_CXX14_STD_EXCHANGE +#endif +#ifndef BOOST_NO_FENV_H +# define BOOST_NO_FENV_H +#endif +#endif + #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER #else diff --git a/boost/config/stdlib/libstdcpp3.hpp b/boost/config/stdlib/libstdcpp3.hpp index 557767b..205489a 100644 --- a/boost/config/stdlib/libstdcpp3.hpp +++ b/boost/config/stdlib/libstdcpp3.hpp @@ -101,8 +101,8 @@ // // Decide which version of libstdc++ we have, normally -// stdlibc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly -// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the stdlibc++ +// libstdc++ C++0x support is detected via __GNUC__, __GNUC_MINOR__, and possibly +// __GNUC_PATCHLEVEL__ at the suggestion of Jonathan Wakely, one of the libstdc++ // developers. He also commented: // // "I'm not sure how useful __GLIBCXX__ is for your purposes, for instance in @@ -110,7 +110,7 @@ // Although 4.3.0 was released earlier than 4.2.4, it has better C++0x support // than any release in the 4.2 series." // -// Another resource for understanding stdlibc++ features is: +// Another resource for understanding libstdc++ features is: // http://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#manual.intro.status.standard.200x // // However, using the GCC version number fails when the compiler is clang since this @@ -222,7 +222,7 @@ // #if (BOOST_LIBSTDCXX_VERSION < 40700) || !defined(BOOST_LIBSTDCXX11) // Note that although existed prior to 4.7, "steady_clock" is spelled "monotonic_clock" -// so 4.7.0 is the first truely conforming one. +// so 4.7.0 is the first truly conforming one. # define BOOST_NO_CXX11_HDR_CHRONO # define BOOST_NO_CXX11_ALLOCATOR #endif diff --git a/boost/config/suffix.hpp b/boost/config/suffix.hpp index eeaec2b..6df9223 100644 --- a/boost/config/suffix.hpp +++ b/boost/config/suffix.hpp @@ -583,6 +583,25 @@ namespace std{ using ::type_info; } # define BOOST_GPU_ENABLED # endif +// BOOST_RESTRICT ---------------------------------------------// +// Macro to use in place of 'restrict' keyword variants +#if !defined(BOOST_RESTRICT) +# if defined(_MSC_VER) +# define BOOST_RESTRICT __restrict +# if !defined(BOOST_NO_RESTRICT_REFERENCES) && (_MSC_FULL_VER < 190023026) +# define BOOST_NO_RESTRICT_REFERENCES +# endif +# elif defined(__GNUC__) && __GNUC__ > 3 + // Clang also defines __GNUC__ (as 4) +# define BOOST_RESTRICT __restrict__ +# else +# define BOOST_RESTRICT +# if !defined(BOOST_NO_RESTRICT_REFERENCES) +# define BOOST_NO_RESTRICT_REFERENCES +# endif +# endif +#endif + // BOOST_FORCEINLINE ---------------------------------------------// // Macro to use in place of 'inline' to force a function to be inline #if !defined(BOOST_FORCEINLINE) @@ -604,7 +623,7 @@ namespace std{ using ::type_info; } # elif defined(__GNUC__) && __GNUC__ > 3 // Clang also defines __GNUC__ (as 4) # if defined(__CUDACC__) - // nvcc doesn't always parse __noinline__, + // nvcc doesn't always parse __noinline__, // see: https://svn.boost.org/trac/boost/ticket/9392 # define BOOST_NOINLINE __attribute__ ((noinline)) # else diff --git a/boost/container/allocator_traits.hpp b/boost/container/allocator_traits.hpp index e6a882e..d6621f6 100644 --- a/boost/container/allocator_traits.hpp +++ b/boost/container/allocator_traits.hpp @@ -289,18 +289,18 @@ struct allocator_traits //! Returns: a.allocate(n) //! - static pointer allocate(Allocator &a, size_type n) + BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n) { return a.allocate(n); } //! Returns: a.deallocate(p, n) //! //! Throws: Nothing - static void deallocate(Allocator &a, pointer p, size_type n) + BOOST_CONTAINER_FORCEINLINE static void deallocate(Allocator &a, pointer p, size_type n) { a.deallocate(p, n); } //! Effects: calls a.allocate(n, p) if that call is well-formed; //! otherwise, invokes a.allocate(n) - static pointer allocate(Allocator &a, size_type n, const_void_pointer p) + BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p) { const bool value = boost::container::container_detail:: has_member_function_callable_with_allocate @@ -312,7 +312,7 @@ struct allocator_traits //! Effects: calls a.destroy(p) if that call is well-formed; //! otherwise, invokes p->~T(). template - static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void destroy(Allocator &a, T*p) BOOST_NOEXCEPT_OR_NOTHROW { typedef T* destroy_pointer; const bool value = boost::container::container_detail:: @@ -324,7 +324,7 @@ struct allocator_traits //! Returns: a.max_size() if that expression is well-formed; otherwise, //! numeric_limits::max(). - static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type max_size(const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { const bool value = allocator_traits_detail::has_max_size::value; container_detail::bool_ flag; @@ -333,7 +333,7 @@ struct allocator_traits //! Returns: a.select_on_container_copy_construction() if that expression is well-formed; //! otherwise, a. - static BOOST_CONTAINER_DOC1ST(Allocator, + BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator, typename container_detail::if_c < allocator_traits_detail::has_select_on_container_copy_construction::value BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type) @@ -349,7 +349,7 @@ struct allocator_traits //! Effects: calls a.construct(p, std::forward(args)...) if that call is well-formed; //! otherwise, invokes ::new (static_cast(p)) T(std::forward(args)...) template - static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) + BOOST_CONTAINER_FORCEINLINE static void construct(Allocator & a, T* p, BOOST_FWD_REF(Args)... args) { static const bool value = ::boost::move_detail::and_ < container_detail::is_not_std_allocator @@ -363,7 +363,7 @@ struct allocator_traits //! Returns: a.storage_is_unpropagable(p) if is_partially_propagable::value is true; otherwise, //! false. - static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW { container_detail::bool_ flag; return allocator_traits::priv_storage_is_unpropagable(flag, a, p); @@ -371,7 +371,7 @@ struct allocator_traits //! Returns: true if is_always_equal::value == true, otherwise, //! a == b. - static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW { container_detail::bool_ flag; return allocator_traits::priv_equal(flag, a, b); @@ -379,46 +379,46 @@ struct allocator_traits #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) private: - static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p) + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p) { return a.allocate(n, p); } - static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer) + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer) { return a.allocate(n); } template - static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW { a.destroy(p); } template - static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW { p->~T(); (void)p; } - static size_type priv_max_size(container_detail::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(container_detail::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a.max_size(); } - static size_type priv_max_size(container_detail::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static size_type priv_max_size(container_detail::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return size_type(-1)/sizeof(value_type); } - static Allocator priv_select_on_container_copy_construction(container_detail::true_type, const Allocator &a) + BOOST_CONTAINER_FORCEINLINE static Allocator priv_select_on_container_copy_construction(container_detail::true_type, const Allocator &a) { return a.select_on_container_copy_construction(); } - static const Allocator &priv_select_on_container_copy_construction(container_detail::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static const Allocator &priv_select_on_container_copy_construction(container_detail::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a; } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) { a.construct( p, ::boost::forward(args)...); } template - static void priv_construct(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) { ::new((void*)p, boost_container_new_t()) T(::boost::forward(args)...); } #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) public: #define BOOST_CONTAINER_ALLOCATOR_TRAITS_CONSTRUCT_IMPL(N) \ template\ - static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE static void construct(Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ static const bool value = ::boost::move_detail::and_ \ < container_detail::is_not_std_allocator \ @@ -438,11 +438,11 @@ struct allocator_traits ///////////////////////////////// #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \ template\ - static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { a.construct( p BOOST_MOVE_I##N BOOST_MOVE_FWD##N ); }\ \ template\ - static void priv_construct(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ { ::new((void*)p, boost_container_new_t()) T(BOOST_MOVE_FWD##N); }\ // BOOST_MOVE_ITERATE_0TO8(BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL) @@ -451,19 +451,19 @@ struct allocator_traits #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - static void priv_construct(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) { ::new((void*)p, boost_container_new_t()) T; } - static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p) + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p) { return a.storage_is_unpropagable(p); } - static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer) + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer) { return false; } - static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &) + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &) { return true; } - static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b) + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b) { return a == b; } #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) diff --git a/boost/container/detail/advanced_insert_int.hpp b/boost/container/detail/advanced_insert_int.hpp index 278cd1b..1050857 100644 --- a/boost/container/detail/advanced_insert_int.hpp +++ b/boost/container/detail/advanced_insert_int.hpp @@ -107,8 +107,8 @@ struct insert_n_copies_proxy void copy_n_and_update(Allocator &, Iterator p, size_type n) const { - for (; 0 < n; --n, ++p){ - *p = v_; + for (; 0 < n; --n, ++p){ + *p = v_; } } diff --git a/boost/container/detail/workaround.hpp b/boost/container/detail/workaround.hpp index ed57718..816d3cc 100644 --- a/boost/container/detail/workaround.hpp +++ b/boost/container/detail/workaround.hpp @@ -49,6 +49,10 @@ #define BOOST_CONTAINER_FALLTHOUGH BOOST_FALLTHOUGH; #endif +#if defined(BOOST_MSVC) && (_MSC_VER < 1400) + #define BOOST_CONTAINER_TEMPLATED_CONVERSION_OPERATOR_BROKEN +#endif + #if !defined(BOOST_NO_CXX11_HDR_TUPLE) || (defined(BOOST_MSVC) && (BOOST_MSVC == 1700 || BOOST_MSVC == 1600)) #define BOOST_CONTAINER_PAIR_TEST_HAS_HEADER_TUPLE #endif diff --git a/boost/container/new_allocator.hpp b/boost/container/new_allocator.hpp index 9304a9c..51065ef 100644 --- a/boost/container/new_allocator.hpp +++ b/boost/container/new_allocator.hpp @@ -140,9 +140,9 @@ 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())) - throw_bad_alloc(); - return static_cast(::operator new(count*sizeof(T))); + if(BOOST_UNLIKELY(count > this->max_size())) + throw_bad_alloc(); + return static_cast(::operator new(count*sizeof(T))); } //!Deallocates previously allocated memory. diff --git a/boost/container/node_handle.hpp b/boost/container/node_handle.hpp index 300b471..c46313c 100644 --- a/boost/container/node_handle.hpp +++ b/boost/container/node_handle.hpp @@ -131,6 +131,9 @@ class node_handle nallocator_type &node_alloc() { return *static_cast(m_nalloc_storage.address()); } + const nallocator_type &node_alloc() const + { return *static_cast(m_nalloc_storage.address()); } + node_pointer release() { node_pointer p(m_ptr); @@ -323,7 +326,7 @@ class node_handle if(was_nh_non_null){ if(was_this_non_null){ - if(ator_traits::propagate_on_container_swap){ + if(ator_traits::propagate_on_container_swap::value){ ::boost::adl_move_swap(this->node_alloc(), nh.node_alloc()); } } diff --git a/boost/container/vector.hpp b/boost/container/vector.hpp index 5d7d765..336d616 100644 --- a/boost/container/vector.hpp +++ b/boost/container/vector.hpp @@ -1735,9 +1735,10 @@ class vector { if (BOOST_LIKELY(this->room_enough())){ //There is more memory, just construct a new object at the end - allocator_traits_type::construct(this->m_holder.alloc(), this->priv_raw_end(), ::boost::forward(args)...); + T* const p = this->priv_raw_end(); + allocator_traits_type::construct(this->m_holder.alloc(), p, ::boost::forward(args)...); ++this->m_holder.m_size; - return *this->priv_raw_end(); + return *p; } else{ typedef container_detail::insert_emplace_proxy type; @@ -1793,10 +1794,11 @@ class vector BOOST_CONTAINER_FORCEINLINE reference emplace_back(BOOST_MOVE_UREF##N)\ {\ if (BOOST_LIKELY(this->room_enough())){\ + T* const p = this->priv_raw_end();\ allocator_traits_type::construct (this->m_holder.alloc()\ , this->priv_raw_end() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ ++this->m_holder.m_size;\ - return *this->priv_raw_end();\ + return *p;\ }\ else{\ typedef container_detail::insert_emplace_proxy_arg##N type;\ @@ -2255,7 +2257,7 @@ class vector boost::uintptr_t const capaddr = boost::uintptr_t(this->priv_raw_begin() + c); boost::uintptr_t const aligned_addr = (addr + szt_align_mask) & ~szt_align_mask; indexes = reinterpret_cast(aligned_addr); - std::size_t index_capacity = (aligned_addr >= capaddr) ? 0u : (capaddr - addr)/sizeof(size_type); + std::size_t index_capacity = (aligned_addr >= capaddr) ? 0u : (capaddr - aligned_addr)/sizeof(size_type); //Capacity is constant, we're not going to change it if(index_capacity < PosCount){ diff --git a/boost/core/addressof.hpp b/boost/core/addressof.hpp index 889b582..0a2b46b 100644 --- a/boost/core/addressof.hpp +++ b/boost/core/addressof.hpp @@ -1,162 +1,265 @@ -// Copyright (C) 2002 Brad King (brad.king@kitware.com) -// Douglas Gregor (gregod@cs.rpi.edu) -// -// Copyright (C) 2002, 2008, 2013 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) +/* +Copyright (C) 2002 Brad King (brad.king@kitware.com) + Douglas Gregor (gregod@cs.rpi.edu) -// For more information, see http://www.boost.org +Copyright (C) 2002, 2008, 2013 Peter Dimov + +Copyright (C) 2017 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_CORE_ADDRESSOF_HPP #define BOOST_CORE_ADDRESSOF_HPP -# include -# include -# include +#include -namespace boost +#if defined(BOOST_MSVC_FULL_VER) && BOOST_MSVC_FULL_VER >= 190024215 +#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF +#elif defined(BOOST_GCC) && BOOST_GCC >= 70000 +#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF +#elif defined(__has_builtin) +#if __has_builtin(__builtin_addressof) +#define BOOST_CORE_HAS_BUILTIN_ADDRESSOF +#endif +#endif + +#if defined(BOOST_CORE_HAS_BUILTIN_ADDRESSOF) +#if defined(BOOST_NO_CXX11_CONSTEXPR) +#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF +#endif + +namespace boost { + +template +BOOST_CONSTEXPR inline T* +addressof(T& o) BOOST_NOEXCEPT { + return __builtin_addressof(o); +} -namespace detail -{ - -template struct addr_impl_ref -{ - T & v_; - - BOOST_FORCEINLINE addr_impl_ref( T & v ): v_( v ) {} - BOOST_FORCEINLINE operator T& () const { return v_; } - -private: - addr_impl_ref & operator=(const addr_impl_ref &); -}; - -template struct addressof_impl -{ - static BOOST_FORCEINLINE T * f( T & v, long ) - { - return reinterpret_cast( - &const_cast(reinterpret_cast(v))); - } - - static BOOST_FORCEINLINE T * f( T * v, int ) - { - return v; - } -}; - -#if !defined( BOOST_NO_CXX11_NULLPTR ) - -#if !defined( BOOST_NO_CXX11_DECLTYPE ) && ( ( defined( __clang__ ) && !defined( _LIBCPP_VERSION ) ) || defined( __INTEL_COMPILER ) ) - - typedef decltype(nullptr) addr_nullptr_t; - +} /* boost */ #else +#include +#include - typedef std::nullptr_t addr_nullptr_t; +namespace boost { +namespace detail { +template +class addressof_ref { +public: + BOOST_FORCEINLINE addressof_ref(T& o) BOOST_NOEXCEPT + : o_(o) { } + BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT { + return o_; + } +private: + addressof_ref& operator=(const addressof_ref&); + T& o_; +}; + +template +struct address_of { + static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT { + return reinterpret_cast(& + const_cast(reinterpret_cast(o))); + } + static BOOST_FORCEINLINE T* get(T* p, int) BOOST_NOEXCEPT { + return p; + } +}; + +#if !defined(BOOST_NO_CXX11_NULLPTR) +#if !defined(BOOST_NO_CXX11_DECLTYPE) && \ + (defined(__INTEL_COMPILER) || \ + (defined(__clang__) && !defined(_LIBCPP_VERSION))) +typedef decltype(nullptr) addressof_null_t; +#else +typedef std::nullptr_t addressof_null_t; #endif -template<> struct addressof_impl< addr_nullptr_t > -{ - typedef addr_nullptr_t T; - - static BOOST_FORCEINLINE T * f( T & v, int ) - { - return &v; +template<> +struct address_of { + typedef addressof_null_t type; + static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { + return &o; } }; -template<> struct addressof_impl< addr_nullptr_t const > -{ - typedef addr_nullptr_t const T; - - static BOOST_FORCEINLINE T * f( T & v, int ) - { - return &v; +template<> +struct address_of { + typedef const addressof_null_t type; + static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { + return &o; } }; -template<> struct addressof_impl< addr_nullptr_t volatile > -{ - typedef addr_nullptr_t volatile T; - - static BOOST_FORCEINLINE T * f( T & v, int ) - { - return &v; +template<> +struct address_of { + typedef volatile addressof_null_t type; + static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { + return &o; } }; -template<> struct addressof_impl< addr_nullptr_t const volatile > -{ - typedef addr_nullptr_t const volatile T; - - static BOOST_FORCEINLINE T * f( T & v, int ) - { - return &v; +template<> +struct address_of { + typedef const volatile addressof_null_t type; + static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { + return &o; } }; - #endif -} // namespace detail +} /* detail */ + +#if defined(BOOST_NO_CXX11_SFINAE_EXPR) || \ + defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || \ + defined(BOOST_NO_CXX11_CONSTEXPR) || \ + defined(BOOST_NO_CXX11_DECLTYPE) +#define BOOST_CORE_NO_CONSTEXPR_ADDRESSOF + +template +BOOST_FORCEINLINE T* +addressof(T& o) BOOST_NOEXCEPT +{ +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x610)) || \ + BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120) + return detail::address_of::get(o, 0); +#else + return detail::address_of::get(detail::addressof_ref(o), 0); +#endif +} + +#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x590)) +namespace detail { + +template +struct addressof_result { + typedef T* type; +}; + +} /* detail */ + +template +BOOST_FORCEINLINE typename detail::addressof_result::type +addressof(T (&o)[N]) BOOST_NOEXCEPT +{ + return &o; +} +#endif + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) +template +BOOST_FORCEINLINE +T (*addressof(T (&o)[N]) BOOST_NOEXCEPT)[N] +{ + return reinterpret_cast(&o); +} + +template +BOOST_FORCEINLINE +const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N] +{ + return reinterpret_cast(&o); +} +#endif +#else +namespace detail { + +template +T&& addressof_declval() BOOST_NOEXCEPT; + +template +struct addressof_void { + typedef void type; +}; + +template +struct addressof_member_operator { + static constexpr bool value = false; +}; + +template +struct addressof_member_operator().operator&())>::type> { + static constexpr bool value = true; +}; + +#if BOOST_WORKAROUND(BOOST_INTEL, < 1600) +struct addressof_addressable { }; + +addressof_addressable* +operator&(addressof_addressable&) BOOST_NOEXCEPT; +#endif + +template +struct addressof_non_member_operator { + static constexpr bool value = false; +}; + +template +struct addressof_non_member_operator()))>::type> { + static constexpr bool value = true; +}; + +template +struct addressof_expression { + static constexpr bool value = false; +}; + +template +struct addressof_expression())>::type> { + static constexpr bool value = true; +}; + +template +struct addressof_is_constexpr { + static constexpr bool value = addressof_expression::value && + !addressof_member_operator::value && + !addressof_non_member_operator::value; +}; + +template +struct addressof_if { }; + +template +struct addressof_if { + typedef T* type; +}; template BOOST_FORCEINLINE -T * addressof( T & v ) +typename addressof_if::value, T>::type +addressof(T& o) BOOST_NOEXCEPT { -#if (defined( __BORLANDC__ ) && BOOST_WORKAROUND( __BORLANDC__, BOOST_TESTED_AT( 0x610 ) ) ) || (defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x5120)) - - return boost::detail::addressof_impl::f( v, 0 ); - -#else - - return boost::detail::addressof_impl::f( boost::detail::addr_impl_ref( v ), 0 ); - -#endif + return address_of::get(addressof_ref(o), 0); } -#if defined( __SUNPRO_CC ) && BOOST_WORKAROUND( __SUNPRO_CC, BOOST_TESTED_AT( 0x590 ) ) - -namespace detail +template +constexpr BOOST_FORCEINLINE +typename addressof_if::value, T>::type +addressof(T& o) BOOST_NOEXCEPT { - -template struct addressof_addp -{ - typedef T * type; -}; - -} // namespace detail - -template< class T, std::size_t N > -BOOST_FORCEINLINE -typename detail::addressof_addp< T[N] >::type addressof( T (&t)[N] ) -{ - return &t; + return &o; } -#endif +} /* detail */ -// Borland doesn't like casting an array reference to a char reference -// but these overloads work around the problem. -#if defined( __BORLANDC__ ) && BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -template -BOOST_FORCEINLINE -T (*addressof(T (&t)[N]))[N] +template +constexpr BOOST_FORCEINLINE T* +addressof(T& o) BOOST_NOEXCEPT { - return reinterpret_cast(&t); -} - -template -BOOST_FORCEINLINE -const T (*addressof(const T (&t)[N]))[N] -{ - return reinterpret_cast(&t); + return detail::addressof(o); } #endif -} // namespace boost +} /* boost */ +#endif -#endif // BOOST_CORE_ADDRESSOF_HPP +#endif diff --git a/boost/core/demangle.hpp b/boost/core/demangle.hpp index f13c26a..dc714d8 100644 --- a/boost/core/demangle.hpp +++ b/boost/core/demangle.hpp @@ -93,15 +93,10 @@ inline void demangle_free( char const * name ) BOOST_NOEXCEPT inline std::string demangle( char const * name ) { scoped_demangled_name demangled_name( name ); - char const * const p = demangled_name.get(); - if( p ) - { - return p; - } - else - { - return name; - } + char const * p = demangled_name.get(); + if( !p ) + p = name; + return p; } #else diff --git a/boost/detail/workaround.hpp b/boost/detail/workaround.hpp index 40b3423..7727aaf 100644 --- a/boost/detail/workaround.hpp +++ b/boost/detail/workaround.hpp @@ -85,6 +85,11 @@ #else #define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0 #endif +#ifndef BOOST_GCC +#define BOOST_GCC_WORKAROUND_GUARD 1 +#else +#define BOOST_GCC_WORKAROUND_GUARD 0 +#endif #ifndef __IBMCPP__ #define __IBMCPP___WORKAROUND_GUARD 1 #else diff --git a/boost/intrusive/bstree.hpp b/boost/intrusive/bstree.hpp index f2cdb42..1eeab55 100644 --- a/boost/intrusive/bstree.hpp +++ b/boost/intrusive/bstree.hpp @@ -967,7 +967,7 @@ class bstree_impl void swap(bstree_impl& other) { //This can throw - ::boost::adl_move_swap(this->comp(), this->comp()); + ::boost::adl_move_swap(this->comp(), other.comp()); //These can't throw node_algorithms::swap_tree(this->header_ptr(), node_ptr(other.header_ptr())); this->sz_traits().swap(other.sz_traits()); diff --git a/boost/intrusive/bstree_algorithms.hpp b/boost/intrusive/bstree_algorithms.hpp index e8caee0..e449eba 100644 --- a/boost/intrusive/bstree_algorithms.hpp +++ b/boost/intrusive/bstree_algorithms.hpp @@ -37,6 +37,9 @@ namespace intrusive { template struct insert_commit_data_t { + BOOST_INTRUSIVE_FORCEINLINE insert_commit_data_t() + : link_left(false), node() + {} bool link_left; NodePtr node; }; diff --git a/boost/intrusive/detail/key_nodeptr_comp.hpp b/boost/intrusive/detail/key_nodeptr_comp.hpp index 9d64f09..bdc025e 100644 --- a/boost/intrusive/detail/key_nodeptr_comp.hpp +++ b/boost/intrusive/detail/key_nodeptr_comp.hpp @@ -59,6 +59,10 @@ struct key_nodeptr_comp //Use public inheritance to avoid MSVC bugs with closures : public key_nodeptr_comp_types::base_t { +private: + struct sfinae_type; + +public: typedef key_nodeptr_comp_types types_t; typedef typename types_t::value_traits value_traits; typedef typename types_t::value_type value_type; @@ -83,32 +87,32 @@ struct key_nodeptr_comp //pred(pnode) template - BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T1 &t1, typename enable_if_c< is_same_or_nodeptr_convertible::value >::type* =0) const + BOOST_INTRUSIVE_FORCEINLINE bool operator()(const T1 &t1, typename enable_if_c< is_same_or_nodeptr_convertible::value, sfinae_type* >::type = 0) const { return base().get()(key_of_value()(*traits_->to_value_ptr(t1))); } //operator() 2 arg //pred(pnode, pnode) template BOOST_INTRUSIVE_FORCEINLINE bool operator() - (const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible::value && is_same_or_nodeptr_convertible::value >::type* =0) const + (const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible::value && is_same_or_nodeptr_convertible::value, sfinae_type* >::type = 0) const { return base()(*traits_->to_value_ptr(t1), *traits_->to_value_ptr(t2)); } //pred(pnode, key) template BOOST_INTRUSIVE_FORCEINLINE bool operator() - (const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible::value && !is_same_or_nodeptr_convertible::value >::type* =0) const + (const T1 &t1, const T2 &t2, typename enable_if_c< is_same_or_nodeptr_convertible::value && !is_same_or_nodeptr_convertible::value, sfinae_type* >::type = 0) const { return base()(*traits_->to_value_ptr(t1), t2); } //pred(key, pnode) template BOOST_INTRUSIVE_FORCEINLINE bool operator() - (const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible::value && is_same_or_nodeptr_convertible::value >::type* =0) const + (const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible::value && is_same_or_nodeptr_convertible::value, sfinae_type* >::type = 0) const { return base()(t1, *traits_->to_value_ptr(t2)); } //pred(key, key) template BOOST_INTRUSIVE_FORCEINLINE bool operator() - (const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible::value && !is_same_or_nodeptr_convertible::value >::type* =0) const + (const T1 &t1, const T2 &t2, typename enable_if_c< !is_same_or_nodeptr_convertible::value && !is_same_or_nodeptr_convertible::value, sfinae_type* >::type = 0) const { return base()(t1, t2); } const ValueTraits *const traits_; diff --git a/boost/intrusive/slist.hpp b/boost/intrusive/slist.hpp index 0020699..f34350d 100644 --- a/boost/intrusive/slist.hpp +++ b/boost/intrusive/slist.hpp @@ -1115,7 +1115,7 @@ class slist_impl //! //! Throws: Nothing. //! - //! Complexity: Lineal to the elements (l - before_f + 1). + //! Complexity: Linear to the elements (l - before_f + 1). //! //! Note: Invalidates the iterators to the erased element. template diff --git a/boost/move/default_delete.hpp b/boost/move/default_delete.hpp index 1c26ed9..31ae67a 100644 --- a/boost/move/default_delete.hpp +++ b/boost/move/default_delete.hpp @@ -96,6 +96,22 @@ typedef int bool_conversion::* explicit_bool_arg; typedef int (bool_conversion::*nullptr_type)(); #endif +template +struct is_array_del +{}; + +template +void call_delete(T *p, is_array_del) +{ + delete [] p; +} + +template +void call_delete(T *p, is_array_del) +{ + delete p; +} + } //namespace move_upd { // @endcond @@ -184,7 +200,7 @@ struct default_delete //and T has no virtual destructor, then you have a problem BOOST_STATIC_ASSERT(( !::boost::move_upmu::missing_virtual_destructor::value )); element_type * const p = static_cast(ptr); - bmupmu::is_array::value ? delete [] p : delete p; + move_upd::call_delete(p, move_upd::is_array_del::value>()); } //! Effects: Same as (*this)(static_cast(nullptr)). diff --git a/boost/move/detail/unique_ptr_meta_utils.hpp b/boost/move/detail/unique_ptr_meta_utils.hpp index 3372068..ac270a8 100644 --- a/boost/move/detail/unique_ptr_meta_utils.hpp +++ b/boost/move/detail/unique_ptr_meta_utils.hpp @@ -397,7 +397,7 @@ struct pointer_type_imp template struct pointer_type_imp { - typedef typename remove_extent::type* type; + typedef T* type; }; template diff --git a/boost/preprocessor/cat.hpp b/boost/preprocessor/cat.hpp index 5e52850..52a3892 100644 --- a/boost/preprocessor/cat.hpp +++ b/boost/preprocessor/cat.hpp @@ -25,7 +25,7 @@ # define BOOST_PP_CAT_OO(par) BOOST_PP_CAT_I ## par # endif # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() +# if (~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC()) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) # define BOOST_PP_CAT_I(a, b) a ## b # else # define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(~, a ## b) diff --git a/boost/preprocessor/config/config.hpp b/boost/preprocessor/config/config.hpp index 8be0e47..4801903 100644 --- a/boost/preprocessor/config/config.hpp +++ b/boost/preprocessor/config/config.hpp @@ -32,7 +32,7 @@ # elif defined(__MWERKS__) && __MWERKS__ >= 0x3200 # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) # elif defined(__EDG__) || defined(__EDG_VERSION__) -# if defined(_MSC_VER) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308) +# if defined(_MSC_VER) && (defined(__clang__) || defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC()) # else # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_EDG() | BOOST_PP_CONFIG_STRICT()) @@ -45,7 +45,7 @@ # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) # elif defined(__BORLANDC__) || defined(__IBMC__) || defined(__IBMCPP__) || defined(__SUNPRO_CC) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_BCC()) -# elif defined(_MSC_VER) && !defined(__clang__) +# elif defined(_MSC_VER) # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_MSVC()) # else # define BOOST_PP_CONFIG_FLAGS() (BOOST_PP_CONFIG_STRICT()) @@ -75,8 +75,8 @@ # /* 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 __IBMCPP__ || defined __PGI # define BOOST_PP_VARIADICS 0 -# /* VC++ (C/C++) */ -# elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__)) && !defined __clang__ +# /* VC++ (C/C++) and Intel C++ Compiler >= 17.0 with MSVC */ +# elif defined _MSC_VER && _MSC_VER >= 1400 && (defined(__clang__) || !defined __EDG__ || defined(__INTELLISENSE__) || defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) # define BOOST_PP_VARIADICS 1 # undef BOOST_PP_VARIADICS_MSVC # define BOOST_PP_VARIADICS_MSVC 1 @@ -92,7 +92,7 @@ # elif !BOOST_PP_VARIADICS + 1 < 2 # undef BOOST_PP_VARIADICS # define BOOST_PP_VARIADICS 1 -# if defined _MSC_VER && _MSC_VER >= 1400 && (defined(__INTELLISENSE__) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) +# 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)) # undef BOOST_PP_VARIADICS_MSVC # define BOOST_PP_VARIADICS_MSVC 1 # endif diff --git a/boost/smart_ptr/detail/sp_noexcept.hpp b/boost/smart_ptr/detail/sp_noexcept.hpp new file mode 100644 index 0000000..6818dce --- /dev/null +++ b/boost/smart_ptr/detail/sp_noexcept.hpp @@ -0,0 +1,30 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED + +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +// detail/sp_noexcept.hpp +// +// Copyright 2016 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 + +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1700 && BOOST_MSVC < 1900 + +#define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT_OR_NOTHROW + +#else + +#define BOOST_SP_NOEXCEPT BOOST_NOEXCEPT + +#endif + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_NOEXCEPT_HPP_INCLUDED diff --git a/boost/smart_ptr/intrusive_ptr.hpp b/boost/smart_ptr/intrusive_ptr.hpp index 1e93397..0e46212 100644 --- a/boost/smart_ptr/intrusive_ptr.hpp +++ b/boost/smart_ptr/intrusive_ptr.hpp @@ -19,6 +19,7 @@ #include #include #include +#include #include // for std::less @@ -59,7 +60,7 @@ public: typedef T element_type; - BOOST_CONSTEXPR intrusive_ptr() BOOST_NOEXCEPT : px( 0 ) + BOOST_CONSTEXPR intrusive_ptr() BOOST_SP_NOEXCEPT : px( 0 ) { } @@ -111,12 +112,12 @@ public: #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES ) - intrusive_ptr(intrusive_ptr && rhs) BOOST_NOEXCEPT : px( rhs.px ) + intrusive_ptr(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT : px( rhs.px ) { rhs.px = 0; } - intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_NOEXCEPT + intrusive_ptr & operator=(intrusive_ptr && rhs) BOOST_SP_NOEXCEPT { this_type( static_cast< intrusive_ptr && >( rhs ) ).swap(*this); return *this; diff --git a/boost/type_index/stl_type_index.hpp b/boost/type_index/stl_type_index.hpp index a5add88..be28889 100644 --- a/boost/type_index/stl_type_index.hpp +++ b/boost/type_index/stl_type_index.hpp @@ -1,5 +1,5 @@ // -// Copyright (c) Antony Polukhin, 2013-2015. +// Copyright (c) Antony Polukhin, 2013-2017. // // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -174,7 +174,7 @@ inline std::string stl_type_index::pretty_name() const { inline std::size_t stl_type_index::hash_code() const BOOST_NOEXCEPT { -#if _MSC_VER > 1600 || (__GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) +#if (defined(_MSC_VER) && _MSC_VER > 1600) || (__GNUC__ == 4 && __GNUC_MINOR__ > 5 && defined(__GXX_EXPERIMENTAL_CXX0X__)) return data_->hash_code(); #else return boost::hash_range(raw_name(), raw_name() + std::strlen(raw_name())); diff --git a/boost/type_traits.hpp b/boost/type_traits.hpp index 7d651ce..93a992d 100644 --- a/boost/type_traits.hpp +++ b/boost/type_traits.hpp @@ -130,6 +130,7 @@ #include #include #include +#include #include #include #include diff --git a/boost/type_traits/detail/common_arithmetic_type.hpp b/boost/type_traits/detail/common_arithmetic_type.hpp index 8c09158..a7aff03 100644 --- a/boost/type_traits/detail/common_arithmetic_type.hpp +++ b/boost/type_traits/detail/common_arithmetic_type.hpp @@ -46,7 +46,7 @@ template<> struct arithmetic_type<3> #endif // There are five standard signed integer types: -// “signed char”, “short int”, “int”, “long int”, and “long long int”. +// "signed char", "short int", "int", "long int", and "long long int". template<> struct arithmetic_type<4> { @@ -79,8 +79,8 @@ template<> struct arithmetic_type<8> }; // For each of the standard signed integer types, there exists a corresponding -// (but different) standard unsigned integer type: “unsigned char”, “unsigned short int”, -// “unsigned int”, “unsigned long int”, and “unsigned long long int” +// (but different) standard unsigned integer type: "unsigned char", "unsigned short int", +// "unsigned int", "unsigned long int", and "unsigned long long int" template<> struct arithmetic_type<9> { diff --git a/boost/type_traits/is_rvalue_reference.hpp b/boost/type_traits/is_rvalue_reference.hpp index 50e88ed..a48edb5 100644 --- a/boost/type_traits/is_rvalue_reference.hpp +++ b/boost/type_traits/is_rvalue_reference.hpp @@ -1,5 +1,5 @@ -// (C) John Maddock 2010. +// (C) Copyright John Maddock 2010. // 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). diff --git a/boost/type_traits/make_void.hpp b/boost/type_traits/make_void.hpp new file mode 100644 index 0000000..f48823b --- /dev/null +++ b/boost/type_traits/make_void.hpp @@ -0,0 +1,52 @@ +/* +Copyright 2017 Glen Joseph Fernandes + + +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_TT_MAKE_VOID_HPP_INCLUDED +#define BOOST_TT_MAKE_VOID_HPP_INCLUDED + +#include + +namespace boost { + +#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +template +struct make_void { + typedef void type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template +using void_t = typename make_void::type; +#endif + +#else /* BOOST_NO_CXX11_VARIADIC_TEMPLATES */ + +template +struct make_void { + typedef void type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) +template +using void_t = typename make_void::type; +#endif + +#endif + +} /* boost */ + +#endif diff --git a/boost/utility.hpp b/boost/utility.hpp index 82177c8..0aacb8b 100644 --- a/boost/utility.hpp +++ b/boost/utility.hpp @@ -14,8 +14,8 @@ #include #include #include -#include +#include +#include #include -#include #endif // BOOST_UTILITY_HPP diff --git a/boost/variant/polymorphic_get.hpp b/boost/variant/polymorphic_get.hpp index 89fca36..1a98382 100644 --- a/boost/variant/polymorphic_get.hpp +++ b/boost/variant/polymorphic_get.hpp @@ -3,7 +3,7 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2013-2015 Antony Polukhin +// Copyright (c) 2013-2017 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -113,13 +113,15 @@ public: // visitor interfaces template pointer operator()(U& operand) const BOOST_NOEXCEPT { + typedef typename boost::remove_reference::type base_t; typedef boost::integral_constant< bool, - boost::mpl::or_< - boost::is_base_of, - boost::is_same, - boost::is_same::type, U > - >::value + ( + boost::is_base_of::value && + (boost::is_const::value || !boost::is_const::value) + ) + || boost::is_same::value + || boost::is_same::type, U >::value > tag_t; return this_type::get(operand, tag_t()); diff --git a/boost/variant/recursive_wrapper_fwd.hpp b/boost/variant/recursive_wrapper_fwd.hpp index 2fc4341..c40399f 100644 --- a/boost/variant/recursive_wrapper_fwd.hpp +++ b/boost/variant/recursive_wrapper_fwd.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002 Eric Friedman, Itay Maman -// Copyright (c) 2016 Antony Polukhin +// Copyright (c) 2016-2017 Antony Polukhin // // Portions Copyright (C) 2002 David Abrahams // @@ -20,6 +20,7 @@ #include #include #include +#include namespace boost { @@ -65,6 +66,9 @@ template struct is_constructible, const template struct is_constructible, recursive_wrapper& > : boost::false_type{}; template struct is_constructible, const recursive_wrapper& > : boost::false_type{}; +// recursive_wrapper is not nothrow move constructible, because it's constructor does dynamic memory allocation. +// This specialisation is required to workaround GCC6 issue: https://svn.boost.org/trac/boost/ticket/12680 +template struct is_nothrow_move_constructible > : boost::false_type{}; /////////////////////////////////////////////////////////////////////////////// // metafunction is_recursive_wrapper (modeled on code by David Abrahams) diff --git a/boost/variant/variant.hpp b/boost/variant/variant.hpp index 6296238..1c64447 100644 --- a/boost/variant/variant.hpp +++ b/boost/variant/variant.hpp @@ -1756,10 +1756,12 @@ public: // structors, cont. template variant(const T& operand, - typename boost::enable_if >, - boost::detail::variant::is_variant_constructible_from - > >::type* = 0) + typename boost::enable_if >, + boost::detail::variant::is_variant_constructible_from + >, + boost::is_same > >::type* = 0) { convert_construct(operand, 1L); } @@ -1767,11 +1769,13 @@ public: // structors, cont. template variant( T& operand - , typename boost::enable_if >, - mpl::not_< boost::is_same >, - boost::detail::variant::is_variant_constructible_from - > >::type* = 0 + , typename boost::enable_if >, + mpl::not_< boost::is_same >, + boost::detail::variant::is_variant_constructible_from + >, + boost::is_same > >::type* = 0 ) { convert_construct(operand, 1L); @@ -1780,12 +1784,14 @@ public: // structors, cont. #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template variant(T&& operand, - typename boost::enable_if, - mpl::not_< boost::is_const >, - mpl::not_< boost::is_same >, - boost::detail::variant::is_variant_constructible_from - > >::type* = 0) + typename boost::enable_if, + mpl::not_< boost::is_const >, + mpl::not_< boost::is_same >, + boost::detail::variant::is_variant_constructible_from + >, + boost::is_same > >::type* = 0) { convert_construct( detail::variant::move(operand), 1L); } diff --git a/boost/variant/variant_fwd.hpp b/boost/variant/variant_fwd.hpp index 769ecc4..b533f76 100644 --- a/boost/variant/variant_fwd.hpp +++ b/boost/variant/variant_fwd.hpp @@ -59,7 +59,7 @@ GCC before 4.0 had no variadic tempaltes; GCC 4.6 has incomplete implementation of variadic templates. - MSVC2013 has variadic templates, but they have issues. + MSVC2015 Update 1 has variadic templates, but they have issues. NOTE: Clang compiler defines __GNUC__ */ diff --git a/boost/version.hpp b/boost/version.hpp index 94c16c3..03b33f9 100644 --- a/boost/version.hpp +++ b/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 106300 +#define BOOST_VERSION 106400 // // 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 to select which library version to link to. -#define BOOST_LIB_VERSION "1_63" +#define BOOST_LIB_VERSION "1_64" #endif From 3abc84abaf63a068cb59a9f9b5675c1947bc6fd9 Mon Sep 17 00:00:00 2001 From: Yuri Kunde Schlesner Date: Sat, 10 Jun 2017 18:37:13 -0700 Subject: [PATCH 4/4] Add boost::container::small_vector --- boost/container/small_vector.hpp | 632 +++++++++++++++++++++++++++++++ build.cmd | 1 + 2 files changed, 633 insertions(+) create mode 100644 boost/container/small_vector.hpp diff --git a/boost/container/small_vector.hpp b/boost/container/small_vector.hpp new file mode 100644 index 0000000..1444624 --- /dev/null +++ b/boost/container/small_vector.hpp @@ -0,0 +1,632 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2015-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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_SMALL_VECTOR_HPP +#define BOOST_CONTAINER_CONTAINER_SMALL_VECTOR_HPP + +#ifndef BOOST_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +#include +#include + +// container +#include +#include +#include +#include //new_allocator +// container/detail +#include +#include + +//move +#include +#include + +//move/detail +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) +#include +#endif + +//std +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) +#include //for std::initializer_list +#endif + +namespace boost { +namespace container { + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +template > +class small_vector_base; + +#endif + +//! A non-standard allocator used to implement `small_vector`. +//! Users should never use it directly. It is described here +//! for documentation purposes. +//! +//! This allocator inherits from a standard-conforming allocator +//! and forwards member functions to the standard allocator except +//! when internal storage is being used as memory source. +//! +//! This allocator is a "partially_propagable" allocator and +//! defines `is_partially_propagable` as true_type. +//! +//! A partially propagable allocator means that not all storage +//! allocatod by an instance of `small_vector_allocator` can be +//! deallocated by another instance of this type, even if both +//! instances compare equal or an instance is propagated to another +//! one using the copy/move constructor or assignment. The storage that +//! can never be propagated is identified by `storage_is_unpropagable(p)`. +//! +//! `boost::container::vector` supports partially propagable allocators +//! fallbacking to deep copy/swap/move operations when internal storage +//! is being used to store vector elements. +//! +//! `small_vector_allocator` assumes that will be instantiated as +//! `boost::container::vector< T, small_vector_allocator >` +//! and internal storage can be obtained downcasting that vector +//! to `small_vector_base`. +template +class small_vector_allocator + : public Allocator +{ + typedef unsigned int allocation_type; + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + private: + + BOOST_COPYABLE_AND_MOVABLE(small_vector_allocator) + + BOOST_CONTAINER_FORCEINLINE const Allocator &as_base() const + { return static_cast(*this); } + + BOOST_CONTAINER_FORCEINLINE Allocator &as_base() + { return static_cast(*this); } + + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + + public: + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + typedef allocator_traits allocator_traits_type; + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + + typedef typename allocator_traits::value_type value_type; + typedef typename allocator_traits::pointer pointer; + typedef typename allocator_traits::const_pointer const_pointer; + typedef typename allocator_traits::reference reference; + typedef typename allocator_traits::const_reference const_reference; + typedef typename allocator_traits::size_type size_type; + typedef typename allocator_traits::difference_type difference_type; + typedef typename allocator_traits::void_pointer void_pointer; + typedef typename allocator_traits::const_void_pointer const_void_pointer; + + typedef typename allocator_traits::propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + typedef typename allocator_traits::propagate_on_container_move_assignment propagate_on_container_move_assignment; + typedef typename allocator_traits::propagate_on_container_swap propagate_on_container_swap; + //! An integral constant with member `value == false` + typedef BOOST_CONTAINER_IMPDEF(container_detail::bool_) is_always_equal; + //! An integral constant with member `value == true` + typedef BOOST_CONTAINER_IMPDEF(container_detail::bool_) is_partially_propagable; + + BOOST_CONTAINER_DOCIGN(typedef container_detail::version_type version;) + + //!Obtains an small_vector_allocator that allocates + //!objects of type T2 + template + struct rebind + { + typedef typename allocator_traits::template rebind_alloc::type other; + }; + + #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //!Constructor from arbitrary arguments + template + BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_FWD_REF(Args) ...args) + : Allocator(::boost::forward(args)...) + {} + #else + #define BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE(N) \ + BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ + BOOST_CONTAINER_FORCEINLINE explicit small_vector_allocator(BOOST_MOVE_UREF##N)\ + : Allocator(BOOST_MOVE_FWD##N)\ + {}\ + // + BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE) + #undef BOOST_CONTAINER_SMALL_VECTOR_ALLOCATOR_CTOR_CODE + #endif + + //!Constructor from other small_vector_allocator. + //!Never throws + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW + : Allocator(other.as_base()) + {} + + //!Move constructor from small_vector_allocator. + //!Never throws + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + : Allocator(::boost::move(other.as_base())) + {} + + //!Constructor from related small_vector_allocator. + //!Never throws + template + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (const small_vector_allocator &other) BOOST_NOEXCEPT_OR_NOTHROW + : Allocator(other.as_base()) + {} + + //!Move constructor from related small_vector_allocator. + //!Never throws + template + BOOST_CONTAINER_FORCEINLINE small_vector_allocator + (BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + : Allocator(::boost::move(other.as_base())) + {} + + //!Assignment from other small_vector_allocator. + //!Never throws + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + { return static_cast(this->Allocator::operator=(other.as_base())); } + + //!Move constructor from other small_vector_allocator. + //!Never throws + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + { return static_cast(this->Allocator::operator=(::boost::move(other.as_base()))); } + + //!Assignment from related small_vector_allocator. + //!Never throws + template + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_COPY_ASSIGN_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + { return static_cast(this->Allocator::operator=(other.as_base())); } + + //!Move assignment from related small_vector_allocator. + //!Never throws + template + BOOST_CONTAINER_FORCEINLINE small_vector_allocator & + operator=(BOOST_RV_REF(small_vector_allocator) other) BOOST_NOEXCEPT_OR_NOTHROW + { return static_cast(this->Allocator::operator=(::boost::move(other.as_base()))); } + + //!Allocates storage from the standard-conforming allocator + BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type count, const_void_pointer hint = const_void_pointer()) + { return allocator_traits_type::allocate(this->as_base(), count, hint); } + + //!Deallocates previously allocated memory. + //!Never throws + void deallocate(pointer ptr, size_type n) BOOST_NOEXCEPT_OR_NOTHROW + { + if(!this->is_internal_storage(ptr)) + allocator_traits_type::deallocate(this->as_base(), ptr, n); + } + + //!Returns the maximum number of elements that could be allocated. + //!Never throws + BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW + { return allocator_traits_type::max_size(this->as_base()); } + + small_vector_allocator select_on_container_copy_construction() const + { return small_vector_allocator(allocator_traits_type::select_on_container_copy_construction(this->as_base())); } + + bool storage_is_unpropagable(pointer p) const + { return this->is_internal_storage(p) || allocator_traits_type::storage_is_unpropagable(this->as_base(), p); } + + //!Swaps two allocators, does nothing + //!because this small_vector_allocator is stateless + BOOST_CONTAINER_FORCEINLINE friend void swap(small_vector_allocator &l, small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW + { boost::adl_move_swap(l.as_base(), r.as_base()); } + + //!An small_vector_allocator always compares to true, as memory allocated with one + //!instance can be deallocated by another instance (except for unpropagable storage) + BOOST_CONTAINER_FORCEINLINE friend bool operator==(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW + { return allocator_traits_type::equal(l.as_base(), r.as_base()); } + + //!An small_vector_allocator always compares to false, as memory allocated with one + //!instance can be deallocated by another instance + BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const small_vector_allocator &l, const small_vector_allocator &r) BOOST_NOEXCEPT_OR_NOTHROW + { return !(l == r); } + + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + /* + //!An advanced function that offers in-place expansion shrink to fit and new allocation + //!capabilities. Memory allocated with this function can only be deallocated with deallocate() + //!or deallocate_many(). + //!This function is available only with Version == 2 + pointer allocation_command(allocation_type command, + size_type limit_size, + size_type &prefer_in_recvd_out_size, + pointer &reuse) + { return allocator_traits_type::allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); } + + //!Returns maximum the number of objects the previously allocated memory + //!pointed by p can hold. + //!Memory must not have been allocated with + //!allocate_one or allocate_individual. + //!This function is available only with Version == 2 + size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW + { return allocator_traits_type::size(p); } + */ + private: + /* + //!Allocates just one object. Memory allocated with this function + //!must be deallocated only with deallocate_one(). + //!Throws bad_alloc if there is no enough memory + //!This function is available only with Version == 2 + using Allocator::allocate_one; + using Allocator::allocate_individual; + using Allocator::deallocate_one; + using Allocator::deallocate_individual; + using Allocator::allocate_many; + using Allocator::deallocate_many;*/ + + BOOST_CONTAINER_FORCEINLINE bool is_internal_storage(pointer p) const + { return this->internal_storage() == p; } + + pointer internal_storage() const + { + typedef typename Allocator::value_type value_type; + typedef container_detail::vector_alloc_holder< small_vector_allocator > vector_alloc_holder_t; + typedef vector > vector_base; + typedef small_vector_base derived_type; + // + const vector_alloc_holder_t &v_holder = static_cast(*this); + const vector_base &v_base = reinterpret_cast(v_holder); + const derived_type &d_base = static_cast(v_base); + return d_base.internal_storage(); + } + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +}; + +//! This class consists of common code from all small_vector types that don't depend on the +//! "N" template parameter. This class is non-copyable and non-destructible, so this class typically +//! used as reference argument to functions that read or write small vectors. Since `small_vector` +//! derives from `small_vector_base`, the conversion to `small_vector_base` is implicit +//!
+//!
+//! //Clients can pass any small_vector.
+//! void read_any_small_vector_of_foo(const small_vector_base &in_parameter);
+//!
+//! void modify_any_small_vector_of_foo(small_vector_base &in_out_parameter);
+//!
+//! void some_function()
+//! {
+//! 
+//!    small_vector myvector;
+//!
+//!    read_any_small_vector_of_foo(myvector);   // Reads myvector
+//!
+//!    modify_any_small_vector_of_foo(myvector); // Modifies myvector
+//! 
+//! }
+//! 
+//! +//! All `boost::container:vector` member functions are inherited. See `vector` documentation for details. +//! +template +class small_vector_base + : public vector > +{ + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + public: + //Make it public as it will be inherited by small_vector and container + //must have this public member + typedef typename allocator_traits::pointer pointer; + + private: + BOOST_COPYABLE_AND_MOVABLE(small_vector_base) + + friend class small_vector_allocator; + + pointer internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW + { + return boost::intrusive::pointer_traits::pointer_to + (*const_cast(static_cast(static_cast(&m_storage_start)))); + } + + typedef vector > base_type; + base_type &as_base() { return static_cast(*this); } + const base_type &as_base() const { return static_cast(*this); } + + public: + typedef typename container_detail::aligned_storage + ::value>::type storage_type; + typedef small_vector_allocator allocator_type; + + protected: + typedef typename base_type::initial_capacity_t initial_capacity_t; + + BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t initial_capacity) + : base_type(initial_capacity_t(), this->internal_storage(), initial_capacity) + {} + + template + BOOST_CONTAINER_FORCEINLINE explicit small_vector_base(initial_capacity_t, std::size_t capacity, BOOST_FWD_REF(AllocFwd) a) + : base_type(initial_capacity_t(), this->internal_storage(), capacity, ::boost::forward(a)) + {} + + //~small_vector_base(){} + + private: + //The only member + storage_type m_storage_start; + + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + + public: + BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_COPY_ASSIGN_REF(small_vector_base) other) + { return static_cast(this->base_type::operator=(static_cast(other))); } + + BOOST_CONTAINER_FORCEINLINE small_vector_base& operator=(BOOST_RV_REF(small_vector_base) other) + { return static_cast(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); } + + BOOST_CONTAINER_FORCEINLINE void swap(small_vector_base &other) + { return this->base_type::swap(other); } + + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + protected: + void move_construct_impl(base_type &x, const allocator_type &a) + { + if(base_type::is_propagable_from(x.get_stored_allocator(), x.data(), a, true)){ + this->steal_resources(x); + } + else{ + this->assign( boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.begin())) + , boost::make_move_iterator(container_detail::iterator_to_raw_pointer(x.end ())) + ); + } + } + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +}; + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +///////////////////////////////////////////////////// +// +// small_vector_storage_calculator +// +///////////////////////////////////////////////////// +template +struct small_vector_storage_calculator_helper +{ + static const std::size_t value = (Needed - Hdr - 1u)/SSize + 1u; +}; + +template +struct small_vector_storage_calculator_helper +{ + static const std::size_t value = 0u; +}; + +template +struct small_vector_storage_calculator +{ + typedef small_vector_base svh_type; + typedef vector > svhb_type; + static const std::size_t s_align = container_detail::alignment_of::value; + static const std::size_t s_size = sizeof(Storage); + static const std::size_t svh_sizeof = sizeof(svh_type); + static const std::size_t svhb_sizeof = sizeof(svhb_type); + static const std::size_t s_start = ((svhb_sizeof-1)/s_align+1)*s_align; + static const std::size_t header_bytes = svh_sizeof-s_start; + static const std::size_t needed_bytes = sizeof(T)*N; + static const std::size_t needed_extra_storages = + small_vector_storage_calculator_helper::value; +}; + +///////////////////////////////////////////////////// +// +// small_vector_storage_definer +// +///////////////////////////////////////////////////// +template +struct small_vector_storage +{ + Storage m_rest_of_storage[N]; +}; + +template +struct small_vector_storage +{}; + +template +struct small_vector_storage_definer +{ + typedef typename Allocator::value_type value_type; + typedef typename small_vector_base::storage_type storage_type; + static const std::size_t needed_extra_storages = + small_vector_storage_calculator::needed_extra_storages; + typedef small_vector_storage type; +}; + +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +//! small_vector is a vector-like container optimized for the case when it contains few elements. +//! It contains some preallocated elements in-place, which can avoid the use of dynamic storage allocation +//! when the actual number of elements is below that preallocated threshold. +//! +//! `small_vector` is convertible to `small_vector_base` that is independent +//! from the preallocated element capacity, so client code does not need to be templated on that N argument. +//! +//! All `boost::container::vector` member functions are inherited. See `vector` documentation for details. +//! +//! \tparam T The type of object that is stored in the small_vector +//! \tparam N The number of preallocated elements stored inside small_vector. It shall be less than Allocator::max_size(); +//! \tparam Allocator The allocator used for memory management when the number of elements exceeds N. +template ) > +class small_vector : public small_vector_base + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + , private small_vector_storage_definer::type + #endif +{ + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + typedef small_vector_base base_type; + typedef typename small_vector_storage_definer::type remaining_storage_holder; + + BOOST_COPYABLE_AND_MOVABLE(small_vector) + + typedef typename base_type::initial_capacity_t initial_capacity_t; + typedef allocator_traits allocator_traits_type; + + public: + typedef small_vector_storage_calculator< typename small_vector_base + ::storage_type, Allocator, T, N> storage_test; + + static const std::size_t needed_extra_storages = storage_test::needed_extra_storages; + static const std::size_t needed_bytes = storage_test::needed_bytes; + static const std::size_t header_bytes = storage_test::header_bytes; + static const std::size_t s_start = storage_test::s_start; + + typedef typename base_type::allocator_type allocator_type; + typedef typename base_type::size_type size_type; + typedef typename base_type::value_type value_type; + + BOOST_CONTAINER_FORCEINLINE static std::size_t internal_capacity() + { return (sizeof(small_vector) - storage_test::s_start)/sizeof(T); } + + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + + //! @brief The capacity/max size of the container + static const size_type static_capacity = N; + + public: + BOOST_CONTAINER_FORCEINLINE small_vector() + BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) + : base_type(initial_capacity_t(), internal_capacity()) + {} + + BOOST_CONTAINER_FORCEINLINE explicit small_vector(const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + {} + + BOOST_CONTAINER_FORCEINLINE explicit small_vector(size_type n) + : base_type(initial_capacity_t(), internal_capacity()) + { this->resize(n); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->resize(n); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, default_init_t) + : base_type(initial_capacity_t(), internal_capacity()) + { this->resize(n, default_init_t()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, default_init_t, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->resize(n, default_init_t()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const value_type &v) + : base_type(initial_capacity_t(), internal_capacity()) + { this->resize(n, v); } + + BOOST_CONTAINER_FORCEINLINE small_vector(size_type n, const value_type &v, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->resize(n, v); } + + template + BOOST_CONTAINER_FORCEINLINE small_vector(InIt first, InIt last + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c + < container_detail::is_convertible::value + BOOST_MOVE_I container_detail::nat >::type * = 0) + ) + : base_type(initial_capacity_t(), internal_capacity()) + { this->assign(first, last); } + + template + BOOST_CONTAINER_FORCEINLINE small_vector(InIt first, InIt last, const allocator_type& a + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_c + < container_detail::is_convertible::value + BOOST_MOVE_I container_detail::nat >::type * = 0) + ) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->assign(first, last); } + + BOOST_CONTAINER_FORCEINLINE small_vector(const small_vector &other) + : base_type( initial_capacity_t(), internal_capacity() + , allocator_traits_type::select_on_container_copy_construction(other.get_stored_allocator())) + { this->assign(other.cbegin(), other.cend()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(const small_vector &other, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->assign(other.cbegin(), other.cend()); } + + BOOST_CONTAINER_FORCEINLINE explicit small_vector(const base_type &other) + : base_type( initial_capacity_t(), internal_capacity() + , allocator_traits_type::select_on_container_copy_construction(other.get_stored_allocator())) + { this->assign(other.cbegin(), other.cend()); } + + BOOST_CONTAINER_FORCEINLINE explicit small_vector(BOOST_RV_REF(base_type) other) + : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator())) + { this->move_construct_impl(other, other.get_stored_allocator()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(BOOST_RV_REF(small_vector) other) + : base_type(initial_capacity_t(), internal_capacity(), ::boost::move(other.get_stored_allocator())) + { this->move_construct_impl(other, other.get_stored_allocator()); } + + BOOST_CONTAINER_FORCEINLINE small_vector(BOOST_RV_REF(small_vector) other, const allocator_type &a) + : base_type(initial_capacity_t(), internal_capacity(), a) + { this->move_construct_impl(other, a); } + + #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + BOOST_CONTAINER_FORCEINLINE small_vector(std::initializer_list il, const allocator_type& a = allocator_type()) + : base_type(initial_capacity_t(), internal_capacity(), a) + { + this->assign(il.begin(), il.end()); + } + #endif + + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_COPY_ASSIGN_REF(small_vector) other) + { return static_cast(this->base_type::operator=(static_cast(other))); } + + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(small_vector) other) + { return static_cast(this->base_type::operator=(BOOST_MOVE_BASE(base_type, other))); } + + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(const base_type &other) + { return static_cast(this->base_type::operator=(other)); } + + BOOST_CONTAINER_FORCEINLINE small_vector& operator=(BOOST_RV_REF(base_type) other) + { return static_cast(this->base_type::operator=(boost::move(other))); } + + BOOST_CONTAINER_FORCEINLINE void swap(small_vector &other) + { return this->base_type::swap(other); } +}; + +}} + +#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED +/* +namespace boost { + +//!has_trivial_destructor_after_move<> == true_type +//!specialization for optimizations +template +struct has_trivial_destructor_after_move > +{ + typedef typename ::boost::container::allocator_traits::pointer pointer; + static const bool value = ::boost::has_trivial_destructor_after_move::value && + ::boost::has_trivial_destructor_after_move::value; +}; + +} +*/ +#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED + +#include + +#endif // #ifndef BOOST_CONTAINER_CONTAINER_SMALL_VECTOR_HPP diff --git a/build.cmd b/build.cmd index 71b9c1a..ccc304c 100644 --- a/build.cmd +++ b/build.cmd @@ -1,6 +1,7 @@ bcp ^ boost/container/flat_map.hpp ^ boost/container/flat_set.hpp ^ + boost/container/small_vector.hpp ^ boost/container/static_vector.hpp ^ boost/crc.hpp ^ boost/icl/interval_map.hpp ^