diff --git a/Readme.md b/Readme.md index 10f2f6a..5585673 100644 --- a/Readme.md +++ b/Readme.md @@ -1,7 +1,7 @@ -Boost libraries - trimmed down for Citra +Boost libraries - trimmed down for yuzu ======================================== -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. +This is a subset of Boost v1.68.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/algorithm/minmax_element.hpp b/boost/algorithm/minmax_element.hpp new file mode 100644 index 0000000..752f6cb --- /dev/null +++ b/boost/algorithm/minmax_element.hpp @@ -0,0 +1,553 @@ +// (C) Copyright Herve Bronnimann 2004. +// +// 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) + +/* + Revision history: + 1 July 2004 + Split the code into two headers to lessen dependence on + Boost.tuple. (Herve) + 26 June 2004 + Added the code for the boost minmax library. (Herve) +*/ + +#ifndef BOOST_ALGORITHM_MINMAX_ELEMENT_HPP +#define BOOST_ALGORITHM_MINMAX_ELEMENT_HPP + +/* PROPOSED STANDARD EXTENSIONS: + * + * minmax_element(first, last) + * Effect: std::make_pair( std::min_element(first, last), + * std::max_element(first, last) ); + * + * minmax_element(first, last, comp) + * Effect: std::make_pair( std::min_element(first, last, comp), + * std::max_element(first, last, comp) ); + */ + +#include // for std::pair and std::make_pair + +namespace boost { + + namespace detail { // for obtaining a uniform version of minmax_element + // that compiles with VC++ 6.0 -- avoid the iterator_traits by + // having comparison object over iterator, not over dereferenced value + + template + struct less_over_iter { + bool operator()(Iterator const& it1, + Iterator const& it2) const { return *it1 < *it2; } + }; + + template + struct binary_pred_over_iter { + explicit binary_pred_over_iter(BinaryPredicate const& p ) : m_p( p ) {} + bool operator()(Iterator const& it1, + Iterator const& it2) const { return m_p(*it1, *it2); } + private: + BinaryPredicate m_p; + }; + + // common base for the two minmax_element overloads + + template + std::pair + basic_minmax_element(ForwardIter first, ForwardIter last, Compare comp) + { + if (first == last) + return std::make_pair(last,last); + + ForwardIter min_result = first; + ForwardIter max_result = first; + + // if only one element + ForwardIter second = first; ++second; + if (second == last) + return std::make_pair(min_result, max_result); + + // treat first pair separately (only one comparison for first two elements) + ForwardIter potential_min_result = last; + if (comp(first, second)) + max_result = second; + else { + min_result = second; + potential_min_result = first; + } + + // then each element by pairs, with at most 3 comparisons per pair + first = ++second; if (first != last) ++second; + while (second != last) { + if (comp(first, second)) { + if (comp(first, min_result)) { + min_result = first; + potential_min_result = last; + } + if (comp(max_result, second)) + max_result = second; + } else { + if (comp(second, min_result)) { + min_result = second; + potential_min_result = first; + } + if (comp(max_result, first)) + max_result = first; + } + first = ++second; + if (first != last) ++second; + } + + // if odd number of elements, treat last element + if (first != last) { // odd number of elements + if (comp(first, min_result)) { + min_result = first; + potential_min_result = last; + } + else if (comp(max_result, first)) + max_result = first; + } + + // resolve min_result being incorrect with one extra comparison + // (in which case potential_min_result is necessarily the correct result) + if (potential_min_result != last + && !comp(min_result, potential_min_result)) + min_result = potential_min_result; + + return std::make_pair(min_result,max_result); + } + + } // namespace detail + + template + std::pair + minmax_element(ForwardIter first, ForwardIter last) + { + return detail::basic_minmax_element(first, last, + detail::less_over_iter() ); + } + + template + std::pair + minmax_element(ForwardIter first, ForwardIter last, BinaryPredicate comp) + { + return detail::basic_minmax_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + +} + +/* PROPOSED BOOST EXTENSIONS + * In the description below, [rfirst,rlast) denotes the reversed range + * of [first,last). Even though the iterator type of first and last may + * be only a Forward Iterator, it is possible to explain the semantics + * by assuming that it is a Bidirectional Iterator. In the sequel, + * reverse(ForwardIterator&) returns the reverse_iterator adaptor. + * This is not how the functions would be implemented! + * + * first_min_element(first, last) + * Effect: std::min_element(first, last); + * + * first_min_element(first, last, comp) + * Effect: std::min_element(first, last, comp); + * + * last_min_element(first, last) + * Effect: reverse( std::min_element(reverse(last), reverse(first)) ); + * + * last_min_element(first, last, comp) + * Effect: reverse( std::min_element(reverse(last), reverse(first), comp) ); + * + * first_max_element(first, last) + * Effect: std::max_element(first, last); + * + * first_max_element(first, last, comp) + * Effect: max_element(first, last); + * + * last_max_element(first, last) + * Effect: reverse( std::max_element(reverse(last), reverse(first)) ); + * + * last_max_element(first, last, comp) + * Effect: reverse( std::max_element(reverse(last), reverse(first), comp) ); + * + * first_min_first_max_element(first, last) + * Effect: std::make_pair( first_min_element(first, last), + * first_max_element(first, last) ); + * + * first_min_first_max_element(first, last, comp) + * Effect: std::make_pair( first_min_element(first, last, comp), + * first_max_element(first, last, comp) ); + * + * first_min_last_max_element(first, last) + * Effect: std::make_pair( first_min_element(first, last), + * last_max_element(first, last) ); + * + * first_min_last_max_element(first, last, comp) + * Effect: std::make_pair( first_min_element(first, last, comp), + * last_max_element(first, last, comp) ); + * + * last_min_first_max_element(first, last) + * Effect: std::make_pair( last_min_element(first, last), + * first_max_element(first, last) ); + * + * last_min_first_max_element(first, last, comp) + * Effect: std::make_pair( last_min_element(first, last, comp), + * first_max_element(first, last, comp) ); + * + * last_min_last_max_element(first, last) + * Effect: std::make_pair( last_min_element(first, last), + * last_max_element(first, last) ); + * + * last_min_last_max_element(first, last, comp) + * Effect: std::make_pair( last_min_element(first, last, comp), + * last_max_element(first, last, comp) ); + */ + +namespace boost { + + // Min_element and max_element variants + + namespace detail { // common base for the overloads + + template + ForwardIter + basic_first_min_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) return last; + ForwardIter min_result = first; + while (++first != last) + if (comp(first, min_result)) + min_result = first; + return min_result; + } + + template + ForwardIter + basic_last_min_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) return last; + ForwardIter min_result = first; + while (++first != last) + if (!comp(min_result, first)) + min_result = first; + return min_result; + } + + template + ForwardIter + basic_first_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) return last; + ForwardIter max_result = first; + while (++first != last) + if (comp(max_result, first)) + max_result = first; + return max_result; + } + + template + ForwardIter + basic_last_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) return last; + ForwardIter max_result = first; + while (++first != last) + if (!comp(first, max_result)) + max_result = first; + return max_result; + } + + } // namespace detail + + template + ForwardIter + first_min_element(ForwardIter first, ForwardIter last) + { + return detail::basic_first_min_element(first, last, + detail::less_over_iter() ); + } + + template + ForwardIter + first_min_element(ForwardIter first, ForwardIter last, BinaryPredicate comp) + { + return detail::basic_first_min_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + + template + ForwardIter + last_min_element(ForwardIter first, ForwardIter last) + { + return detail::basic_last_min_element(first, last, + detail::less_over_iter() ); + } + + template + ForwardIter + last_min_element(ForwardIter first, ForwardIter last, BinaryPredicate comp) + { + return detail::basic_last_min_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + + template + ForwardIter + first_max_element(ForwardIter first, ForwardIter last) + { + return detail::basic_first_max_element(first, last, + detail::less_over_iter() ); + } + + template + ForwardIter + first_max_element(ForwardIter first, ForwardIter last, BinaryPredicate comp) + { + return detail::basic_first_max_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + + template + ForwardIter + last_max_element(ForwardIter first, ForwardIter last) + { + return detail::basic_last_max_element(first, last, + detail::less_over_iter() ); + } + + template + ForwardIter + last_max_element(ForwardIter first, ForwardIter last, BinaryPredicate comp) + { + return detail::basic_last_max_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + + + // Minmax_element variants -- comments removed + + namespace detail { + + template + std::pair + basic_first_min_last_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) + return std::make_pair(last,last); + + ForwardIter min_result = first; + ForwardIter max_result = first; + + ForwardIter second = ++first; + if (second == last) + return std::make_pair(min_result, max_result); + + if (comp(second, min_result)) + min_result = second; + else + max_result = second; + + first = ++second; if (first != last) ++second; + while (second != last) { + if (!comp(second, first)) { + if (comp(first, min_result)) + min_result = first; + if (!comp(second, max_result)) + max_result = second; + } else { + if (comp(second, min_result)) + min_result = second; + if (!comp(first, max_result)) + max_result = first; + } + first = ++second; if (first != last) ++second; + } + + if (first != last) { + if (comp(first, min_result)) + min_result = first; + else if (!comp(first, max_result)) + max_result = first; + } + + return std::make_pair(min_result, max_result); + } + + template + std::pair + basic_last_min_first_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) return std::make_pair(last,last); + + ForwardIter min_result = first; + ForwardIter max_result = first; + + ForwardIter second = ++first; + if (second == last) + return std::make_pair(min_result, max_result); + + if (comp(max_result, second)) + max_result = second; + else + min_result = second; + + first = ++second; if (first != last) ++second; + while (second != last) { + if (comp(first, second)) { + if (!comp(min_result, first)) + min_result = first; + if (comp(max_result, second)) + max_result = second; + } else { + if (!comp(min_result, second)) + min_result = second; + if (comp(max_result, first)) + max_result = first; + } + first = ++second; if (first != last) ++second; + } + + if (first != last) { + if (!comp(min_result, first)) + min_result = first; + else if (comp(max_result, first)) + max_result = first; + } + + return std::make_pair(min_result, max_result); + } + + template + std::pair + basic_last_min_last_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + if (first == last) return std::make_pair(last,last); + + ForwardIter min_result = first; + ForwardIter max_result = first; + + ForwardIter second = first; ++second; + if (second == last) + return std::make_pair(min_result,max_result); + + ForwardIter potential_max_result = last; + if (comp(first, second)) + max_result = second; + else { + min_result = second; + potential_max_result = second; + } + + first = ++second; if (first != last) ++second; + while (second != last) { + if (comp(first, second)) { + if (!comp(min_result, first)) + min_result = first; + if (!comp(second, max_result)) { + max_result = second; + potential_max_result = last; + } + } else { + if (!comp(min_result, second)) + min_result = second; + if (!comp(first, max_result)) { + max_result = first; + potential_max_result = second; + } + } + first = ++second; + if (first != last) ++second; + } + + if (first != last) { + if (!comp(min_result, first)) + min_result = first; + if (!comp(first, max_result)) { + max_result = first; + potential_max_result = last; + } + } + + if (potential_max_result != last + && !comp(potential_max_result, max_result)) + max_result = potential_max_result; + + return std::make_pair(min_result,max_result); + } + + } // namespace detail + + template + inline std::pair + first_min_first_max_element(ForwardIter first, ForwardIter last) + { + return minmax_element(first, last); + } + + template + inline std::pair + first_min_first_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + return minmax_element(first, last, comp); + } + + template + std::pair + first_min_last_max_element(ForwardIter first, ForwardIter last) + { + return detail::basic_first_min_last_max_element(first, last, + detail::less_over_iter() ); + } + + template + inline std::pair + first_min_last_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + return detail::basic_first_min_last_max_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + + template + std::pair + last_min_first_max_element(ForwardIter first, ForwardIter last) + { + return detail::basic_last_min_first_max_element(first, last, + detail::less_over_iter() ); + } + + template + inline std::pair + last_min_first_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + return detail::basic_last_min_first_max_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + + template + std::pair + last_min_last_max_element(ForwardIter first, ForwardIter last) + { + return detail::basic_last_min_last_max_element(first, last, + detail::less_over_iter() ); + } + + template + inline std::pair + last_min_last_max_element(ForwardIter first, ForwardIter last, + BinaryPredicate comp) + { + return detail::basic_last_min_last_max_element(first, last, + detail::binary_pred_over_iter(comp) ); + } + +} // namespace boost + +#endif // BOOST_ALGORITHM_MINMAX_ELEMENT_HPP diff --git a/boost/bind/bind.hpp b/boost/bind/bind.hpp index 1ccbc73..4cedc5e 100644 --- a/boost/bind/bind.hpp +++ b/boost/bind/bind.hpp @@ -2126,7 +2126,7 @@ template -# ifdef __cpp_noexcept_function_type +# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) # undef BOOST_BIND_NOEXCEPT # define BOOST_BIND_NOEXCEPT noexcept # include @@ -2187,7 +2187,7 @@ template #include -# ifdef __cpp_noexcept_function_type +# if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) # undef BOOST_BIND_MF_NOEXCEPT # define BOOST_BIND_MF_NOEXCEPT noexcept # include @@ -2292,7 +2292,7 @@ template< class R, class T > struct add_cref< R (T::*) () const, 1 > typedef void type; }; -#ifdef __cpp_noexcept_function_type +#if defined( __cpp_noexcept_function_type ) || defined( _NOEXCEPT_TYPES_SUPPORTED ) template< class R, class T > struct add_cref< R (T::*) () const noexcept, 1 > { diff --git a/boost/config/compiler/borland.hpp b/boost/config/compiler/borland.hpp index fa891de..cb164f8 100644 --- a/boost/config/compiler/borland.hpp +++ b/boost/config/compiler/borland.hpp @@ -174,6 +174,7 @@ #define BOOST_NO_CXX11_CONSTEXPR #define BOOST_NO_CXX11_DECLTYPE_N3276 #define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_MOVES #define BOOST_NO_CXX11_DELETED_FUNCTIONS #define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST @@ -238,6 +239,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH diff --git a/boost/config/compiler/clang.hpp b/boost/config/compiler/clang.hpp index 0fdf331..3d893c6 100644 --- a/boost/config/compiler/clang.hpp +++ b/boost/config/compiler/clang.hpp @@ -98,11 +98,15 @@ // // Dynamic shared object (DSO) and dynamic-link library (DLL) support // -#if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32) +#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) +# define BOOST_HAS_DECLSPEC +# define BOOST_SYMBOL_EXPORT __attribute__((__dllexport__)) +# define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__)) +#else # define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default"))) # define BOOST_SYMBOL_IMPORT -# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default"))) #endif +#define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default"))) // // The BOOST_FALLTHROUGH macro can be used to annotate implicit fall-through @@ -290,6 +294,10 @@ # define BOOST_NO_CXX17_STRUCTURED_BINDINGS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + // Clang 3.9+ in c++1z #if !__has_cpp_attribute(fallthrough) || __cplusplus < 201406L # define BOOST_NO_CXX17_INLINE_VARIABLES diff --git a/boost/config/compiler/codegear.hpp b/boost/config/compiler/codegear.hpp index 44ca842..c2cfe15 100644 --- a/boost/config/compiler/codegear.hpp +++ b/boost/config/compiler/codegear.hpp @@ -167,6 +167,10 @@ # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + // // TR1 macros: // diff --git a/boost/config/compiler/common_edg.hpp b/boost/config/compiler/common_edg.hpp index d49ceb6..88aba9a 100644 --- a/boost/config/compiler/common_edg.hpp +++ b/boost/config/compiler/common_edg.hpp @@ -149,6 +149,10 @@ # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + #ifdef c_plusplus // EDG has "long long" in non-strict mode // However, some libraries have insufficient "long long" support diff --git a/boost/config/compiler/cray.hpp b/boost/config/compiler/cray.hpp index 5f81078..412ef9e 100644 --- a/boost/config/compiler/cray.hpp +++ b/boost/config/compiler/cray.hpp @@ -1,68 +1,227 @@ -// (C) Copyright John Maddock 2011. -// (C) Copyright Cray, Inc. 2013 +// Copyright 2011 John Maddock +// Copyright 2013, 2017-2018 Cray, Inc. // 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) // See http://www.boost.org for most recent version. -// Greenhills C compiler setup: +// Cray C++ compiler setup. +// +// There are a few parameters that affect the macros defined in this file: +// +// - What version of CCE (Cray Compiling Environment) are we running? This +// comes from the '_RELEASE_MAJOR', '_RELEASE_MINOR', and +// '_RELEASE_PATCHLEVEL' macros. +// - What C++ standards conformance level are we using (e.g. '-h +// std=c++14')? This comes from the '__cplusplus' macro. +// - Are we using GCC extensions ('-h gnu' or '-h nognu')? If we have '-h +// gnu' then CCE emulates GCC, and the macros '__GNUC__', +// '__GNUC_MINOR__', and '__GNUC_PATCHLEVEL__' are defined. +// +// This file is organized as follows: +// +// - Verify that the combination of parameters listed above is supported. +// If we have an unsupported combination, we abort with '#error'. +// - Establish baseline values for all Boost macros. +// - Apply changes to the baseline macros based on compiler version. These +// changes are cummulative so each version section only describes the +// changes since the previous version. +// - Within each version section, we may also apply changes based on +// other parameters (i.e. C++ standards conformance level and GCC +// extensions). +// +// To test changes to this file: +// +// ``` +// module load cce/8.6.5 # Pick the version you want to test. +// cd boost/libs/config/test/all +// b2 -j 8 toolset=cray cxxstd=03 cxxstd=11 cxxstd=14 cxxstd-dialect=gnu linkflags=-lrt +// ``` +// Note: Using 'cxxstd-dialect=iso' is not supported at this time (the +// tests run, but many tests fail). +// +// Note: 'linkflags=-lrt' is needed in Cray Linux Environment. Otherwise +// you get an 'undefined reference to clock_gettime' error. +// +// Note: If a test '*_fail.cpp' file compiles, but fails to run, then it is +// reported as a defect. However, this is not actually a defect. This is an +// area where the test system is somewhat broken. Tests that are failing +// because of this problem are noted in the comments. +// +// Pay attention to the macro definitions for the macros you wish to +// modify. For example, only macros categorized as compiler macros should +// appear in this file; platform macros should not appear in this file. +// Also, some macros have to be defined to specific values; it is not +// always enough to define or undefine a macro. +// +// Macro definitions are available in the source code at: +// +// `boost/libs/config/doc/html/boost_config/boost_macro_reference.html` +// +// Macro definitions are also available online at: +// +// http://www.boost.org/doc/libs/master/libs/config/doc/html/boost_config/boost_macro_reference.html +// +// Typically, if you enable a feature, and the tests pass, then you have +// nothing to worry about. However, it's sometimes hard to figure out if a +// disabled feature needs to stay disabled. To get a list of disabled +// features, run 'b2' in 'boost/libs/config/checks'. These are the macros +// you should pay attention to (in addition to macros that cause test +// failures). -#define BOOST_COMPILER "Cray C version " BOOST_STRINGIZE(_RELEASE) +//// +//// Front matter +//// -#if _RELEASE_MAJOR < 8 +// In a developer build of the Cray compiler (i.e. a compiler built by a +// Cray employee), the release patch level is reported as "x". This gives +// versions that look like e.g. "8.6.x". +// +// To accomplish this, the the Cray compiler preprocessor inserts: +// +// #define _RELEASE_PATCHLEVEL x +// +// If we are using a developer build of the compiler, we want to use the +// configuration macros for the most recent patch level of the release. To +// accomplish this, we'll pretend that _RELEASE_PATCHLEVEL is 99. +// +// However, it's difficult to detect if _RELEASE_PATCHLEVEL is x. We must +// consider that the x will be expanded if x is defined as a macro +// elsewhere. For example, imagine if someone put "-D x=3" on the command +// line, and _RELEASE_PATCHLEVEL is x. Then _RELEASE_PATCHLEVEL would +// expand to 3, and we could not distinguish it from an actual +// _RELEASE_PATCHLEVEL of 3. This problem only affects developer builds; in +// production builds, _RELEASE_PATCHLEVEL is always an integer. +// +// IMPORTANT: In developer builds, if x is defined as a macro, you will get +// an incorrect configuration. The behavior in this case is undefined. +// +// Even if x is not defined, we have to use some trickery to detect if +// _RELEASE_PATCHLEVEL is x. First we define BOOST_CRAY_x to some arbitrary +// magic value, 9867657. Then we use BOOST_CRAY_APPEND to append the +// expanded value of _RELEASE_PATCHLEVEL to the string "BOOST_CRAY_". +// +// - If _RELEASE_PATCHLEVEL is undefined, we get "BOOST_CRAY_". +// - If _RELEASE_PATCHLEVEL is 5, we get "BOOST_CRAY_5". +// - If _RELEASE_PATCHLEVEL is x (and x is not defined) we get +// "BOOST_CRAY_x": +// +// Then we check if BOOST_CRAY_x is equal to the output of +// BOOST_CRAY_APPEND. In other words, the output of BOOST_CRAY_APPEND is +// treated as a macro name, and expanded again. If we can safely assume +// that BOOST_CRAY_ is not a macro defined as our magic number, and +// BOOST_CRAY_5 is not a macro defined as our magic number, then the only +// way the equality test can pass is if _RELEASE_PATCHLEVEL expands to x. +// +// So, that is how we detect if we are using a developer build of the Cray +// compiler. + +#define BOOST_CRAY_x 9867657 // Arbitrary number +#define BOOST_CRAY_APPEND(MACRO) BOOST_CRAY_APPEND_INTERNAL(MACRO) +#define BOOST_CRAY_APPEND_INTERNAL(MACRO) BOOST_CRAY_##MACRO + +#if BOOST_CRAY_x == BOOST_CRAY_APPEND(_RELEASE_PATCHLEVEL) + + // This is a developer build. + // + // - _RELEASE_PATCHLEVEL is defined as x, and x is not defined as a macro. + + // Pretend _RELEASE_PATCHLEVEL is 99, so we get the configuration for the + // most recent patch level in this release. + + #define BOOST_CRAY_VERSION (_RELEASE_MAJOR * 10000 + _RELEASE_MINOR * 100 + 99) + +#else + + // This is a production build. + // + // _RELEASE_PATCHLEVEL is not defined as x, or x is defined as a macro. + + #define BOOST_CRAY_VERSION (_RELEASE_MAJOR * 10000 + _RELEASE_MINOR * 100 + _RELEASE_PATCHLEVEL) + +#endif // BOOST_CRAY_x == BOOST_CRAY_APPEND(_RELEASE_PATCHLEVEL) + +#undef BOOST_CRAY_APPEND_INTERNAL +#undef BOOST_CRAY_APPEND +#undef BOOST_CRAY_x + + +#ifdef __GNUC__ +# define BOOST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) +#endif + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "Cray C++ version " BOOST_STRINGIZE(_RELEASE_MAJOR) "." BOOST_STRINGIZE(_RELEASE_MINOR) "." BOOST_STRINGIZE(_RELEASE_PATCHLEVEL) +#endif + +// Since the Cray compiler defines '__GNUC__', we have to emulate some +// additional GCC macros in order to make everything work. +// +// FIXME: Perhaps Cray should fix the compiler to define these additional +// macros for GCC emulation? + +#if __cplusplus >= 201103L && defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define __GXX_EXPERIMENTAL_CXX0X__ 1 +#endif + +//// +//// Parameter validation +//// + +// FIXME: Do we really need to support compilers before 8.5? Do they pass +// the Boost.Config tests? + +#if BOOST_CRAY_VERSION < 80000 # error "Boost is not configured for Cray compilers prior to version 8, please try the configure script." #endif -// -// Check this is a recent EDG based compiler, otherwise we don't support it here: -// -#ifndef __EDG_VERSION__ +// We only support recent EDG based compilers. + +#ifndef __EDG__ # error "Unsupported Cray compiler, please try running the configure script." #endif -#if _RELEASE_MINOR < 5 || __cplusplus < 201100 +//// +//// Baseline values +//// + #include -// -// -#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_HAS_NRVO +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION #define BOOST_NO_CXX11_AUTO_DECLARATIONS #define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS -#define BOOST_HAS_NRVO -#define BOOST_NO_CXX11_VARIADIC_MACROS -#define BOOST_NO_CXX11_VARIADIC_TEMPLATES -#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX -#define BOOST_NO_CXX11_UNICODE_LITERALS -#define BOOST_NO_TWO_PHASE_NAME_LOOKUP -#define BOOST_HAS_NRVO -#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 -#define BOOST_NO_CXX11_RAW_LITERALS -#define BOOST_NO_CXX11_NULLPTR -#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #define BOOST_NO_CXX11_LAMBDAS #define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS -#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_CXX11_DELETED_FUNCTIONS -#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS -#define BOOST_NO_CXX11_DECLTYPE_N3276 -#define BOOST_NO_CXX11_DECLTYPE -#define BOOST_NO_CXX11_CONSTEXPR -#define BOOST_NO_CXX11_USER_DEFINED_LITERALS -#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#define BOOST_NO_CXX11_CHAR32_T -#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS #define BOOST_NO_CXX11_REF_QUALIFIERS -#define BOOST_NO_CXX11_FINAL +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS +#define BOOST_NO_CXX11_SFINAE_EXPR +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES #define BOOST_NO_CXX11_THREAD_LOCAL - +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_USER_DEFINED_LITERALS +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP //#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG #define BOOST_MATH_DISABLE_STD_FPCLASSIFY @@ -71,15 +230,15 @@ #define BOOST_SP_USE_PTHREADS #define BOOST_AC_USE_PTHREADS -/* everything that follows is working around what are thought to be - * compiler shortcomings. Revist all of these regularly. - */ +// +// Everything that follows is working around what are thought to be +// compiler shortcomings. Revist all of these regularly. +// //#define BOOST_USE_ENUM_STATIC_ASSERT //#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS //(this may be implied by the previous #define -// These constants should be provided by the -// compiler, at least when -hgnu is asserted on the command line. +// These constants should be provided by the compiler. #ifndef __ATOMIC_RELAXED #define __ATOMIC_RELAXED 0 @@ -90,7 +249,55 @@ #define __ATOMIC_SEQ_CST 5 #endif -#else /* _RELEASE_MINOR */ +//// +//// Version changes +//// + +// +// 8.5.0 +// + +#if BOOST_CRAY_VERSION >= 80500 + +#if __cplusplus >= 201103L + +#undef BOOST_HAS_NRVO +#undef BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#undef BOOST_NO_CXX11_AUTO_DECLARATIONS +#undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#undef BOOST_NO_CXX11_CHAR16_T +#undef BOOST_NO_CXX11_CHAR32_T +#undef BOOST_NO_CXX11_CONSTEXPR +#undef BOOST_NO_CXX11_DECLTYPE +#undef BOOST_NO_CXX11_DECLTYPE_N3276 +#undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#undef BOOST_NO_CXX11_DELETED_FUNCTIONS +#undef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#undef BOOST_NO_CXX11_FINAL +#undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#undef BOOST_NO_CXX11_LAMBDAS +#undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#undef BOOST_NO_CXX11_NOEXCEPT +#undef BOOST_NO_CXX11_NULLPTR +#undef BOOST_NO_CXX11_RANGE_BASED_FOR +#undef BOOST_NO_CXX11_RAW_LITERALS +#undef BOOST_NO_CXX11_REF_QUALIFIERS +#undef BOOST_NO_CXX11_RVALUE_REFERENCES +#undef BOOST_NO_CXX11_SCOPED_ENUMS +#undef BOOST_NO_CXX11_SFINAE_EXPR +#undef BOOST_NO_CXX11_STATIC_ASSERT +#undef BOOST_NO_CXX11_TEMPLATE_ALIASES +#undef BOOST_NO_CXX11_THREAD_LOCAL +#undef BOOST_NO_CXX11_UNICODE_LITERALS +#undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#undef BOOST_NO_CXX11_USER_DEFINED_LITERALS +#undef BOOST_NO_CXX11_VARIADIC_MACROS +#undef BOOST_NO_CXX11_VARIADIC_TEMPLATES +#undef BOOST_NO_SFINAE_EXPR +#undef BOOST_NO_TWO_PHASE_NAME_LOOKUP +#undef BOOST_MATH_DISABLE_STD_FPCLASSIFY +#undef BOOST_SP_USE_PTHREADS +#undef BOOST_AC_USE_PTHREADS #define BOOST_HAS_VARIADIC_TMPL #define BOOST_HAS_UNISTD_H @@ -114,11 +321,120 @@ #define BOOST_HAS_LONG_LONG #define BOOST_HAS_FLOAT128 -#if __cplusplus < 201400 +#if __cplusplus < 201402L #define BOOST_NO_CXX11_DECLTYPE_N3276 -#endif /* __cpluspus */ +#endif // __cplusplus < 201402L -#endif /* _RELEASE_MINOR */ +#endif // __cplusplus >= 201103L +#endif // BOOST_CRAY_VERSION >= 80500 +// +// 8.6.4 +// (versions prior to 8.6.5 do not define _RELEASE_PATCHLEVEL) +// +#if BOOST_CRAY_VERSION >= 80600 + +#if __cplusplus >= 199711L +#define BOOST_HAS_FLOAT128 +#define BOOST_HAS_PTHREAD_YIELD // This is a platform macro, but it improves test results. +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION // This is correct. Test compiles, but fails to run. +#undef BOOST_NO_CXX11_CHAR16_T +#undef BOOST_NO_CXX11_CHAR32_T +#undef BOOST_NO_CXX11_INLINE_NAMESPACES +#undef BOOST_NO_CXX11_FINAL +#undef BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS +#undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_SFINAE_EXPR // This is correct, even though '*_fail.cpp' test fails. +#undef BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#undef BOOST_NO_CXX11_VARIADIC_MACROS +#undef BOOST_NO_CXX11_VARIADIC_TEMPLATES +// 'BOOST_NO_DEDUCED_TYPENAME' test is broken. The test files are enabled / +// disabled with an '#ifdef BOOST_DEDUCED_TYPENAME'. However, +// 'boost/libs/config/include/boost/config/detail/suffix.hpp' ensures that +// 'BOOST_DEDUCED_TYPENAME' is always defined (the value it is defined as +// depends on 'BOOST_NO_DEDUCED_TYPENAME'). So, modifying +// 'BOOST_NO_DEDUCED_TYPENAME' has no effect on which tests are run. +// +// The 'no_ded_typename_pass.cpp' test should always compile and run +// successfully, because 'BOOST_DEDUCED_TYPENAME' must always have an +// appropriate value (it's not just something that you turn on or off). +// Therefore, if you wish to test changes to 'BOOST_NO_DEDUCED_TYPENAME', +// you have to modify 'no_ded_typename_pass.cpp' to unconditionally include +// 'boost_no_ded_typename.ipp'. +#undef BOOST_NO_DEDUCED_TYPENAME // This is correct. Test is broken. +#undef BOOST_NO_SFINAE_EXPR +#undef BOOST_NO_TWO_PHASE_NAME_LOOKUP +#endif // __cplusplus >= 199711L + +#if __cplusplus >= 201103L +#undef BOOST_NO_CXX11_ALIGNAS +#undef BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_HDR_ATOMIC +#undef BOOST_NO_CXX11_HDR_FUNCTIONAL +#define BOOST_NO_CXX11_HDR_REGEX // This is correct. Test compiles, but fails to run. +#undef BOOST_NO_CXX11_SFINAE_EXPR +#undef BOOST_NO_CXX11_SMART_PTR +#undef BOOST_NO_CXX11_TRAILING_RESULT_TYPES +#endif // __cplusplus >= 201103L + +#if __cplusplus >= 201402L +#undef BOOST_NO_CXX14_CONSTEXPR +#define BOOST_NO_CXX14_DIGIT_SEPARATORS +#endif // __cplusplus == 201402L + +#endif // BOOST_CRAY_VERSION >= 80600 + +// +// 8.6.5 +// (no change from 8.6.4) +// + +// +// 8.7.0 +// + +#if BOOST_CRAY_VERSION >= 80700 + +#if __cplusplus >= 199711L +#endif // __cplusplus >= 199711L + +#if __cplusplus >= 201103L +#undef BOOST_NO_CXX11_HDR_ATOMIC +#undef BOOST_NO_CXX11_HDR_REGEX +#endif // __cplusplus >= 201103L + +#if __cplusplus >= 201402L +#endif // __cplusplus == 201402L + +#endif // BOOST_CRAY_VERSION >= 80700 + +// +// Next release +// + +#if BOOST_CRAY_VERSION > 80799 + +#if __cplusplus >= 199711L +#endif // __cplusplus >= 199711L + +#if __cplusplus >= 201103L +#endif // __cplusplus >= 201103L + +#if __cplusplus >= 201402L +#endif // __cplusplus == 201402L + +#endif // BOOST_CRAY_VERSION > 80799 + +//// +//// Remove temporary macros +//// + +// I've commented out some '#undef' statements to signify that we purposely +// want to keep certain macros. + +//#undef __GXX_EXPERIMENTAL_CXX0X__ +//#undef BOOST_COMPILER +#undef BOOST_GCC_VERSION +#undef BOOST_CRAY_VERSION diff --git a/boost/config/compiler/diab.hpp b/boost/config/compiler/diab.hpp index 0de72d0..943db83 100644 --- a/boost/config/compiler/diab.hpp +++ b/boost/config/compiler/diab.hpp @@ -12,8 +12,15 @@ #include "boost/config/compiler/common_edg.hpp" -#define BOOST_HAS_LONG_LONG #define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS + +#define BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE +#define BOOST_LOG_NO_MEMBER_TEMPLATE_FRIENDS +#define BOOST_REGEX_NO_EXTERNAL_TEMPLATES + #define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #define BOOST_NO_CXX11_HDR_CODECVT +#define BOOST_NO_CXX11_NUMERIC_LIMITS + #define BOOST_COMPILER "Wind River Diab " BOOST_STRINGIZE(__VERSION_NUMBER__) diff --git a/boost/config/compiler/digitalmars.hpp b/boost/config/compiler/digitalmars.hpp index e4c5afd..3e9a3ab 100644 --- a/boost/config/compiler/digitalmars.hpp +++ b/boost/config/compiler/digitalmars.hpp @@ -124,6 +124,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #if (__DMC__ <= 0x840) #error "Compiler not supported or configured - please reconfigure" diff --git a/boost/config/compiler/gcc.hpp b/boost/config/compiler/gcc.hpp index c67ab81..19ccc59 100644 --- a/boost/config/compiler/gcc.hpp +++ b/boost/config/compiler/gcc.hpp @@ -99,10 +99,10 @@ // Dynamic shared object (DSO) and dynamic-link library (DLL) support // #if __GNUC__ >= 4 -# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__) +# if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(__CYGWIN__) // All Win32 development environments, including 64-bit Windows and MinGW, define // _WIN32 or one of its variant spellings. Note that Cygwin is a POSIX environment, - // so does not define _WIN32 or its variants. + // so does not define _WIN32 or its variants, but still supports dllexport/dllimport. # define BOOST_HAS_DECLSPEC # define BOOST_SYMBOL_EXPORT __attribute__((__dllexport__)) # define BOOST_SYMBOL_IMPORT __attribute__((__dllimport__)) @@ -233,6 +233,7 @@ // #if (BOOST_GCC_VERSION < 40600) || !defined(BOOST_GCC_CXX11) #define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DEFAULTED_MOVES #define BOOST_NO_CXX11_NOEXCEPT #define BOOST_NO_CXX11_NULLPTR #define BOOST_NO_CXX11_RANGE_BASED_FOR @@ -284,7 +285,7 @@ #if !defined(__cpp_constexpr) || (__cpp_constexpr < 201304) # define BOOST_NO_CXX14_CONSTEXPR #endif -#if !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304) +#if (BOOST_GCC_VERSION < 50200) || !defined(__cpp_variable_templates) || (__cpp_variable_templates < 201304) # define BOOST_NO_CXX14_VARIABLE_TEMPLATES #endif @@ -298,6 +299,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #if __GNUC__ >= 7 # define BOOST_FALLTHROUGH __attribute__((fallthrough)) diff --git a/boost/config/compiler/gcc_xml.hpp b/boost/config/compiler/gcc_xml.hpp index 2b47585..bdba4ed 100644 --- a/boost/config/compiler/gcc_xml.hpp +++ b/boost/config/compiler/gcc_xml.hpp @@ -102,6 +102,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/boost/config/compiler/intel.hpp b/boost/config/compiler/intel.hpp index 00396b0..0eea05b 100644 --- a/boost/config/compiler/intel.hpp +++ b/boost/config/compiler/intel.hpp @@ -45,6 +45,7 @@ #undef BOOST_GCC_VERSION #undef BOOST_GCC_CXX11 +#undef BOOST_GCC // Broken in all versions up to 17 (newer versions not tested) #if (__INTEL_COMPILER <= 1700) && !defined(BOOST_NO_CXX14_CONSTEXPR) diff --git a/boost/config/compiler/metrowerks.hpp b/boost/config/compiler/metrowerks.hpp index 99ff0f5..4bfc01e 100644 --- a/boost/config/compiler/metrowerks.hpp +++ b/boost/config/compiler/metrowerks.hpp @@ -167,6 +167,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/boost/config/compiler/mpw.hpp b/boost/config/compiler/mpw.hpp index d954434..2292ada 100644 --- a/boost/config/compiler/mpw.hpp +++ b/boost/config/compiler/mpw.hpp @@ -116,6 +116,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif // // versions check: diff --git a/boost/config/compiler/nvcc.hpp b/boost/config/compiler/nvcc.hpp index f21b9b5..ed035fc 100644 --- a/boost/config/compiler/nvcc.hpp +++ b/boost/config/compiler/nvcc.hpp @@ -12,7 +12,7 @@ #endif #if defined(__CUDACC_VER_MAJOR__) && defined(__CUDACC_VER_MINOR__) && defined(__CUDACC_VER_BUILD__) -# define BOOST_CUDA_VERSION __CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__ +# define BOOST_CUDA_VERSION (__CUDACC_VER_MAJOR__ * 1000000 + __CUDACC_VER_MINOR__ * 10000 + __CUDACC_VER_BUILD__) #else // We don't really know what the CUDA version is, but it's definitely before 7.5: # define BOOST_CUDA_VERSION 7000000 @@ -33,8 +33,8 @@ #if (BOOST_CUDA_VERSION > 8000000) && (BOOST_CUDA_VERSION < 8010000) # define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif -// Most recent CUDA (8.0) has no constexpr support in msvc mode: -#if defined(_MSC_VER) +// CUDA (8.0) has no constexpr support in msvc mode: +#if defined(_MSC_VER) && (BOOST_CUDA_VERSION < 9000000) # define BOOST_NO_CXX11_CONSTEXPR #endif diff --git a/boost/config/compiler/pathscale.hpp b/boost/config/compiler/pathscale.hpp index 94b3f91..1318d27 100644 --- a/boost/config/compiler/pathscale.hpp +++ b/boost/config/compiler/pathscale.hpp @@ -129,4 +129,7 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif #endif diff --git a/boost/config/compiler/sunpro_cc.hpp b/boost/config/compiler/sunpro_cc.hpp index 54ad77a..41b7bca 100644 --- a/boost/config/compiler/sunpro_cc.hpp +++ b/boost/config/compiler/sunpro_cc.hpp @@ -182,6 +182,9 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif // Turn on threading support for Solaris 12. // Ticket #11972 diff --git a/boost/config/compiler/vacpp.hpp b/boost/config/compiler/vacpp.hpp index c8400a3..cabe844 100644 --- a/boost/config/compiler/vacpp.hpp +++ b/boost/config/compiler/vacpp.hpp @@ -178,3 +178,6 @@ #if !defined(__cpp_fold_expressions) || (__cpp_fold_expressions < 201603) # define BOOST_NO_CXX17_FOLD_EXPRESSIONS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif diff --git a/boost/config/compiler/visualc.hpp b/boost/config/compiler/visualc.hpp index d946561..ded7284 100644 --- a/boost/config/compiler/visualc.hpp +++ b/boost/config/compiler/visualc.hpp @@ -167,6 +167,7 @@ // #if (_MSC_FULL_VER < 190023026) # define BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NO_CXX11_DEFAULTED_MOVES # define BOOST_NO_CXX11_REF_QUALIFIERS # define BOOST_NO_CXX11_USER_DEFINED_LITERALS # define BOOST_NO_CXX11_ALIGNAS @@ -200,6 +201,7 @@ // #if (_MSC_VER < 1911) || (_MSVC_LANG < 201703) # define BOOST_NO_CXX17_STRUCTURED_BINDINGS +# define BOOST_NO_CXX17_IF_CONSTEXPR #endif // MSVC including version 14 has not yet completely @@ -217,17 +219,29 @@ // https://connect.microsoft.com/VisualStudio/feedback/details/1582233/c-subobjects-still-not-value-initialized-correctly // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) +// Still present in VC15.5, Dec 2017. #define BOOST_NO_COMPLETE_VALUE_INITIALIZATION // // C++ 11: // -#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +// This is supported with /permissive- for 15.5 onwards, unfortunately we appear to have no way to tell +// if this is in effect or not, in any case nothing in Boost is currently using this, so we'll just go +// on defining it for now: +// +# define BOOST_NO_TWO_PHASE_NAME_LOOKUP + +#if (_MSC_VER < 1912) || (_MSVC_LANG < 201402) +// Supported from msvc-15.5 onwards: #define BOOST_NO_CXX11_SFINAE_EXPR +#endif // C++ 14: +// Still gives internal compiler error for msvc-15.5: # define BOOST_NO_CXX14_CONSTEXPR // C++ 17: +#if (_MSC_VER < 1912) || (_MSVC_LANG < 201703) #define BOOST_NO_CXX17_INLINE_VARIABLES #define BOOST_NO_CXX17_FOLD_EXPRESSIONS +#endif // // Things that don't work in clr mode: @@ -325,12 +339,17 @@ # define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) #endif +#include + // -// last known and checked version is 19.11.25547 (VC++ 2017.4): -#if (_MSC_VER > 1911) +// last known and checked version is 19.12.25830.2 (VC++ 2017.3): +#if (_MSC_VER > 1912) # if defined(BOOST_ASSERT_CONFIG) # error "Boost.Config is older than your current compiler version." # elif !defined(BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE) -# pragma message("Info: Boost.Config is older than your compiler version - probably nothing bad will happen - but you may wish to look for an update Boost version. Define BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE to suppress this message.") + // + // Disabled as of March 2018 - the pace of VS releases is hard to keep up with + // and in any case, we have relatively few defect macros defined now. + // BOOST_PRAGMA_MESSAGE("Info: Boost.Config is older than your compiler version - probably nothing bad will happen - but you may wish to look for an updated Boost version. Define BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE to suppress this message.") # endif #endif diff --git a/boost/config/compiler/xlcpp.hpp b/boost/config/compiler/xlcpp.hpp index a4c66e4..ee7aa12 100644 --- a/boost/config/compiler/xlcpp.hpp +++ b/boost/config/compiler/xlcpp.hpp @@ -246,6 +246,10 @@ # define BOOST_NO_CXX17_STRUCTURED_BINDINGS #endif +#if !defined(__cpp_if_constexpr) || (__cpp_if_constexpr < 201606) +# define BOOST_NO_CXX17_IF_CONSTEXPR +#endif + // Clang 3.9+ in c++1z #if !__has_cpp_attribute(fallthrough) || __cplusplus < 201406L # define BOOST_NO_CXX17_INLINE_VARIABLES diff --git a/boost/config/compiler/xlcpp_zos.hpp b/boost/config/compiler/xlcpp_zos.hpp index bc785b8..eb1bf2e 100644 --- a/boost/config/compiler/xlcpp_zos.hpp +++ b/boost/config/compiler/xlcpp_zos.hpp @@ -153,6 +153,7 @@ #define BOOST_NO_CXX17_STRUCTURED_BINDINGS #define BOOST_NO_CXX17_INLINE_VARIABLES #define BOOST_NO_CXX17_FOLD_EXPRESSIONS +#define BOOST_NO_CXX17_IF_CONSTEXPR // ------------------------------------- diff --git a/boost/config/detail/suffix.hpp b/boost/config/detail/suffix.hpp index caa0b22..22d31f6 100644 --- a/boost/config/detail/suffix.hpp +++ b/boost/config/detail/suffix.hpp @@ -537,25 +537,10 @@ namespace std{ using ::type_info; } // ---------------------------------------------------------------------------// -// // Helper macro BOOST_STRINGIZE: -// Converts the parameter X to a string after macro replacement -// on X has been performed. -// -#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) -#define BOOST_DO_STRINGIZE(X) #X - -// // Helper macro BOOST_JOIN: -// The following piece of macro magic joins the two -// arguments together, even when one of the arguments is -// itself a macro (see 16.3.1 in C++ standard). The key -// is that macro expansion of macro arguments does not -// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. -// -#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) -#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) -#define BOOST_DO_JOIN2( X, Y ) X##Y + +#include // // Set some default values for compiler/library/platform names. @@ -702,6 +687,11 @@ namespace std{ using ::type_info; } # define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS #endif +// Lack of defaulted moves is implied by the lack of either rvalue references or any defaulted functions +#if !defined(BOOST_NO_CXX11_DEFAULTED_MOVES) && (defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_RVALUE_REFERENCES)) +# define BOOST_NO_CXX11_DEFAULTED_MOVES +#endif + // Defaulted and deleted function declaration helpers // These macros are intended to be inside a class definition. // BOOST_DEFAULTED_FUNCTION accepts the function declaration and its diff --git a/boost/config/header_deprecated.hpp b/boost/config/header_deprecated.hpp new file mode 100644 index 0000000..864554f --- /dev/null +++ b/boost/config/header_deprecated.hpp @@ -0,0 +1,26 @@ +#ifndef BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED +#define BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED + +// Copyright 2017 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 +// +// BOOST_HEADER_DEPRECATED("") +// +// Expands to the equivalent of +// BOOST_PRAGMA_MESSAGE("This header is deprecated. Use instead.") +// +// Note that this header is C compatible. + +#include + +#if defined(BOOST_ALLOW_DEPRECATED_HEADERS) +# define BOOST_HEADER_DEPRECATED(a) +#else +# define BOOST_HEADER_DEPRECATED(a) BOOST_PRAGMA_MESSAGE("This header is deprecated. Use " a " instead.") +#endif + +#endif // BOOST_CONFIG_HEADER_DEPRECATED_HPP_INCLUDED diff --git a/boost/config/helper_macros.hpp b/boost/config/helper_macros.hpp new file mode 100644 index 0000000..3e79526 --- /dev/null +++ b/boost/config/helper_macros.hpp @@ -0,0 +1,37 @@ +#ifndef BOOST_CONFIG_HELPER_MACROS_HPP_INCLUDED +#define BOOST_CONFIG_HELPER_MACROS_HPP_INCLUDED + +// Copyright 2001 John Maddock. +// Copyright 2017 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 +// +// BOOST_STRINGIZE(X) +// BOOST_JOIN(X, Y) +// +// Note that this header is C compatible. + +// +// Helper macro BOOST_STRINGIZE: +// Converts the parameter X to a string after macro replacement +// on X has been performed. +// +#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) +#define BOOST_DO_STRINGIZE(X) #X + +// +// Helper macro BOOST_JOIN: +// The following piece of macro magic joins the two +// arguments together, even when one of the arguments is +// itself a macro (see 16.3.1 in C++ standard). The key +// is that macro expansion of macro arguments does not +// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. +// +#define BOOST_JOIN(X, Y) BOOST_DO_JOIN(X, Y) +#define BOOST_DO_JOIN(X, Y) BOOST_DO_JOIN2(X,Y) +#define BOOST_DO_JOIN2(X, Y) X##Y + +#endif // BOOST_CONFIG_HELPER_MACROS_HPP_INCLUDED diff --git a/boost/config/platform/cygwin.hpp b/boost/config/platform/cygwin.hpp index 8ecc4a4..6dd7e57 100644 --- a/boost/config/platform/cygwin.hpp +++ b/boost/config/platform/cygwin.hpp @@ -38,10 +38,21 @@ #ifdef _STDINT_H #define BOOST_HAS_STDINT_H #endif +#if __GNUC__ > 5 && !defined(BOOST_HAS_STDINT_H) +# define BOOST_HAS_STDINT_H +#endif /// Cygwin has no fenv.h #define BOOST_NO_FENV_H +// Cygwin has it's own which breaks unless the correct compiler flags are used: +#ifndef BOOST_NO_CXX14_HDR_SHARED_MUTEX +#include +#if !(__XSI_VISIBLE >= 500 || __POSIX_VISIBLE >= 200112) +# define BOOST_NO_CXX14_HDR_SHARED_MUTEX +#endif +#endif + // boilerplate code: #include diff --git a/boost/config/platform/vxworks.hpp b/boost/config/platform/vxworks.hpp index a7f571c..a91e4ab 100644 --- a/boost/config/platform/vxworks.hpp +++ b/boost/config/platform/vxworks.hpp @@ -1,30 +1,50 @@ // (C) Copyright Dustin Spicuzza 2009. // Adapted to vxWorks 6.9 by Peter Brockamp 2012. +// Updated for VxWorks 7 by Brian Kuhl 2016 // 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) // See http://www.boost.org for most recent version. -// Since WRS does not yet properly support boost under vxWorks -// and this file was badly outdated, but I was keen on using it, -// I patched boost myself to make things work. This has been tested -// and adapted by me for vxWorks 6.9 *only*, as I'm lacking access -// to earlier 6.X versions! The only thing I know for sure is that -// very old versions of vxWorks (namely everything below 6.x) are -// absolutely unable to use boost. This is mainly due to the completely -// outdated libraries and ancient compiler (GCC 2.96 or worse). Do -// not even think of getting this to work, a miserable failure will -// be guaranteed! +// Old versions of vxWorks (namely everything below 6.x) are +// absolutely unable to use boost. Old STLs and compilers +// 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 library similar to those -// of vxWorks 5.X - with all its limitations and incompatibilities -// with respect to ANSI C++ and STL. So probably there might be problems -// with the usage of boost from DKMs. WRS or any voluteers are free to -// prove the opposite! - +// 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 +// 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: @@ -38,29 +58,14 @@ // Now, VxWorks POSIX-semaphores for DKM's default to the usage of // priority inverting semaphores, which is fine. On the other hand, // for RTP's it defaults to using non priority inverting semaphores, -// which could easily pose a serious problem for a real time process, -// i.e. deadlocks! To overcome this two possibilities do exist: +// which could easily pose a serious problem for a real time process. // -// a) Patch every piece of boost that uses semaphores to instanciate -// the proper type of semaphores. This is non-intrusive with respect -// to the OS and could relatively easy been done by giving all -// semaphores attributes deviating from the default (for in-depth -// information see the POSIX functions pthread_mutexattr_init() -// and pthread_mutexattr_setprotocol()). However this breaks all -// too easily, as with every new version some boost library could -// all in a sudden start using semaphores, resurrecting the very -// same, hard to locate problem over and over again! -// -// b) We could change the default properties for POSIX-semaphores -// that VxWorks uses for RTP's and this is being suggested here, -// as it will more or less seamlessly integrate with boost. I got -// the following information from WRS how to do this, compare -// Wind River TSR# 1209768: -// -// Instructions for changing the default properties of POSIX- -// semaphores for RTP's in VxWorks 6.9: -// - Edit the file /vxworks-6.9/target/usr/src/posix/pthreadLib.c -// in the root of your Workbench-installation. +// To change the default properties for POSIX-semaphores in VxWorks 7 +// enable core > CORE_USER Menu > DEFAULT_PTHREAD_PRIO_INHERIT +// +// In VxWorks 6.x so as to integrate with boost. +// - Edit the file +// installDir/vxworks-6.x/target/usr/src/posix/pthreadLib.c // - Around line 917 there should be the definition of the default // mutex attributes: // @@ -81,30 +86,11 @@ // pAttr->mutexAttrType = PTHREAD_MUTEX_DEFAULT; // // Here again, replace PTHREAD_PRIO_NONE by PTHREAD_PRIO_INHERIT. -// - Finally, rebuild your VSB. This will create a new VxWorks kernel +// - Finally, rebuild your VSB. This will rebuild the libraries // with the changed properties. That's it! Now, using boost should // no longer cause any problems with task deadlocks! // -// And here's another useful piece of information concerning VxWorks' -// POSIX-functionality in general: -// VxWorks is not a genuine POSIX-OS in itself, rather it is using a -// kind of compatibility layer (sort of a wrapper) to emulate the -// POSIX-functionality by using its own resources and functions. -// At the time a task (thread) calls it's first POSIX-function during -// runtime it is being transformed by the OS into a POSIX-thread. -// This transformation does include a call to malloc() to allocate the -// memory required for the housekeeping of POSIX-threads. In a high -// priority RTP this malloc() call may be highly undesirable, as its -// timing is more or less unpredictable (depending on what your actual -// heap looks like). You can circumvent this problem by calling the -// function thread_self() at a well defined point in the code of the -// task, e.g. shortly after the task spawns up. Thereby you are able -// to define the time when the task-transformation will take place and -// you could shift it to an uncritical point where a malloc() call is -// tolerable. So, if this could pose a problem for your code, remember -// to call thread_self() from the affected task at an early stage. -// -// ==================================================================== +// ==================================================================== // Block out all versions before vxWorks 6.x, as these don't work: // Include header with the vxWorks version information and query them @@ -158,11 +144,6 @@ #define BOOST_HAS_CLOCK_GETTIME #define BOOST_HAS_MACRO_USE_FACET -// Generally unavailable functionality, delivered by boost's test function: -//#define BOOST_NO_DEDUCED_TYPENAME // Commented this out, boost's test gives an errorneous result! -#define BOOST_NO_CXX11_EXTERN_TEMPLATE -#define BOOST_NO_CXX11_VARIADIC_MACROS - // Generally available threading API's: #define BOOST_HAS_PTHREADS #define BOOST_HAS_SCHED_YIELD @@ -191,14 +172,7 @@ # endif #endif -// vxWorks doesn't work with asio serial ports: -#define BOOST_ASIO_DISABLE_SERIAL_PORT -// TODO: The problem here seems to bee that vxWorks uses its own, very specific -// ways to handle serial ports, incompatible with POSIX or anything... -// Maybe a specific implementation would be possible, but until the -// straight need arises... This implementation would presumably consist -// of some vxWorks specific ioctl-calls, etc. Any voluteers? - +#if (_WRS_VXWORKS_MAJOR < 7) // vxWorks-around: #defines CLOCKS_PER_SEC as sysClkRateGet() but // miserably fails to #include the required to make // sysClkRateGet() available! So we manually include it here. @@ -208,11 +182,12 @@ #endif // vxWorks-around: In the macros INT32_C(), UINT32_C(), INT64_C() and -// UINT64_C() are defined errorneously, yielding not a signed/ +// UINT64_C() are defined erroneously, yielding not a signed/ // unsigned long/long long type, but a signed/unsigned int/long // type. Eventually this leads to compile errors in ratio_fwd.hpp, // when trying to define several constants which do not fit into a // long type! We correct them here by redefining. + #include // Some macro-magic to do the job @@ -231,12 +206,16 @@ #define UINT64_C(x) VX_JOIN(x, ULL) // #include Libraries required for the following function adaption +#include +#endif // _WRS_VXWORKS_MAJOR < 7 + #include #include -#include // Use C-linkage for the following helper functions +#ifdef __cplusplus extern "C" { +#endif // vxWorks-around: The required functions getrlimit() and getrlimit() are missing. // But we have the similar functions getprlimit() and setprlimit(), @@ -248,7 +227,7 @@ extern "C" { // TODO: getprlimit() and setprlimit() do exist for RTPs only, for whatever reason. // Thus for DKMs there would have to be another implementation. -#ifdef __RTP__ +#if defined ( __RTP__) && (_WRS_VXWORKS_MAJOR < 7) inline int getrlimit(int resource, struct rlimit *rlp){ return getprlimit(0, 0, resource, rlp); } @@ -273,14 +252,20 @@ inline int truncate(const char *p, off_t l){ return close(fd); } +#ifdef __GNUC__ +#define ___unused __attribute__((unused)) +#else +#define ___unused +#endif + // Fake symlink handling by dummy functions: -inline int symlink(const char*, const char*){ +inline int symlink(const char* path1 ___unused, const char* path2 ___unused){ // vxWorks has no symlinks -> always return an error! errno = EACCES; return -1; } -inline ssize_t readlink(const char*, char*, size_t){ +inline ssize_t readlink(const char* path1 ___unused, char* path2 ___unused, size_t size ___unused){ // vxWorks has no symlinks -> always return an error! errno = EACCES; return -1; @@ -297,8 +282,18 @@ inline int gettimeofday(struct timeval *tv, void * /*tzv*/) { } #endif +#ifdef __cplusplus +} // extern "C" +#endif -// vxWorks does provide neither struct tms nor function times()! +/* + * moved to os/utils/unix/freind_h/times.h in VxWorks 7 + * to avoid conflict with MPL operator times + */ +#if (_WRS_VXWORKS_MAJOR < 7) +#ifdef __cplusplus + +// vxWorks provides neither struct tms nor function times()! // We implement an empty dummy-function, simply setting the user // and system time to the half of thew actual system ticks-value // and the child user and system time to 0. @@ -315,7 +310,8 @@ struct tms{ clock_t tms_cstime; // System CPU time of terminated child processes }; -inline clock_t times(struct tms *t){ + + inline clock_t times(struct tms *t){ struct timespec ts; clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); clock_t ticks(static_cast(static_cast(ts.tv_sec) * CLOCKS_PER_SEC + @@ -327,8 +323,16 @@ inline clock_t times(struct tms *t){ return ticks; } -extern void bzero (void *, size_t); // FD_ZERO uses bzero() but doesn't include strings.h -} // extern "C" + +namespace std { + using ::times; +} +#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 // Put the selfmade functions into the std-namespace, just in case namespace std { @@ -339,9 +343,11 @@ namespace std { using ::truncate; using ::symlink; using ::readlink; - using ::times; - using ::gettimeofday; +#if (_WRS_VXWORKS_MAJOR < 7) + using ::gettimeofday; +#endif } +#endif // __cplusplus // Some more macro-magic: // vxWorks-around: Some functions are not present or broken in vxWorks @@ -349,12 +355,13 @@ namespace std { // Include signal.h which might contain a typo to be corrected here #include - -inline int getpagesize() { return sysconf(_SC_PAGESIZE); } // getpagesize is deprecated anyway! +#if (_WRS_VXWORKS_MAJOR < 7) +#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 -inline int lstat(p, b) { return stat(p, b); } // lstat() == stat(), as vxWorks has no symlinks! #ifndef FPE_FLTINV # define FPE_FLTINV (FPE_FLTSUB+1) // vxWorks has no FPE_FLTINV, so define one as a dummy #endif @@ -371,22 +378,56 @@ 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 Dinkum STL version and GCC version (or ICC and DCC) - +// by examining the Dinkum STL version and GCC version (or ICC and DCC) #ifndef _WRS_CONFIG_LANG_LIB_CPLUS_CPLUS_USER_2011 +# define BOOST_NO_CXX11_ADDRESSOF // C11 addressof operator on memory location +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_NUMERIC_LIMITS // max_digits10 in test/../print_helper.hpp +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_STD_ALIGN + + # define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST //serialization/test/test_list.cpp +# define BOOST_NO_CXX11_HDR_FUNCTIONAL +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM //math/../test_data.hpp +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX14_HDR_SHARED_MUTEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD # define BOOST_NO_CXX11_HDR_TYPEINDEX # define BOOST_NO_CXX11_HDR_TYPE_TRAITS # define BOOST_NO_CXX11_HDR_TUPLE -# define BOOST_NO_CXX11_ALLOCATOR -# define BOOST_NO_CXX11_SMART_PTR -# define BOOST_NO_CXX11_STD_ALIGN -# define BOOST_NO_CXX11_HDR_UNORDERED_SET -# define BOOST_NO_CXX11_HDR_TYPE_TRAITS # define BOOST_NO_CXX11_HDR_UNORDERED_MAP -# define BOOST_NO_CXX11_HDR_FUNCTIONAL -# define BOOST_NO_CXX11_HDR_ATOMIC +# define BOOST_NO_CXX11_HDR_UNORDERED_SET #else -# define BOOST_NO_CXX11_NULLPTR +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED // workaround link error in spirit +#endif #endif + +// NONE is used in enums in lamda and other libraries +#undef NONE +// restrict is an iostreams class +#undef restrict + +// use fake poll() from Unix layer in ASIO to get full functionality +// most libraries will use select() but this define allows 'iostream' functionality +// which is based on poll() only +#if (_WRS_VXWORKS_MAJOR > 6) +# ifndef BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR +# define BOOST_ASIO_HAS_POSIX_STREAM_DESCRIPTOR +# endif +#else +# define BOOST_ASIO_DISABLE_SERIAL_PORT +#endif + + diff --git a/boost/config/posix_features.hpp b/boost/config/posix_features.hpp deleted file mode 100644 index d129547..0000000 --- a/boost/config/posix_features.hpp +++ /dev/null @@ -1,95 +0,0 @@ -// (C) Copyright John Maddock 2001 - 2003. -// 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) - - -// See http://www.boost.org for most recent version. - -// All POSIX feature tests go in this file, -// Note that we test _POSIX_C_SOURCE and _XOPEN_SOURCE as well -// _POSIX_VERSION and _XOPEN_VERSION: on some systems POSIX API's -// may be present but none-functional unless _POSIX_C_SOURCE and -// _XOPEN_SOURCE have been defined to the right value (it's up -// to the user to do this *before* including any header, although -// in most cases the compiler will do this for you). - -# if defined(BOOST_HAS_UNISTD_H) -# include - - // XOpen has , but is this the correct version check? -# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION >= 3) -# define BOOST_HAS_NL_TYPES_H -# endif - - // POSIX version 6 requires -# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 200100) -# define BOOST_HAS_STDINT_H -# endif - - // POSIX version 2 requires -# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199009L) -# define BOOST_HAS_DIRENT_H -# endif - - // POSIX version 3 requires to have sigaction: -# if defined(_POSIX_VERSION) && (_POSIX_VERSION >= 199506L) -# define BOOST_HAS_SIGACTION -# endif - // POSIX defines _POSIX_THREADS > 0 for pthread support, - // however some platforms define _POSIX_THREADS without - // a value, hence the (_POSIX_THREADS+0 >= 0) check. - // Strictly speaking this may catch platforms with a - // non-functioning stub , but such occurrences should - // occur very rarely if at all. -# if defined(_POSIX_THREADS) && (_POSIX_THREADS+0 >= 0) && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_MPTASKS) -# define BOOST_HAS_PTHREADS -# endif - - // BOOST_HAS_NANOSLEEP: - // This is predicated on _POSIX_TIMERS or _XOPEN_REALTIME: -# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) \ - || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) -# define BOOST_HAS_NANOSLEEP -# endif - - // BOOST_HAS_CLOCK_GETTIME: - // This is predicated on _POSIX_TIMERS (also on _XOPEN_REALTIME - // but at least one platform - linux - defines that flag without - // defining clock_gettime): -# if (defined(_POSIX_TIMERS) && (_POSIX_TIMERS+0 >= 0)) -# define BOOST_HAS_CLOCK_GETTIME -# endif - - // BOOST_HAS_SCHED_YIELD: - // This is predicated on _POSIX_PRIORITY_SCHEDULING or - // on _POSIX_THREAD_PRIORITY_SCHEDULING or on _XOPEN_REALTIME. -# if defined(_POSIX_PRIORITY_SCHEDULING) && (_POSIX_PRIORITY_SCHEDULING+0 > 0)\ - || (defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING+0 > 0))\ - || (defined(_XOPEN_REALTIME) && (_XOPEN_REALTIME+0 >= 0)) -# define BOOST_HAS_SCHED_YIELD -# endif - - // BOOST_HAS_GETTIMEOFDAY: - // BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE: - // These are predicated on _XOPEN_VERSION, and appears to be first released - // in issue 4, version 2 (_XOPEN_VERSION > 500). - // Likewise for the functions log1p and expm1. -# if defined(_XOPEN_VERSION) && (_XOPEN_VERSION+0 >= 500) -# define BOOST_HAS_GETTIMEOFDAY -# if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE+0 >= 500) -# define BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE -# endif -# ifndef BOOST_HAS_LOG1P -# define BOOST_HAS_LOG1P -# endif -# ifndef BOOST_HAS_EXPM1 -# define BOOST_HAS_EXPM1 -# endif -# endif - -# endif - - - - diff --git a/boost/config/pragma_message.hpp b/boost/config/pragma_message.hpp new file mode 100644 index 0000000..b2c5ff2 --- /dev/null +++ b/boost/config/pragma_message.hpp @@ -0,0 +1,31 @@ +#ifndef BOOST_CONFIG_PRAGMA_MESSAGE_HPP_INCLUDED +#define BOOST_CONFIG_PRAGMA_MESSAGE_HPP_INCLUDED + +// Copyright 2017 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 +// +// BOOST_PRAGMA_MESSAGE("message") +// +// Expands to the equivalent of #pragma message("message") +// +// Note that this header is C compatible. + +#include + +#if defined(BOOST_DISABLE_PRAGMA_MESSAGE) +# define BOOST_PRAGMA_MESSAGE(x) +#elif defined(__INTEL_COMPILER) +# define BOOST_PRAGMA_MESSAGE(x) __pragma(message(__FILE__ "(" BOOST_STRINGIZE(__LINE__) "): note: " x)) +#elif defined(__GNUC__) +# define BOOST_PRAGMA_MESSAGE(x) _Pragma(BOOST_STRINGIZE(message(x))) +#elif defined(_MSC_VER) +# define BOOST_PRAGMA_MESSAGE(x) __pragma(message(__FILE__ "(" BOOST_STRINGIZE(__LINE__) "): note: " x)) +#else +# define BOOST_PRAGMA_MESSAGE(x) +#endif + +#endif // BOOST_CONFIG_PRAGMA_MESSAGE_HPP_INCLUDED diff --git a/boost/config/select_compiler_config.hpp b/boost/config/select_compiler_config.hpp deleted file mode 100644 index 7a75708..0000000 --- a/boost/config/select_compiler_config.hpp +++ /dev/null @@ -1,148 +0,0 @@ -// Boost compiler configuration selection header file - -// (C) Copyright John Maddock 2001 - 2003. -// (C) Copyright Martin Wille 2003. -// (C) Copyright Guillaume Melquiond 2003. -// -// 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. - -// locate which compiler we are using and define -// BOOST_COMPILER_CONFIG as needed: - -#if defined __CUDACC__ -// NVIDIA CUDA C++ compiler for GPU -# include "boost/config/compiler/nvcc.hpp" - -#endif - -#if defined(__GCCXML__) -// GCC-XML emulates other compilers, it has to appear first here! -# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" - -#elif defined(_CRAYC) -// EDG based Cray compiler: -# define BOOST_COMPILER_CONFIG "boost/config/compiler/cray.hpp" - -#elif defined __COMO__ -// Comeau C++ -# define BOOST_COMPILER_CONFIG "boost/config/compiler/comeau.hpp" - -#elif defined(__PATHSCALE__) && (__PATHCC__ >= 4) -// PathScale EKOPath compiler (has to come before clang and gcc) -# define BOOST_COMPILER_CONFIG "boost/config/compiler/pathscale.hpp" - -#elif defined(__INTEL_COMPILER) || defined(__ICL) || defined(__ICC) || defined(__ECC) -// Intel -# define BOOST_COMPILER_CONFIG "boost/config/compiler/intel.hpp" - -#elif defined __clang__ && !defined(__CUDACC__) && !defined(__ibmxl__) -// when using clang and cuda at same time, you want to appear as gcc -// Clang C++ emulates GCC, so it has to appear early. -# define BOOST_COMPILER_CONFIG "boost/config/compiler/clang.hpp" - -#elif defined __DMC__ -// Digital Mars C++ -# define BOOST_COMPILER_CONFIG "boost/config/compiler/digitalmars.hpp" - -# elif defined(__GNUC__) && !defined(__ibmxl__) -// GNU C++: -# define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc.hpp" - -#elif defined __KCC -// Kai C++ -# define BOOST_COMPILER_CONFIG "boost/config/compiler/kai.hpp" - -#elif defined __sgi -// SGI MIPSpro C++ -# define BOOST_COMPILER_CONFIG "boost/config/compiler/sgi_mipspro.hpp" - -#elif defined __DECCXX -// Compaq Tru64 Unix cxx -# define BOOST_COMPILER_CONFIG "boost/config/compiler/compaq_cxx.hpp" - -#elif defined __ghs -// Greenhills C++ -# define BOOST_COMPILER_CONFIG "boost/config/compiler/greenhills.hpp" - -#elif defined __CODEGEARC__ -// CodeGear - must be checked for before Borland -# define BOOST_COMPILER_CONFIG "boost/config/compiler/codegear.hpp" - -#elif defined __BORLANDC__ -// Borland -# define BOOST_COMPILER_CONFIG "boost/config/compiler/borland.hpp" - -#elif defined __MWERKS__ -// Metrowerks CodeWarrior -# define BOOST_COMPILER_CONFIG "boost/config/compiler/metrowerks.hpp" - -#elif defined __SUNPRO_CC -// Sun Workshop Compiler C++ -# define BOOST_COMPILER_CONFIG "boost/config/compiler/sunpro_cc.hpp" - -#elif defined __HP_aCC -// HP aCC -# define BOOST_COMPILER_CONFIG "boost/config/compiler/hp_acc.hpp" - -#elif defined(__MRC__) || defined(__SC__) -// MPW MrCpp or SCpp -# define BOOST_COMPILER_CONFIG "boost/config/compiler/mpw.hpp" - -#elif defined(__ibmxl__) -// IBM XL C/C++ for Linux (Little Endian) -# define BOOST_COMPILER_CONFIG "boost/config/compiler/xlcpp.hpp" - -#elif defined(__IBMCPP__) -// IBM Visual Age or IBM XL C/C++ for Linux (Big Endian) -# define BOOST_COMPILER_CONFIG "boost/config/compiler/vacpp.hpp" - -#elif defined(__PGI) -// Portland Group Inc. -# define BOOST_COMPILER_CONFIG "boost/config/compiler/pgi.hpp" - -#elif defined _MSC_VER -// Microsoft Visual C++ -// -// Must remain the last #elif since some other vendors (Metrowerks, for -// example) also #define _MSC_VER -# define BOOST_COMPILER_CONFIG "boost/config/compiler/visualc.hpp" - -#elif defined (BOOST_ASSERT_CONFIG) -// this must come last - generate an error if we don't -// recognise the compiler: -# error "Unknown compiler - please configure (http://www.boost.org/libs/config/config.htm#configuring) and report the results to the main boost mailing list (http://www.boost.org/more/mailing_lists.htm#main)" - -#endif - -#if 0 -// -// This section allows dependency scanners to find all the headers we *might* include: -// -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif - diff --git a/boost/config/select_platform_config.hpp b/boost/config/select_platform_config.hpp deleted file mode 100644 index 62fd818..0000000 --- a/boost/config/select_platform_config.hpp +++ /dev/null @@ -1,137 +0,0 @@ -// Boost compiler configuration selection header file - -// (C) Copyright John Maddock 2001 - 2002. -// (C) Copyright Jens Maurer 2001. -// 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) - -// See http://www.boost.org for most recent version. - -// locate which platform we are on and define BOOST_PLATFORM_CONFIG as needed. -// Note that we define the headers to include using "header_name" not -// in order to prevent macro expansion within the header -// name (for example "linux" is a macro on linux systems). - -#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) -// linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? -# define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" - -#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) -// BSD: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/bsd.hpp" - -#elif defined(sun) || defined(__sun) -// solaris: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/solaris.hpp" - -#elif defined(__sgi) -// SGI Irix: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/irix.hpp" - -#elif defined(__hpux) -// hp unix: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/hpux.hpp" - -#elif defined(__CYGWIN__) -// cygwin is not win32: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/cygwin.hpp" - -#elif defined(_WIN32) || defined(__WIN32__) || defined(WIN32) -// win32: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/win32.hpp" - -#elif defined(__HAIKU__) -// Haiku -# define BOOST_PLATFORM_CONFIG "boost/config/platform/haiku.hpp" - -#elif defined(__BEOS__) -// BeOS -# define BOOST_PLATFORM_CONFIG "boost/config/platform/beos.hpp" - -#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -// MacOS -# define BOOST_PLATFORM_CONFIG "boost/config/platform/macos.hpp" - -#elif defined(__IBMCPP__) || defined(_AIX) -// IBM -# define BOOST_PLATFORM_CONFIG "boost/config/platform/aix.hpp" - -#elif defined(__amigaos__) -// AmigaOS -# define BOOST_PLATFORM_CONFIG "boost/config/platform/amigaos.hpp" - -#elif defined(__QNXNTO__) -// QNX: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" - -#elif defined(__VXWORKS__) -// vxWorks: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" - -#elif defined(__SYMBIAN32__) -// Symbian: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/symbian.hpp" - -#elif defined(_CRAYC) -// Cray: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/cray.hpp" - -#elif defined(__VMS) -// VMS: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/vms.hpp" - -#elif defined(__CloudABI__) -// Nuxi CloudABI: -# define BOOST_PLATFORM_CONFIG "boost/config/platform/cloudabi.hpp" -#else - -# if defined(unix) \ - || defined(__unix) \ - || defined(_XOPEN_SOURCE) \ - || defined(_POSIX_SOURCE) - - // generic unix platform: - -# ifndef BOOST_HAS_UNISTD_H -# define BOOST_HAS_UNISTD_H -# endif - -# include - -# endif - -# if defined (BOOST_ASSERT_CONFIG) - // this must come last - generate an error if we don't - // recognise the platform: -# error "Unknown platform - please configure and report the results to boost.org" -# endif - -#endif - -#if 0 -// -// This section allows dependency scanners to find all the files we *might* include: -// -# include "boost/config/platform/linux.hpp" -# include "boost/config/platform/bsd.hpp" -# include "boost/config/platform/solaris.hpp" -# include "boost/config/platform/irix.hpp" -# include "boost/config/platform/hpux.hpp" -# include "boost/config/platform/cygwin.hpp" -# include "boost/config/platform/win32.hpp" -# include "boost/config/platform/beos.hpp" -# include "boost/config/platform/macos.hpp" -# include "boost/config/platform/aix.hpp" -# include "boost/config/platform/amigaos.hpp" -# include "boost/config/platform/qnxnto.hpp" -# include "boost/config/platform/vxworks.hpp" -# include "boost/config/platform/symbian.hpp" -# include "boost/config/platform/cray.hpp" -# include "boost/config/platform/vms.hpp" -# include - - - -#endif - diff --git a/boost/config/select_stdlib_config.hpp b/boost/config/select_stdlib_config.hpp deleted file mode 100644 index e270a88..0000000 --- a/boost/config/select_stdlib_config.hpp +++ /dev/null @@ -1,105 +0,0 @@ -// Boost compiler configuration selection header file - -// (C) Copyright John Maddock 2001 - 2003. -// (C) Copyright Jens Maurer 2001 - 2002. -// 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) - - -// See http://www.boost.org for most recent version. - -// locate which std lib we are using and define BOOST_STDLIB_CONFIG as needed: - -// First include 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 -# include -#else -# include -#endif - -#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) -// STLPort library; this _must_ come first, otherwise since -// STLport typically sits on top of some other library, we -// can end up detecting that first rather than STLport: -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/stlport.hpp" - -#else - -// If our std lib was not some version of STLport, and has not otherwise -// been detected, then include as it is about -// the smallest of the std lib headers that includes real C++ stuff. -// Some std libs do not include their C++-related macros in -// so this additional include makes sure we get those definitions. -// Note: do not rely on this header being included since users can short-circuit this -// #include if they know whose std lib they are using. -#if !defined(__LIBCOMO__) && !defined(__STD_RWCOMPILER_H__) && !defined(_RWSTD_VER)\ - && !defined(_LIBCPP_VERSION) && !defined(__GLIBCPP__) && !defined(__GLIBCXX__)\ - && !defined(__STL_CONFIG_H) && !defined(__MSL_CPP__) && !defined(__IBMCPP__)\ - && !defined(MSIPL_COMPILE_H) && !defined(_YVALS) && !defined(_CPPLIB_VER) -#include -#endif - -#if defined(__LIBCOMO__) -// Comeau STL: -#define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcomo.hpp" - -#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) -// Rogue Wave library: -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/roguewave.hpp" - -#elif defined(_LIBCPP_VERSION) -// libc++ -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/libcpp.hpp" - -#elif defined(__GLIBCPP__) || defined(__GLIBCXX__) -// GNU libstdc++ 3 -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/libstdcpp3.hpp" - -#elif defined(__STL_CONFIG_H) -// generic SGI STL -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/sgi.hpp" - -#elif defined(__MSL_CPP__) -// MSL standard lib: -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/msl.hpp" - -#elif defined(__IBMCPP__) -// take the default VACPP std lib -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/vacpp.hpp" - -#elif defined(MSIPL_COMPILE_H) -// Modena C++ standard library -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/modena.hpp" - -#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) -// Dinkumware Library (this has to appear after any possible replacement libraries): -# define BOOST_STDLIB_CONFIG "boost/config/stdlib/dinkumware.hpp" - -#elif defined (BOOST_ASSERT_CONFIG) -// this must come last - generate an error if we don't -// recognise the library: -# error "Unknown standard library - please configure and report the results to boost.org" - -#endif - -#endif - -#if 0 -// -// This section allows dependency scanners to find all the files we *might* include: -// -# include "boost/config/stdlib/stlport.hpp" -# include "boost/config/stdlib/libcomo.hpp" -# include "boost/config/stdlib/roguewave.hpp" -# include "boost/config/stdlib/libcpp.hpp" -# include "boost/config/stdlib/libstdcpp3.hpp" -# include "boost/config/stdlib/sgi.hpp" -# include "boost/config/stdlib/msl.hpp" -# include "boost/config/stdlib/vacpp.hpp" -# include "boost/config/stdlib/modena.hpp" -# include "boost/config/stdlib/dinkumware.hpp" -#endif - diff --git a/boost/config/stdlib/dinkumware.hpp b/boost/config/stdlib/dinkumware.hpp index 0af104d..e829f08 100644 --- a/boost/config/stdlib/dinkumware.hpp +++ b/boost/config/stdlib/dinkumware.hpp @@ -96,7 +96,8 @@ #include #endif #include -#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (!_HAS_NAMESPACE && defined(__ghs__)) ) && !defined(__TI_COMPILER_VERSION__) && !defined(__VISUALDSPVERSION__) +#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (defined(__ghs__) && !_HAS_NAMESPACE) ) && !defined(__TI_COMPILER_VERSION__) && !defined(__VISUALDSPVERSION__) \ + && !defined(__VXWORKS__) # define BOOST_NO_STD_TYPEINFO #endif @@ -172,11 +173,16 @@ // C++17 features #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 -#endif -#if !defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) -# define BOOST_NO_CXX17_STD_INVOKE # define BOOST_NO_CXX17_ITERATOR_TRAITS #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 +#endif + +#if !(!defined(_CPPLIB_VER) || (_CPPLIB_VER < 650) || !defined(BOOST_MSVC) || (BOOST_MSVC < 1912) || !defined(_HAS_CXX17) || (_HAS_CXX17 == 0)) +// Deprecated std::iterator: +# define BOOST_NO_STD_ITERATOR +#endif #if defined(BOOST_INTEL) && (BOOST_INTEL <= 1400) // Intel's compiler can't handle this header yet: diff --git a/boost/config/stdlib/libcpp.hpp b/boost/config/stdlib/libcpp.hpp index 3d3f4ae..a051dbb 100644 --- a/boost/config/stdlib/libcpp.hpp +++ b/boost/config/stdlib/libcpp.hpp @@ -87,9 +87,6 @@ #endif // C++17 features -#if (_LIBCPP_VERSION < 3700) || (__cplusplus <= 201402L) -# define BOOST_NO_CXX17_STD_INVOKE -#endif #if (_LIBCPP_VERSION < 4000) || (__cplusplus <= 201402L) # define BOOST_NO_CXX17_STD_APPLY #endif @@ -104,6 +101,7 @@ #endif #define BOOST_NO_CXX17_ITERATOR_TRAITS +#define BOOST_NO_CXX17_STD_INVOKE // Invoke support is incomplete (no invoke_result) #if (_LIBCPP_VERSION <= 1101) && !defined(BOOST_NO_CXX11_THREAD_LOCAL) // This is a bit of a sledgehammer, because really it's just libc++abi that has no @@ -113,6 +111,13 @@ # define BOOST_NO_CXX11_THREAD_LOCAL #endif +#if defined(__linux__) && !defined(BOOST_NO_CXX11_THREAD_LOCAL) +// After libc++-dev is installed on Trusty, clang++-libc++ almost works, +// except uses of `thread_local` fail with undefined reference to +// `__cxa_thread_atexit`. +# define BOOST_NO_CXX11_THREAD_LOCAL +#endif + #if defined(__has_include) #if !__has_include() # define BOOST_NO_CXX14_HDR_SHARED_MUTEX diff --git a/boost/config/stdlib/libstdcpp3.hpp b/boost/config/stdlib/libstdcpp3.hpp index 6cd420a..f6eab26 100644 --- a/boost/config/stdlib/libstdcpp3.hpp +++ b/boost/config/stdlib/libstdcpp3.hpp @@ -78,6 +78,7 @@ # include #endif +#ifndef __VXWORKS__ // VxWorks uses Dinkum, not GNU STL with GCC #if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0 # define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx # define BOOST_HAS_SLIST @@ -91,6 +92,7 @@ # define BOOST_HASH_MAP_HEADER # endif #endif +#endif // // Decide whether we have C++11 support turned on: @@ -292,12 +294,10 @@ extern "C" char *gets (char *__s); #endif // -// C++17 features in GCC 6.1 and later +// C++17 features in GCC 7.1 and later // -#if (BOOST_LIBSTDCXX_VERSION < 60100) || (__cplusplus <= 201402L) -# define BOOST_NO_CXX17_STD_INVOKE -#endif #if (BOOST_LIBSTDCXX_VERSION < 70100) || (__cplusplus <= 201402L) +# define BOOST_NO_CXX17_STD_INVOKE # define BOOST_NO_CXX17_STD_APPLY #endif diff --git a/boost/config/suffix.hpp b/boost/config/suffix.hpp deleted file mode 100644 index 6df9223..0000000 --- a/boost/config/suffix.hpp +++ /dev/null @@ -1,1036 +0,0 @@ -// Boost config.hpp configuration header file ------------------------------// -// boostinspect:ndprecated_macros -- tell the inspect tool to ignore this file - -// Copyright (c) 2001-2003 John Maddock -// Copyright (c) 2001 Darin Adler -// Copyright (c) 2001 Peter Dimov -// Copyright (c) 2002 Bill Kempf -// Copyright (c) 2002 Jens Maurer -// Copyright (c) 2002-2003 David Abrahams -// Copyright (c) 2003 Gennaro Prota -// Copyright (c) 2003 Eric Friedman -// Copyright (c) 2010 Eric Jourdanneau, Joel Falcou -// 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. - -// Boost config.hpp policy and rationale documentation has been moved to -// http://www.boost.org/libs/config/ -// -// This file is intended to be stable, and relatively unchanging. -// It should contain boilerplate code only - no compiler specific -// code unless it is unavoidable - no changes unless unavoidable. - -#ifndef BOOST_CONFIG_SUFFIX_HPP -#define BOOST_CONFIG_SUFFIX_HPP - -#if defined(__GNUC__) && (__GNUC__ >= 4) -// -// Some GCC-4.x versions issue warnings even when __extension__ is used, -// so use this as a workaround: -// -#pragma GCC system_header -#endif - -// -// ensure that visibility macros are always defined, thus symplifying use -// -#ifndef BOOST_SYMBOL_EXPORT -# define BOOST_SYMBOL_EXPORT -#endif -#ifndef BOOST_SYMBOL_IMPORT -# define BOOST_SYMBOL_IMPORT -#endif -#ifndef BOOST_SYMBOL_VISIBLE -# define BOOST_SYMBOL_VISIBLE -#endif - -// -// look for long long by looking for the appropriate macros in . -// Note that we use limits.h rather than climits for maximal portability, -// remember that since these just declare a bunch of macros, there should be -// no namespace issues from this. -// -#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG) \ - && !defined(BOOST_MSVC) && !defined(__BORLANDC__) -# include -# if (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX)) -# define BOOST_HAS_LONG_LONG -# else -# define BOOST_NO_LONG_LONG -# endif -#endif - -// GCC 3.x will clean up all of those nasty macro definitions that -// BOOST_NO_CTYPE_FUNCTIONS is intended to help work around, so undefine -// it under GCC 3.x. -#if defined(__GNUC__) && (__GNUC__ >= 3) && defined(BOOST_NO_CTYPE_FUNCTIONS) -# undef BOOST_NO_CTYPE_FUNCTIONS -#endif - -// -// Assume any extensions are in namespace std:: unless stated otherwise: -// -# ifndef BOOST_STD_EXTENSION_NAMESPACE -# define BOOST_STD_EXTENSION_NAMESPACE std -# endif - -// -// If cv-qualified specializations are not allowed, then neither are cv-void ones: -// -# if defined(BOOST_NO_CV_SPECIALIZATIONS) \ - && !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS) -# define BOOST_NO_CV_VOID_SPECIALIZATIONS -# endif - -// -// If there is no numeric_limits template, then it can't have any compile time -// constants either! -// -# if defined(BOOST_NO_LIMITS) \ - && !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) -# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS -# define BOOST_NO_MS_INT64_NUMERIC_LIMITS -# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS -# endif - -// -// if there is no long long then there is no specialisation -// for numeric_limits either: -// -#if !defined(BOOST_HAS_LONG_LONG) && !defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS) -# define BOOST_NO_LONG_LONG_NUMERIC_LIMITS -#endif - -// -// if there is no __int64 then there is no specialisation -// for numeric_limits<__int64> either: -// -#if !defined(BOOST_HAS_MS_INT64) && !defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS) -# define BOOST_NO_MS_INT64_NUMERIC_LIMITS -#endif - -// -// if member templates are supported then so is the -// VC6 subset of member templates: -// -# if !defined(BOOST_NO_MEMBER_TEMPLATES) \ - && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) -# define BOOST_MSVC6_MEMBER_TEMPLATES -# endif - -// -// Without partial specialization, can't test for partial specialisation bugs: -// -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_BCB_PARTIAL_SPECIALIZATION_BUG) -# define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG -# endif - -// -// Without partial specialization, we can't have array-type partial specialisations: -// -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) -# define BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS -# endif - -// -// Without partial specialization, std::iterator_traits can't work: -// -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_NO_STD_ITERATOR_TRAITS) -# define BOOST_NO_STD_ITERATOR_TRAITS -# endif - -// -// Without partial specialization, partial -// specialization with default args won't work either: -// -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS) -# define BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS -# endif - -// -// Without member template support, we can't have template constructors -// in the standard library either: -// -# if defined(BOOST_NO_MEMBER_TEMPLATES) \ - && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ - && !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS) -# define BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS -# endif - -// -// Without member template support, we can't have a conforming -// std::allocator template either: -// -# if defined(BOOST_NO_MEMBER_TEMPLATES) \ - && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) \ - && !defined(BOOST_NO_STD_ALLOCATOR) -# define BOOST_NO_STD_ALLOCATOR -# endif - -// -// without ADL support then using declarations will break ADL as well: -// -#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) && !defined(BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL) -# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL -#endif - -// -// Without typeid support we have no dynamic RTTI either: -// -#if defined(BOOST_NO_TYPEID) && !defined(BOOST_NO_RTTI) -# define BOOST_NO_RTTI -#endif - -// -// If we have a standard allocator, then we have a partial one as well: -// -#if !defined(BOOST_NO_STD_ALLOCATOR) -# define BOOST_HAS_PARTIAL_STD_ALLOCATOR -#endif - -// -// We can't have a working std::use_facet if there is no std::locale: -// -# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_USE_FACET) -# define BOOST_NO_STD_USE_FACET -# endif - -// -// We can't have a std::messages facet if there is no std::locale: -// -# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_MESSAGES) -# define BOOST_NO_STD_MESSAGES -# endif - -// -// We can't have a working std::wstreambuf if there is no std::locale: -// -# if defined(BOOST_NO_STD_LOCALE) && !defined(BOOST_NO_STD_WSTREAMBUF) -# define BOOST_NO_STD_WSTREAMBUF -# endif - -// -// We can't have a if there is no : -// -# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_CWCTYPE) -# define BOOST_NO_CWCTYPE -# endif - -// -// We can't have a swprintf if there is no : -// -# if defined(BOOST_NO_CWCHAR) && !defined(BOOST_NO_SWPRINTF) -# define BOOST_NO_SWPRINTF -# endif - -// -// If Win32 support is turned off, then we must turn off -// threading support also, unless there is some other -// thread API enabled: -// -#if defined(BOOST_DISABLE_WIN32) && defined(_WIN32) \ - && !defined(BOOST_DISABLE_THREADS) && !defined(BOOST_HAS_PTHREADS) -# define BOOST_DISABLE_THREADS -#endif - -// -// Turn on threading support if the compiler thinks that it's in -// multithreaded mode. We put this here because there are only a -// limited number of macros that identify this (if there's any missing -// from here then add to the appropriate compiler section): -// -#if (defined(__MT__) || defined(_MT) || defined(_REENTRANT) \ - || defined(_PTHREADS) || defined(__APPLE__) || defined(__DragonFly__)) \ - && !defined(BOOST_HAS_THREADS) -# define BOOST_HAS_THREADS -#endif - -// -// Turn threading support off if BOOST_DISABLE_THREADS is defined: -// -#if defined(BOOST_DISABLE_THREADS) && defined(BOOST_HAS_THREADS) -# undef BOOST_HAS_THREADS -#endif - -// -// Turn threading support off if we don't recognise the threading API: -// -#if defined(BOOST_HAS_THREADS) && !defined(BOOST_HAS_PTHREADS)\ - && !defined(BOOST_HAS_WINTHREADS) && !defined(BOOST_HAS_BETHREADS)\ - && !defined(BOOST_HAS_MPTASKS) -# undef BOOST_HAS_THREADS -#endif - -// -// Turn threading detail macros off if we don't (want to) use threading -// -#ifndef BOOST_HAS_THREADS -# undef BOOST_HAS_PTHREADS -# undef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE -# undef BOOST_HAS_PTHREAD_YIELD -# undef BOOST_HAS_PTHREAD_DELAY_NP -# undef BOOST_HAS_WINTHREADS -# undef BOOST_HAS_BETHREADS -# undef BOOST_HAS_MPTASKS -#endif - -// -// If the compiler claims to be C99 conformant, then it had better -// have a : -// -# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901) -# define BOOST_HAS_STDINT_H -# ifndef BOOST_HAS_LOG1P -# define BOOST_HAS_LOG1P -# endif -# ifndef BOOST_HAS_EXPM1 -# define BOOST_HAS_EXPM1 -# endif -# endif - -// -// Define BOOST_NO_SLIST and BOOST_NO_HASH if required. -// Note that this is for backwards compatibility only. -// -# if !defined(BOOST_HAS_SLIST) && !defined(BOOST_NO_SLIST) -# define BOOST_NO_SLIST -# endif - -# if !defined(BOOST_HAS_HASH) && !defined(BOOST_NO_HASH) -# define BOOST_NO_HASH -# endif - -// -// Set BOOST_SLIST_HEADER if not set already: -// -#if defined(BOOST_HAS_SLIST) && !defined(BOOST_SLIST_HEADER) -# define BOOST_SLIST_HEADER -#endif - -// -// Set BOOST_HASH_SET_HEADER if not set already: -// -#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_SET_HEADER) -# define BOOST_HASH_SET_HEADER -#endif - -// -// Set BOOST_HASH_MAP_HEADER if not set already: -// -#if defined(BOOST_HAS_HASH) && !defined(BOOST_HASH_MAP_HEADER) -# define BOOST_HASH_MAP_HEADER -#endif - -// BOOST_HAS_ABI_HEADERS -// This macro gets set if we have headers that fix the ABI, -// and prevent ODR violations when linking to external libraries: -#if defined(BOOST_ABI_PREFIX) && defined(BOOST_ABI_SUFFIX) && !defined(BOOST_HAS_ABI_HEADERS) -# define BOOST_HAS_ABI_HEADERS -#endif - -#if defined(BOOST_HAS_ABI_HEADERS) && defined(BOOST_DISABLE_ABI_HEADERS) -# undef BOOST_HAS_ABI_HEADERS -#endif - -// BOOST_NO_STDC_NAMESPACE workaround --------------------------------------// -// Because std::size_t usage is so common, even in boost headers which do not -// otherwise use the C library, the workaround is included here so -// that ugly workaround code need not appear in many other boost headers. -// NOTE WELL: This is a workaround for non-conforming compilers; -// must still be #included in the usual places so that inclusion -// works as expected with standard conforming compilers. The resulting -// double inclusion of is harmless. - -# if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus) -# include - namespace std { using ::ptrdiff_t; using ::size_t; } -# endif - -// Workaround for the unfortunate min/max macros defined by some platform headers - -#define BOOST_PREVENT_MACRO_SUBSTITUTION - -#ifndef BOOST_USING_STD_MIN -# define BOOST_USING_STD_MIN() using std::min -#endif - -#ifndef BOOST_USING_STD_MAX -# define BOOST_USING_STD_MAX() using std::max -#endif - -// BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// - -# if defined(BOOST_NO_STD_MIN_MAX) && defined(__cplusplus) - -namespace std { - template - inline const _Tp& min BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { - return __b < __a ? __b : __a; - } - template - inline const _Tp& max BOOST_PREVENT_MACRO_SUBSTITUTION (const _Tp& __a, const _Tp& __b) { - return __a < __b ? __b : __a; - } -} - -# endif - -// BOOST_STATIC_CONSTANT workaround --------------------------------------- // -// On compilers which don't allow in-class initialization of static integral -// constant members, we must use enums as a workaround if we want the constants -// to be available at compile-time. This macro gives us a convenient way to -// declare such constants. - -# ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -# define BOOST_STATIC_CONSTANT(type, assignment) enum { assignment } -# else -# define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment -# endif - -// BOOST_USE_FACET / HAS_FACET workaround ----------------------------------// -// When the standard library does not have a conforming std::use_facet there -// are various workarounds available, but they differ from library to library. -// The same problem occurs with has_facet. -// These macros provide a consistent way to access a locale's facets. -// Usage: -// replace -// std::use_facet(loc); -// with -// BOOST_USE_FACET(Type, loc); -// Note do not add a std:: prefix to the front of BOOST_USE_FACET! -// Use for BOOST_HAS_FACET is analogous. - -#if defined(BOOST_NO_STD_USE_FACET) -# ifdef BOOST_HAS_TWO_ARG_USE_FACET -# define BOOST_USE_FACET(Type, loc) std::use_facet(loc, static_cast(0)) -# define BOOST_HAS_FACET(Type, loc) std::has_facet(loc, static_cast(0)) -# elif defined(BOOST_HAS_MACRO_USE_FACET) -# define BOOST_USE_FACET(Type, loc) std::_USE(loc, Type) -# define BOOST_HAS_FACET(Type, loc) std::_HAS(loc, Type) -# elif defined(BOOST_HAS_STLP_USE_FACET) -# define BOOST_USE_FACET(Type, loc) (*std::_Use_facet(loc)) -# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) -# endif -#else -# define BOOST_USE_FACET(Type, loc) std::use_facet< Type >(loc) -# define BOOST_HAS_FACET(Type, loc) std::has_facet< Type >(loc) -#endif - -// BOOST_NESTED_TEMPLATE workaround ------------------------------------------// -// Member templates are supported by some compilers even though they can't use -// the A::template member syntax, as a workaround replace: -// -// typedef typename A::template rebind binder; -// -// with: -// -// typedef typename A::BOOST_NESTED_TEMPLATE rebind binder; - -#ifndef BOOST_NO_MEMBER_TEMPLATE_KEYWORD -# define BOOST_NESTED_TEMPLATE template -#else -# define BOOST_NESTED_TEMPLATE -#endif - -// BOOST_UNREACHABLE_RETURN(x) workaround -------------------------------------// -// Normally evaluates to nothing, unless BOOST_NO_UNREACHABLE_RETURN_DETECTION -// is defined, in which case it evaluates to return x; Use when you have a return -// statement that can never be reached. - -#ifndef BOOST_UNREACHABLE_RETURN -# ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION -# define BOOST_UNREACHABLE_RETURN(x) return x; -# else -# define BOOST_UNREACHABLE_RETURN(x) -# endif -#endif - -// BOOST_DEDUCED_TYPENAME workaround ------------------------------------------// -// -// Some compilers don't support the use of `typename' for dependent -// types in deduced contexts, e.g. -// -// template void f(T, typename T::type); -// ^^^^^^^^ -// Replace these declarations with: -// -// template void f(T, BOOST_DEDUCED_TYPENAME T::type); - -#ifndef BOOST_NO_DEDUCED_TYPENAME -# define BOOST_DEDUCED_TYPENAME typename -#else -# define BOOST_DEDUCED_TYPENAME -#endif - -#ifndef BOOST_NO_TYPENAME_WITH_CTOR -# define BOOST_CTOR_TYPENAME typename -#else -# define BOOST_CTOR_TYPENAME -#endif - -// long long workaround ------------------------------------------// -// On gcc (and maybe other compilers?) long long is alway supported -// but it's use may generate either warnings (with -ansi), or errors -// (with -pedantic -ansi) unless it's use is prefixed by __extension__ -// -#if defined(BOOST_HAS_LONG_LONG) && defined(__cplusplus) -namespace boost{ -# ifdef __GNUC__ - __extension__ typedef long long long_long_type; - __extension__ typedef unsigned long long ulong_long_type; -# else - typedef long long long_long_type; - typedef unsigned long long ulong_long_type; -# endif -} -#endif -// same again for __int128: -#if defined(BOOST_HAS_INT128) && defined(__cplusplus) -namespace boost{ -# ifdef __GNUC__ - __extension__ typedef __int128 int128_type; - __extension__ typedef unsigned __int128 uint128_type; -# else - typedef __int128 int128_type; - typedef unsigned __int128 uint128_type; -# endif -} -#endif -// same again for __float128: -#if defined(BOOST_HAS_FLOAT128) && defined(__cplusplus) -namespace boost { -# ifdef __GNUC__ - __extension__ typedef __float128 float128_type; -# else - typedef __float128 float128_type; -# endif -} -#endif - -// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// - -// These macros are obsolete. Port away and remove. - -# define BOOST_EXPLICIT_TEMPLATE_TYPE(t) -# define BOOST_EXPLICIT_TEMPLATE_TYPE_SPEC(t) -# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE(t, v) -# define BOOST_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) - -# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(t) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) -# define BOOST_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) - -// When BOOST_NO_STD_TYPEINFO is defined, we can just import -// the global definition into std namespace: -#if defined(BOOST_NO_STD_TYPEINFO) && defined(__cplusplus) -#include -namespace std{ using ::type_info; } -#endif - -// ---------------------------------------------------------------------------// - -// -// Helper macro BOOST_STRINGIZE: -// Converts the parameter X to a string after macro replacement -// on X has been performed. -// -#define BOOST_STRINGIZE(X) BOOST_DO_STRINGIZE(X) -#define BOOST_DO_STRINGIZE(X) #X - -// -// Helper macro BOOST_JOIN: -// The following piece of macro magic joins the two -// arguments together, even when one of the arguments is -// itself a macro (see 16.3.1 in C++ standard). The key -// is that macro expansion of macro arguments does not -// occur in BOOST_DO_JOIN2 but does in BOOST_DO_JOIN. -// -#define BOOST_JOIN( X, Y ) BOOST_DO_JOIN( X, Y ) -#define BOOST_DO_JOIN( X, Y ) BOOST_DO_JOIN2(X,Y) -#define BOOST_DO_JOIN2( X, Y ) X##Y - -// -// Set some default values for compiler/library/platform names. -// These are for debugging config setup only: -// -# ifndef BOOST_COMPILER -# define BOOST_COMPILER "Unknown ISO C++ Compiler" -# endif -# ifndef BOOST_STDLIB -# define BOOST_STDLIB "Unknown ISO standard library" -# endif -# ifndef BOOST_PLATFORM -# if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) \ - || defined(_POSIX_SOURCE) -# define BOOST_PLATFORM "Generic Unix" -# else -# define BOOST_PLATFORM "Unknown" -# endif -# endif - -// -// Set some default values GPU support -// -# ifndef BOOST_GPU_ENABLED -# 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) -# if defined(_MSC_VER) -# define BOOST_FORCEINLINE __forceinline -# elif defined(__GNUC__) && __GNUC__ > 3 - // Clang also defines __GNUC__ (as 4) -# define BOOST_FORCEINLINE inline __attribute__ ((__always_inline__)) -# else -# define BOOST_FORCEINLINE inline -# endif -#endif - -// BOOST_NOINLINE ---------------------------------------------// -// Macro to use in place of 'inline' to prevent a function to be inlined -#if !defined(BOOST_NOINLINE) -# if defined(_MSC_VER) -# define BOOST_NOINLINE __declspec(noinline) -# elif defined(__GNUC__) && __GNUC__ > 3 - // Clang also defines __GNUC__ (as 4) -# if defined(__CUDACC__) - // nvcc doesn't always parse __noinline__, - // see: https://svn.boost.org/trac/boost/ticket/9392 -# define BOOST_NOINLINE __attribute__ ((noinline)) -# else -# define BOOST_NOINLINE __attribute__ ((__noinline__)) -# endif -# else -# define BOOST_NOINLINE -# endif -#endif - -// BOOST_NORETURN ---------------------------------------------// -// Macro to use before a function declaration/definition to designate -// the function as not returning normally (i.e. with a return statement -// or by leaving the function scope, if the function return type is void). -#if !defined(BOOST_NORETURN) -# if defined(_MSC_VER) -# define BOOST_NORETURN __declspec(noreturn) -# elif defined(__GNUC__) -# define BOOST_NORETURN __attribute__ ((__noreturn__)) -# elif defined(__has_attribute) && defined(__SUNPRO_CC) -# if __has_attribute(noreturn) -# define BOOST_NORETURN [[noreturn]] -# endif -# elif defined(__has_cpp_attribute) -# if __has_cpp_attribute(noreturn) -# define BOOST_NORETURN [[noreturn]] -# endif -# endif -#endif - -#if !defined(BOOST_NORETURN) -# define BOOST_NO_NORETURN -# define BOOST_NORETURN -#endif - -// Branch prediction hints -// These macros are intended to wrap conditional expressions that yield true or false -// -// if (BOOST_LIKELY(var == 10)) -// { -// // the most probable code here -// } -// -#if !defined(BOOST_LIKELY) -# define BOOST_LIKELY(x) x -#endif -#if !defined(BOOST_UNLIKELY) -# define BOOST_UNLIKELY(x) x -#endif - -// Type and data alignment specification -// -#if !defined(BOOST_NO_CXX11_ALIGNAS) -# define BOOST_ALIGNMENT(x) alignas(x) -#elif defined(_MSC_VER) -# define BOOST_ALIGNMENT(x) __declspec(align(x)) -#elif defined(__GNUC__) -# define BOOST_ALIGNMENT(x) __attribute__ ((__aligned__(x))) -#else -# define BOOST_NO_ALIGNMENT -# define BOOST_ALIGNMENT(x) -#endif - -// Lack of non-public defaulted functions is implied by the lack of any defaulted functions -#if !defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS) && defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) -# define BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS -#endif - -// Defaulted and deleted function declaration helpers -// These macros are intended to be inside a class definition. -// BOOST_DEFAULTED_FUNCTION accepts the function declaration and its -// body, which will be used if the compiler doesn't support defaulted functions. -// BOOST_DELETED_FUNCTION only accepts the function declaration. It -// will expand to a private function declaration, if the compiler doesn't support -// deleted functions. Because of this it is recommended to use BOOST_DELETED_FUNCTION -// in the end of the class definition. -// -// class my_class -// { -// public: -// // Default-constructible -// BOOST_DEFAULTED_FUNCTION(my_class(), {}) -// // Copying prohibited -// BOOST_DELETED_FUNCTION(my_class(my_class const&)) -// BOOST_DELETED_FUNCTION(my_class& operator= (my_class const&)) -// }; -// -#if !(defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) || defined(BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS)) -# define BOOST_DEFAULTED_FUNCTION(fun, body) fun = default; -#else -# define BOOST_DEFAULTED_FUNCTION(fun, body) fun body -#endif - -#if !defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) -# define BOOST_DELETED_FUNCTION(fun) fun = delete; -#else -# define BOOST_DELETED_FUNCTION(fun) private: fun; -#endif - -// -// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined -// -#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) -#define BOOST_NO_CXX11_DECLTYPE_N3276 BOOST_NO_CXX11_DECLTYPE -#endif - -// -------------------- Deprecated macros for 1.50 --------------------------- -// These will go away in a future release - -// Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP -// instead of BOOST_NO_STD_UNORDERED -#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) -# ifndef BOOST_NO_CXX11_STD_UNORDERED -# define BOOST_NO_CXX11_STD_UNORDERED -# endif -#endif - -// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST instead of BOOST_NO_INITIALIZER_LISTS -#if defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) -# define BOOST_NO_INITIALIZER_LISTS -#endif - -// Use BOOST_NO_CXX11_HDR_ARRAY instead of BOOST_NO_0X_HDR_ARRAY -#if defined(BOOST_NO_CXX11_HDR_ARRAY) && !defined(BOOST_NO_0X_HDR_ARRAY) -# define BOOST_NO_0X_HDR_ARRAY -#endif -// Use BOOST_NO_CXX11_HDR_CHRONO instead of BOOST_NO_0X_HDR_CHRONO -#if defined(BOOST_NO_CXX11_HDR_CHRONO) && !defined(BOOST_NO_0X_HDR_CHRONO) -# define BOOST_NO_0X_HDR_CHRONO -#endif -// Use BOOST_NO_CXX11_HDR_CODECVT instead of BOOST_NO_0X_HDR_CODECVT -#if defined(BOOST_NO_CXX11_HDR_CODECVT) && !defined(BOOST_NO_0X_HDR_CODECVT) -# define BOOST_NO_0X_HDR_CODECVT -#endif -// Use BOOST_NO_CXX11_HDR_CONDITION_VARIABLE instead of BOOST_NO_0X_HDR_CONDITION_VARIABLE -#if defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) && !defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -#endif -// Use BOOST_NO_CXX11_HDR_FORWARD_LIST instead of BOOST_NO_0X_HDR_FORWARD_LIST -#if defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) && !defined(BOOST_NO_0X_HDR_FORWARD_LIST) -# define BOOST_NO_0X_HDR_FORWARD_LIST -#endif -// Use BOOST_NO_CXX11_HDR_FUTURE instead of BOOST_NO_0X_HDR_FUTURE -#if defined(BOOST_NO_CXX11_HDR_FUTURE) && !defined(BOOST_NO_0X_HDR_FUTURE) -# define BOOST_NO_0X_HDR_FUTURE -#endif - -// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST -// instead of BOOST_NO_0X_HDR_INITIALIZER_LIST or BOOST_NO_INITIALIZER_LISTS -#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST -# ifndef BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# endif -# ifndef BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_INITIALIZER_LISTS -# endif -#endif - -// Use BOOST_NO_CXX11_HDR_MUTEX instead of BOOST_NO_0X_HDR_MUTEX -#if defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) -# define BOOST_NO_0X_HDR_MUTEX -#endif -// Use BOOST_NO_CXX11_HDR_RANDOM instead of BOOST_NO_0X_HDR_RANDOM -#if defined(BOOST_NO_CXX11_HDR_RANDOM) && !defined(BOOST_NO_0X_HDR_RANDOM) -# define BOOST_NO_0X_HDR_RANDOM -#endif -// Use BOOST_NO_CXX11_HDR_RATIO instead of BOOST_NO_0X_HDR_RATIO -#if defined(BOOST_NO_CXX11_HDR_RATIO) && !defined(BOOST_NO_0X_HDR_RATIO) -# define BOOST_NO_0X_HDR_RATIO -#endif -// Use BOOST_NO_CXX11_HDR_REGEX instead of BOOST_NO_0X_HDR_REGEX -#if defined(BOOST_NO_CXX11_HDR_REGEX) && !defined(BOOST_NO_0X_HDR_REGEX) -# define BOOST_NO_0X_HDR_REGEX -#endif -// Use BOOST_NO_CXX11_HDR_SYSTEM_ERROR instead of BOOST_NO_0X_HDR_SYSTEM_ERROR -#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_0X_HDR_SYSTEM_ERROR) -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -#endif -// Use BOOST_NO_CXX11_HDR_THREAD instead of BOOST_NO_0X_HDR_THREAD -#if defined(BOOST_NO_CXX11_HDR_THREAD) && !defined(BOOST_NO_0X_HDR_THREAD) -# define BOOST_NO_0X_HDR_THREAD -#endif -// Use BOOST_NO_CXX11_HDR_TUPLE instead of BOOST_NO_0X_HDR_TUPLE -#if defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_0X_HDR_TUPLE) -# define BOOST_NO_0X_HDR_TUPLE -#endif -// Use BOOST_NO_CXX11_HDR_TYPE_TRAITS instead of BOOST_NO_0X_HDR_TYPE_TRAITS -#if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) -# define BOOST_NO_0X_HDR_TYPE_TRAITS -#endif -// Use BOOST_NO_CXX11_HDR_TYPEINDEX instead of BOOST_NO_0X_HDR_TYPEINDEX -#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) && !defined(BOOST_NO_0X_HDR_TYPEINDEX) -# define BOOST_NO_0X_HDR_TYPEINDEX -#endif -// Use BOOST_NO_CXX11_HDR_UNORDERED_MAP instead of BOOST_NO_0X_HDR_UNORDERED_MAP -#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) && !defined(BOOST_NO_0X_HDR_UNORDERED_MAP) -# define BOOST_NO_0X_HDR_UNORDERED_MAP -#endif -// Use BOOST_NO_CXX11_HDR_UNORDERED_SET instead of BOOST_NO_0X_HDR_UNORDERED_SET -#if defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_0X_HDR_UNORDERED_SET) -# define BOOST_NO_0X_HDR_UNORDERED_SET -#endif - -// ------------------ End of deprecated macros for 1.50 --------------------------- - -// -------------------- Deprecated macros for 1.51 --------------------------- -// These will go away in a future release - -// Use BOOST_NO_CXX11_AUTO_DECLARATIONS instead of BOOST_NO_AUTO_DECLARATIONS -#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_AUTO_DECLARATIONS) -# define BOOST_NO_AUTO_DECLARATIONS -#endif -// Use BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS instead of BOOST_NO_AUTO_MULTIDECLARATIONS -#if defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS) && !defined(BOOST_NO_AUTO_MULTIDECLARATIONS) -# define BOOST_NO_AUTO_MULTIDECLARATIONS -#endif -// Use BOOST_NO_CXX11_CHAR16_T instead of BOOST_NO_CHAR16_T -#if defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CHAR16_T) -# define BOOST_NO_CHAR16_T -#endif -// Use BOOST_NO_CXX11_CHAR32_T instead of BOOST_NO_CHAR32_T -#if defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CHAR32_T) -# define BOOST_NO_CHAR32_T -#endif -// Use BOOST_NO_CXX11_TEMPLATE_ALIASES instead of BOOST_NO_TEMPLATE_ALIASES -#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_TEMPLATE_ALIASES) -# define BOOST_NO_TEMPLATE_ALIASES -#endif -// Use BOOST_NO_CXX11_CONSTEXPR instead of BOOST_NO_CONSTEXPR -#if defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CONSTEXPR) -# define BOOST_NO_CONSTEXPR -#endif -// Use BOOST_NO_CXX11_DECLTYPE_N3276 instead of BOOST_NO_DECLTYPE_N3276 -#if defined(BOOST_NO_CXX11_DECLTYPE_N3276) && !defined(BOOST_NO_DECLTYPE_N3276) -# define BOOST_NO_DECLTYPE_N3276 -#endif -// Use BOOST_NO_CXX11_DECLTYPE instead of BOOST_NO_DECLTYPE -#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE) -# define BOOST_NO_DECLTYPE -#endif -// Use BOOST_NO_CXX11_DEFAULTED_FUNCTIONS instead of BOOST_NO_DEFAULTED_FUNCTIONS -#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_DEFAULTED_FUNCTIONS) -# define BOOST_NO_DEFAULTED_FUNCTIONS -#endif -// Use BOOST_NO_CXX11_DELETED_FUNCTIONS instead of BOOST_NO_DELETED_FUNCTIONS -#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_DELETED_FUNCTIONS) -# define BOOST_NO_DELETED_FUNCTIONS -#endif -// Use BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS instead of BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#endif -// Use BOOST_NO_CXX11_EXTERN_TEMPLATE instead of BOOST_NO_EXTERN_TEMPLATE -#if defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) && !defined(BOOST_NO_EXTERN_TEMPLATE) -# define BOOST_NO_EXTERN_TEMPLATE -#endif -// Use BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS instead of BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#endif -// Use BOOST_NO_CXX11_LAMBDAS instead of BOOST_NO_LAMBDAS -#if defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS) -# define BOOST_NO_LAMBDAS -#endif -// Use BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS instead of BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS -#if defined(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS) && !defined(BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS) -# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS -#endif -// Use BOOST_NO_CXX11_NOEXCEPT instead of BOOST_NO_NOEXCEPT -#if defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT) -# define BOOST_NO_NOEXCEPT -#endif -// Use BOOST_NO_CXX11_NULLPTR instead of BOOST_NO_NULLPTR -#if defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR) -# define BOOST_NO_NULLPTR -#endif -// Use BOOST_NO_CXX11_RAW_LITERALS instead of BOOST_NO_RAW_LITERALS -#if defined(BOOST_NO_CXX11_RAW_LITERALS) && !defined(BOOST_NO_RAW_LITERALS) -# define BOOST_NO_RAW_LITERALS -#endif -// Use BOOST_NO_CXX11_RVALUE_REFERENCES instead of BOOST_NO_RVALUE_REFERENCES -#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_RVALUE_REFERENCES) -# define BOOST_NO_RVALUE_REFERENCES -#endif -// Use BOOST_NO_CXX11_SCOPED_ENUMS instead of BOOST_NO_SCOPED_ENUMS -#if defined(BOOST_NO_CXX11_SCOPED_ENUMS) && !defined(BOOST_NO_SCOPED_ENUMS) -# define BOOST_NO_SCOPED_ENUMS -#endif -// Use BOOST_NO_CXX11_STATIC_ASSERT instead of BOOST_NO_STATIC_ASSERT -#if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT) -# define BOOST_NO_STATIC_ASSERT -#endif -// Use BOOST_NO_CXX11_STD_UNORDERED instead of BOOST_NO_STD_UNORDERED -#if defined(BOOST_NO_CXX11_STD_UNORDERED) && !defined(BOOST_NO_STD_UNORDERED) -# define BOOST_NO_STD_UNORDERED -#endif -// Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS -#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS) -# define BOOST_NO_UNICODE_LITERALS -#endif -// Use BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX instead of BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX -#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX) -# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX -#endif -// Use BOOST_NO_CXX11_VARIADIC_TEMPLATES instead of BOOST_NO_VARIADIC_TEMPLATES -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) -# define BOOST_NO_VARIADIC_TEMPLATES -#endif -// Use BOOST_NO_CXX11_VARIADIC_MACROS instead of BOOST_NO_VARIADIC_MACROS -#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS) -# define BOOST_NO_VARIADIC_MACROS -#endif -// Use BOOST_NO_CXX11_NUMERIC_LIMITS instead of BOOST_NO_NUMERIC_LIMITS_LOWEST -#if defined(BOOST_NO_CXX11_NUMERIC_LIMITS) && !defined(BOOST_NO_NUMERIC_LIMITS_LOWEST) -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -#endif -// ------------------ End of deprecated macros for 1.51 --------------------------- - - - -// -// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR -// These aid the transition to C++11 while still supporting C++03 compilers -// -#ifdef BOOST_NO_CXX11_NOEXCEPT -# define BOOST_NOEXCEPT -# define BOOST_NOEXCEPT_OR_NOTHROW throw() -# define BOOST_NOEXCEPT_IF(Predicate) -# define BOOST_NOEXCEPT_EXPR(Expression) false -#else -# define BOOST_NOEXCEPT noexcept -# define BOOST_NOEXCEPT_OR_NOTHROW noexcept -# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) -# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) -#endif -// -// Helper macro BOOST_FALLTHROUGH -// Fallback definition of BOOST_FALLTHROUGH macro used to mark intended -// fall-through between case labels in a switch statement. We use a definition -// that requires a semicolon after it to avoid at least one type of misuse even -// on unsupported compilers. -// -#ifndef BOOST_FALLTHROUGH -# define BOOST_FALLTHROUGH ((void)0) -#endif - -// -// constexpr workarounds -// -#if defined(BOOST_NO_CXX11_CONSTEXPR) -#define BOOST_CONSTEXPR -#define BOOST_CONSTEXPR_OR_CONST const -#else -#define BOOST_CONSTEXPR constexpr -#define BOOST_CONSTEXPR_OR_CONST constexpr -#endif -#if defined(BOOST_NO_CXX14_CONSTEXPR) -#define BOOST_CXX14_CONSTEXPR -#else -#define BOOST_CXX14_CONSTEXPR constexpr -#endif - -// -// Unused variable/typedef workarounds: -// -#ifndef BOOST_ATTRIBUTE_UNUSED -# define BOOST_ATTRIBUTE_UNUSED -#endif - -#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST - -// -// Set BOOST_HAS_STATIC_ASSERT when BOOST_NO_CXX11_STATIC_ASSERT is not defined -// -#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) -# define BOOST_HAS_STATIC_ASSERT -#endif - -// -// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_CXX11_RVALUE_REFERENCES is not defined -// -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) -#define BOOST_HAS_RVALUE_REFS -#endif - -// -// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_CXX11_VARIADIC_TEMPLATES is not defined -// -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) -#define BOOST_HAS_VARIADIC_TMPL -#endif -// -// Set BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS when -// BOOST_NO_CXX11_VARIADIC_TEMPLATES is set: -// -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS) -# define BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS -#endif - -// -// Finish off with checks for macros that are depricated / no longer supported, -// if any of these are set then it's very likely that much of Boost will no -// longer work. So stop with a #error for now, but give the user a chance -// to continue at their own risk if they really want to: -// -#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_CONFIG_ALLOW_DEPRECATED) -# error "You are using a compiler which lacks features which are now a minimum requirement in order to use Boost, define BOOST_CONFIG_ALLOW_DEPRECATED if you want to continue at your own risk!!!" -#endif - -#endif diff --git a/boost/config/workaround.hpp b/boost/config/workaround.hpp index 0ce8108..fca8f3a 100644 --- a/boost/config/workaround.hpp +++ b/boost/config/workaround.hpp @@ -87,8 +87,10 @@ #endif #ifndef BOOST_GCC #define BOOST_GCC_WORKAROUND_GUARD 1 +#define BOOST_GCC_VERSION_WORKAROUND_GUARD 1 #else #define BOOST_GCC_WORKAROUND_GUARD 0 +#define BOOST_GCC_VERSION_WORKAROUND_GUARD 0 #endif #ifndef BOOST_XLCPP_ZOS #define BOOST_XLCPP_ZOS_WORKAROUND_GUARD 1 diff --git a/boost/container/allocator_traits.hpp b/boost/container/allocator_traits.hpp index b08f601..af32f18 100644 --- a/boost/container/allocator_traits.hpp +++ b/boost/container/allocator_traits.hpp @@ -50,21 +50,21 @@ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 2 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 2 #include #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 #include #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 9 @@ -87,7 +87,7 @@ BOOST_INTRUSIVE_HAS_STATIC_MEMBER_FUNC_SIGNATURE(has_select_on_container_copy_co } //namespace allocator_traits_detail { -namespace container_detail { +namespace dtl { //workaround needed for C++03 compilers with no construct() //supporting rvalue references @@ -121,7 +121,7 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_always_equal) BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(is_partially_propagable) -} //namespace container_detail { +} //namespace dtl { #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -196,59 +196,59 @@ struct allocator_traits { typedef see_documentation type; }; #else //pointer - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, pointer, value_type*) pointer; //const_pointer - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator, + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator, const_pointer, typename boost::intrusive::pointer_traits::template rebind_pointer) const_pointer; //reference - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - reference, typename container_detail::unvoid_ref::type) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + reference, typename dtl::unvoid_ref::type) reference; //const_reference - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - const_reference, typename container_detail::unvoid_ref::type) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + const_reference, typename dtl::unvoid_ref::type) const_reference; //void_pointer - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator, + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator, void_pointer, typename boost::intrusive::pointer_traits::template rebind_pointer) void_pointer; //const_void_pointer - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Allocator, + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::dtl::, Allocator, const_void_pointer, typename boost::intrusive::pointer_traits::template rebind_pointer) const_void_pointer; //difference_type - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, difference_type, std::ptrdiff_t) difference_type; //size_type - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, size_type, std::size_t) size_type; //propagate_on_container_copy_assignment - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - propagate_on_container_copy_assignment, container_detail::false_type) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + propagate_on_container_copy_assignment, dtl::false_type) propagate_on_container_copy_assignment; //propagate_on_container_move_assignment - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - propagate_on_container_move_assignment, container_detail::false_type) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + propagate_on_container_move_assignment, dtl::false_type) propagate_on_container_move_assignment; //propagate_on_container_swap - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - propagate_on_container_swap, container_detail::false_type) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + propagate_on_container_swap, dtl::false_type) propagate_on_container_swap; //is_always_equal - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - is_always_equal, container_detail::is_empty) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + is_always_equal, dtl::is_empty) is_always_equal; //is_partially_propagable - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Allocator, - is_partially_propagable, container_detail::false_type) + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::dtl::, Allocator, + is_partially_propagable, dtl::false_type) is_partially_propagable; //rebind_alloc & rebind_traits @@ -302,10 +302,10 @@ struct allocator_traits //! otherwise, invokes a.allocate(n) BOOST_CONTAINER_FORCEINLINE static pointer allocate(Allocator &a, size_type n, const_void_pointer p) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_allocate ::value; - container_detail::bool_ flag; + dtl::bool_ flag; return allocator_traits::priv_allocate(flag, a, n, p); } @@ -315,10 +315,10 @@ struct allocator_traits 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:: + const bool value = boost::container::dtl:: has_member_function_callable_with_destroy ::value; - container_detail::bool_ flag; + dtl::bool_ flag; allocator_traits::priv_destroy(flag, a, p); } @@ -327,21 +327,21 @@ struct allocator_traits 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; + dtl::bool_ flag; return allocator_traits::priv_max_size(flag, a); } //! Returns: a.select_on_container_copy_construction() if that expression is well-formed; //! otherwise, a. BOOST_CONTAINER_FORCEINLINE static BOOST_CONTAINER_DOC1ST(Allocator, - typename container_detail::if_c + typename dtl::if_c < allocator_traits_detail::has_select_on_container_copy_construction::value BOOST_MOVE_I Allocator BOOST_MOVE_I const Allocator & >::type) select_on_container_copy_construction(const Allocator &a) { const bool value = allocator_traits_detail::has_select_on_container_copy_construction ::value; - container_detail::bool_ flag; + dtl::bool_ flag; return allocator_traits::priv_select_on_container_copy_construction(flag, a); } @@ -352,11 +352,11 @@ struct allocator_traits 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 - , boost::container::container_detail::has_member_function_callable_with_construct + < dtl::is_not_std_allocator + , boost::container::dtl::has_member_function_callable_with_construct < Allocator, T*, Args... > >::value; - container_detail::bool_ flag; + dtl::bool_ flag; allocator_traits::priv_construct(flag, a, p, ::boost::forward(args)...); } #endif @@ -365,7 +365,7 @@ struct allocator_traits //! false. BOOST_CONTAINER_FORCEINLINE static bool storage_is_unpropagable(const Allocator &a, pointer p) BOOST_NOEXCEPT_OR_NOTHROW { - container_detail::bool_ flag; + dtl::bool_ flag; return allocator_traits::priv_storage_is_unpropagable(flag, a, p); } @@ -373,45 +373,45 @@ struct allocator_traits //! a == b. BOOST_CONTAINER_FORCEINLINE static bool equal(const Allocator &a, const Allocator &b) BOOST_NOEXCEPT_OR_NOTHROW { - container_detail::bool_ flag; + dtl::bool_ flag; return allocator_traits::priv_equal(flag, a, b); } #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) private: - BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::true_type, Allocator &a, size_type n, const_void_pointer p) + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::true_type, Allocator &a, size_type n, const_void_pointer p) { return a.allocate(n, p); } - BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(container_detail::false_type, Allocator &a, size_type n, const_void_pointer) + BOOST_CONTAINER_FORCEINLINE static pointer priv_allocate(dtl::false_type, Allocator &a, size_type n, const_void_pointer) { return a.allocate(n); } template - BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::true_type, Allocator &a, T* p) BOOST_NOEXCEPT_OR_NOTHROW { a.destroy(p); } template - BOOST_CONTAINER_FORCEINLINE static void priv_destroy(container_detail::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE static void priv_destroy(dtl::false_type, Allocator &, T* p) BOOST_NOEXCEPT_OR_NOTHROW { p->~T(); (void)p; } - BOOST_CONTAINER_FORCEINLINE 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(dtl::true_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a.max_size(); } - BOOST_CONTAINER_FORCEINLINE 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(dtl::false_type, const Allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return size_type(-1)/sizeof(value_type); } - BOOST_CONTAINER_FORCEINLINE 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(dtl::true_type, const Allocator &a) { return a.select_on_container_copy_construction(); } - BOOST_CONTAINER_FORCEINLINE 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(dtl::false_type, const Allocator &a) BOOST_NOEXCEPT_OR_NOTHROW { return a; } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) template - BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::true_type, Allocator &a, T *p, BOOST_FWD_REF(Args) ...args) { a.construct( p, ::boost::forward(args)...); } template - BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, BOOST_FWD_REF(Args) ...args) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::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: @@ -421,11 +421,11 @@ struct allocator_traits 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 \ - , boost::container::container_detail::has_member_function_callable_with_construct \ + < dtl::is_not_std_allocator \ + , boost::container::dtl::has_member_function_callable_with_construct \ < Allocator, T* BOOST_MOVE_I##N BOOST_MOVE_FWD_T##N > \ >::value; \ - container_detail::bool_ flag;\ + dtl::bool_ flag;\ (priv_construct)(flag, a, p BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ }\ // @@ -438,11 +438,11 @@ struct allocator_traits ///////////////////////////////// #define BOOST_CONTAINER_ALLOCATOR_TRAITS_PRIV_CONSTRUCT_IMPL(N) \ template\ - BOOST_CONTAINER_FORCEINLINE 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(dtl::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\ - BOOST_CONTAINER_FORCEINLINE 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(dtl::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 - BOOST_CONTAINER_FORCEINLINE static void priv_construct(container_detail::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) + BOOST_CONTAINER_FORCEINLINE static void priv_construct(dtl::false_type, Allocator &, T *p, const ::boost::container::default_init_t&) { ::new((void*)p, boost_container_new_t()) T; } - BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::true_type, const Allocator &a, pointer p) + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::true_type, const Allocator &a, pointer p) { return a.storage_is_unpropagable(p); } - BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(container_detail::false_type, const Allocator &, pointer) + BOOST_CONTAINER_FORCEINLINE static bool priv_storage_is_unpropagable(dtl::false_type, const Allocator &, pointer) { return false; } - BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::true_type, const Allocator &, const Allocator &) + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::true_type, const Allocator &, const Allocator &) { return true; } - BOOST_CONTAINER_FORCEINLINE static bool priv_equal(container_detail::false_type, const Allocator &a, const Allocator &b) + BOOST_CONTAINER_FORCEINLINE static bool priv_equal(dtl::false_type, const Allocator &a, const Allocator &b) { return a == b; } #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) diff --git a/boost/container/container_fwd.hpp b/boost/container/container_fwd.hpp index e85a6ce..e4fe6f8 100644 --- a/boost/container/container_fwd.hpp +++ b/boost/container/container_fwd.hpp @@ -67,7 +67,7 @@ namespace detail{ //Create namespace to avoid compilation errors }}} -namespace boost{ namespace container{ namespace container_detail{ +namespace boost{ namespace container{ namespace dtl{ namespace bi = boost::intrusive; namespace bid = boost::intrusive::detail; }}} @@ -88,23 +88,14 @@ namespace boost{ namespace container{ namespace pmr{ namespace boost { namespace container { -//! Enumeration used to configure ordered associative containers -//! with a concrete tree implementation. -enum tree_type_enum -{ - red_black_tree, - avl_tree, - scapegoat_tree, - splay_tree -}; - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED template class new_allocator; template > + ,class Allocator = new_allocator + ,class Options = void> class vector; template > class slist; -template -struct tree_opt; - -typedef tree_opt tree_assoc_defaults; - template ,class Allocator = new_allocator - ,class Options = tree_assoc_defaults > + ,class Options = void> class set; template ,class Allocator = new_allocator - ,class Options = tree_assoc_defaults > + ,class Options = void > class multiset; template ,class Allocator = new_allocator > - ,class Options = tree_assoc_defaults > + ,class Options = void > class map; template ,class Allocator = new_allocator > - ,class Options = tree_assoc_defaults > + ,class Options = void > class multimap; template -//! - optimize_size -typedef implementation_defined tree_assoc_defaults; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED //! Type used to tag that the input range is diff --git a/boost/container/detail/addressof.hpp b/boost/container/detail/addressof.hpp index fedbdb9..b3b8a4d 100644 --- a/boost/container/detail/addressof.hpp +++ b/boost/container/detail/addressof.hpp @@ -22,7 +22,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj) @@ -34,7 +34,7 @@ BOOST_CONTAINER_FORCEINLINE T* addressof(T& obj) ))); } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/advanced_insert_int.hpp b/boost/container/detail/advanced_insert_int.hpp index db5e8df..fc8a33a 100644 --- a/boost/container/detail/advanced_insert_int.hpp +++ b/boost/container/detail/advanced_insert_int.hpp @@ -41,7 +41,7 @@ #include #include -namespace boost { namespace container { namespace container_detail { +namespace boost { namespace container { namespace dtl { template struct move_insert_range_proxy @@ -125,8 +125,16 @@ struct insert_value_initialized_n_proxy void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const { boost::container::uninitialized_value_init_alloc_n(a, n, p); } - void copy_n_and_update(Allocator &, Iterator, size_type) const - { BOOST_ASSERT(false); } + void copy_n_and_update(Allocator &a, Iterator p, size_type n) const + { + for (; 0 < n; --n, ++p){ + typename aligned_storage::value>::type stor; + value_type &v = *static_cast(static_cast(stor.data)); + alloc_traits::construct(a, &v); + value_destructor on_exit(a, v); (void)on_exit; + *p = ::boost::move(v); + } + } }; template @@ -139,8 +147,18 @@ struct insert_default_initialized_n_proxy void uninitialized_copy_n_and_update(Allocator &a, Iterator p, size_type n) const { boost::container::uninitialized_default_init_alloc_n(a, n, p); } - void copy_n_and_update(Allocator &, Iterator, size_type) const - { BOOST_ASSERT(false); } + void copy_n_and_update(Allocator &a, Iterator p, size_type n) const + { + if(!is_pod::value){ + for (; 0 < n; --n, ++p){ + typename aligned_storage::value>::type stor; + value_type &v = *static_cast(static_cast(stor.data)); + alloc_traits::construct(a, &v, default_init); + value_destructor on_exit(a, v); (void)on_exit; + *p = ::boost::move(v); + } + } + } }; template @@ -208,7 +226,7 @@ insert_copy_proxy get_insert_value_proxy(const typename boost::co return insert_copy_proxy(v); } -}}} //namespace boost { namespace container { namespace container_detail { +}}} //namespace boost { namespace container { namespace dtl { #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -217,7 +235,7 @@ insert_copy_proxy get_insert_value_proxy(const typename boost::co namespace boost { namespace container { -namespace container_detail { +namespace dtl { template struct insert_nonmovable_emplace_proxy @@ -271,7 +289,7 @@ struct insert_emplace_proxy { BOOST_ASSERT(n ==1); (void)n; typename aligned_storage::value>::type v; - value_type *vp = static_cast(static_cast(&v)); + value_type *vp = static_cast(static_cast(v.data)); alloc_traits::construct(a, vp, ::boost::forward(get(this->args_))...); BOOST_TRY{ @@ -301,7 +319,7 @@ struct insert_emplace_proxy struct insert_emplace_proxy::value_type>::type + , typename boost::container::dtl::add_const::value_type>::type > : public insert_copy_proxy { @@ -321,7 +339,7 @@ struct insert_emplace_proxy struct insert_emplace_proxy::value_type>::type & + , typename boost::container::dtl::add_const::value_type>::type & > : public insert_copy_proxy { @@ -330,7 +348,7 @@ struct insert_emplace_proxy\ @@ -382,7 +400,7 @@ struct insert_emplace_proxy_arg##N\ BOOST_ASSERT(n == 1); (void)n;\ typename aligned_storage::value>::type v;\ BOOST_ASSERT((((size_type)(&v)) % alignment_of::value) == 0);\ - value_type *vp = static_cast(static_cast(&v));\ + value_type *vp = static_cast(static_cast(v.data));\ alloc_traits::construct(a, vp BOOST_MOVE_I##N BOOST_MOVE_MFWD##N);\ BOOST_TRY{\ *p = ::boost::move(*vp);\ @@ -437,7 +455,7 @@ struct insert_emplace_proxy_arg1 struct insert_emplace_proxy_arg1::value_type>::type + , typename boost::container::dtl::add_const::value_type>::type > : public insert_copy_proxy { @@ -457,7 +475,7 @@ struct insert_emplace_proxy_arg1 struct insert_emplace_proxy_arg1::value_type>::type & + , typename boost::container::dtl::add_const::value_type>::type & > : public insert_copy_proxy { @@ -468,7 +486,7 @@ struct insert_emplace_proxy_arg1 -inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) +inline void swap_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +inline void swap_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { boost::adl_move_swap(l, r); } template -inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type) +inline void assign_alloc(AllocatorType &, const AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type) +inline void assign_alloc(AllocatorType &l, const AllocatorType &r, dtl::true_type) { l = r; } template -inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) +inline void move_alloc(AllocatorType &, AllocatorType &, dtl::false_type) BOOST_NOEXCEPT_OR_NOTHROW {} template -inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +inline void move_alloc(AllocatorType &l, AllocatorType &r, dtl::true_type) { l = ::boost::move(r); } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/allocator_version_traits.hpp b/boost/container/detail/allocator_version_traits.hpp index 62492da..18460bd 100644 --- a/boost/container/detail/allocator_version_traits.hpp +++ b/boost/container/detail/allocator_version_traits.hpp @@ -33,12 +33,12 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { -template::value> +template::value> struct allocator_version_traits { - typedef ::boost::container::container_detail::integral_constant + typedef ::boost::container::dtl::integral_constant alloc_version; typedef typename Allocator::multiallocation_chain multiallocation_chain; @@ -67,7 +67,7 @@ struct allocator_version_traits template struct allocator_version_traits { - typedef ::boost::container::container_detail::integral_constant + typedef ::boost::container::dtl::integral_constant alloc_version; typedef typename boost::container::allocator_traits::pointer pointer; @@ -76,9 +76,9 @@ struct allocator_version_traits typedef typename boost::intrusive::pointer_traits:: template rebind_pointer::type void_ptr; - typedef container_detail::basic_multiallocation_chain + typedef dtl::basic_multiallocation_chain multialloc_cached_counted; - typedef boost::container::container_detail:: + typedef boost::container::dtl:: transform_multiallocation_chain < multialloc_cached_counted, value_type> multiallocation_chain; @@ -153,7 +153,7 @@ struct allocator_version_traits } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/construct_in_place.hpp b/boost/container/detail/construct_in_place.hpp index 9fecd24..b131f06 100644 --- a/boost/container/detail/construct_in_place.hpp +++ b/boost/container/detail/construct_in_place.hpp @@ -67,7 +67,7 @@ BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, InpIt source) template BOOST_CONTAINER_FORCEINLINE void assign_in_place(DstIt dest, value_init_construct_iterator) { - container_detail::value_init val; + dtl::value_init val; *dest = boost::move(val.get()); } diff --git a/boost/container/detail/container_or_allocator_rebind.hpp b/boost/container/detail/container_or_allocator_rebind.hpp index c60d1c0..d74df6c 100644 --- a/boost/container/detail/container_or_allocator_rebind.hpp +++ b/boost/container/detail/container_or_allocator_rebind.hpp @@ -24,7 +24,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template::value> struct container_or_allocator_rebind_impl @@ -42,7 +42,7 @@ struct container_or_allocator_rebind : container_or_allocator_rebind_impl {}; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/container_rebind.hpp b/boost/container/detail/container_rebind.hpp index 79ad9d7..0ebb478 100644 --- a/boost/container/detail/container_rebind.hpp +++ b/boost/container/detail/container_rebind.hpp @@ -23,7 +23,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template struct container_rebind; @@ -251,7 +251,7 @@ namespace container_detail { #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/copy_move_algo.hpp b/boost/container/detail/copy_move_algo.hpp index 5293260..f03800a 100644 --- a/boost/container/detail/copy_move_algo.hpp +++ b/boost/container/detail/copy_move_algo.hpp @@ -34,11 +34,16 @@ // other #include // std -#include //for emmove/memcpy +#include //for memmove/memcpy + +#if defined(BOOST_GCC) && (BOOST_GCC >= 80000) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wclass-memaccess" +#endif namespace boost { namespace container { -namespace container_detail { +namespace dtl { template struct are_elements_contiguous @@ -65,17 +70,15 @@ struct are_elements_contiguous< ::boost::move_iterator > : are_elements_contiguous {}; +} //namespace dtl { + ///////////////////////// // predeclarations ///////////////////////// -template -class vector_iterator; +template +class vec_iterator; -template -class vector_const_iterator; - -} //namespace container_detail { } //namespace container { namespace interprocess { @@ -87,20 +90,14 @@ class offset_ptr; namespace container { -namespace container_detail { +namespace dtl { ///////////////////////// //vector_[const_]iterator ///////////////////////// -template -struct are_elements_contiguous > -{ - static const bool value = true; -}; - -template -struct are_elements_contiguous > +template +struct are_elements_contiguous > { static const bool value = true; }; @@ -130,7 +127,7 @@ template struct is_memtransfer_copy_assignable : boost::move_detail::and_ < are_contiguous_and_same - , container_detail::is_trivially_copy_assignable< typename ::boost::container::iterator_traits::value_type > + , dtl::is_trivially_copy_assignable< typename ::boost::container::iterator_traits::value_type > > {}; @@ -138,28 +135,28 @@ template struct is_memtransfer_copy_constructible : boost::move_detail::and_ < are_contiguous_and_same - , container_detail::is_trivially_copy_constructible< typename ::boost::container::iterator_traits::value_type > + , dtl::is_trivially_copy_constructible< typename ::boost::container::iterator_traits::value_type > > {}; template struct enable_if_memtransfer_copy_constructible - : enable_if, R> + : enable_if, R> {}; template struct disable_if_memtransfer_copy_constructible - : disable_if, R> + : disable_if, R> {}; template struct enable_if_memtransfer_copy_assignable - : enable_if, R> + : enable_if, R> {}; template struct disable_if_memtransfer_copy_assignable - : disable_if, R> + : disable_if, R> {}; template @@ -224,44 +221,44 @@ struct is_memzero_initializable { typedef typename ::boost::container::iterator_traits::value_type value_type; static const bool value = are_elements_contiguous::value && - ( container_detail::is_integral::value || container_detail::is_enum::value + ( dtl::is_integral::value || dtl::is_enum::value #if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) - || container_detail::is_pointer::value + || dtl::is_pointer::value #endif #if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) - || container_detail::is_floating_point::value + || dtl::is_floating_point::value #endif #if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) && defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL) - || container_detail::is_pod::value + || dtl::is_pod::value #endif ); }; template struct enable_if_memzero_initializable - : enable_if_c::value, R> + : enable_if_c::value, R> {}; template struct disable_if_memzero_initializable - : enable_if_c::value, R> + : enable_if_c::value, R> {}; template struct enable_if_trivially_destructible - : enable_if_c < container_detail::is_trivially_destructible + : enable_if_c < dtl::is_trivially_destructible ::value_type>::value , R> {}; template struct disable_if_trivially_destructible - : enable_if_c ::value_type>::value , R> {}; -} //namespace container_detail { +} //namespace dtl { ////////////////////////////////////////////////////////////////////////////// // @@ -281,7 +278,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible::type +inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_move_alloc(Allocator &a, I f, I l, F r) { F back = r; @@ -305,9 +302,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_move_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -326,7 +323,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible::type +inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; @@ -350,9 +347,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -371,7 +368,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible::type +inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; @@ -395,9 +392,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_move_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -416,7 +413,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible::type +inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc(Allocator &a, I f, I l, F r) { F back = r; @@ -440,9 +437,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc(Allocator &, I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -461,7 +458,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible::type +inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; @@ -485,9 +482,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -506,7 +503,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_constructible::type +inline typename dtl::disable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n_source(Allocator &a, I f, typename boost::container::allocator_traits::size_type n, F r) { F back = r; @@ -530,9 +527,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_constructible::type +inline typename dtl::enable_if_memtransfer_copy_constructible::type uninitialized_copy_alloc_n_source(Allocator &, I f, typename boost::container::allocator_traits::size_type n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -550,7 +547,7 @@ inline typename container_detail::enable_if_memtransfer_copy_constructible // F models ForwardIterator -inline typename container_detail::disable_if_memzero_initializable::type +inline typename dtl::disable_if_memzero_initializable::type uninitialized_value_init_alloc_n(Allocator &a, typename boost::container::allocator_traits::size_type n, F r) { F back = r; @@ -573,7 +570,7 @@ inline typename container_detail::disable_if_memzero_initializable::type template // F models ForwardIterator -inline typename container_detail::enable_if_memzero_initializable::type +inline typename dtl::enable_if_memzero_initializable::type uninitialized_value_init_alloc_n(Allocator &, typename boost::container::allocator_traits::size_type n, F r) { typedef typename boost::container::iterator_traits::value_type value_type; @@ -698,7 +695,7 @@ inline F uninitialized_fill_alloc_n(Allocator &a, const T &v, typename boost::co template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type copy(I f, I l, F r) { while (f != l) { @@ -711,9 +708,9 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -725,7 +722,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type copy_n(I f, U n, F r) { while (n--) { @@ -739,9 +736,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -753,7 +750,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type copy_n_source(I f, U n, F r) { while (n--) { @@ -767,9 +764,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -781,7 +778,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type copy_n_source_dest(I f, U n, F &r) { while (n--) { @@ -795,9 +792,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type copy_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source_dest(f, n, r); } +{ return dtl::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -808,7 +805,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type move(I f, I l, F r) { while (f != l) { @@ -821,9 +818,9 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove(f, l, r); } +{ return dtl::memmove(f, l, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -835,7 +832,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type move_n(I f, U n, F r) { while (n--) { @@ -849,9 +846,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_n(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n(f, n, r); } +{ return dtl::memmove_n(f, n, r); } ////////////////////////////////////////////////////////////////////////////// @@ -863,7 +860,7 @@ inline typename container_detail::enable_if_memtransfer_copy_assignable template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type move_backward(I f, I l, F r) { while (f != l) { @@ -876,7 +873,7 @@ inline typename container_detail::disable_if_memtransfer_copy_assignable // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_backward(I f, I l, F r) BOOST_NOEXCEPT_OR_NOTHROW { typedef typename boost::container::iterator_traits::value_type value_type; @@ -896,7 +893,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type move_n_source_dest(I f, U n, F &r) { while (n--) { @@ -910,9 +907,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_n_source_dest(I f, U n, F &r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source_dest(f, n, r); } +{ return dtl::memmove_n_source_dest(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -924,7 +921,7 @@ template // F models ForwardIterator -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type move_n_source(I f, U n, F r) { while (n--) { @@ -938,9 +935,9 @@ template // F models ForwardIterator -inline typename container_detail::enable_if_memtransfer_copy_assignable::type +inline typename dtl::enable_if_memtransfer_copy_assignable::type move_n_source(I f, U n, F r) BOOST_NOEXCEPT_OR_NOTHROW -{ return container_detail::memmove_n_source(f, n, r); } +{ return dtl::memmove_n_source(f, n, r); } ////////////////////////////////////////////////////////////////////////////// // @@ -952,7 +949,7 @@ template // U models unsigned integral constant -inline typename container_detail::disable_if_trivially_destructible::type +inline typename dtl::disable_if_trivially_destructible::type destroy_alloc_n(Allocator &a, I f, U n) { while(n){ @@ -966,7 +963,7 @@ template // U models unsigned integral constant -inline typename container_detail::enable_if_trivially_destructible::type +inline typename dtl::enable_if_trivially_destructible::type destroy_alloc_n(Allocator &, I, U) {} @@ -982,7 +979,7 @@ template ,typename F // F models ForwardIterator ,typename G // G models ForwardIterator > -inline typename container_detail::disable_if_memtransfer_copy_assignable::type +inline typename dtl::disable_if_memtransfer_copy_assignable::type deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits::size_type n_i , G large_range_f, typename allocator_traits::size_type n_j) { @@ -1002,21 +999,21 @@ template ,typename F // F models ForwardIterator ,typename G // G models ForwardIterator > -inline typename container_detail::enable_if_c - < container_detail::is_memtransfer_copy_assignable::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false +inline typename dtl::enable_if_c + < dtl::is_memtransfer_copy_assignable::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false , void>::type deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits::size_type n_i , G large_range_f, typename allocator_traits::size_type n_j) { typedef typename allocator_traits::value_type value_type; - typedef typename container_detail::aligned_storage - ::value>::type storage_type; + typedef typename dtl::aligned_storage + ::value>::type storage_type; storage_type storage; const std::size_t n_i_bytes = sizeof(value_type)*n_i; void *const large_ptr = static_cast(boost::movelib::iterator_to_raw_pointer(large_range_f)); void *const short_ptr = static_cast(boost::movelib::iterator_to_raw_pointer(short_range_f)); - void *const stora_ptr = static_cast(boost::movelib::iterator_to_raw_pointer(storage)); + void *const stora_ptr = static_cast(boost::movelib::iterator_to_raw_pointer(storage.data)); std::memcpy(stora_ptr, large_ptr, n_i_bytes); std::memcpy(large_ptr, short_ptr, n_i_bytes); std::memcpy(short_ptr, stora_ptr, n_i_bytes); @@ -1032,22 +1029,22 @@ template ,typename F // F models ForwardIterator ,typename G // G models ForwardIterator > -inline typename container_detail::enable_if_c - < container_detail::is_memtransfer_copy_assignable::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage) +inline typename dtl::enable_if_c + < dtl::is_memtransfer_copy_assignable::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage) , void>::type deep_swap_alloc_n( Allocator &a, F short_range_f, typename allocator_traits::size_type n_i , G large_range_f, typename allocator_traits::size_type n_j) { typedef typename allocator_traits::value_type value_type; - typedef typename container_detail::aligned_storage - ::value>::type storage_type; + typedef typename dtl::aligned_storage + ::value>::type storage_type; storage_type storage; const std::size_t sizeof_storage = sizeof(storage); std::size_t n_i_bytes = sizeof(value_type)*n_i; char *large_ptr = static_cast(static_cast(boost::movelib::iterator_to_raw_pointer(large_range_f))); char *short_ptr = static_cast(static_cast(boost::movelib::iterator_to_raw_pointer(short_range_f))); - char *stora_ptr = static_cast(static_cast(&storage)); + char *stora_ptr = static_cast(static_cast(storage.data)); std::size_t szt_times = n_i_bytes/sizeof_storage; const std::size_t szt_rem = n_i_bytes%sizeof_storage; @@ -1149,4 +1146,9 @@ void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_tr } //namespace container { } //namespace boost { +#if defined(BOOST_GCC) && (BOOST_GCC >= 80000) +#pragma GCC diagnostic pop +#endif + + #endif //#ifndef BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP diff --git a/boost/container/detail/destroyers.hpp b/boost/container/detail/destroyers.hpp index c3a5d90..9b0be44 100644 --- a/boost/container/detail/destroyers.hpp +++ b/boost/container/detail/destroyers.hpp @@ -30,7 +30,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { //!A deleter for scoped_ptr that deallocates the memory //!allocated for an object using a STL allocator. @@ -39,8 +39,8 @@ struct scoped_deallocator { typedef allocator_traits allocator_traits_type; typedef typename allocator_traits_type::pointer pointer; - typedef container_detail::integral_constant::value> alloc_version; private: @@ -142,8 +142,8 @@ struct scoped_destroy_deallocator typedef boost::container::allocator_traits AllocTraits; typedef typename AllocTraits::pointer pointer; typedef typename AllocTraits::size_type size_type; - typedef container_detail::integral_constant::value> alloc_version; scoped_destroy_deallocator(pointer p, Allocator& a) @@ -296,8 +296,8 @@ class allocator_destroyer typedef boost::container::allocator_traits AllocTraits; typedef typename AllocTraits::value_type value_type; typedef typename AllocTraits::pointer pointer; - typedef container_detail::integral_constant::value> alloc_version; private: @@ -369,7 +369,7 @@ class allocator_multialloc_chain_node_deallocator } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/flat_tree.hpp b/boost/container/detail/flat_tree.hpp index 319cad6..e9cbe38 100644 --- a/boost/container/detail/flat_tree.hpp +++ b/boost/container/detail/flat_tree.hpp @@ -47,6 +47,7 @@ #include #include #include +#include #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) #include @@ -56,7 +57,7 @@ //merge_unique #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge_unique -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3 @@ -64,7 +65,7 @@ //merge_equal #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3 @@ -72,7 +73,7 @@ //index_of #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME index_of -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 @@ -80,7 +81,7 @@ //nth #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME nth -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 @@ -88,7 +89,7 @@ //reserve #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME reserve -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 @@ -96,7 +97,7 @@ //capacity #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME capacity -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0 #define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 @@ -106,196 +107,297 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { + +/////////////////////////////////////// +// +// Helper functions to merge elements +// +/////////////////////////////////////// BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(stored_allocator_type) +/////////////////////////////////////// +// +// flat_tree_container_inplace_merge +// +/////////////////////////////////////// +template +void flat_tree_container_inplace_merge //is_contiguous_container == true + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp , dtl::true_) +{ + typedef typename SequenceContainer::value_type value_type; + value_type *const braw = boost::movelib::iterator_to_raw_pointer(dest.begin()); + value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); + value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); + boost::movelib::adaptive_merge(braw, iraw, eraw, comp, eraw, dest.capacity()- dest.size()); +} + +template +void flat_tree_container_inplace_merge //is_contiguous_container == false + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp, dtl::false_) +{ + boost::movelib::adaptive_merge(dest.begin(), it, dest.end(), comp); +} + +/////////////////////////////////////// +// +// flat_tree_container_inplace_sort_ending +// +/////////////////////////////////////// +template +void flat_tree_container_inplace_sort_ending //is_contiguous_container == true + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp, dtl::true_) +{ + typedef typename SequenceContainer::value_type value_type; + value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); + value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); + boost::movelib::adaptive_sort(iraw, eraw, comp, eraw, dest.capacity()- dest.size()); +} + +template +void flat_tree_container_inplace_sort_ending //is_contiguous_container == false + (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp , dtl::false_) +{ + boost::movelib::adaptive_sort(it, dest.end(), comp); +} + +/////////////////////////////////////// +// +// flat_tree_merge +// +/////////////////////////////////////// template BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::true_) + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::true_) { dest.merge(first, last, comp); } template -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal_non_merge_member - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::true_) +BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal //has_merge_unique == false + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_) { typedef typename SequenceContainer::iterator iterator; - typedef typename SequenceContainer::value_type value_type; - iterator const it = dest.insert( dest.end(), first, last ); - value_type *const braw = boost::movelib::iterator_to_raw_pointer(dest.begin()); - value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); - value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); - value_type *const sraw = boost::movelib::iterator_to_raw_pointer(dest.begin()+dest.size()); - boost::movelib::adaptive_sort(iraw, eraw, comp, sraw, dest.capacity()); - boost::movelib::adaptive_merge(braw, iraw, eraw, comp, sraw, dest.capacity()- dest.size()); + dtl::bool_::value> contiguous_tag; + (flat_tree_container_inplace_merge)(dest, it, comp, contiguous_tag); } +/////////////////////////////////////// +// +// flat_tree_merge_unique +// +/////////////////////////////////////// template -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal_non_merge_member - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::false_) -{ - typedef typename SequenceContainer::iterator iterator; - - iterator const it = dest.insert( dest.end(), first, last ); - boost::movelib::adaptive_sort(it, dest.end(), comp); - boost::movelib::adaptive_merge(dest.begin(), it, dest.end(), comp); -} - -template -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::false_) -{ - (flat_tree_merge_equal_non_merge_member)( dest, first, last, comp - , container_detail::bool_::value>()); -} - -template -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::true_) +BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == true + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::true_) { dest.merge_unique(first, last, comp); } template -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, container_detail::false_) +BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == false + (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_) { - (flat_tree_merge_equal)(dest, first, last, comp, container_detail::false_()); - dest.erase(boost::movelib::unique - (dest.begin(), dest.end(), boost::movelib::negate(comp)), dest.cend()); + typedef typename SequenceContainer::iterator iterator; + typedef typename SequenceContainer::size_type size_type; + + size_type const old_sz = dest.size(); + iterator const first_new = dest.insert(dest.cend(), first, last ); + iterator e = boost::movelib::inplace_set_difference(first_new, dest.end(), dest.begin(), first_new, comp); + dest.erase(e, dest.end()); + dtl::bool_::value> contiguous_tag; + (flat_tree_container_inplace_merge)(dest, dest.begin()+old_sz, comp, contiguous_tag); } +/////////////////////////////////////// +// +// flat_tree_index_of +// +/////////////////////////////////////// template BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_index_of - (SequenceContainer& cont, Iterator p, container_detail::true_) + flat_tree_index_of // has_index_of == true + (SequenceContainer& cont, Iterator p, dtl::true_) { return cont.index_of(p); } template BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_index_of - (SequenceContainer& cont, Iterator p, container_detail::false_) + flat_tree_index_of // has_index_of == false + (SequenceContainer& cont, Iterator p, dtl::false_) { typedef typename SequenceContainer::size_type size_type; return static_cast(p - cont.begin()); } +/////////////////////////////////////// +// +// flat_tree_nth +// +/////////////////////////////////////// template BOOST_CONTAINER_FORCEINLINE Iterator - flat_tree_nth - (SequenceContainer& cont, typename SequenceContainer::size_type n, container_detail::true_) + flat_tree_nth // has_nth == true + (SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::true_) { return cont.nth(n); } template BOOST_CONTAINER_FORCEINLINE Iterator - flat_tree_nth - (SequenceContainer& cont, typename SequenceContainer::size_type n, container_detail::false_) + flat_tree_nth // has_nth == false + (SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::false_) { return cont.begin()+ n; } +/////////////////////////////////////// +// +// flat_tree_get_stored_allocator +// +/////////////////////////////////////// template BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::stored_allocator_type & - flat_tree_get_stored_allocator - (SequenceContainer& cont, container_detail::true_) + flat_tree_get_stored_allocator // has_get_stored_allocator == true + (SequenceContainer& cont, dtl::true_) { return cont.get_stored_allocator(); } template BOOST_CONTAINER_FORCEINLINE const typename SequenceContainer::stored_allocator_type & - flat_tree_get_stored_allocator - (const SequenceContainer& cont, container_detail::true_) + flat_tree_get_stored_allocator // has_get_stored_allocator == true + (const SequenceContainer& cont, dtl::true_) { return cont.get_stored_allocator(); } template BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::allocator_type - flat_tree_get_stored_allocator - (SequenceContainer& cont, container_detail::false_) + flat_tree_get_stored_allocator // has_get_stored_allocator == false + (SequenceContainer& cont, dtl::false_) { return cont.get_allocator(); } +/////////////////////////////////////// +// +// flat_tree_adopt_sequence_equal +// +/////////////////////////////////////// template -void flat_tree_adopt_sequence_equal(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::true_) +void flat_tree_sort_contiguous_to_adopt // is_contiguous_container == true + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp) { - tseq.clear(); - boost::movelib::adaptive_sort - (boost::movelib::iterator_to_raw_pointer(seq.begin()) - , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp - , boost::movelib::iterator_to_raw_pointer(tseq.begin() + tseq.size()) - , tseq.capacity() - tseq.size()); + if(tseq.capacity() >= (seq.capacity() - seq.size())) { + tseq.clear(); + boost::movelib::adaptive_sort + (boost::movelib::iterator_to_raw_pointer(seq.begin()) + , boost::movelib::iterator_to_raw_pointer(seq.end()) + , comp + , boost::movelib::iterator_to_raw_pointer(tseq.begin()) + , tseq.capacity()); + } + else{ + boost::movelib::adaptive_sort + (boost::movelib::iterator_to_raw_pointer(seq.begin()) + , boost::movelib::iterator_to_raw_pointer(seq.end()) + , comp + , boost::movelib::iterator_to_raw_pointer(seq.end()) + , seq.capacity() - seq.size()); + } +} + +template +void flat_tree_adopt_sequence_equal // is_contiguous_container == true + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::true_) +{ + flat_tree_sort_contiguous_to_adopt(tseq, boost::move(seq), comp); tseq = boost::move(seq); } template -void flat_tree_adopt_sequence_equal(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::false_) +void flat_tree_adopt_sequence_equal // is_contiguous_container == false + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::false_) { boost::movelib::adaptive_sort(seq.begin(), seq.end(), comp); tseq = boost::move(seq); } +/////////////////////////////////////// +// +// flat_tree_adopt_sequence_unique +// +/////////////////////////////////////// template -void flat_tree_adopt_sequence_unique(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::true_) +void flat_tree_adopt_sequence_unique// is_contiguous_container == true + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::true_) { - boost::movelib::adaptive_sort + boost::movelib::pdqsort ( boost::movelib::iterator_to_raw_pointer(seq.begin()) , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp - , boost::movelib::iterator_to_raw_pointer(tseq.begin() + tseq.size()) - , tseq.capacity() - tseq.size()); - seq.erase(boost::movelib::unique - ( seq.begin(), seq.end(), boost::movelib::negate(comp)) - , seq.cend()); - tseq = boost::move(seq); -} - -template -void flat_tree_adopt_sequence_unique(SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, container_detail::false_) -{ - boost::movelib::adaptive_sort(seq.begin(), seq.end(), comp); + , comp); seq.erase(boost::movelib::unique (seq.begin(), seq.end(), boost::movelib::negate(comp)), seq.cend()); tseq = boost::move(seq); } +template +void flat_tree_adopt_sequence_unique// is_contiguous_container == false + (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::false_) +{ + boost::movelib::pdqsort(seq.begin(), seq.end(), comp); + seq.erase(boost::movelib::unique + (seq.begin(), seq.end(), boost::movelib::negate(comp)), seq.cend()); + tseq = boost::move(seq); +} + +/////////////////////////////////////// +// +// flat_tree_reserve +// +/////////////////////////////////////// template -BOOST_CONTAINER_FORCEINLINE void - flat_tree_reserve(SequenceContainer &tseq, typename SequenceContainer::size_type cap, container_detail::true_) +BOOST_CONTAINER_FORCEINLINE void // has_reserve == true + flat_tree_reserve(SequenceContainer &tseq, typename SequenceContainer::size_type cap, dtl::true_) { tseq.reserve(cap); } template -BOOST_CONTAINER_FORCEINLINE void - flat_tree_reserve(SequenceContainer &, typename SequenceContainer::size_type, container_detail::false_) +BOOST_CONTAINER_FORCEINLINE void // has_reserve == false + flat_tree_reserve(SequenceContainer &, typename SequenceContainer::size_type, dtl::false_) { } -template +/////////////////////////////////////// +// +// flat_tree_capacity +// +/////////////////////////////////////// +template // has_capacity == true BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_capacity(const SequenceContainer &tseq, container_detail::true_) + flat_tree_capacity(const SequenceContainer &tseq, dtl::true_) { return tseq.capacity(); } -template +template // has_capacity == false BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_capacity(const SequenceContainer &tseq, container_detail::false_) + flat_tree_capacity(const SequenceContainer &tseq, dtl::false_) { return tseq.size(); } +/////////////////////////////////////// +// +// flat_tree_value_compare +// +/////////////////////////////////////// + template class flat_tree_value_compare : private Compare @@ -324,21 +426,14 @@ class flat_tree_value_compare Compare &get_comp() { return *this; } }; -/* -template -struct get_flat_tree_iterators -{ - typedef typename boost::container::container_detail:: - vec_iterator iterator; - typedef typename boost::container::container_detail:: - vec_iterator const_iterator; - typedef boost::container::reverse_iterator reverse_iterator; - typedef boost::container::reverse_iterator const_reverse_iterator; -}; -*/ +/////////////////////////////////////// +// +// select_container_type +// +/////////////////////////////////////// template < class Value, class AllocatorOrContainer - , bool = boost::container::container_detail::is_container::value > + , bool = boost::container::dtl::is_container::value > struct select_container_type { typedef AllocatorOrContainer type; @@ -350,6 +445,12 @@ struct select_container_type typedef boost::container::vector type; }; + +/////////////////////////////////////// +// +// flat_tree +// +/////////////////////////////////////// template class flat_tree @@ -452,20 +553,20 @@ class flat_tree //!Standard extension typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - (boost::container::container_detail::, container_type + (boost::container::dtl::, container_type ,stored_allocator_type, allocator_type) stored_allocator_type; static const bool has_stored_allocator_type = - BOOST_INTRUSIVE_HAS_TYPE(boost::container::container_detail::, container_type, stored_allocator_type); + BOOST_INTRUSIVE_HAS_TYPE(boost::container::dtl::, container_type, stored_allocator_type); private: typedef allocator_traits stored_allocator_traits; public: - typedef typename container_detail::if_c + typedef typename dtl::if_c ::type get_stored_allocator_const_return_t; - typedef typename container_detail::if_c + typedef typename dtl::if_c ::type get_stored_allocator_noconst_return_t; BOOST_CONTAINER_FORCEINLINE flat_tree() @@ -489,7 +590,7 @@ class flat_tree { } BOOST_CONTAINER_FORCEINLINE flat_tree(BOOST_RV_REF(flat_tree) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : m_data(boost::move(x.m_data)) { } @@ -599,7 +700,7 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE flat_tree& operator=(BOOST_RV_REF(flat_tree) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { m_data = boost::move(x.m_data); return *this; } BOOST_CONTAINER_FORCEINLINE const value_compare &priv_value_comp() const @@ -632,12 +733,12 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const { - return flat_tree_get_stored_allocator(this->m_data.m_seq, container_detail::bool_()); + return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() { - return flat_tree_get_stored_allocator(this->m_data.m_seq, container_detail::bool_()); + return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE iterator begin() @@ -687,7 +788,7 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE void swap(flat_tree& other) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ) + && boost::container::dtl::is_nothrow_swappable::value ) { this->m_data.swap(other.m_data); } public: @@ -767,109 +868,51 @@ class flat_tree template void insert_unique(InIt first, InIt last) { - for ( ; first != last; ++first){ - this->insert_unique(*first); - } + dtl::bool_::value> contiguous_tag; + container_type &seq = this->m_data.m_seq; + value_compare &val_cmp = this->priv_value_comp(); + + //Step 1: put new elements in the back + typename container_type::iterator const it = seq.insert(seq.cend(), first, last); + + //Step 2: sort them + boost::movelib::pdqsort(it, seq.end(), val_cmp); + + //Step 3: only left unique values from the back not already present in the original range + typename container_type::iterator const e = boost::movelib::inplace_set_unique_difference + (it, seq.end(), seq.begin(), it, val_cmp); + seq.erase(e, seq.cend()); + + //Step 4: merge both ranges + (flat_tree_container_inplace_merge)(seq, it, this->priv_value_comp(), contiguous_tag); } template - void insert_equal(InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < container_detail::is_input_iterator::value - >::type * = 0 - #endif - ) - { this->priv_insert_equal_loop(first, last); } - - template - void insert_equal(InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !container_detail::is_input_iterator::value - >::type * = 0 - #endif - ) + void insert_equal(InIt first, InIt last) { - const size_type len = static_cast(boost::container::iterator_distance(first, last)); - this->reserve(this->size()+len); - this->priv_insert_equal_loop(first, last); + dtl::bool_::value> contiguous_tag; + container_type &seq = this->m_data.m_seq; + typename container_type::iterator const it = seq.insert(seq.cend(), first, last); + (flat_tree_container_inplace_sort_ending)(seq, it, this->priv_value_comp(), contiguous_tag); + (flat_tree_container_inplace_merge) (seq, it, this->priv_value_comp(), contiguous_tag); } //Ordered template - void insert_equal(ordered_range_t, InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < container_detail::is_input_iterator::value - >::type * = 0 - #endif - ) - { this->priv_insert_equal_loop_ordered(first, last); } - - template - void insert_equal(ordered_range_t, FwdIt first, FwdIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !container_detail::is_input_iterator::value && - container_detail::is_forward_iterator::value - >::type * = 0 - #endif - ) + void insert_equal(ordered_range_t, InIt first, InIt last) { - const size_type len = static_cast(boost::container::iterator_distance(first, last)); - this->reserve(this->size()+len); - this->priv_insert_equal_loop_ordered(first, last); - } - - template - void insert_equal(ordered_range_t, BidirIt first, BidirIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or - < void - , container_detail::is_input_iterator - , container_detail::is_forward_iterator - >::type * = 0 - #endif - ) - { - const bool value = boost::container::container_detail:: - has_member_function_callable_with_merge_unique::value; - (flat_tree_merge_equal)(this->m_data.m_seq, first, last, this->priv_value_comp(), container_detail::bool_()); + const bool value = boost::container::dtl:: + has_member_function_callable_with_merge_unique::value; + (flat_tree_merge_equal)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_()); } template - void insert_unique(ordered_unique_range_t, InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_or - < void - , container_detail::is_input_iterator - , container_detail::is_forward_iterator - >::type * = 0 - #endif - ) + void insert_unique(ordered_unique_range_t, InIt first, InIt last) { - const_iterator pos(this->cend()); - for ( ; first != last; ++first){ - pos = this->insert_unique(pos, *first); - ++pos; - } - } - - template - void insert_unique(ordered_unique_range_t, BidirIt first, BidirIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_c - < !(container_detail::is_input_iterator::value || - container_detail::is_forward_iterator::value) - >::type * = 0 - #endif - ) - { - const bool value = boost::container::container_detail:: - has_member_function_callable_with_merge_unique::value; - (flat_tree_merge_unique)(this->m_data.m_seq, first, last, this->priv_value_comp(), container_detail::bool_()); + const bool value = boost::container::dtl:: + has_member_function_callable_with_merge_unique::value; + (flat_tree_merge_unique)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_()); } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -878,7 +921,7 @@ class flat_tree std::pair emplace_unique(BOOST_FWD_REF(Args)... args) { typename aligned_storage::value>::type v; - value_type &val = *static_cast(static_cast(&v)); + value_type &val = *static_cast(static_cast(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward(args)... ); value_destructor d(a, val); @@ -890,7 +933,7 @@ class flat_tree { //hint checked in insert_unique typename aligned_storage::value>::type v; - value_type &val = *static_cast(static_cast(&v)); + value_type &val = *static_cast(static_cast(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward(args)... ); value_destructor d(a, val); @@ -901,7 +944,7 @@ class flat_tree iterator emplace_equal(BOOST_FWD_REF(Args)... args) { typename aligned_storage::value>::type v; - value_type &val = *static_cast(static_cast(&v)); + value_type &val = *static_cast(static_cast(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward(args)... ); value_destructor d(a, val); @@ -913,7 +956,7 @@ class flat_tree { //hint checked in insert_equal typename aligned_storage::value>::type v; - value_type &val = *static_cast(static_cast(&v)); + value_type &val = *static_cast(static_cast(v.data)); get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); stored_allocator_traits::construct(a, &val, ::boost::forward(args)... ); value_destructor d(a, val); @@ -950,7 +993,7 @@ class flat_tree std::pair emplace_unique(BOOST_MOVE_UREF##N)\ {\ typename aligned_storage::value>::type v;\ - value_type &val = *static_cast(static_cast(&v));\ + value_type &val = *static_cast(static_cast(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor d(a, val);\ @@ -961,7 +1004,7 @@ class flat_tree iterator emplace_hint_unique(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ typename aligned_storage::value>::type v;\ - value_type &val = *static_cast(static_cast(&v));\ + value_type &val = *static_cast(static_cast(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor d(a, val);\ @@ -972,7 +1015,7 @@ class flat_tree iterator emplace_equal(BOOST_MOVE_UREF##N)\ {\ typename aligned_storage::value>::type v;\ - value_type &val = *static_cast(static_cast(&v));\ + value_type &val = *static_cast(static_cast(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor d(a, val);\ @@ -983,7 +1026,7 @@ class flat_tree iterator emplace_hint_equal(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ typename aligned_storage ::value>::type v;\ - value_type &val = *static_cast(static_cast(&v));\ + value_type &val = *static_cast(static_cast(v.data));\ get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ value_destructor d(a, val);\ @@ -1069,30 +1112,30 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_nth::value; - return flat_tree_nth(this->m_data.m_seq, n, container_detail::bool_()); + return flat_tree_nth(this->m_data.m_seq, n, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_nth::value; - return flat_tree_nth(this->m_data.m_seq, n, container_detail::bool_()); + return flat_tree_nth(this->m_data.m_seq, n, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_index_of::value; - return flat_tree_index_of(this->m_data.m_seq, p, container_detail::bool_()); + return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_index_of::value; - return flat_tree_index_of(this->m_data.m_seq, p, container_detail::bool_()); + return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_()); } // set operations: @@ -1117,7 +1160,31 @@ class flat_tree return i; } - // set operations: + template + typename dtl::enable_if_transparent::type + find(const K& k) + { + iterator i = this->lower_bound(k); + iterator end_it = this->end(); + if (i != end_it && this->m_data.get_comp()(k, KeyOfValue()(*i))){ + i = end_it; + } + return i; + } + + template + typename dtl::enable_if_transparent::type + find(const K& k) const + { + const_iterator i = this->lower_bound(k); + + const_iterator end_it = this->cend(); + if (i != end_it && this->m_data.get_comp()(k, KeyOfValue()(*i))){ + i = end_it; + } + return i; + } + size_type count(const key_type& k) const { std::pair p = this->equal_range(k); @@ -1125,6 +1192,15 @@ class flat_tree return n; } + template + typename dtl::enable_if_transparent::type + count(const K& k) const + { + std::pair p = this->equal_range(k); + size_type n = p.second - p.first; + return n; + } + template BOOST_CONTAINER_FORCEINLINE void merge_unique(flat_tree& source) { @@ -1141,26 +1217,26 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE void merge_unique(flat_tree& source) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_merge_unique::value; (flat_tree_merge_unique) ( this->m_data.m_seq , boost::make_move_iterator(source.m_data.m_seq.begin()) , boost::make_move_iterator(source.m_data.m_seq.end()) , this->priv_value_comp() - , container_detail::bool_()); + , dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE void merge_equal(flat_tree& source) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_merge::value; (flat_tree_merge_equal) ( this->m_data.m_seq , boost::make_move_iterator(source.m_data.m_seq.begin()) , boost::make_move_iterator(source.m_data.m_seq.end()) , this->priv_value_comp() - , container_detail::bool_()); + , dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) @@ -1169,36 +1245,85 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const { return this->priv_lower_bound(this->cbegin(), this->cend(), k); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + lower_bound(const K& k) + { return this->priv_lower_bound(this->begin(), this->end(), k); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + lower_bound(const K& k) const + { return this->priv_lower_bound(this->cbegin(), this->cend(), k); } + BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) { return this->priv_upper_bound(this->begin(), this->end(), k); } BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const { return this->priv_upper_bound(this->cbegin(), this->cend(), k); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + upper_bound(const K& k) + { return this->priv_upper_bound(this->begin(), this->end(), k); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + upper_bound(const K& k) const + { return this->priv_upper_bound(this->cbegin(), this->cend(), k); } + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& k) { return this->priv_equal_range(this->begin(), this->end(), k); } BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& k) const { return this->priv_equal_range(this->cbegin(), this->cend(), k); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + equal_range(const K& k) + { return this->priv_equal_range(this->begin(), this->end(), k); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + equal_range(const K& k) const + { return this->priv_equal_range(this->cbegin(), this->cend(), k); } + + BOOST_CONTAINER_FORCEINLINE std::pair lower_bound_range(const key_type& k) { return this->priv_lower_bound_range(this->begin(), this->end(), k); } BOOST_CONTAINER_FORCEINLINE std::pair lower_bound_range(const key_type& k) const { return this->priv_lower_bound_range(this->cbegin(), this->cend(), k); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + lower_bound_range(const K& k) + { return this->priv_lower_bound_range(this->begin(), this->end(), k); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + lower_bound_range(const K& k) const + { return this->priv_lower_bound_range(this->cbegin(), this->cend(), k); } + BOOST_CONTAINER_FORCEINLINE size_type capacity() const { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_capacity::value; - return (flat_tree_capacity)(this->m_data.m_seq, container_detail::bool_()); + return (flat_tree_capacity)(this->m_data.m_seq, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE void reserve(size_type cnt) { - const bool value = boost::container::container_detail:: + const bool value = boost::container::dtl:: has_member_function_callable_with_reserve::value; - (flat_tree_reserve)(this->m_data.m_seq, cnt, container_detail::bool_()); + (flat_tree_reserve)(this->m_data.m_seq, cnt, dtl::bool_()); } BOOST_CONTAINER_FORCEINLINE container_type extract_sequence() @@ -1214,13 +1339,13 @@ class flat_tree BOOST_CONTAINER_FORCEINLINE void adopt_sequence_equal(BOOST_RV_REF(container_type) seq) { (flat_tree_adopt_sequence_equal)( m_data.m_seq, boost::move(seq), this->priv_value_comp() - , container_detail::bool_::value>()); + , dtl::bool_::value>()); } BOOST_CONTAINER_FORCEINLINE void adopt_sequence_unique(BOOST_RV_REF(container_type) seq) { (flat_tree_adopt_sequence_unique)(m_data.m_seq, boost::move(seq), this->priv_value_comp() - , container_detail::bool_::value>()); + , dtl::bool_::value>()); } void adopt_sequence_equal(ordered_range_t, BOOST_RV_REF(container_type) seq) @@ -1270,14 +1395,10 @@ class flat_tree //for the constructor //Call end() every iteration as reallocation might have invalidated iterators if(unique_insertion){ - for ( ; first != last; ++first){ - this->insert_unique(this->cend(), *first); - } + this->insert_unique(first, last); } else{ - for ( ; first != last; ++first){ - this->insert_equal(this->cend(), *first); - } + this->insert_equal (first, last); } } @@ -1380,9 +1501,9 @@ class flat_tree , boost::forward(convertible)); } - template + template RanIt priv_lower_bound(RanIt first, const RanIt last, - const key_type & key) const + const K & key) const { const Compare &key_cmp = this->m_data.get_comp(); KeyOfValue key_extract; @@ -1405,9 +1526,9 @@ class flat_tree return first; } - template + template RanIt priv_upper_bound - (RanIt first, const RanIt last,const key_type & key) const + (RanIt first, const RanIt last,const K & key) const { const Compare &key_cmp = this->m_data.get_comp(); KeyOfValue key_extract; @@ -1430,9 +1551,9 @@ class flat_tree return first; } - template + template std::pair - priv_equal_range(RanIt first, RanIt last, const key_type& key) const + priv_equal_range(RanIt first, RanIt last, const K& key) const { const Compare &key_cmp = this->m_data.get_comp(); KeyOfValue key_extract; @@ -1463,8 +1584,8 @@ class flat_tree return std::pair(first, first); } - template - std::pair priv_lower_bound_range(RanIt first, RanIt last, const key_type& k) const + template + std::pair priv_lower_bound_range(RanIt first, RanIt last, const K& k) const { const Compare &key_cmp = this->m_data.get_comp(); KeyOfValue key_extract; @@ -1474,30 +1595,9 @@ class flat_tree } return std::pair(lb, ub); } - - template - void priv_insert_equal_loop(InIt first, InIt last) - { - for ( ; first != last; ++first){ - this->insert_equal(*first); - } - } - - template - void priv_insert_equal_loop_ordered(InIt first, InIt last) - { - const_iterator pos(this->cend()); - for ( ; first != last; ++first){ - //If ordered, then try hint version - //to achieve constant-time complexity per insertion - //in some cases - pos = this->insert_equal(pos, *first); - ++pos; - } - } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { @@ -1505,9 +1605,9 @@ class flat_tree //!specialization for optimizations template -struct has_trivial_destructor_after_move > +struct has_trivial_destructor_after_move > { - typedef typename boost::container::container_detail::select_container_type::type container_type; + typedef typename boost::container::dtl::select_container_type::type container_type; typedef typename container_type::allocator_type allocator_t; typedef typename ::boost::container::allocator_traits::pointer pointer; static const bool value = ::boost::has_trivial_destructor_after_move::value && diff --git a/boost/container/detail/is_container.hpp b/boost/container/detail/is_container.hpp index 6052f04..feab702 100644 --- a/boost/container/detail/is_container.hpp +++ b/boost/container/detail/is_container.hpp @@ -36,7 +36,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template struct is_container @@ -48,7 +48,7 @@ struct is_container has_member_function_callable_with_empty::value; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/is_contiguous_container.hpp b/boost/container/detail/is_contiguous_container.hpp index af98c7f..528aeee 100644 --- a/boost/container/detail/is_contiguous_container.hpp +++ b/boost/container/detail/is_contiguous_container.hpp @@ -28,7 +28,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template struct is_contiguous_container @@ -40,7 +40,7 @@ struct is_contiguous_container has_member_function_callable_with_data::value; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/is_sorted.hpp b/boost/container/detail/is_sorted.hpp index b8c223b..315bab5 100644 --- a/boost/container/detail/is_sorted.hpp +++ b/boost/container/detail/is_sorted.hpp @@ -20,7 +20,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred) @@ -50,7 +50,7 @@ bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pre return true; } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/iterator.hpp b/boost/container/detail/iterator.hpp index 8538acc..2ceaf26 100644 --- a/boost/container/detail/iterator.hpp +++ b/boost/container/detail/iterator.hpp @@ -22,6 +22,7 @@ #endif #include +#include namespace boost { namespace container { @@ -34,6 +35,35 @@ using ::boost::intrusive::iterator_enable_if_tag; using ::boost::intrusive::iterator_disable_if_tag; using ::boost::intrusive::iterator_arrow_result; +template +class back_emplacer +{ + private: + Container& container; + + public: + typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; + + back_emplacer(Container& x) + : container(x) + {} + + template + back_emplacer& operator=(BOOST_FWD_REF(U) value) + { + container.emplace_back(boost::forward(value)); + return *this; + } + back_emplacer& operator*() { return *this; } + back_emplacer& operator++() { return *this; } + back_emplacer& operator++(int){ return *this; } +}; + + } //namespace container { } //namespace boost { diff --git a/boost/container/detail/iterator_to_raw_pointer.hpp b/boost/container/detail/iterator_to_raw_pointer.hpp deleted file mode 100644 index 83736d8..0000000 --- a/boost/container/detail/iterator_to_raw_pointer.hpp +++ /dev/null @@ -1,58 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-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_DETAIL_ITERATOR_TO_RAW_POINTER_HPP -#define BOOST_CONTAINER_DETAIL_ITERATOR_TO_RAW_POINTER_HPP - -#ifndef BOOST_CONFIG_HPP -# include -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include -#include -#include - -namespace boost { -namespace container { -namespace container_detail { - -template -inline T* iterator_to_pointer(T* i) -{ return i; } - -template -inline typename boost::container::iterator_traits::pointer - iterator_to_pointer(const Iterator &i) -{ return i.operator->(); } - -template -struct iterator_to_element_ptr -{ - typedef typename boost::container::iterator_traits::pointer pointer; - typedef typename boost::intrusive::pointer_traits::element_type element_type; - typedef element_type* type; -}; - -template -inline typename iterator_to_element_ptr::type - iterator_to_raw_pointer(const Iterator &i) -{ - return ::boost::intrusive::detail::to_raw_pointer - ( ::boost::container::container_detail::iterator_to_pointer(i) ); -} - -} //namespace container_detail { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATOR_TO_RAW_POINTER_HPP diff --git a/boost/container/detail/iterators.hpp b/boost/container/detail/iterators.hpp index 11ffaae..7ccdac9 100644 --- a/boost/container/detail/iterators.hpp +++ b/boost/container/detail/iterators.hpp @@ -612,7 +612,7 @@ class emplace_iterator template struct emplace_functor { - typedef typename container_detail::build_number_seq::type index_tuple_t; + typedef typename dtl::build_number_seq::type index_tuple_t; emplace_functor(BOOST_FWD_REF(Args)... args) : args_(args...) @@ -628,21 +628,21 @@ struct emplace_functor private: template - BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const container_detail::index_tuple&) + BOOST_CONTAINER_FORCEINLINE void inplace_impl(Allocator &a, T* ptr, const dtl::index_tuple&) { allocator_traits::construct - (a, ptr, ::boost::forward(container_detail::get(args_))...); + (a, ptr, ::boost::forward(dtl::get(args_))...); } template - BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const container_detail::index_tuple&) + BOOST_CONTAINER_FORCEINLINE void inplace_impl(DestIt dest, const dtl::index_tuple&) { typedef typename boost::container::iterator_traits::value_type value_type; - value_type && tmp= value_type(::boost::forward(container_detail::get(args_))...); + value_type && tmp= value_type(::boost::forward(dtl::get(args_))...); *dest = ::boost::move(tmp); } - container_detail::tuple args_; + dtl::tuple args_; }; template @@ -672,7 +672,7 @@ struct emplace_functor##N\ void operator()(DestIt dest)\ {\ typedef typename boost::container::iterator_traits::value_type value_type;\ - BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), container_detail::value_init tmp) ;\ + BOOST_MOVE_IF(N, value_type tmp(BOOST_MOVE_MFWD##N), dtl::value_init tmp) ;\ *dest = ::boost::move(const_cast(BOOST_MOVE_IF(N, tmp, tmp.get())));\ }\ \ @@ -692,7 +692,7 @@ BOOST_MOVE_ITERATE_0TO9(BOOST_MOVE_ITERATOR_EMPLACE_FUNCTOR_CODE) #endif -namespace container_detail { +namespace dtl { template struct has_iterator_category @@ -863,7 +863,7 @@ class iterator_from_iiterator IIterator m_iit; }; -} //namespace container_detail { +} //namespace dtl { using ::boost::intrusive::reverse_iterator; diff --git a/boost/container/detail/min_max.hpp b/boost/container/detail/min_max.hpp index 7486db7..35cf066 100644 --- a/boost/container/detail/min_max.hpp +++ b/boost/container/detail/min_max.hpp @@ -20,7 +20,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template const T &max_value(const T &a, const T &b) @@ -30,7 +30,7 @@ template const T &min_value(const T &a, const T &b) { return a < b ? a : b; } -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/mpl.hpp b/boost/container/detail/mpl.hpp index 82fcc70..385f7db 100644 --- a/boost/container/detail/mpl.hpp +++ b/boost/container/detail/mpl.hpp @@ -30,7 +30,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using boost::move_detail::integral_constant; using boost::move_detail::true_type; @@ -76,7 +76,25 @@ struct select1st { return const_cast(x.first); } }; -} //namespace container_detail { +template +struct is_transparent +{ + static const bool value = false; +}; + +template +struct is_transparent +{ + static const bool value = true; +}; + +template +struct enable_if_transparent + : boost::move_detail::enable_if_c::value, R> +{}; + + +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/multiallocation_chain.hpp b/boost/container/detail/multiallocation_chain.hpp index bce1b86..c10f809 100644 --- a/boost/container/detail/multiallocation_chain.hpp +++ b/boost/container/detail/multiallocation_chain.hpp @@ -35,7 +35,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template class basic_multiallocation_chain @@ -53,7 +53,7 @@ class basic_multiallocation_chain typedef bi::slist< node , bi::linear , bi::cache_last - , bi::size_type::type> + , bi::size_type::type> > slist_impl_t; slist_impl_t slist_impl_; @@ -182,7 +182,7 @@ class basic_multiallocation_chain template struct cast_functor { - typedef typename container_detail::add_reference::type result_type; + typedef typename dtl::add_reference::type result_type; template result_type operator()(U &ptr) const { return *static_cast(static_cast(&ptr)); } @@ -211,7 +211,7 @@ class transform_multiallocation_chain public: typedef transform_iterator < typename MultiallocationChain::iterator - , container_detail::cast_functor > iterator; + , dtl::cast_functor > iterator; typedef typename MultiallocationChain::size_type size_type; transform_multiallocation_chain() @@ -289,7 +289,7 @@ class transform_multiallocation_chain }}} -// namespace container_detail { +// namespace dtl { // namespace container { // namespace boost { diff --git a/boost/container/detail/next_capacity.hpp b/boost/container/detail/next_capacity.hpp index 3bc98a3..7e6554d 100644 --- a/boost/container/detail/next_capacity.hpp +++ b/boost/container/detail/next_capacity.hpp @@ -23,52 +23,54 @@ // container/detail #include +#include + namespace boost { namespace container { -namespace container_detail { +namespace dtl { -enum NextCapacityOption { NextCapacityDouble, NextCapacity60Percent }; - -template -struct next_capacity_calculator; - -template -struct next_capacity_calculator +template +struct grow_factor_ratio { - static SizeType get(const SizeType max_size - ,const SizeType capacity - ,const SizeType n) + BOOST_STATIC_ASSERT(Numerator > Denominator); + BOOST_STATIC_ASSERT(Numerator < 100); + BOOST_STATIC_ASSERT(Denominator < 100); + BOOST_STATIC_ASSERT(Denominator == 1 || (0 != Numerator % Denominator)); + + template + SizeType operator()(const SizeType cur_cap, const SizeType add_min_cap, const SizeType max_cap) const { - const SizeType remaining = max_size - capacity; - if ( remaining < n ) - boost::container::throw_length_error("get_next_capacity, allocator's max_size reached"); - const SizeType additional = max_value(n, capacity); - return ( remaining < additional ) ? max_size : ( capacity + additional ); + const SizeType overflow_limit = ((SizeType)-1) / Numerator; + + SizeType new_cap = 0; + + if(cur_cap <= overflow_limit){ + new_cap = cur_cap * Numerator / Denominator; + } + else if(Denominator == 1 || (SizeType(new_cap = cur_cap) / Denominator) > overflow_limit){ + new_cap = (SizeType)-1; + } + else{ + new_cap *= Numerator; + } + return max_value(SizeType(Minimum), max_value(cur_cap+add_min_cap, min_value(max_cap, new_cap))); } }; -template -struct next_capacity_calculator -{ - static SizeType get(const SizeType max_size - ,const SizeType capacity - ,const SizeType n) - { - const SizeType remaining = max_size - capacity; - if ( remaining < n ) - boost::container::throw_length_error("get_next_capacity, allocator's max_size reached"); - const SizeType m3 = max_size/3; +} //namespace dtl { - if (capacity < m3) - return capacity + max_value(3*(capacity+1)/5, n); +struct growth_factor_50 + : dtl::grow_factor_ratio<0, 3, 2> +{}; - if (capacity < m3*2) - return capacity + max_value((capacity+1)/2, n); - return max_size; - } -}; +struct growth_factor_60 + : dtl::grow_factor_ratio<0, 8, 5> +{}; + +struct growth_factor_100 + : dtl::grow_factor_ratio<0, 2, 1> +{}; -} //namespace container_detail { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/node_alloc_holder.hpp b/boost/container/detail/node_alloc_holder.hpp index b6e602e..ad7b713 100644 --- a/boost/container/detail/node_alloc_holder.hpp +++ b/boost/container/detail/node_alloc_holder.hpp @@ -50,7 +50,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_compare) BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(predicate_type) @@ -61,14 +61,14 @@ struct node_alloc_holder //If the intrusive container is an associative container, obtain the predicate, which will //be of type node_compare<>. If not an associative container value_compare will be a "nat" type. typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - ( boost::container::container_detail:: - , ICont, value_compare, container_detail::nat) intrusive_value_compare; + ( boost::container::dtl:: + , ICont, value_compare, dtl::nat) intrusive_value_compare; //In that case obtain the value predicate from the node predicate via predicate_type //if intrusive_value_compare is node_compare<>, nat otherwise typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - ( boost::container::container_detail:: + ( boost::container::dtl:: , intrusive_value_compare - , predicate_type, container_detail::nat) value_compare; + , predicate_type, dtl::nat) value_compare; typedef allocator_traits allocator_traits_type; typedef typename allocator_traits_type::value_type value_type; @@ -77,14 +77,14 @@ struct node_alloc_holder typedef typename allocator_traits_type::template portable_rebind_alloc::type NodeAlloc; typedef allocator_traits node_allocator_traits_type; - typedef container_detail::allocator_version_traits node_allocator_version_traits_type; + typedef dtl::allocator_version_traits node_allocator_version_traits_type; typedef Allocator ValAlloc; typedef typename node_allocator_traits_type::pointer NodePtr; - typedef container_detail::scoped_deallocator Deallocator; + typedef dtl::scoped_deallocator Deallocator; typedef typename node_allocator_traits_type::size_type size_type; typedef typename node_allocator_traits_type::difference_type difference_type; - typedef container_detail::integral_constant::value> alloc_version; typedef typename ICont::iterator icont_iterator; typedef typename ICont::const_iterator icont_citerator; @@ -134,15 +134,15 @@ struct node_alloc_holder void copy_assign_alloc(const node_alloc_holder &x) { - container_detail::bool_ flag; - container_detail::assign_alloc( static_cast(this->members_) + dtl::bool_ flag; + dtl::assign_alloc( static_cast(this->members_) , static_cast(x.members_), flag); } void move_assign_alloc( node_alloc_holder &x) { - container_detail::bool_ flag; - container_detail::move_alloc( static_cast(this->members_) + dtl::bool_ flag; + dtl::move_alloc( static_cast(this->members_) , static_cast(x.members_), flag); } @@ -167,7 +167,7 @@ struct node_alloc_holder Deallocator node_deallocator(p, this->node_alloc()); allocator_traits::construct ( this->node_alloc() - , container_detail::addressof(p->m_data), boost::forward(args)...); + , dtl::addressof(p->m_data), boost::forward(args)...); node_deallocator.release(); //This does not throw typedef typename Node::hook_type hook_type; @@ -185,7 +185,7 @@ struct node_alloc_holder Deallocator node_deallocator(p, this->node_alloc());\ allocator_traits::construct\ ( this->node_alloc()\ - , container_detail::addressof(p->m_data)\ + , dtl::addressof(p->m_data)\ BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ node_deallocator.release();\ typedef typename Node::hook_type hook_type;\ @@ -203,7 +203,7 @@ struct node_alloc_holder { NodePtr p = this->allocate_one(); Deallocator node_deallocator(p, this->node_alloc()); - ::boost::container::construct_in_place(this->node_alloc(), container_detail::addressof(p->m_data), it); + ::boost::container::construct_in_place(this->node_alloc(), dtl::addressof(p->m_data), it); node_deallocator.release(); //This does not throw typedef typename Node::hook_type hook_type; @@ -218,12 +218,12 @@ struct node_alloc_holder NodeAlloc &na = this->node_alloc(); Deallocator node_deallocator(p, this->node_alloc()); node_allocator_traits_type::construct - (na, container_detail::addressof(p->m_data.first), boost::forward(key)); + (na, dtl::addressof(p->m_data.first), boost::forward(key)); BOOST_TRY{ - node_allocator_traits_type::construct(na, container_detail::addressof(p->m_data.second)); + node_allocator_traits_type::construct(na, dtl::addressof(p->m_data.second)); } BOOST_CATCH(...){ - node_allocator_traits_type::destroy(na, container_detail::addressof(p->m_data.first)); + node_allocator_traits_type::destroy(na, dtl::addressof(p->m_data.first)); BOOST_RETHROW; } BOOST_CATCH_END @@ -243,8 +243,8 @@ struct node_alloc_holder void swap(node_alloc_holder &x) { this->icont().swap(x.icont()); - container_detail::bool_ flag; - container_detail::swap_alloc(this->node_alloc(), x.node_alloc(), flag); + dtl::bool_ flag; + dtl::swap_alloc(this->node_alloc(), x.node_alloc(), flag); } template @@ -264,13 +264,13 @@ struct node_alloc_holder Node *p = 0; BOOST_TRY{ Deallocator node_deallocator(NodePtr(), nalloc); - container_detail::scoped_destructor sdestructor(nalloc, 0); + dtl::scoped_destructor sdestructor(nalloc, 0); while(n--){ p = boost::movelib::iterator_to_raw_pointer(itbeg); node_deallocator.set(p); ++itbeg; //This can throw - boost::container::construct_in_place(nalloc, container_detail::addressof(p->m_data), beg); + boost::container::construct_in_place(nalloc, dtl::addressof(p->m_data), beg); sdestructor.set(p); ++beg; //This does not throw @@ -410,7 +410,7 @@ struct node_alloc_holder { return this->members_.m_icont; } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/pair.hpp b/boost/container/detail/pair.hpp index 4755e56..9cca9f6 100644 --- a/boost/container/detail/pair.hpp +++ b/boost/container/detail/pair.hpp @@ -74,7 +74,7 @@ struct is_boost_tuple< boost::tuples::tuple struct disable_if_boost_tuple - : boost::container::container_detail::disable_if< is_boost_tuple > + : boost::container::dtl::disable_if< is_boost_tuple > {}; template @@ -133,7 +133,7 @@ static piecewise_construct_t piecewise_construct = BOOST_CONTAINER_DOC1ST(unspec ///@cond -namespace container_detail { +namespace dtl { struct piecewise_construct_use { @@ -283,7 +283,7 @@ struct pair pair( piecewise_construct_t\ , BoostTuple p\ , BoostTuple q\ - , typename container_detail::enable_if_c\ + , typename dtl::enable_if_c\ < pair_impl::is_boost_tuple< BoostTuple >::value &&\ !(pair_impl::is_tuple_null::value || pair_impl::is_tuple_null::value) \ >::type* = 0\ @@ -381,10 +381,10 @@ struct pair } template - typename ::boost::container::container_detail::disable_if_or + typename ::boost::container::dtl::disable_if_or < pair & - , ::boost::container::container_detail::is_same - , ::boost::container::container_detail::is_same + , ::boost::container::dtl::is_same + , ::boost::container::dtl::is_same >::type operator=(const pair&p) { @@ -394,10 +394,10 @@ struct pair } template - typename ::boost::container::container_detail::disable_if_or + typename ::boost::container::dtl::disable_if_or < pair & - , ::boost::container::container_detail::is_same - , ::boost::container::container_detail::is_same + , ::boost::container::dtl::is_same + , ::boost::container::dtl::is_same >::type operator=(BOOST_RV_REF_BEG pair BOOST_RV_REF_END p) { @@ -478,13 +478,13 @@ template inline void swap(pair& x, pair& y) { x.swap(y); } -} //namespace container_detail { +} //namespace dtl { } //namespace container { #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES template -struct has_move_emulation_enabled< ::boost::container::container_detail::pair > +struct has_move_emulation_enabled< ::boost::container::dtl::pair > { static const bool value = true; }; @@ -497,7 +497,7 @@ template struct is_class_or_union; template -struct is_class_or_union< ::boost::container::container_detail::pair > +struct is_class_or_union< ::boost::container::dtl::pair > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { @@ -516,7 +516,7 @@ template struct is_union; template -struct is_union< ::boost::container::container_detail::pair > +struct is_union< ::boost::container::dtl::pair > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { @@ -535,7 +535,7 @@ template struct is_class; template -struct is_class< ::boost::container::container_detail::pair > +struct is_class< ::boost::container::dtl::pair > //This specialization is needed to avoid instantiation of pair in //is_class, and allow recursive maps. { @@ -550,6 +550,61 @@ struct is_class< std::pair > static const bool value = true; }; + +//Triviality of pair +template +struct is_trivially_copy_constructible; + +template +struct is_trivially_copy_assignable + > +{ + static const bool value = boost::move_detail::is_trivially_copy_assignable::value && + boost::move_detail::is_trivially_copy_assignable::value ; +}; + +template +struct is_trivially_move_constructible; + +template +struct is_trivially_move_assignable + > +{ + static const bool value = boost::move_detail::is_trivially_move_assignable::value && + boost::move_detail::is_trivially_move_assignable::value ; +}; + +template +struct is_trivially_copy_assignable; + +template +struct is_trivially_copy_constructible > +{ + static const bool value = boost::move_detail::is_trivially_copy_constructible::value && + boost::move_detail::is_trivially_copy_constructible::value ; +}; + +template +struct is_trivially_move_assignable; + +template +struct is_trivially_move_constructible > +{ + static const bool value = boost::move_detail::is_trivially_move_constructible::value && + boost::move_detail::is_trivially_move_constructible::value ; +}; + +template +struct is_trivially_destructible; + +template +struct is_trivially_destructible > +{ + static const bool value = boost::move_detail::is_trivially_destructible::value && + boost::move_detail::is_trivially_destructible::value ; +}; + + } //namespace move_detail{ } //namespace boost { diff --git a/boost/container/detail/to_raw_pointer.hpp b/boost/container/detail/to_raw_pointer.hpp deleted file mode 100644 index 0b4445a..0000000 --- a/boost/container/detail/to_raw_pointer.hpp +++ /dev/null @@ -1,33 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-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_DETAIL_TO_RAW_POINTER_HPP -#define BOOST_CONTAINER_DETAIL_TO_RAW_POINTER_HPP - -#ifndef BOOST_CONFIG_HPP -# include -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include - -namespace boost { -namespace container { -namespace container_detail { - -using ::boost::intrusive::detail::to_raw_pointer; - -} //namespace container_detail { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_TO_RAW_POINTER_HPP diff --git a/boost/container/detail/transform_iterator.hpp b/boost/container/detail/transform_iterator.hpp index ba64c7d..ce81813 100644 --- a/boost/container/detail/transform_iterator.hpp +++ b/boost/container/detail/transform_iterator.hpp @@ -63,7 +63,7 @@ class transform_iterator : public UnaryFunction , public boost::container::iterator < typename Iterator::iterator_category - , typename container_detail::remove_reference::type + , typename dtl::remove_reference::type , typename Iterator::difference_type , operator_arrow_proxy , typename UnaryFunction::result_type> diff --git a/boost/container/detail/tree.hpp b/boost/container/detail/tree.hpp index 99baf3a..c32e992 100644 --- a/boost/container/detail/tree.hpp +++ b/boost/container/detail/tree.hpp @@ -61,7 +61,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using boost::intrusive::tree_value_compare; @@ -71,38 +71,38 @@ struct intrusive_tree_hook; template struct intrusive_tree_hook { - typedef typename container_detail::bi::make_set_base_hook - < container_detail::bi::void_pointer - , container_detail::bi::link_mode - , container_detail::bi::optimize_size + typedef typename dtl::bi::make_set_base_hook + < dtl::bi::void_pointer + , dtl::bi::link_mode + , dtl::bi::optimize_size >::type type; }; template struct intrusive_tree_hook { - typedef typename container_detail::bi::make_avl_set_base_hook - < container_detail::bi::void_pointer - , container_detail::bi::link_mode - , container_detail::bi::optimize_size + typedef typename dtl::bi::make_avl_set_base_hook + < dtl::bi::void_pointer + , dtl::bi::link_mode + , dtl::bi::optimize_size >::type type; }; template struct intrusive_tree_hook { - typedef typename container_detail::bi::make_bs_set_base_hook - < container_detail::bi::void_pointer - , container_detail::bi::link_mode + typedef typename dtl::bi::make_bs_set_base_hook + < dtl::bi::void_pointer + , dtl::bi::link_mode >::type type; }; template struct intrusive_tree_hook { - typedef typename container_detail::bi::make_bs_set_base_hook - < container_detail::bi::void_pointer - , container_detail::bi::link_mode + typedef typename dtl::bi::make_bs_set_base_hook + < dtl::bi::void_pointer + , dtl::bi::link_mode >::type type; }; @@ -222,9 +222,9 @@ class push_back_functor { this->icont_.push_back(n); } }; -}//namespace container_detail { +}//namespace dtl { -namespace container_detail { +namespace dtl { template< class NodeType, class NodeCompareType , class SizeType, class HookType @@ -235,12 +235,12 @@ template struct intrusive_tree_dispatch { - typedef typename container_detail::bi::make_rbtree + typedef typename dtl::bi::make_rbtree - ,container_detail::bi::base_hook - ,container_detail::bi::constant_time_size - ,container_detail::bi::size_type + ,dtl::bi::compare + ,dtl::bi::base_hook + ,dtl::bi::constant_time_size + ,dtl::bi::size_type >::type type; }; @@ -248,12 +248,12 @@ template struct intrusive_tree_dispatch { - typedef typename container_detail::bi::make_avltree + typedef typename dtl::bi::make_avltree - ,container_detail::bi::base_hook - ,container_detail::bi::constant_time_size - ,container_detail::bi::size_type + ,dtl::bi::compare + ,dtl::bi::base_hook + ,dtl::bi::constant_time_size + ,dtl::bi::size_type >::type type; }; @@ -261,12 +261,12 @@ template struct intrusive_tree_dispatch { - typedef typename container_detail::bi::make_sgtree + typedef typename dtl::bi::make_sgtree - ,container_detail::bi::base_hook - ,container_detail::bi::floating_point - ,container_detail::bi::size_type + ,dtl::bi::compare + ,dtl::bi::base_hook + ,dtl::bi::floating_point + ,dtl::bi::size_type >::type type; }; @@ -274,12 +274,12 @@ template struct intrusive_tree_dispatch { - typedef typename container_detail::bi::make_splaytree + typedef typename dtl::bi::make_splaytree - ,container_detail::bi::base_hook - ,container_detail::bi::constant_time_size - ,container_detail::bi::size_type + ,dtl::bi::compare + ,dtl::bi::base_hook + ,dtl::bi::constant_time_size + ,dtl::bi::size_type >::type type; }; @@ -293,7 +293,7 @@ struct intrusive_tree_type allocator_traits::void_pointer void_pointer; typedef typename boost::container:: allocator_traits::size_type size_type; - typedef typename container_detail::tree_node + typedef typename dtl::tree_node < value_type, void_pointer , tree_type_value, OptimizeSize> node_t; typedef value_to_node_compare @@ -340,9 +340,9 @@ struct intrusive_tree_proxy { c.rebalance(); } }; -} //namespace container_detail { +} //namespace dtl { -namespace container_detail { +namespace dtl { //This functor will be used with Intrusive clone functions to obtain //already allocated nodes from a intrusive container instead of @@ -394,6 +394,7 @@ class RecyclingCloner intrusive_container &m_icont; }; + template struct key_node_compare : public boost::intrusive::detail::ebo_functor_holder @@ -407,6 +408,21 @@ struct key_node_compare typedef KeyOfValue key_of_value; typedef typename KeyOfValue::type key_type; + + template + BOOST_CONTAINER_FORCEINLINE static const key_type & + key_from(const tree_node &n) + { + return key_of_value()(n.get_data()); + } + + template + BOOST_CONTAINER_FORCEINLINE static const T & + key_from(const T &t) + { + return t; + } + BOOST_CONTAINER_FORCEINLINE const key_compare &key_comp() const { return static_cast(*this); } @@ -418,36 +434,51 @@ struct key_node_compare template BOOST_CONTAINER_FORCEINLINE bool operator()(const key_type &key1, const U &nonkey2) const - { return this->key_comp()(key1, key_of_value()(nonkey2.get_data())); } + { return this->key_comp()(key1, this->key_from(nonkey2)); } template BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const key_type &key2) const - { return this->key_comp()(key_of_value()(nonkey1.get_data()), key2); } + { return this->key_comp()(this->key_from(nonkey1), key2); } template BOOST_CONTAINER_FORCEINLINE bool operator()(const U &nonkey1, const V &nonkey2) const - { return this->key_comp()(key_of_value()(nonkey1.get_data()), key_of_value()(nonkey2.get_data())); } + { return this->key_comp()(this->key_from(nonkey1), this->key_from(nonkey2)); } }; -template +template +struct get_tree_opt +{ + typedef Options type; +}; + +template<> +struct get_tree_opt +{ + typedef tree_assoc_defaults type; +}; + +template class tree - : public container_detail::node_alloc_holder + : public dtl::node_alloc_holder < Allocator - , typename container_detail::intrusive_tree_type + , typename dtl::intrusive_tree_type < Allocator, tree_value_compare ::pointer, Compare, KeyOfValue> - , Options::tree_type, Options::optimize_size>::type + , get_tree_opt::type::tree_type + , get_tree_opt::type::optimize_size + >::type > { typedef tree_value_compare < typename allocator_traits::pointer , Compare, KeyOfValue> ValComp; - typedef typename container_detail::intrusive_tree_type - < Allocator, ValComp, Options::tree_type - , Options::optimize_size>::type Icont; - typedef container_detail::node_alloc_holder + typedef typename get_tree_opt::type options_type; + typedef typename dtl::intrusive_tree_type + < Allocator, ValComp + , options_type::tree_type + , options_type::optimize_size + >::type Icont; + typedef dtl::node_alloc_holder AllocHolder; typedef typename AllocHolder::NodePtr NodePtr; typedef tree < T, KeyOfValue @@ -459,9 +490,9 @@ class tree typedef typename AllocHolder::Node Node; typedef typename Icont::iterator iiterator; typedef typename Icont::const_iterator iconst_iterator; - typedef container_detail::allocator_destroyer Destroyer; + typedef dtl::allocator_destroyer Destroyer; typedef typename AllocHolder::alloc_version alloc_version; - typedef intrusive_tree_proxy intrusive_tree_proxy_t; + typedef intrusive_tree_proxy intrusive_tree_proxy_t; BOOST_COPYABLE_AND_MOVABLE(tree) @@ -484,9 +515,9 @@ class tree allocator_traits::size_type size_type; typedef typename boost::container:: allocator_traits::difference_type difference_type; - typedef container_detail::iterator_from_iiterator + typedef dtl::iterator_from_iiterator iterator; - typedef container_detail::iterator_from_iiterator + typedef dtl::iterator_from_iiterator const_iterator; typedef boost::container::reverse_iterator reverse_iterator; @@ -590,10 +621,10 @@ class tree template void tree_construct_non_unique(InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_or + , typename dtl::enable_if_or < void - , container_detail::is_same - , container_detail::is_input_iterator + , dtl::is_same + , dtl::is_input_iterator >::type * = 0 #endif ) @@ -610,10 +641,10 @@ class tree template void tree_construct_non_unique(InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_same - , container_detail::is_input_iterator + , dtl::is_same + , dtl::is_input_iterator >::type * = 0 #endif ) @@ -627,10 +658,10 @@ class tree template void tree_construct( ordered_range_t, InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_same - , container_detail::is_input_iterator + , dtl::is_same + , dtl::is_input_iterator >::type * = 0 #endif ) @@ -638,17 +669,17 @@ class tree //Optimized allocation and construction this->allocate_many_and_construct ( first, boost::container::iterator_distance(first, last) - , container_detail::push_back_functor(this->icont())); + , dtl::push_back_functor(this->icont())); //AllocHolder clears in case of exception } template void tree_construct( ordered_range_t, InputIterator first, InputIterator last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::enable_if_or + , typename dtl::enable_if_or < void - , container_detail::is_same - , container_detail::is_input_iterator + , dtl::is_same + , dtl::is_input_iterator >::type * = 0 #endif ) @@ -668,7 +699,7 @@ class tree } BOOST_CONTAINER_FORCEINLINE tree(BOOST_RV_REF(tree) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x), x.value_comp()) {} @@ -701,7 +732,7 @@ class tree if (&x != this){ NodeAlloc &this_alloc = this->get_stored_allocator(); const NodeAlloc &x_alloc = x.get_stored_allocator(); - container_detail::bool_:: + dtl::bool_:: propagate_on_container_copy_assignment::value> flag; if(flag && this_alloc != x_alloc){ this->clear(); @@ -730,7 +761,7 @@ class tree tree& operator=(BOOST_RV_REF(tree) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { BOOST_ASSERT(this != &x); NodeAlloc &this_alloc = this->node_alloc(); @@ -856,7 +887,7 @@ class tree BOOST_CONTAINER_FORCEINLINE void swap(ThisType& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ) + && boost::container::dtl::is_nothrow_swappable::value ) { AllocHolder::swap(x); } public: @@ -1245,21 +1276,63 @@ class tree BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& k) const { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + find(const K& k) + { return iterator(this->icont().find(k, KeyNodeCompare(key_comp()))); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + find(const K& k) const + { return const_iterator(this->non_const_icont().find(k, KeyNodeCompare(key_comp()))); } + BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& k) const { return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + count(const K& k) const + { return size_type(this->icont().count(k, KeyNodeCompare(key_comp()))); } + BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) { return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); } BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + lower_bound(const K& k) + { return iterator(this->icont().lower_bound(k, KeyNodeCompare(key_comp()))); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + lower_bound(const K& k) const + { return const_iterator(this->non_const_icont().lower_bound(k, KeyNodeCompare(key_comp()))); } + BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) { return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); } BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + upper_bound(const K& k) + { return iterator(this->icont().upper_bound(k, KeyNodeCompare(key_comp()))); } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent::type + upper_bound(const K& k) const + { return const_iterator(this->non_const_icont().upper_bound(k, KeyNodeCompare(key_comp()))); } + std::pair equal_range(const key_type& k) { std::pair ret = @@ -1275,6 +1348,27 @@ class tree (const_iterator(ret.first), const_iterator(ret.second)); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + equal_range(const K& k) + { + std::pair ret = + this->icont().equal_range(k, KeyNodeCompare(key_comp())); + return std::pair(iterator(ret.first), iterator(ret.second)); + } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + equal_range(const K& k) const + { + std::pair ret = + this->non_const_icont().equal_range(k, KeyNodeCompare(key_comp())); + return std::pair + (const_iterator(ret.first), const_iterator(ret.second)); + } + std::pair lower_bound_range(const key_type& k) { std::pair ret = @@ -1290,6 +1384,27 @@ class tree (const_iterator(ret.first), const_iterator(ret.second)); } + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + lower_bound_range(const K& k) + { + std::pair ret = + this->icont().lower_bound_range(k, KeyNodeCompare(key_comp())); + return std::pair(iterator(ret.first), iterator(ret.second)); + } + + template + BOOST_CONTAINER_FORCEINLINE + typename dtl::enable_if_transparent >::type + lower_bound_range(const K& k) const + { + std::pair ret = + this->non_const_icont().lower_bound_range(k, KeyNodeCompare(key_comp())); + return std::pair + (const_iterator(ret.first), const_iterator(ret.second)); + } + BOOST_CONTAINER_FORCEINLINE void rebalance() { intrusive_tree_proxy_t::rebalance(this->icont()); } @@ -1315,7 +1430,7 @@ class tree { x.swap(y); } }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { template @@ -1326,7 +1441,7 @@ struct has_trivial_destructor_after_move; template struct has_trivial_destructor_after_move < - ::boost::container::container_detail::tree + ::boost::container::dtl::tree > { diff --git a/boost/container/detail/type_traits.hpp b/boost/container/detail/type_traits.hpp index e1453a6..686cc40 100644 --- a/boost/container/detail/type_traits.hpp +++ b/boost/container/detail/type_traits.hpp @@ -28,7 +28,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { using ::boost::move_detail::enable_if; using ::boost::move_detail::enable_if_and; @@ -63,7 +63,7 @@ using ::boost::move_detail::aligned_storage; using ::boost::move_detail::nat; using ::boost::move_detail::max_align_t; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/value_functors.hpp b/boost/container/detail/value_functors.hpp new file mode 100644 index 0000000..a2c494c --- /dev/null +++ b/boost/container/detail/value_functors.hpp @@ -0,0 +1,36 @@ +#ifndef BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP +#define BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP +/////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2017-2017. 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_CONFIG_HPP +# include +#endif + +#if defined(BOOST_HAS_PRAGMA_ONCE) +# pragma once +#endif + +//Functors for member algorithm defaults +template +struct value_less +{ + bool operator()(const ValueType &a, const ValueType &b) const + { return a < b; } +}; + +template +struct value_equal +{ + bool operator()(const ValueType &a, const ValueType &b) const + { return a == b; } +}; + +#endif //BOOST_CONTAINER_DETAIL_VALUE_FUNCTORS_HPP diff --git a/boost/container/detail/value_init.hpp b/boost/container/detail/value_init.hpp index faba70e..35b0aa1 100644 --- a/boost/container/detail/value_init.hpp +++ b/boost/container/detail/value_init.hpp @@ -26,7 +26,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template struct value_init @@ -42,7 +42,7 @@ struct value_init T m_t; }; -} //namespace container_detail { +} //namespace dtl { } //namespace container { } //namespace boost { diff --git a/boost/container/detail/variadic_templates_tools.hpp b/boost/container/detail/variadic_templates_tools.hpp index e9fa9cd..4f16fb0 100644 --- a/boost/container/detail/variadic_templates_tools.hpp +++ b/boost/container/detail/variadic_templates_tools.hpp @@ -28,7 +28,7 @@ namespace boost { namespace container { -namespace container_detail { +namespace dtl { template class tuple; @@ -78,7 +78,7 @@ class tuple template -tuple forward_as_tuple(Values&&... values) +tuple forward_as_tuple_impl(Values&&... values) { return tuple(::boost::forward(values)...); } template @@ -156,7 +156,7 @@ struct build_number_seq template<> struct build_number_seq<0> : index_tuple<>{}; template<> struct build_number_seq<1> : index_tuple<0>{}; -}}} //namespace boost { namespace container { namespace container_detail { +}}} //namespace boost { namespace container { namespace dtl { #include diff --git a/boost/container/detail/version_type.hpp b/boost/container/detail/version_type.hpp index a20b3ee..c2531cc 100644 --- a/boost/container/detail/version_type.hpp +++ b/boost/container/detail/version_type.hpp @@ -32,11 +32,11 @@ namespace boost{ namespace container { -namespace container_detail { +namespace dtl { template struct version_type - : public container_detail::integral_constant + : public dtl::integral_constant { typedef T type; @@ -46,7 +46,7 @@ struct version_type namespace impl{ template , typename T::version>::value> + bool = dtl::is_convertible, typename T::version>::value> struct extract_version { static const unsigned value = 1; @@ -86,7 +86,7 @@ struct version template struct version - : public container_detail::integral_constant::value> + : public dtl::integral_constant::value> {}; template @@ -96,11 +96,11 @@ struct is_version is_same< typename version::type, integral_constant >::value; }; -} //namespace container_detail { +} //namespace dtl { -typedef container_detail::integral_constant version_0; -typedef container_detail::integral_constant version_1; -typedef container_detail::integral_constant version_2; +typedef dtl::integral_constant version_0; +typedef dtl::integral_constant version_1; +typedef dtl::integral_constant version_2; } //namespace container { } //namespace boost{ diff --git a/boost/container/flat_map.hpp b/boost/container/flat_map.hpp index d87f7bd..9679946 100644 --- a/boost/container/flat_map.hpp +++ b/boost/container/flat_map.hpp @@ -57,7 +57,7 @@ namespace container { template class flat_multimap; -namespace container_detail{ +namespace dtl{ template BOOST_CONTAINER_FORCEINLINE static D &force(S &s) @@ -71,7 +71,7 @@ BOOST_CONTAINER_FORCEINLINE static D force_copy(const S &s) return ret_val; } -} //namespace container_detail{ +} //namespace dtl{ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -115,18 +115,18 @@ class flat_map private: BOOST_COPYABLE_AND_MOVABLE(flat_map) //This is the tree that we should store if pair was movable - typedef container_detail::flat_tree< + typedef dtl::flat_tree< std::pair, - container_detail::select1st, + dtl::select1st, Compare, AllocatorOrContainer> tree_t; //This is the real tree stored here. It's based on a movable pair - typedef container_detail::flat_tree< - container_detail::pair, - container_detail::select1st, + typedef dtl::flat_tree< + dtl::pair, + dtl::select1st, Compare, - typename container_detail::container_or_allocator_rebind >::type + typename dtl::container_or_allocator_rebind >::type > impl_tree_t; impl_tree_t m_flat_tree; // flat tree representing flat_map @@ -138,9 +138,9 @@ class flat_map typedef std::initializer_list impl_initializer_list; #endif - typedef container_detail::flat_tree_value_compare + typedef dtl::flat_tree_value_compare < Compare - , container_detail::select1st + , dtl::select1st , std::pair > value_compare_t; typedef typename tree_t::iterator iterator_t; typedef typename tree_t::const_iterator const_iterator_t; @@ -195,7 +195,7 @@ class flat_map typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type; //AllocatorOrContainer::value_type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename allocator_type::value_type>::value)); + BOOST_STATIC_ASSERT((dtl::is_same, typename allocator_type::value_type>::value)); ////////////////////////////////////////////// // @@ -206,8 +206,8 @@ class flat_map //! Effects: Default constructs an empty flat_map. //! //! Complexity: Constant. - BOOST_CONTAINER_FORCEINLINE flat_map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + BOOST_CONTAINER_FORCEINLINE flat_map() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : m_flat_tree() {} @@ -215,7 +215,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE explicit flat_map(const allocator_type& a) - : m_flat_tree(container_detail::force(a)) + : m_flat_tree(dtl::force(a)) {} //! Effects: Constructs an empty flat_map using the specified @@ -231,7 +231,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE flat_map(const Compare& comp, const allocator_type& a) - : m_flat_tree(comp, container_detail::force(a)) + : m_flat_tree(comp, dtl::force(a)) {} //! Effects: Constructs an empty flat_map and @@ -251,7 +251,7 @@ class flat_map //! the predicate and otherwise N logN, where N is last - first. template BOOST_CONTAINER_FORCEINLINE flat_map(InputIterator first, InputIterator last, const allocator_type& a) - : m_flat_tree(true, first, last, container_detail::force(a)) + : m_flat_tree(true, first, last, dtl::force(a)) {} //! Effects: Constructs an empty flat_map using the specified comparison object and @@ -271,7 +271,7 @@ class flat_map //! the predicate and otherwise N logN, where N is last - first. template BOOST_CONTAINER_FORCEINLINE flat_map(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(true, first, last, comp, container_detail::force(a)) + : m_flat_tree(true, first, last, comp, dtl::force(a)) {} //! Effects: Constructs an empty flat_map @@ -316,7 +316,7 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(ordered_range, first, last, comp, container_detail::force(a)) + : m_flat_tree(ordered_range, first, last, comp, dtl::force(a)) {} #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -327,8 +327,8 @@ class flat_map //! the predicate and otherwise N logN, where N is last - first. BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list il) : m_flat_tree( true - , container_detail::force(il).begin() - , container_detail::force(il).end()) + , dtl::force(il).begin() + , dtl::force(il).end()) {} //! Effects: Constructs an empty flat_map using the specified @@ -338,9 +338,9 @@ class flat_map //! the predicate and otherwise N logN, where N is last - first. BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list il, const allocator_type& a) : m_flat_tree( true - , container_detail::force(il).begin() - , container_detail::force(il).end() - , container_detail::force(a)) + , dtl::force(il).begin() + , dtl::force(il).end() + , dtl::force(a)) {} //! Effects: Constructs an empty flat_map using the specified comparison object and @@ -350,8 +350,8 @@ class flat_map //! the predicate and otherwise N logN, where N is last - first. BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list il, const Compare& comp) : m_flat_tree(true - , container_detail::force(il).begin() - , container_detail::force(il).end() + , dtl::force(il).begin() + , dtl::force(il).end() , comp) {} @@ -362,10 +362,10 @@ class flat_map //! the predicate and otherwise N logN, where N is last - first. BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list il, const Compare& comp, const allocator_type& a) : m_flat_tree(true - , container_detail::force(il).begin() - , container_detail::force(il).end() + , dtl::force(il).begin() + , dtl::force(il).end() , comp - , container_detail::force(a)) + , dtl::force(a)) {} //! Effects: Constructs an empty flat_map using and @@ -380,8 +380,8 @@ class flat_map //! Note: Non-standard extension. BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, std::initializer_list il) : m_flat_tree(ordered_unique_range - , container_detail::force(il).begin() - , container_detail::force(il).end()) + , dtl::force(il).begin() + , dtl::force(il).end()) {} //! Effects: Constructs an empty flat_map using the specified comparison object and @@ -396,8 +396,8 @@ class flat_map //! Note: Non-standard extension. BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, std::initializer_list il, const Compare& comp) : m_flat_tree(ordered_unique_range - , container_detail::force(il).begin() - , container_detail::force(il).end() + , dtl::force(il).begin() + , dtl::force(il).end() , comp) {} @@ -413,10 +413,10 @@ class flat_map //! Note: Non-standard extension. BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, std::initializer_list il, const Compare& comp, const allocator_type& a) : m_flat_tree( ordered_unique_range - , container_detail::force(il).begin() - , container_detail::force(il).end() + , dtl::force(il).begin() + , dtl::force(il).end() , comp - , container_detail::force(a)) + , dtl::force(a)) {} #endif @@ -434,7 +434,7 @@ class flat_map //! //! Postcondition: x is emptied. BOOST_CONTAINER_FORCEINLINE flat_map(BOOST_RV_REF(flat_map) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : m_flat_tree(boost::move(x.m_flat_tree)) {} @@ -442,7 +442,7 @@ class flat_map //! //! Complexity: Linear in x.size(). BOOST_CONTAINER_FORCEINLINE flat_map(const flat_map& x, const allocator_type &a) - : m_flat_tree(x.m_flat_tree, container_detail::force(a)) + : m_flat_tree(x.m_flat_tree, dtl::force(a)) {} //! Effects: Move constructs a flat_map using the specified allocator. @@ -450,7 +450,7 @@ class flat_map //! //! Complexity: Constant if x.get_allocator() == a, linear otherwise. BOOST_CONTAINER_FORCEINLINE flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a) - : m_flat_tree(boost::move(x.m_flat_tree), container_detail::force(a)) + : m_flat_tree(boost::move(x.m_flat_tree), dtl::force(a)) {} //! Effects: Makes *this a copy of x. @@ -471,7 +471,7 @@ class flat_map BOOST_CONTAINER_FORCEINLINE flat_map& operator=(BOOST_RV_REF(flat_map) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { m_flat_tree = boost::move(x.m_flat_tree); return *this; } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -489,7 +489,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.get_allocator()); } + { return dtl::force_copy(m_flat_tree.get_allocator()); } //! Effects: Returns a reference to the internal allocator. //! @@ -501,7 +501,7 @@ class flat_map BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW { impl_get_stored_allocator_noconst_return_t r = m_flat_tree.get_stored_allocator(); - return container_detail::force(r); + return dtl::force(r); } //! Effects: Returns a reference to the internal allocator. @@ -514,7 +514,7 @@ class flat_map BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW { impl_get_stored_allocator_const_return_t r = m_flat_tree.get_stored_allocator(); - return container_detail::force(r); + return dtl::force(r); } ////////////////////////////////////////////// @@ -529,7 +529,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.begin()); } + { return dtl::force_copy(m_flat_tree.begin()); } //! Effects: Returns a const_iterator to the first element contained in the container. //! @@ -537,7 +537,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.begin()); } + { return dtl::force_copy(m_flat_tree.begin()); } //! Effects: Returns an iterator to the end of the container. //! @@ -545,7 +545,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.end()); } + { return dtl::force_copy(m_flat_tree.end()); } //! Effects: Returns a const_iterator to the end of the container. //! @@ -553,7 +553,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.end()); } + { return dtl::force_copy(m_flat_tree.end()); } //! Effects: Returns a reverse_iterator pointing to the beginning //! of the reversed container. @@ -562,7 +562,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rbegin()); } + { return dtl::force_copy(m_flat_tree.rbegin()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. @@ -571,7 +571,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rbegin()); } + { return dtl::force_copy(m_flat_tree.rbegin()); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed container. @@ -580,7 +580,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rend()); } + { return dtl::force_copy(m_flat_tree.rend()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed container. @@ -589,7 +589,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rend()); } + { return dtl::force_copy(m_flat_tree.rend()); } //! Effects: Returns a const_iterator to the first element contained in the container. //! @@ -597,7 +597,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.cbegin()); } + { return dtl::force_copy(m_flat_tree.cbegin()); } //! Effects: Returns a const_iterator to the end of the container. //! @@ -605,7 +605,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.cend()); } + { return dtl::force_copy(m_flat_tree.cend()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. @@ -614,7 +614,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.crbegin()); } + { return dtl::force_copy(m_flat_tree.crbegin()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed container. @@ -623,7 +623,7 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.crend()); } + { return dtl::force_copy(m_flat_tree.crend()); } ////////////////////////////////////////////// // @@ -731,7 +731,7 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj) { - return container_detail::force_copy< std::pair > + return dtl::force_copy< std::pair > (this->m_flat_tree.insert_or_assign ( impl_const_iterator(), k, ::boost::forward(obj)) ); @@ -752,7 +752,7 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE std::pair insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) { - return container_detail::force_copy< std::pair > + return dtl::force_copy< std::pair > (this->m_flat_tree.insert_or_assign ( impl_const_iterator(), ::boost::move(k), ::boost::forward(obj)) ); @@ -775,9 +775,9 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj) { - return container_detail::force_copy< std::pair > + return dtl::force_copy< std::pair > (this->m_flat_tree.insert_or_assign - ( container_detail::force_copy(hint) + ( dtl::force_copy(hint) , k, ::boost::forward(obj)) ); } @@ -799,28 +799,28 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) { - return container_detail::force_copy< std::pair > + return dtl::force_copy< std::pair > (this->m_flat_tree.insert_or_assign - ( container_detail::force_copy(hint) + ( dtl::force_copy(hint) , ::boost::move(k), ::boost::forward(obj)) ); } //! @copydoc ::boost::container::flat_set::nth(size_type) BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.nth(n)); } + { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::nth(size_type) const BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.nth(n)); } + { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::index_of(iterator) BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(container_detail::force_copy(p)); } + { return m_flat_tree.index_of(dtl::force_copy(p)); } //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(container_detail::force_copy(p)); } + { return m_flat_tree.index_of(dtl::force_copy(p)); } //! Returns: A reference to the element whose key is equivalent to x. //! @@ -872,7 +872,7 @@ class flat_map //! Note: If an element is inserted it might invalidate elements. template BOOST_CONTAINER_FORCEINLINE std::pair emplace(BOOST_FWD_REF(Args)... args) - { return container_detail::force_copy< std::pair >(m_flat_tree.emplace_unique(boost::forward(args)...)); } + { return dtl::force_copy< std::pair >(m_flat_tree.emplace_unique(boost::forward(args)...)); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container if and only if there is @@ -889,8 +889,8 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args) { - return container_detail::force_copy - (m_flat_tree.emplace_hint_unique( container_detail::force_copy(hint) + return dtl::force_copy + (m_flat_tree.emplace_hint_unique( dtl::force_copy(hint) , boost::forward(args)...)); } @@ -908,7 +908,7 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(const key_type& k, BOOST_FWD_REF(Args)... args) { - return container_detail::force_copy< std::pair >( + return dtl::force_copy< std::pair >( m_flat_tree.try_emplace(impl_const_iterator(), k, boost::forward(args)...)); } @@ -926,8 +926,8 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k, BOOST_FWD_REF(Args)... args) { - return container_detail::force_copy(m_flat_tree.try_emplace - (container_detail::force_copy(hint), k, boost::forward(args)...).first); + return dtl::force_copy(m_flat_tree.try_emplace + (dtl::force_copy(hint), k, boost::forward(args)...).first); } //! Requires: value_type shall be EmplaceConstructible into map from piecewise_construct, @@ -944,7 +944,7 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) { - return container_detail::force_copy< std::pair > + return dtl::force_copy< std::pair > (m_flat_tree.try_emplace(impl_const_iterator(), boost::move(k), boost::forward(args)...)); } @@ -962,8 +962,8 @@ class flat_map template BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) { - return container_detail::force_copy - (m_flat_tree.try_emplace(container_detail::force_copy + return dtl::force_copy + (m_flat_tree.try_emplace(dtl::force_copy (hint), boost::move(k), boost::forward(args)...).first); } @@ -973,39 +973,39 @@ class flat_map BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE std::pair emplace(BOOST_MOVE_UREF##N)\ {\ - return container_detail::force_copy< std::pair >\ + return dtl::force_copy< std::pair >\ (m_flat_tree.emplace_unique(BOOST_MOVE_FWD##N));\ }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - return container_detail::force_copy(m_flat_tree.emplace_hint_unique\ - (container_detail::force_copy(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ + return dtl::force_copy(m_flat_tree.emplace_hint_unique\ + (dtl::force_copy(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ }\ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(const key_type& k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - return container_detail::force_copy< std::pair >\ + return dtl::force_copy< std::pair >\ (m_flat_tree.try_emplace(impl_const_iterator(), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { return container_detail::force_copy(m_flat_tree.try_emplace\ - (container_detail::force_copy(hint), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ + { return dtl::force_copy(m_flat_tree.try_emplace\ + (dtl::force_copy(hint), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE std::pair try_emplace(BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - return container_detail::force_copy< std::pair >\ + return dtl::force_copy< std::pair >\ (m_flat_tree.try_emplace(impl_const_iterator(), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { return container_detail::force_copy(m_flat_tree.try_emplace\ - (container_detail::force_copy(hint), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ + { return dtl::force_copy(m_flat_tree.try_emplace\ + (dtl::force_copy(hint), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE) #undef BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE @@ -1024,8 +1024,8 @@ class flat_map //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE std::pair insert(const value_type& x) - { return container_detail::force_copy >( - m_flat_tree.insert_unique(container_detail::force(x))); } + { return dtl::force_copy >( + m_flat_tree.insert_unique(dtl::force(x))); } //! Effects: Inserts a new value_type move constructed from the pair if and //! only if there is no element in the container with key equivalent to the key of x. @@ -1039,8 +1039,8 @@ class flat_map //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE std::pair insert(BOOST_RV_REF(value_type) x) - { return container_detail::force_copy >( - m_flat_tree.insert_unique(boost::move(container_detail::force(x)))); } + { return dtl::force_copy >( + m_flat_tree.insert_unique(boost::move(dtl::force(x)))); } //! Effects: Inserts a new value_type move constructed from the pair if and //! only if there is no element in the container with key equivalent to the key of x. @@ -1055,7 +1055,7 @@ class flat_map //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE std::pair insert(BOOST_RV_REF(movable_value_type) x) { - return container_detail::force_copy > + return dtl::force_copy > (m_flat_tree.insert_unique(boost::move(x))); } @@ -1072,9 +1072,9 @@ class flat_map //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x) { - return container_detail::force_copy( - m_flat_tree.insert_unique( container_detail::force_copy(p) - , container_detail::force(x))); + return dtl::force_copy( + m_flat_tree.insert_unique( dtl::force_copy(p) + , dtl::force(x))); } //! Effects: Inserts an element move constructed from x in the container. @@ -1088,9 +1088,9 @@ class flat_map //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) { - return container_detail::force_copy - (m_flat_tree.insert_unique( container_detail::force_copy(p) - , boost::move(container_detail::force(x)))); + return dtl::force_copy + (m_flat_tree.insert_unique( dtl::force_copy(p) + , boost::move(dtl::force(x)))); } //! Effects: Inserts an element move constructed from x in the container. @@ -1104,8 +1104,8 @@ class flat_map //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) { - return container_detail::force_copy( - m_flat_tree.insert_unique(container_detail::force_copy(p), boost::move(x))); + return dtl::force_copy( + m_flat_tree.insert_unique(dtl::force_copy(p), boost::move(x))); } //! Requires: first, last are not iterators into *this. @@ -1113,8 +1113,7 @@ class flat_map //! Effects: inserts each element from the range [first,last) if and only //! if there is no element with key equivalent to the key of that element. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: N log(size()+N). //! //! Note: If an element is inserted it might invalidate elements. template @@ -1130,8 +1129,7 @@ class flat_map //! if there is no element with key equivalent to the key of that element. This //! function is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: If an element is inserted it might invalidate elements. //! @@ -1144,14 +1142,13 @@ class flat_map //! Effects: inserts each element from the range [il.begin(), il.end()) if and only //! if there is no element with key equivalent to the key of that element. //! - //! Complexity: At most N log(size()+N) (N is the distance from il.first() to il.end()) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list il) { - m_flat_tree.insert_unique( container_detail::force(il).begin() - , container_detail::force(il).end()); + m_flat_tree.insert_unique( dtl::force(il).begin() + , dtl::force(il).end()); } //! Requires: [il.begin(), il.end()) must be ordered according to the predicate and must be @@ -1161,8 +1158,7 @@ class flat_map //! if there is no element with key equivalent to the key of that element. This //! function is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: If an element is inserted it might invalidate elements. //! @@ -1170,8 +1166,8 @@ class flat_map BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list il) { m_flat_tree.insert_unique(ordered_unique_range - , container_detail::force(il).begin() - , container_detail::force(il).end()); + , dtl::force(il).begin() + , dtl::force(il).end()); } #endif @@ -1220,8 +1216,8 @@ class flat_map //! not less than the erased element. BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p) { - return container_detail::force_copy - (m_flat_tree.erase(container_detail::force_copy(p))); + return dtl::force_copy + (m_flat_tree.erase(dtl::force_copy(p))); } //! Effects: Erases all elements in the container with key equivalent to x. @@ -1243,9 +1239,9 @@ class flat_map //! linear to the elements with bigger keys. BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator first, const_iterator last) { - return container_detail::force_copy( - m_flat_tree.erase( container_detail::force_copy(first) - , container_detail::force_copy(last))); + return dtl::force_copy( + m_flat_tree.erase( dtl::force_copy(first) + , dtl::force_copy(last))); } //! Effects: Swaps the contents of *this and x. @@ -1255,7 +1251,7 @@ class flat_map //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE void swap(flat_map& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ) + && boost::container::dtl::is_nothrow_swappable::value ) { m_flat_tree.swap(x.m_flat_tree); } //! Effects: erase(a.begin(),a.end()). @@ -1277,14 +1273,14 @@ class flat_map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const - { return container_detail::force_copy(m_flat_tree.key_comp()); } + { return dtl::force_copy(m_flat_tree.key_comp()); } //! Effects: Returns an object of value_compare constructed out //! of the comparison object. //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const - { return value_compare(container_detail::force_copy(m_flat_tree.key_comp())); } + { return value_compare(dtl::force_copy(m_flat_tree.key_comp())); } ////////////////////////////////////////////// // @@ -1297,14 +1293,36 @@ class flat_map //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x) - { return container_detail::force_copy(m_flat_tree.find(x)); } + { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: A const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const - { return container_detail::force_copy(m_flat_tree.find(x)); } + { return dtl::force_copy(m_flat_tree.find(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE iterator find(const K& x) + { return dtl::force_copy(m_flat_tree.find(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const_iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE const_iterator find(const K& x) const + { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: The number of elements with key equivalent to x. //! @@ -1312,45 +1330,119 @@ class flat_map BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const { return static_cast(m_flat_tree.find(x) != m_flat_tree.end()); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: The number of elements with key equivalent to x. + //! + //! Complexity: log(size())+count(k) + template + BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + { return static_cast(m_flat_tree.find(x) != m_flat_tree.end()); } + //! Returns: An iterator pointing to the first element with key not less //! than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x) - { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: A const iterator pointing to the first element with key not //! less than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const - { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const K& x) + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const K& x) const + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x) - { return container_detail::force_copy(m_flat_tree.upper_bound(x)); } + { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Returns: A const iterator pointing to the first element with key not //! less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const - { return container_detail::force_copy(m_flat_tree.upper_bound(x)); } + { return dtl::force_copy(m_flat_tree.upper_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const K& x) + { return dtl::force_copy(m_flat_tree.upper_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const K& x) const + { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) - { return container_detail::force_copy >(m_flat_tree.lower_bound_range(x)); } + { return dtl::force_copy >(m_flat_tree.lower_bound_range(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) const - { return container_detail::force_copy >(m_flat_tree.lower_bound_range(x)); } + { return dtl::force_copy >(m_flat_tree.lower_bound_range(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) + { return dtl::force_copy >(m_flat_tree.lower_bound_range(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) const + { return dtl::force_copy >(m_flat_tree.lower_bound_range(x)); } //! Effects: Extracts the internal sequence container. //! @@ -1361,7 +1453,7 @@ class flat_map //! Throws: If secuence_type's move constructor throws BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() { - return boost::move(container_detail::force(m_flat_tree.get_sequence_ref())); + return boost::move(dtl::force(m_flat_tree.get_sequence_ref())); } //! Effects: Discards the internally hold sequence container and adopts the @@ -1371,7 +1463,7 @@ class flat_map //! //! Throws: If the comparison or the move constructor throws BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_unique(boost::move(container_detail::force(seq))); } + { this->m_flat_tree.adopt_sequence_unique(boost::move(dtl::force(seq))); } //! Requires: seq shall be ordered according to this->compare() //! and shall contain unique elements. @@ -1383,7 +1475,7 @@ class flat_map //! //! Throws: If the move assignment throws BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_unique(ordered_unique_range_t(), boost::move(container_detail::force(seq))); } + { this->m_flat_tree.adopt_sequence_unique(ordered_unique_range_t(), boost::move(dtl::force(seq))); } //! Effects: Returns true if x and y are equal //! @@ -1434,7 +1526,7 @@ class flat_map iterator i = lower_bound(k); // i->first is greater than or equivalent to k. if (i == end() || key_comp()(k, (*i).first)){ - container_detail::value_init m; + dtl::value_init m; i = insert(i, impl_value_type(k, ::boost::move(m.m_t))); } return (*i).second; @@ -1445,7 +1537,7 @@ class flat_map iterator i = lower_bound(k); // i->first is greater than or equivalent to k. if (i == end() || key_comp()(k, (*i).first)){ - container_detail::value_init m; + dtl::value_init m; i = insert(i, impl_value_type(boost::move(k), ::boost::move(m.m_t))); } return (*i).second; @@ -1453,6 +1545,60 @@ class flat_map #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +flat_map(InputIterator, InputIterator) -> + flat_map< typename dtl::remove_const< typename iterator_traits::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +flat_map(InputIterator, InputIterator, Allocator const&) -> + flat_map< typename dtl::remove_const< typename iterator_traits::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +flat_map(InputIterator, InputIterator, Compare const&) -> + flat_map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +flat_map(InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator) -> + flat_map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> + flat_map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> + flat_map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +flat_map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { @@ -1510,17 +1656,17 @@ class flat_multimap #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_multimap) - typedef container_detail::flat_tree< + typedef dtl::flat_tree< std::pair, - container_detail::select1st, + dtl::select1st, Compare, AllocatorOrContainer> tree_t; //This is the real tree stored here. It's based on a movable pair - typedef container_detail::flat_tree< - container_detail::pair, - container_detail::select1st, + typedef dtl::flat_tree< + dtl::pair, + dtl::select1st, Compare, - typename container_detail::container_or_allocator_rebind >::type + typename dtl::container_or_allocator_rebind >::type > impl_tree_t; impl_tree_t m_flat_tree; // flat tree representing flat_map @@ -1532,9 +1678,9 @@ class flat_multimap typedef std::initializer_list impl_initializer_list; #endif - typedef container_detail::flat_tree_value_compare + typedef dtl::flat_tree_value_compare < Compare - , container_detail::select1st + , dtl::select1st , std::pair > value_compare_t; typedef typename tree_t::iterator iterator_t; typedef typename tree_t::const_iterator const_iterator_t; @@ -1584,7 +1730,7 @@ class flat_multimap typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type; //AllocatorOrContainer::value_type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same, typename AllocatorOrContainer::value_type>::value)); + BOOST_STATIC_ASSERT((dtl::is_same, typename AllocatorOrContainer::value_type>::value)); ////////////////////////////////////////////// // @@ -1596,8 +1742,8 @@ class flat_multimap //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE flat_multimap() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : m_flat_tree() {} @@ -1605,7 +1751,7 @@ class flat_multimap //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE explicit flat_multimap(const allocator_type& a) - : m_flat_tree(container_detail::force(a)) + : m_flat_tree(dtl::force(a)) {} //! Effects: Constructs an empty flat_multimap using the specified comparison @@ -1622,7 +1768,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE flat_multimap(const Compare& comp, const allocator_type& a) - : m_flat_tree(comp, container_detail::force(a)) + : m_flat_tree(comp, dtl::force(a)) {} //! Effects: Constructs an empty flat_multimap @@ -1644,7 +1790,7 @@ class flat_multimap template BOOST_CONTAINER_FORCEINLINE flat_multimap(InputIterator first, InputIterator last, const allocator_type& a) - : m_flat_tree(false, first, last, container_detail::force(a)) + : m_flat_tree(false, first, last, dtl::force(a)) {} //! Effects: Constructs an empty flat_multimap using the specified comparison object @@ -1666,7 +1812,7 @@ class flat_multimap template BOOST_CONTAINER_FORCEINLINE flat_multimap(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(false, first, last, comp, container_detail::force(a)) + : m_flat_tree(false, first, last, comp, dtl::force(a)) {} //! Effects: Constructs an empty flat_multimap @@ -1723,8 +1869,8 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(std::initializer_list il) : m_flat_tree( false - , container_detail::force(il).begin() - , container_detail::force(il).end()) + , dtl::force(il).begin() + , dtl::force(il).end()) {} //! Effects: Constructs an empty flat_map using the specified @@ -1735,9 +1881,9 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(std::initializer_list il, const allocator_type& a) : m_flat_tree(false - , container_detail::force(il).begin() - , container_detail::force(il).end() - , container_detail::force(a)) + , dtl::force(il).begin() + , dtl::force(il).end() + , dtl::force(a)) {} //! Effects: Constructs an empty flat_map using the specified comparison object and @@ -1748,8 +1894,8 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(std::initializer_list il, const Compare& comp) : m_flat_tree(false - , container_detail::force(il).begin() - , container_detail::force(il).end(), comp) + , dtl::force(il).begin() + , dtl::force(il).end(), comp) {} //! Effects: Constructs an empty flat_map using the specified comparison object and @@ -1760,9 +1906,9 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(std::initializer_list il, const Compare& comp, const allocator_type& a) : m_flat_tree( false - , container_detail::force(il).begin() - , container_detail::force(il).end() - , comp, container_detail::force(a)) + , dtl::force(il).begin() + , dtl::force(il).end() + , comp, dtl::force(a)) {} //! Effects: Constructs an empty flat_multimap and @@ -1777,8 +1923,8 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(ordered_range_t, std::initializer_list il) : m_flat_tree( ordered_range - , container_detail::force(il).begin() - , container_detail::force(il).end()) + , dtl::force(il).begin() + , dtl::force(il).end()) {} //! Effects: Constructs an empty flat_multimap using the specified comparison object and @@ -1793,8 +1939,8 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(ordered_range_t, std::initializer_list il, const Compare& comp) : m_flat_tree( ordered_range - , container_detail::force(il).begin() - , container_detail::force(il).end(), comp) + , dtl::force(il).begin() + , dtl::force(il).end(), comp) {} //! Effects: Constructs an empty flat_multimap using the specified comparison object and @@ -1809,9 +1955,9 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE flat_multimap(ordered_range_t, std::initializer_list il, const Compare& comp, const allocator_type& a) : m_flat_tree( ordered_range - , container_detail::force(il).begin() - , container_detail::force(il).end() - , comp, container_detail::force(a)) + , dtl::force(il).begin() + , dtl::force(il).end() + , comp, dtl::force(a)) {} #endif @@ -1830,7 +1976,7 @@ class flat_multimap //! Postcondition: x is emptied. BOOST_CONTAINER_FORCEINLINE flat_multimap(BOOST_RV_REF(flat_multimap) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : m_flat_tree(boost::move(x.m_flat_tree)) {} @@ -1839,7 +1985,7 @@ class flat_multimap //! Complexity: Linear in x.size(). BOOST_CONTAINER_FORCEINLINE flat_multimap(const flat_multimap& x, const allocator_type &a) - : m_flat_tree(x.m_flat_tree, container_detail::force(a)) + : m_flat_tree(x.m_flat_tree, dtl::force(a)) {} //! Effects: Move constructs a flat_multimap using the specified allocator. @@ -1848,7 +1994,7 @@ class flat_multimap //! Complexity: Constant if a == x.get_allocator(), linear otherwise. BOOST_CONTAINER_FORCEINLINE flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a) - : m_flat_tree(boost::move(x.m_flat_tree), container_detail::force(a)) + : m_flat_tree(boost::move(x.m_flat_tree), dtl::force(a)) {} //! Effects: Makes *this a copy of x. @@ -1865,7 +2011,7 @@ class flat_multimap flat_multimap& operator=(BOOST_RV_REF(flat_multimap) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { m_flat_tree = boost::move(x.m_flat_tree); return *this; } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1887,7 +2033,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.get_allocator()); } + { return dtl::force_copy(m_flat_tree.get_allocator()); } //! Effects: Returns a reference to the internal allocator. //! @@ -1898,7 +2044,7 @@ class flat_multimap //! Note: Non-standard extension. BOOST_CONTAINER_FORCEINLINE stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force(m_flat_tree.get_stored_allocator()); } + { return dtl::force(m_flat_tree.get_stored_allocator()); } //! Effects: Returns a reference to the internal allocator. //! @@ -1909,7 +2055,7 @@ class flat_multimap //! Note: Non-standard extension. BOOST_CONTAINER_FORCEINLINE const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force(m_flat_tree.get_stored_allocator()); } + { return dtl::force(m_flat_tree.get_stored_allocator()); } ////////////////////////////////////////////// // @@ -1924,7 +2070,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.begin()); } + { return dtl::force_copy(m_flat_tree.begin()); } //! Effects: Returns a const_iterator to the first element contained in the container. //! @@ -1933,7 +2079,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.begin()); } + { return dtl::force_copy(m_flat_tree.begin()); } //! Effects: Returns an iterator to the end of the container. //! @@ -1942,7 +2088,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.end()); } + { return dtl::force_copy(m_flat_tree.end()); } //! Effects: Returns a const_iterator to the end of the container. //! @@ -1951,7 +2097,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.end()); } + { return dtl::force_copy(m_flat_tree.end()); } //! Effects: Returns a reverse_iterator pointing to the beginning //! of the reversed container. @@ -1961,7 +2107,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rbegin()); } + { return dtl::force_copy(m_flat_tree.rbegin()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. @@ -1971,7 +2117,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rbegin()); } + { return dtl::force_copy(m_flat_tree.rbegin()); } //! Effects: Returns a reverse_iterator pointing to the end //! of the reversed container. @@ -1981,7 +2127,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rend()); } + { return dtl::force_copy(m_flat_tree.rend()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed container. @@ -1991,7 +2137,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.rend()); } + { return dtl::force_copy(m_flat_tree.rend()); } //! Effects: Returns a const_iterator to the first element contained in the container. //! @@ -2000,7 +2146,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.cbegin()); } + { return dtl::force_copy(m_flat_tree.cbegin()); } //! Effects: Returns a const_iterator to the end of the container. //! @@ -2009,7 +2155,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.cend()); } + { return dtl::force_copy(m_flat_tree.cend()); } //! Effects: Returns a const_reverse_iterator pointing to the beginning //! of the reversed container. @@ -2019,7 +2165,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.crbegin()); } + { return dtl::force_copy(m_flat_tree.crbegin()); } //! Effects: Returns a const_reverse_iterator pointing to the end //! of the reversed container. @@ -2029,7 +2175,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.crend()); } + { return dtl::force_copy(m_flat_tree.crend()); } ////////////////////////////////////////////// // @@ -2101,22 +2247,22 @@ class flat_multimap //! @copydoc ::boost::container::flat_set::nth(size_type) BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.nth(n)); } + { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::nth(size_type) const BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { return container_detail::force_copy(m_flat_tree.nth(n)); } + { return dtl::force_copy(m_flat_tree.nth(n)); } //! @copydoc ::boost::container::flat_set::index_of(iterator) BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(container_detail::force_copy(p)); } + { return m_flat_tree.index_of(dtl::force_copy(p)); } //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(container_detail::force_copy(p)); } + { return m_flat_tree.index_of(dtl::force_copy(p)); } #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) @@ -2131,7 +2277,7 @@ class flat_multimap template BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args) - { return container_detail::force_copy(m_flat_tree.emplace_equal(boost::forward(args)...)); } + { return dtl::force_copy(m_flat_tree.emplace_equal(boost::forward(args)...)); } //! Effects: Inserts an object of type T constructed with //! std::forward(args)... in the container. @@ -2149,8 +2295,8 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args) { - return container_detail::force_copy(m_flat_tree.emplace_hint_equal - (container_detail::force_copy(hint), boost::forward(args)...)); + return dtl::force_copy(m_flat_tree.emplace_hint_equal + (dtl::force_copy(hint), boost::forward(args)...)); } #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) @@ -2158,13 +2304,13 @@ class flat_multimap #define BOOST_CONTAINER_FLAT_MULTIMAP_EMPLACE_CODE(N) \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\ - { return container_detail::force_copy(m_flat_tree.emplace_equal(BOOST_MOVE_FWD##N)); }\ + { return dtl::force_copy(m_flat_tree.emplace_equal(BOOST_MOVE_FWD##N)); }\ \ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ - return container_detail::force_copy(m_flat_tree.emplace_hint_equal\ - (container_detail::force_copy(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ + return dtl::force_copy(m_flat_tree.emplace_hint_equal\ + (dtl::force_copy(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ }\ // BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTIMAP_EMPLACE_CODE) @@ -2181,8 +2327,8 @@ class flat_multimap //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const value_type& x) { - return container_detail::force_copy( - m_flat_tree.insert_equal(container_detail::force(x))); + return dtl::force_copy( + m_flat_tree.insert_equal(dtl::force(x))); } //! Effects: Inserts a new value move-constructed from x and returns @@ -2193,7 +2339,7 @@ class flat_multimap //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(value_type) x) - { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); } + { return dtl::force_copy(m_flat_tree.insert_equal(boost::move(x))); } //! Effects: Inserts a new value move-constructed from x and returns //! the iterator pointing to the newly inserted element. @@ -2203,7 +2349,7 @@ class flat_multimap //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(impl_value_type) x) - { return container_detail::force_copy(m_flat_tree.insert_equal(boost::move(x))); } + { return dtl::force_copy(m_flat_tree.insert_equal(boost::move(x))); } //! Effects: Inserts a copy of x in the container. //! p is a hint pointing to where the insert should start to search. @@ -2218,9 +2364,9 @@ class flat_multimap //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x) { - return container_detail::force_copy - (m_flat_tree.insert_equal( container_detail::force_copy(p) - , container_detail::force(x))); + return dtl::force_copy + (m_flat_tree.insert_equal( dtl::force_copy(p) + , dtl::force(x))); } //! Effects: Inserts a value move constructed from x in the container. @@ -2236,8 +2382,8 @@ class flat_multimap //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) { - return container_detail::force_copy - (m_flat_tree.insert_equal(container_detail::force_copy(p) + return dtl::force_copy + (m_flat_tree.insert_equal(dtl::force_copy(p) , boost::move(x))); } @@ -2254,16 +2400,15 @@ class flat_multimap //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(impl_value_type) x) { - return container_detail::force_copy( - m_flat_tree.insert_equal(container_detail::force_copy(p), boost::move(x))); + return dtl::force_copy( + m_flat_tree.insert_equal(dtl::force_copy(p), boost::move(x))); } //! Requires: first, last are not iterators into *this. //! //! Effects: inserts each element from the range [first,last) . //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. template @@ -2278,8 +2423,7 @@ class flat_multimap //! if there is no element with key equivalent to the key of that element. This //! function is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: If an element is inserted it might invalidate elements. //! @@ -2291,14 +2435,13 @@ class flat_multimap #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: inserts each element from the range [il.begin(), il.end()) . //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list il) { - m_flat_tree.insert_equal( container_detail::force(il).begin() - , container_detail::force(il).end()); + m_flat_tree.insert_equal( dtl::force(il).begin() + , dtl::force(il).end()); } //! Requires: [il.begin(), il.end()) must be ordered according to the predicate. @@ -2307,8 +2450,7 @@ class flat_multimap //! if there is no element with key equivalent to the key of that element. This //! function is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: If an element is inserted it might invalidate elements. //! @@ -2316,8 +2458,8 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list il) { m_flat_tree.insert_equal( ordered_range - , container_detail::force(il).begin() - , container_detail::force(il).end()); + , dtl::force(il).begin() + , dtl::force(il).end()); } #endif @@ -2365,8 +2507,8 @@ class flat_multimap //! not less than the erased element. BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p) { - return container_detail::force_copy( - m_flat_tree.erase(container_detail::force_copy(p))); + return dtl::force_copy( + m_flat_tree.erase(dtl::force_copy(p))); } //! Effects: Erases all elements in the container with key equivalent to x. @@ -2388,9 +2530,9 @@ class flat_multimap //! linear to the elements with bigger keys. BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator first, const_iterator last) { - return container_detail::force_copy - (m_flat_tree.erase( container_detail::force_copy(first) - , container_detail::force_copy(last))); + return dtl::force_copy + (m_flat_tree.erase( dtl::force_copy(first) + , dtl::force_copy(last))); } //! Effects: Swaps the contents of *this and x. @@ -2400,7 +2542,7 @@ class flat_multimap //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE void swap(flat_multimap& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ) + && boost::container::dtl::is_nothrow_swappable::value ) { m_flat_tree.swap(x.m_flat_tree); } //! Effects: erase(a.begin(),a.end()). @@ -2422,14 +2564,14 @@ class flat_multimap //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const - { return container_detail::force_copy(m_flat_tree.key_comp()); } + { return dtl::force_copy(m_flat_tree.key_comp()); } //! Effects: Returns an object of value_compare constructed out //! of the comparison object. //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const - { return value_compare(container_detail::force_copy(m_flat_tree.key_comp())); } + { return value_compare(dtl::force_copy(m_flat_tree.key_comp())); } ////////////////////////////////////////////// // @@ -2442,14 +2584,36 @@ class flat_multimap //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x) - { return container_detail::force_copy(m_flat_tree.find(x)); } + { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: An const_iterator pointing to an element with the key //! equivalent to x, or end() if such an element is not found. //! //! Complexity: Logarithmic. BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const - { return container_detail::force_copy(m_flat_tree.find(x)); } + { return dtl::force_copy(m_flat_tree.find(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE iterator find(const K& x) + { return dtl::force_copy(m_flat_tree.find(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An const_iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + BOOST_CONTAINER_FORCEINLINE const_iterator find(const K& x) const + { return dtl::force_copy(m_flat_tree.find(x)); } //! Returns: The number of elements with key equivalent to x. //! @@ -2457,45 +2621,119 @@ class flat_multimap BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const { return m_flat_tree.count(x); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: The number of elements with key equivalent to x. + //! + //! Complexity: log(size())+count(k) + template + BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + { return m_flat_tree.count(x); } + //! Returns: An iterator pointing to the first element with key not less //! than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x) - { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } - //! Returns: A const iterator pointing to the first element with key - //! not less than k, or a.end() if such an element is not found. + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. //! //! Complexity: Logarithmic BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const - { return container_detail::force_copy(m_flat_tree.lower_bound(x)); } + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const K& x) + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const K& x) const + { return dtl::force_copy(m_flat_tree.lower_bound(x)); } //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! //! Complexity: Logarithmic BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x) - {return container_detail::force_copy(m_flat_tree.upper_bound(x)); } + {return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Returns: A const iterator pointing to the first element with key //! not less than x, or end() if such an element is not found. //! //! Complexity: Logarithmic BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const - { return container_detail::force_copy(m_flat_tree.upper_bound(x)); } + { return dtl::force_copy(m_flat_tree.upper_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const K& x) + {return dtl::force_copy(m_flat_tree.upper_bound(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key + //! not less than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const K& x) const + { return dtl::force_copy(m_flat_tree.upper_bound(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) - { return container_detail::force_copy >(m_flat_tree.equal_range(x)); } + { return dtl::force_copy >(m_flat_tree.equal_range(x)); } //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) const - { return container_detail::force_copy >(m_flat_tree.equal_range(x)); } + { return dtl::force_copy >(m_flat_tree.equal_range(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) + { return dtl::force_copy >(m_flat_tree.equal_range(x)); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const K& x) const + { return dtl::force_copy >(m_flat_tree.equal_range(x)); } //! Effects: Extracts the internal sequence container. //! @@ -2506,7 +2744,7 @@ class flat_multimap //! Throws: If secuence_type's move constructor throws BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() { - return boost::move(container_detail::force(m_flat_tree.get_sequence_ref())); + return boost::move(dtl::force(m_flat_tree.get_sequence_ref())); } //! Effects: Discards the internally hold sequence container and adopts the @@ -2516,7 +2754,7 @@ class flat_multimap //! //! Throws: If the comparison or the move constructor throws BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_equal(boost::move(container_detail::force(seq))); } + { this->m_flat_tree.adopt_sequence_equal(boost::move(dtl::force(seq))); } //! Requires: seq shall be ordered according to this->compare(). //! @@ -2527,7 +2765,7 @@ class flat_multimap //! //! Throws: If the move assignment throws BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_equal(ordered_range_t(), boost::move(container_detail::force(seq))); } + { this->m_flat_tree.adopt_sequence_equal(ordered_range_t(), boost::move(dtl::force(seq))); } //! Effects: Returns true if x and y are equal //! @@ -2572,6 +2810,60 @@ class flat_multimap { x.swap(y); } }; +#if __cplusplus >= 201703L + +template +flat_multimap(InputIterator, InputIterator) -> + flat_multimap::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +flat_multimap(InputIterator, InputIterator, Allocator const&) -> + flat_multimap::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +flat_multimap(InputIterator, InputIterator, Compare const&) -> + flat_multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +flat_multimap(InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +template +flat_multimap(ordered_range_t, InputIterator, InputIterator) -> + flat_multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +flat_multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> + flat_multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) -> + flat_multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +flat_multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +#endif + }} #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/boost/container/flat_set.hpp b/boost/container/flat_set.hpp index 567fec9..cfea7c8 100644 --- a/boost/container/flat_set.hpp +++ b/boost/container/flat_set.hpp @@ -80,13 +80,13 @@ template #endif class flat_set ///@cond - : public container_detail::flat_tree, Compare, AllocatorOrContainer> + : public dtl::flat_tree, Compare, AllocatorOrContainer> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_set) - typedef container_detail::flat_tree, Compare, AllocatorOrContainer> tree_t; + typedef dtl::flat_tree, Compare, AllocatorOrContainer> tree_t; public: tree_t &tree() @@ -134,8 +134,8 @@ class flat_set //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE - flat_set() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + flat_set() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : tree_t() {} @@ -350,7 +350,7 @@ class flat_set //! //! Postcondition: x is emptied. BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : tree_t(BOOST_MOVE_BASE(tree_t, x)) {} @@ -384,7 +384,7 @@ class flat_set BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_RV_REF(flat_set) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { return static_cast(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -687,8 +687,7 @@ class flat_set //! Effects: inserts each element from the range [first,last) if and only //! if there is no element with key equivalent to the key of that element. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. template @@ -702,8 +701,7 @@ class flat_set //! Effects: inserts each element from the range [first,last) .This function //! is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: Non-standard extension. If an element is inserted it might invalidate elements. template @@ -714,8 +712,7 @@ class flat_set //! Effects: inserts each element from the range [il.begin(), il.end()) if and only //! if there is no element with key equivalent to the key of that element. //! - //! Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end()) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list il) @@ -727,8 +724,7 @@ class flat_set //! Effects: inserts each element from the range [il.begin(), il.end()) .This function //! is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end()) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: Non-standard extension. If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list il) @@ -794,7 +790,7 @@ class flat_set //! Complexity: Constant. void swap(flat_set& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ); + && boost::container::dtl::is_nothrow_swappable::value ); //! Effects: erase(a.begin(),a.end()). //! @@ -827,6 +823,26 @@ class flat_set //! Complexity: Logarithmic. const_iterator find(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + iterator find(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const_iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + const_iterator find(const K& x) const; + //! Requires: size() >= n. //! //! Effects: Returns an iterator to the nth element @@ -885,6 +901,16 @@ class flat_set BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const { return static_cast(this->tree_t::find(x) != this->tree_t::cend()); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: The number of elements with key equivalent to x. + //! + //! Complexity: log(size())+count(k) + template + BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + { return static_cast(this->tree_t::find(x) != this->tree_t::cend()); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Returns: An iterator pointing to the first element with key not less //! than k, or a.end() if such an element is not found. @@ -898,6 +924,26 @@ class flat_set //! Complexity: Logarithmic const_iterator lower_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator lower_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator lower_bound(const K& x) const; + //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! @@ -910,6 +956,26 @@ class flat_set //! Complexity: Logarithmic const_iterator upper_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator upper_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator upper_bound(const K& x) const; + #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). @@ -924,6 +990,26 @@ class flat_set BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) { return this->tree_t::lower_bound_range(x); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x) + { return this->tree_t::lower_bound_range(x); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x) const + { return this->tree_t::lower_bound_range(x); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Returns true if x and y are equal @@ -1005,6 +1091,42 @@ class flat_set #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +flat_set(InputIterator, InputIterator) -> + flat_set::value_type>; + +template +flat_set(InputIterator, InputIterator, Allocator const&) -> + flat_set::value_type, std::less::value_type>, Allocator>; + +template +flat_set(InputIterator, InputIterator, Compare const&) -> + flat_set::value_type, Compare>; + +template +flat_set(InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_set::value_type, Compare, Allocator>; + +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator) -> + flat_set::value_type>; + +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> + flat_set::value_type, std::less::value_type>, Allocator>; + +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> + flat_set::value_type, Compare>; + +template +flat_set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_set::value_type, Compare, Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { @@ -1052,13 +1174,13 @@ template #endif class flat_multiset ///@cond - : public container_detail::flat_tree, Compare, AllocatorOrContainer> + : public dtl::flat_tree, Compare, AllocatorOrContainer> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(flat_multiset) - typedef container_detail::flat_tree, Compare, AllocatorOrContainer> tree_t; + typedef dtl::flat_tree, Compare, AllocatorOrContainer> tree_t; public: tree_t &tree() @@ -1095,8 +1217,8 @@ class flat_multiset typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; //! @copydoc ::boost::container::flat_set::flat_set() - BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : tree_t() {} @@ -1249,7 +1371,7 @@ class flat_multiset //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&) BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : tree_t(boost::move(static_cast(x))) {} @@ -1271,7 +1393,7 @@ class flat_multiset BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { return static_cast(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1456,8 +1578,7 @@ class flat_multiset //! //! Effects: inserts each element from the range [first,last) . //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. template @@ -1470,8 +1591,7 @@ class flat_multiset //! Effects: inserts each element from the range [first,last) .This function //! is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: Non-standard extension. If an element is inserted it might invalidate elements. template @@ -1481,8 +1601,7 @@ class flat_multiset #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) //! Effects: inserts each element from the range [il.begin(), il.end()). //! - //! Complexity: At most N log(size()+N) (N is the distance from first to last) - //! search time plus N*size() insertion time. + //! Complexity: N log(N). //! //! Note: If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list il) @@ -1493,8 +1612,7 @@ class flat_multiset //! Effects: inserts each element from the range [il.begin(), il.end()). This function //! is more efficient than the normal range creation for ordered ranges. //! - //! Complexity: At most N log(size()+N) (N is the distance from il.begin() to il.end()) - //! search time plus N*size() insertion time. + //! Complexity: Linear. //! //! Note: Non-standard extension. If an element is inserted it might invalidate elements. BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list il) @@ -1535,7 +1653,7 @@ class flat_multiset //! @copydoc ::boost::container::flat_set::swap void swap(flat_multiset& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ); + && boost::container::dtl::is_nothrow_swappable::value ); //! @copydoc ::boost::container::flat_set::clear void clear() BOOST_NOEXCEPT_OR_NOTHROW; @@ -1663,6 +1781,46 @@ class flat_multiset #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +flat_multiset(InputIterator, InputIterator) -> + flat_multiset::value_type>; + +template +flat_multiset(InputIterator, InputIterator, Allocator const&) -> + flat_multiset< typename iterator_traits::value_type + , std::less::value_type> + , Allocator>; + +template +flat_multiset(InputIterator, InputIterator, Compare const&) -> + flat_multiset::value_type, Compare>; + +template +flat_multiset(InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_multiset::value_type, Compare, Allocator>; + +template +flat_multiset(ordered_range_t, InputIterator, InputIterator) -> + flat_multiset::value_type>; + +template +flat_multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> + flat_multiset< typename iterator_traits::value_type + , std::less::value_type> + , Allocator>; + +template +flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) -> + flat_multiset< typename iterator_traits::value_type, Compare>; + +template +flat_multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + flat_multiset::value_type, Compare, Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/boost/container/map.hpp b/boost/container/map.hpp index 33e0331..a88b6a5 100644 --- a/boost/container/map.hpp +++ b/boost/container/map.hpp @@ -78,9 +78,9 @@ template #endif class map ///@cond - : public container_detail::tree + : public dtl::tree < std::pair - , container_detail::select1st + , dtl::select1st , Compare, Allocator, Options> ///@endcond { @@ -88,11 +88,11 @@ class map private: BOOST_COPYABLE_AND_MOVABLE(map) - typedef container_detail::select1st select_1st_t; + typedef dtl::select1st select_1st_t; typedef std::pair value_type_impl; - typedef container_detail::tree + typedef dtl::tree base_t; - typedef container_detail::pair movable_value_type_impl; + typedef dtl::pair movable_value_type_impl; typedef typename base_t::value_compare value_compare_impl; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -131,7 +131,7 @@ class map (insert_return_type_base) insert_return_type; //allocator_type::value_type type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same >::value)); + BOOST_STATIC_ASSERT((dtl::is_same >::value)); ////////////////////////////////////////////// // @@ -143,8 +143,8 @@ class map //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE - map() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + map() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : base_t() {} @@ -350,7 +350,7 @@ class map //! //! Postcondition: x is emptied. BOOST_CONTAINER_FORCEINLINE map(BOOST_RV_REF(map) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} @@ -388,7 +388,7 @@ class map BOOST_CONTAINER_FORCEINLINE map& operator=(BOOST_RV_REF(map) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1014,7 +1014,7 @@ class map template BOOST_CONTAINER_FORCEINLINE void merge(map& source) { - typedef container_detail::tree + typedef dtl::tree base2_t; this->merge_unique(static_cast(source)); } @@ -1028,7 +1028,7 @@ class map template BOOST_CONTAINER_FORCEINLINE void merge(multimap& source) { - typedef container_detail::tree + typedef dtl::tree base2_t; this->base_t::merge_unique(static_cast(source)); } @@ -1046,7 +1046,7 @@ class map //! Complexity: Constant. void swap(map& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ) + && boost::container::dtl::is_nothrow_swappable::value ) //! Effects: erase(a.begin(),a.end()). //! @@ -1079,6 +1079,26 @@ class map //! Complexity: Logarithmic. const_iterator find(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + iterator find(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const_iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + const_iterator find(const K& x) const; + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Returns: The number of elements with key equivalent to x. @@ -1087,6 +1107,16 @@ class map BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const { return static_cast(this->find(x) != this->cend()); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: The number of elements with key equivalent to x. + //! + //! Complexity: log(size())+count(k) + template + BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + { return static_cast(this->find(x) != this->cend()); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Returns: An iterator pointing to the first element with key not less @@ -1101,6 +1131,26 @@ class map //! Complexity: Logarithmic const_iterator lower_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator lower_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator lower_bound(const K& x) const; + //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! @@ -1113,6 +1163,26 @@ class map //! Complexity: Logarithmic const_iterator upper_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator upper_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator upper_bound(const K& x) const; + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic @@ -1123,6 +1193,24 @@ class map //! Complexity: Logarithmic std::pair equal_range(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x) const; + //! Effects: Rebalances the tree. It's a no-op for Red-Black and AVL trees. //! //! Complexity: Linear @@ -1175,6 +1263,60 @@ class map #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +map(InputIterator, InputIterator) -> + map< typename dtl::remove_const< typename iterator_traits::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +map(InputIterator, InputIterator, Allocator const&) -> + map< typename dtl::remove_const< typename iterator_traits::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +map(InputIterator, InputIterator, Compare const&) -> + map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +map(InputIterator, InputIterator, Compare const&, Allocator const&) -> + map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +template +map(ordered_unique_range_t, InputIterator, InputIterator) -> + map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +map(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> + map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> + map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +map(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + map< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -1219,9 +1361,9 @@ template #endif class multimap ///@cond - : public container_detail::tree + : public dtl::tree < std::pair - , container_detail::select1st + , dtl::select1st , Compare, Allocator, Options> ///@endcond { @@ -1229,11 +1371,11 @@ class multimap private: BOOST_COPYABLE_AND_MOVABLE(multimap) - typedef container_detail::select1st select_1st_t; + typedef dtl::select1st select_1st_t; typedef std::pair value_type_impl; - typedef container_detail::tree + typedef dtl::tree base_t; - typedef container_detail::pair movable_value_type_impl; + typedef dtl::pair movable_value_type_impl; typedef typename base_t::value_compare value_compare_impl; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -1271,7 +1413,7 @@ class multimap >) node_type; //allocator_type::value_type type must be std::pair - BOOST_STATIC_ASSERT((container_detail::is_same >::value)); + BOOST_STATIC_ASSERT((dtl::is_same >::value)); ////////////////////////////////////////////// // @@ -1283,8 +1425,8 @@ class multimap //! //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE multimap() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : base_t() {} @@ -1486,7 +1628,7 @@ class multimap //! //! Postcondition: x is emptied. BOOST_CONTAINER_FORCEINLINE multimap(BOOST_RV_REF(multimap) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} @@ -1518,7 +1660,7 @@ class multimap BOOST_CONTAINER_FORCEINLINE multimap& operator=(BOOST_RV_REF(multimap) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1790,7 +1932,7 @@ class multimap template BOOST_CONTAINER_FORCEINLINE void merge(multimap& source) { - typedef container_detail::tree + typedef dtl::tree base2_t; this->base_t::merge_equal(static_cast(source)); } @@ -1804,7 +1946,7 @@ class multimap template BOOST_CONTAINER_FORCEINLINE void merge(map& source) { - typedef container_detail::tree + typedef dtl::tree base2_t; this->base_t::merge_equal(static_cast(source)); } @@ -1818,7 +1960,7 @@ class multimap //! @copydoc ::boost::container::set::swap void swap(multiset& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ); + && boost::container::dtl::is_nothrow_swappable::value ); //! @copydoc ::boost::container::set::clear void clear() BOOST_NOEXCEPT_OR_NOTHROW; @@ -1841,11 +1983,40 @@ class multimap //! Complexity: Logarithmic. const_iterator find(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + iterator find(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const_iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + const_iterator find(const K& x) const; + //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) size_type count(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: The number of elements with key equivalent to x. + //! + //! Complexity: log(size())+count(k) + template + size_type count(const K& x) const; + //! Returns: An iterator pointing to the first element with key not less //! than k, or a.end() if such an element is not found. //! @@ -1858,6 +2029,26 @@ class multimap //! Complexity: Logarithmic const_iterator lower_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator lower_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator lower_bound(const K& x) const; + //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! @@ -1870,6 +2061,26 @@ class multimap //! Complexity: Logarithmic const_iterator upper_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator upper_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator upper_bound(const K& x) const; + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). //! //! Complexity: Logarithmic @@ -1880,6 +2091,24 @@ class multimap //! Complexity: Logarithmic std::pair equal_range(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x) const; + //! Effects: Rebalances the tree. It's a no-op for Red-Black and AVL trees. //! //! Complexity: Linear @@ -1923,6 +2152,60 @@ class multimap #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) }; +#if __cplusplus >= 201703L + +template +multimap(InputIterator, InputIterator) -> + multimap::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +multimap(InputIterator, InputIterator, Allocator const&) -> + multimap::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +multimap(InputIterator, InputIterator, Compare const&) -> + multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +multimap(InputIterator, InputIterator, Compare const&, Allocator const&) -> + multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +template +multimap(ordered_range_t, InputIterator, InputIterator) -> + multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type>; + +template +multimap(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> + multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , std::less::value_type::first_type>::type> + , Allocator>; + +template +multimap(ordered_range_t, InputIterator, InputIterator, Compare const&) -> + multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare>; + +template +multimap(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + multimap< typename dtl::remove_const::value_type::first_type>::type + , typename iterator_traits::value_type::second_type + , Compare + , Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/boost/container/node_handle.hpp b/boost/container/node_handle.hpp index 594a09c..ef1d71f 100644 --- a/boost/container/node_handle.hpp +++ b/boost/container/node_handle.hpp @@ -174,9 +174,9 @@ class node_handle //! of a node handle is void. template node_handle( BOOST_RV_REF_BEG node_handle BOOST_RV_REF_END nh - , typename container_detail::enable_if_c - < ((unsigned)container_detail::is_same::value + - (unsigned)container_detail::is_same::value) == 1u + , typename dtl::enable_if_c + < ((unsigned)dtl::is_same::value + + (unsigned)dtl::is_same::value) == 1u >::type* = 0) BOOST_NOEXCEPT : m_ptr(nh.get()) { this->move_construct_end(nh); } @@ -250,7 +250,7 @@ class node_handle //! Throws: Nothing. value_type& value() const BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT((container_detail::is_same::value)); + BOOST_STATIC_ASSERT((dtl::is_same::value)); BOOST_ASSERT(!empty()); return m_ptr->get_data(); } @@ -265,7 +265,7 @@ class node_handle //! Requires: Modifying the key through the returned reference is permitted. key_type& key() const BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT((!container_detail::is_same::value)); + BOOST_STATIC_ASSERT((!dtl::is_same::value)); BOOST_ASSERT(!empty()); return const_cast(KeyMapped().key_of_value(m_ptr->get_data())); } @@ -278,7 +278,7 @@ class node_handle //! Throws: Nothing. mapped_type& mapped() const BOOST_NOEXCEPT { - BOOST_STATIC_ASSERT((!container_detail::is_same::value)); + BOOST_STATIC_ASSERT((!dtl::is_same::value)); BOOST_ASSERT(!empty()); return KeyMapped().mapped_of_value(m_ptr->get_data()); } diff --git a/boost/container/options.hpp b/boost/container/options.hpp index da8b6a7..2ac7783 100644 --- a/boost/container/options.hpp +++ b/boost/container/options.hpp @@ -28,6 +28,24 @@ namespace boost { namespace container { +//////////////////////////////////////////////////////////////// +// +// +// OPTIONS FOR ASSOCIATIVE TREE-BASED CONTAINERS +// +// +//////////////////////////////////////////////////////////////// + +//! Enumeration used to configure ordered associative containers +//! with a concrete tree implementation. +enum tree_type_enum +{ + red_black_tree, + avl_tree, + scapegoat_tree, + splay_tree +}; + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template @@ -37,6 +55,8 @@ struct tree_opt static const bool optimize_size = OptimizeSize; }; +typedef tree_opt tree_assoc_defaults; + #endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //!This option setter specifies the underlying tree type @@ -72,6 +92,151 @@ struct tree_assoc_options typedef implementation_defined type; }; +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +//! Helper alias metafunction to combine options into a single type to be used +//! by tree-based associative containers +template +using tree_assoc_options_t = typename boost::container::tree_assoc_options::type; + +#endif + +//////////////////////////////////////////////////////////////// +// +// +// OPTIONS FOR VECTOR-BASED CONTAINERS +// +// +//////////////////////////////////////////////////////////////// + +#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +template +struct get_stored_size_type_with_alloctraits +{ + typedef StoredSizeType type; +}; + +template +struct get_stored_size_type_with_alloctraits +{ + typedef typename AllocTraits::size_type type; +}; + +template +struct vector_opt +{ + typedef GrowthType growth_factor_type; + typedef StoredSizeType stored_size_type; + + template + struct get_stored_size_type + : get_stored_size_type_with_alloctraits + {}; +}; + +class default_next_capacity; + +typedef vector_opt vector_null_opt; + +#else //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +//!This growth factor argument specifies that the container should increase it's +//!capacity a 50% when existing capacity is exhausted. +struct growth_factor_50{}; + +//!This growth factor argument specifies that the container should increase it's +//!capacity a 60% when existing capacity is exhausted. +struct growth_factor_60{}; + +//!This growth factor argument specifies that the container should increase it's +//!capacity a 100% (doubling its capacity) when existing capacity is exhausted. +struct growth_factor_100{}; + +#endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +//!This option setter specifies the growth factor strategy of the underlying vector. +//! +//!\tparam GrowthFactor A function object that has the following signature:

+//!`template`
+//!`SizeType operator()(SizeType cur_cap, SizeType add_min_cap, SizeType max_cap) const;`.

+//!`cur_cap` is the current capacity, `add_min_cap` is the minimum additional capacity +//!we want to achieve and `max_cap` is the maximum capacity that the allocator or other +//!factors allow. The implementation should return a value between `cur_cap` + `add_min_cap` +//!and `max_cap`. `cur_cap` + `add_min_cap` is guaranteed not to overflow/wraparound, +//! but the implementation should handle wraparound produced by the growth factor. +//! +//!Predefined growth factors that can be passed as arguments to this option are: +//!\c boost::container::growth_factor_50 +//!\c boost::container::growth_factor_60 +//!\c boost::container::growth_factor_100 +//! +//!If this option is not specified, a default will be used by the container. +BOOST_INTRUSIVE_OPTION_TYPE(growth_factor, GrowthFactor, GrowthFactor, growth_factor_type) + +//!This option specifies the unsigned integer type that a user wants the container +//!to use to hold size-related information inside a container (e.g. current size, current capacity). +//! +//!\tparam StoredSizeType A unsigned integer type. It shall be smaller than than the size +//! of the size_type deduced from `allocator_traits
::size_type` or the same type. +//! +//!If the maximum capacity() to be used is limited, a user can try to use 8-bit, 16-bit +//!(e.g. in 32-bit machines), or 32-bit size types (e.g. in a 64 bit machine) to see if some +//!memory can be saved for empty vectors. This could potentially performance benefits due to better +//!cache usage. +//! +//!Note that alignment requirements can disallow theoritical space savings. Example: +//!\c vector holds a pointer and two size types (for size and capacity), in a 32 bit machine +//!a 8 bit size type (total size: 4 byte pointer + 2 x 1 byte sizes = 6 bytes) +//!will not save space when comparing two 16-bit size types because usually +//!a 32 bit alignment is required for vector and the size will be rounded to 8 bytes. In a 64-bit +//!machine a 16 bit size type does not usually save memory when comparing to a 32-bit size type. +//!Measure the size of the resulting container and do not assume a smaller \c stored_size +//!will always lead to a smaller sizeof(container). +//! +//!If a user tries to insert more elements than representable by \c stored_size, vector +//!will throw a length_error. +//! +//!If this option is not specified, `allocator_traits::size_type` (usually std::size_t) will +//!be used to store size-related information inside the container. +BOOST_INTRUSIVE_OPTION_TYPE(stored_size, StoredSizeType, StoredSizeType, stored_size_type) + +//! Helper metafunction to combine options into a single type to be used +//! by \c boost::container::vector. +//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size +#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) || defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) +template +#else +template +#endif +struct vector_options +{ + /// @cond + typedef typename ::boost::intrusive::pack_options + < vector_null_opt, + #if !defined(BOOST_CONTAINER_VARIADIC_TEMPLATES) + O1, O2, O3, O4 + #else + Options... + #endif + >::type packed_options; + typedef vector_opt< typename packed_options::growth_factor_type + , typename packed_options::stored_size_type> implementation_defined; + /// @endcond + typedef implementation_defined type; +}; + +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) + +//! Helper alias metafunction to combine options into a single type to be used +//! by \c boost::container::vector. +//! Supported options are: \c boost::container::growth_factor and \c boost::container::stored_size +template +using vector_options_t = typename boost::container::vector_options::type; + +#endif + + } //namespace container { } //namespace boost { diff --git a/boost/container/set.hpp b/boost/container/set.hpp index 8730b1c..e300898 100644 --- a/boost/container/set.hpp +++ b/boost/container/set.hpp @@ -60,21 +60,21 @@ namespace container { //! \tparam Compare is the comparison functor used to order keys //! \tparam Allocator is the allocator to be used to allocate memory for this container //! \tparam Options is an packed option type generated using using boost::container::tree_assoc_options. -template , class Allocator = new_allocator, class Options = tree_assoc_defaults > +template , class Allocator = new_allocator, class Options = void> #else template #endif class set ///@cond - : public container_detail::tree - < Key, container_detail::identity, Compare, Allocator, Options> + : public dtl::tree + < Key, dtl::identity, Compare, Allocator, Options> ///@endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(set) - typedef container_detail::tree - < Key, container_detail::identity, Compare, Allocator, Options> base_t; + typedef dtl::tree + < Key, dtl::identity, Compare, Allocator, Options> base_t; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -114,8 +114,8 @@ class set //! Complexity: Constant. BOOST_CONTAINER_FORCEINLINE set() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : base_t() {} @@ -320,7 +320,7 @@ class set //! //! Postcondition: x is emptied. BOOST_CONTAINER_FORCEINLINE set(BOOST_RV_REF(set) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} @@ -356,7 +356,7 @@ class set BOOST_CONTAINER_FORCEINLINE set& operator=(BOOST_RV_REF(set) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -639,8 +639,8 @@ class set template BOOST_CONTAINER_FORCEINLINE void merge(set& source) { - typedef container_detail::tree - , C2, Allocator, Options> base2_t; + typedef dtl::tree + , C2, Allocator, Options> base2_t; this->base_t::merge_unique(static_cast(source)); } @@ -653,8 +653,8 @@ class set template BOOST_CONTAINER_FORCEINLINE void merge(multiset& source) { - typedef container_detail::tree - , C2, Allocator, Options> base2_t; + typedef dtl::tree + , C2, Allocator, Options> base2_t; this->base_t::merge_unique(static_cast(source)); } @@ -701,7 +701,7 @@ class set //! Complexity: Constant. void swap(set& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ); + && boost::container::dtl::is_nothrow_swappable::value ); //! Effects: erase(a.begin(),a.end()). //! @@ -734,6 +734,26 @@ class set //! Complexity: Logarithmic. const_iterator find(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + iterator find(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const_iterator pointing to an element with the key + //! equivalent to x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic. + template + const_iterator find(const K& x) const; + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Returns: The number of elements with key equivalent to x. @@ -742,6 +762,16 @@ class set BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const { return static_cast(this->base_t::find(x) != this->base_t::cend()); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: The number of elements with key equivalent to x. + //! + //! Complexity: log(size())+count(k) + template + BOOST_CONTAINER_FORCEINLINE size_type count(const K& x) const + { return static_cast(this->find(x) != this->cend()); } + //! Returns: The number of elements with key equivalent to x. //! //! Complexity: log(size())+count(k) @@ -762,6 +792,26 @@ class set //! Complexity: Logarithmic const_iterator lower_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator lower_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than k, or a.end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator lower_bound(const K& x) const; + //! Returns: An iterator pointing to the first element with key not less //! than x, or end() if such an element is not found. //! @@ -774,6 +824,26 @@ class set //! Complexity: Logarithmic const_iterator upper_bound(const key_type& x) const; + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: An iterator pointing to the first element with key not less + //! than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + iterator upper_bound(const K& x); + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Returns: A const iterator pointing to the first element with key not + //! less than x, or end() if such an element is not found. + //! + //! Complexity: Logarithmic + template + const_iterator upper_bound(const K& x) const; + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). @@ -788,18 +858,28 @@ class set BOOST_CONTAINER_FORCEINLINE std::pair equal_range(const key_type& x) const { return this->base_t::lower_bound_range(x); } + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x) + { return this->base_t::lower_bound_range(x); } + + //! Requires: This overload is available only if + //! key_compare::is_transparent exists. + //! + //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). + //! + //! Complexity: Logarithmic + template + std::pair equal_range(const K& x) const + { return this->base_t::lower_bound_range(x); } + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! Complexity: Logarithmic - std::pair equal_range(const key_type& x); - - //! Effects: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! Complexity: Logarithmic - std::pair equal_range(const key_type& x) const; - //! Effects: Rebalances the tree. It's a no-op for Red-Black and AVL trees. //! //! Complexity: Linear @@ -854,6 +934,42 @@ class set #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +set(InputIterator, InputIterator) -> + set::value_type>; + +template +set(InputIterator, InputIterator, Allocator const&) -> + set::value_type, std::less::value_type>, Allocator>; + +template +set(InputIterator, InputIterator, Compare const&) -> + set::value_type, Compare>; + +template +set(InputIterator, InputIterator, Compare const&, Allocator const&) -> + set::value_type, Compare, Allocator>; + +template +set(ordered_unique_range_t, InputIterator, InputIterator) -> + set::value_type>; + +template +set(ordered_unique_range_t, InputIterator, InputIterator, Allocator const&) -> + set::value_type, std::less::value_type>, Allocator>; + +template +set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&) -> + set::value_type, Compare>; + +template +set(ordered_unique_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + set::value_type, Compare, Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { @@ -893,15 +1009,15 @@ template #endif class multiset /// @cond - : public container_detail::tree - , Compare, Allocator, Options> + : public dtl::tree + , Compare, Allocator, Options> /// @endcond { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(multiset) - typedef container_detail::tree - , Compare, Allocator, Options> base_t; + typedef dtl::tree + , Compare, Allocator, Options> base_t; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -938,8 +1054,8 @@ class multiset //! @copydoc ::boost::container::set::set() BOOST_CONTAINER_FORCEINLINE multiset() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value && - container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value && + dtl::is_nothrow_default_constructible::value) : base_t() {} @@ -1068,7 +1184,7 @@ class multiset //! @copydoc ::boost::container::set::set(set &&) BOOST_CONTAINER_FORCEINLINE multiset(BOOST_RV_REF(multiset) x) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, x)) {} @@ -1090,7 +1206,7 @@ class multiset BOOST_CONTAINER_FORCEINLINE multiset& operator=(BOOST_RV_REF(multiset) x) BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || allocator_traits_type::is_always_equal::value) && - boost::container::container_detail::is_nothrow_move_assignable::value) + boost::container::dtl::is_nothrow_move_assignable::value) { return static_cast(this->base_t::operator=(BOOST_MOVE_BASE(base_t, x))); } #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) @@ -1269,8 +1385,8 @@ class multiset template BOOST_CONTAINER_FORCEINLINE void merge(multiset& source) { - typedef container_detail::tree - , C2, Allocator, Options> base2_t; + typedef dtl::tree + , C2, Allocator, Options> base2_t; this->base_t::merge_equal(static_cast(source)); } @@ -1283,8 +1399,8 @@ class multiset template BOOST_CONTAINER_FORCEINLINE void merge(set& source) { - typedef container_detail::tree - , C2, Allocator, Options> base2_t; + typedef dtl::tree + , C2, Allocator, Options> base2_t; this->base_t::merge_equal(static_cast(source)); } @@ -1313,7 +1429,7 @@ class multiset //! @copydoc ::boost::container::set::swap void swap(multiset& x) BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::container_detail::is_nothrow_swappable::value ); + && boost::container::dtl::is_nothrow_swappable::value ); //! @copydoc ::boost::container::set::clear void clear() BOOST_NOEXCEPT_OR_NOTHROW; @@ -1330,27 +1446,63 @@ class multiset //! @copydoc ::boost::container::set::find(const key_type& ) const const_iterator find(const key_type& x) const; + //! @copydoc ::boost::container::set::find(const K& ) + template + iterator find(const K& x); + + //! @copydoc ::boost::container::set::find(const K& ) + template + const_iterator find(const K& x) const; + //! @copydoc ::boost::container::set::count(const key_type& ) const size_type count(const key_type& x) const; + //! @copydoc ::boost::container::set::count(const K& ) const + template + size_type count(const K& x) const; + //! @copydoc ::boost::container::set::lower_bound(const key_type& ) iterator lower_bound(const key_type& x); //! @copydoc ::boost::container::set::lower_bound(const key_type& ) const const_iterator lower_bound(const key_type& x) const; + //! @copydoc ::boost::container::set::lower_bound(const K& ) + template + iterator lower_bound(const K& x); + + //! @copydoc ::boost::container::set::lower_bound(const K& ) const + template + const_iterator lower_bound(const K& x) const; + //! @copydoc ::boost::container::set::upper_bound(const key_type& ) iterator upper_bound(const key_type& x); //! @copydoc ::boost::container::set::upper_bound(const key_type& ) const const_iterator upper_bound(const key_type& x) const; + //! @copydoc ::boost::container::set::upper_bound(const K& ) + template + iterator upper_bound(const K& x); + + //! @copydoc ::boost::container::set::upper_bound(const K& ) const + template + const_iterator upper_bound(const K& x) const; + //! @copydoc ::boost::container::set::equal_range(const key_type& ) const std::pair equal_range(const key_type& x) const; //! @copydoc ::boost::container::set::equal_range(const key_type& ) std::pair equal_range(const key_type& x); + //! @copydoc ::boost::container::set::equal_range(const K& ) const + template + std::pair equal_range(const K& x) const; + + //! @copydoc ::boost::container::set::equal_range(const K& ) + template + std::pair equal_range(const K& x); + //! @copydoc ::boost::container::set::rebalance() void rebalance(); @@ -1404,6 +1556,46 @@ class multiset #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +multiset(InputIterator, InputIterator) -> + multiset::value_type>; + +template +multiset(InputIterator, InputIterator, Allocator const&) -> + multiset< typename iterator_traits::value_type + , std::less::value_type> + , Allocator>; + +template +multiset(InputIterator, InputIterator, Compare const&) -> + multiset::value_type, Compare>; + +template +multiset(InputIterator, InputIterator, Compare const&, Allocator const&) -> + multiset::value_type, Compare, Allocator>; + +template +multiset(ordered_range_t, InputIterator, InputIterator) -> + multiset::value_type>; + +template +multiset(ordered_range_t, InputIterator, InputIterator, Allocator const&) -> + multiset< typename iterator_traits::value_type + , std::less::value_type> + , Allocator>; + +template +multiset(ordered_range_t, InputIterator, InputIterator, Compare const&) -> + multiset< typename iterator_traits::value_type, Compare>; + +template +multiset(ordered_range_t, InputIterator, InputIterator, Compare const&, Allocator const&) -> + multiset::value_type, Compare, Allocator>; + +#endif + #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED } //namespace container { diff --git a/boost/container/small_vector.hpp b/boost/container/small_vector.hpp index 804740c..70704d6 100644 --- a/boost/container/small_vector.hpp +++ b/boost/container/small_vector.hpp @@ -118,11 +118,11 @@ class small_vector_allocator 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; + typedef BOOST_CONTAINER_IMPDEF(dtl::bool_) is_always_equal; //! An integral constant with member `value == true` - typedef BOOST_CONTAINER_IMPDEF(container_detail::bool_) is_partially_propagable; + typedef BOOST_CONTAINER_IMPDEF(dtl::bool_) is_partially_propagable; - BOOST_CONTAINER_DOCIGN(typedef container_detail::version_type version;) + BOOST_CONTAINER_DOCIGN(typedef dtl::version_type version;) //!Obtains an small_vector_allocator that allocates //!objects of type T2 @@ -282,7 +282,8 @@ class small_vector_allocator 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 typename allocator_traits_type::size_type size_type; + typedef vector_alloc_holder< small_vector_allocator, size_type > vector_alloc_holder_t; typedef vector > vector_base; typedef small_vector_base derived_type; // @@ -337,7 +338,7 @@ class small_vector_base pointer internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW { return boost::intrusive::pointer_traits::pointer_to - (*const_cast(static_cast(static_cast(&m_storage_start)))); + (*const_cast(static_cast(static_cast(m_storage_start.data)))); } typedef vector > base_type; @@ -345,12 +346,11 @@ class small_vector_base const base_type &as_base() const { return static_cast(*this); } public: - typedef typename container_detail::aligned_storage - ::value>::type storage_type; + typedef typename dtl::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) @@ -419,7 +419,7 @@ 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_align = dtl::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); @@ -481,7 +481,6 @@ class small_vector : public small_vector_base BOOST_COPYABLE_AND_MOVABLE(small_vector) - typedef typename base_type::initial_capacity_t initial_capacity_t; typedef allocator_traits allocator_traits_type; public: @@ -507,7 +506,7 @@ class small_vector : public small_vector_base public: BOOST_CONTAINER_FORCEINLINE small_vector() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : base_type(initial_capacity_t(), internal_capacity()) {} @@ -541,18 +540,18 @@ class small_vector : public small_vector_base 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) + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c + < dtl::is_convertible::value + BOOST_MOVE_I dtl::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) + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c + < dtl::is_convertible::value + BOOST_MOVE_I dtl::nat >::type * = 0) ) : base_type(initial_capacity_t(), internal_capacity(), a) { this->assign(first, last); } diff --git a/boost/container/static_vector.hpp b/boost/container/static_vector.hpp index 4a341c3..b40d5c3 100644 --- a/boost/container/static_vector.hpp +++ b/boost/container/static_vector.hpp @@ -33,7 +33,7 @@ namespace boost { namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -namespace container_detail { +namespace dtl { template class static_storage_allocator @@ -51,17 +51,17 @@ class static_storage_allocator { return *this; } BOOST_CONTAINER_FORCEINLINE T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_cast(static_cast(static_cast(&storage))); } + { return const_cast(static_cast(static_cast(storage.data))); } BOOST_CONTAINER_FORCEINLINE T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW - { return static_cast(static_cast(&storage)); } + { return static_cast(static_cast(storage.data)); } static const std::size_t internal_capacity = N; std::size_t max_size() const { return N; } - typedef boost::container::container_detail::version_type version; + typedef boost::container::dtl::version_type version; BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW { return false; } @@ -73,7 +73,7 @@ class static_storage_allocator typename aligned_storage::value>::type storage; }; -} //namespace container_detail { +} //namespace dtl { #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -103,10 +103,10 @@ class static_storage_allocator //!@tparam Capacity The maximum number of elements static_vector can store, fixed at compile time. template class static_vector - : public vector > + : public vector > { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef vector > base_t; + typedef vector > base_t; BOOST_COPYABLE_AND_MOVABLE(static_vector) @@ -114,7 +114,7 @@ class static_vector friend class static_vector; public: - typedef container_detail::static_storage_allocator allocator_type; + typedef dtl::static_storage_allocator allocator_type; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED public: @@ -259,7 +259,7 @@ public: {} BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF(static_vector) other, const allocator_type &) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, other)) {} @@ -294,7 +294,7 @@ public: //! @par Complexity //! Linear O(N). BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF(static_vector) other) - BOOST_NOEXCEPT_IF(boost::container::container_detail::is_nothrow_move_constructible::value) + BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible::value) : base_t(BOOST_MOVE_BASE(base_t, other)) {} @@ -1228,7 +1228,7 @@ inline void swap(static_vector & x, static_vector & y); template inline void swap(static_vector & x, static_vector & y - , typename container_detail::enable_if_c< C1 != C2>::type * = 0) + , typename dtl::enable_if_c< C1 != C2>::type * = 0) { x.swap(y); } diff --git a/boost/container/vector.hpp b/boost/container/vector.hpp index 8e1e7a5..c3baebc 100644 --- a/boost/container/vector.hpp +++ b/boost/container/vector.hpp @@ -27,6 +27,7 @@ #include #include //new_allocator #include +#include // container detail #include #include //equal() @@ -39,6 +40,7 @@ #include #include #include +#include #include #include #include @@ -58,6 +60,7 @@ #include #include #include +#include // other #include #include @@ -73,7 +76,6 @@ namespace container { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -namespace container_detail { template class vec_iterator @@ -82,7 +84,7 @@ class vec_iterator typedef std::random_access_iterator_tag iterator_category; typedef typename boost::intrusive::pointer_traits::element_type value_type; typedef typename boost::intrusive::pointer_traits::difference_type difference_type; - typedef typename if_c + typedef typename dtl::if_c < IsConst , typename boost::intrusive::pointer_traits::template rebind_pointer::type @@ -120,42 +122,42 @@ class vec_iterator //Pointer like operators BOOST_CONTAINER_FORCEINLINE reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW - { return *m_ptr; } + { BOOST_ASSERT(!!m_ptr); return *m_ptr; } BOOST_CONTAINER_FORCEINLINE pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW - { return ::boost::intrusive::pointer_traits::pointer_to(this->operator*()); } + { return m_ptr; } BOOST_CONTAINER_FORCEINLINE reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW - { return m_ptr[off]; } + { BOOST_ASSERT(!!m_ptr); return m_ptr[off]; } //Increment / Decrement BOOST_CONTAINER_FORCEINLINE vec_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW - { ++m_ptr; return *this; } + { BOOST_ASSERT(!!m_ptr); ++m_ptr; return *this; } BOOST_CONTAINER_FORCEINLINE vec_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW - { return vec_iterator(m_ptr++); } + { BOOST_ASSERT(!!m_ptr); return vec_iterator(m_ptr++); } BOOST_CONTAINER_FORCEINLINE vec_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW - { --m_ptr; return *this; } + { BOOST_ASSERT(!!m_ptr); --m_ptr; return *this; } BOOST_CONTAINER_FORCEINLINE vec_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW - { return vec_iterator(m_ptr--); } + { BOOST_ASSERT(!!m_ptr); return vec_iterator(m_ptr--); } //Arithmetic BOOST_CONTAINER_FORCEINLINE vec_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { m_ptr += off; return *this; } + { BOOST_ASSERT(!!m_ptr); m_ptr += off; return *this; } BOOST_CONTAINER_FORCEINLINE vec_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { m_ptr -= off; return *this; } + { BOOST_ASSERT(!!m_ptr); m_ptr -= off; return *this; } BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { return vec_iterator(x.m_ptr+off); } + { BOOST_ASSERT(!!x.m_ptr); return vec_iterator(x.m_ptr+off); } BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_NOEXCEPT_OR_NOTHROW - { right.m_ptr += off; return right; } + { BOOST_ASSERT(!!right.m_ptr); right.m_ptr += off; return right; } BOOST_CONTAINER_FORCEINLINE friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { left.m_ptr -= off; return left; } + { BOOST_ASSERT(!!left.m_ptr); left.m_ptr -= off; return left; } BOOST_CONTAINER_FORCEINLINE friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW { return left.m_ptr - right.m_ptr; } @@ -210,64 +212,28 @@ struct vector_insert_ordered_cursor BiDirValueIt last_value_it; }; -template -struct vector_merge_cursor -{ - typedef SizeType size_type; - typedef typename iterator_traits::reference reference; - - BOOST_CONTAINER_FORCEINLINE vector_merge_cursor(T *pbeg, T *plast, BiDirValueIt valueit, Comp &cmp) - : m_pbeg(pbeg), m_pcur(--plast), m_valueit(valueit), m_cmp(cmp) - {} - - void operator --() - { - --m_valueit; - const T &t = *m_valueit; - while((m_pcur + 1) != m_pbeg){ - if(!m_cmp(t, *m_pcur)){ - break; - } - --m_pcur; - } - } - - BOOST_CONTAINER_FORCEINLINE size_type get_pos() const - { return static_cast((m_pcur + 1) - m_pbeg); } - - BOOST_CONTAINER_FORCEINLINE reference get_val() - { return *m_valueit; } - - T *const m_pbeg; - T *m_pcur; - BiDirValueIt m_valueit; - Comp &m_cmp; -}; - -} //namespace container_detail { +struct initial_capacity_t{}; template -BOOST_CONTAINER_FORCEINLINE const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW +BOOST_CONTAINER_FORCEINLINE const Pointer &vector_iterator_get_ptr(const vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW { return it.get_ptr(); } template -BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr(container_detail::vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW +BOOST_CONTAINER_FORCEINLINE Pointer &get_ptr(vec_iterator &it) BOOST_NOEXCEPT_OR_NOTHROW { return it.get_ptr(); } -namespace container_detail { - -struct uninitialized_size_t {}; -static const uninitialized_size_t uninitialized_size = uninitialized_size_t(); +struct vector_uninitialized_size_t {}; +static const vector_uninitialized_size_t vector_uninitialized_size = vector_uninitialized_size_t(); template struct vector_value_traits_base { - static const bool trivial_dctr = is_trivially_destructible::value; + static const bool trivial_dctr = dtl::is_trivially_destructible::value; static const bool trivial_dctr_after_move = has_trivial_destructor_after_move::value; - static const bool trivial_copy = is_trivially_copy_constructible::value; - static const bool nothrow_copy = is_nothrow_copy_constructible::value || trivial_copy; - static const bool trivial_assign = is_trivially_copy_assignable::value; - static const bool nothrow_assign = is_nothrow_copy_assignable::value || trivial_assign; + static const bool trivial_copy = dtl::is_trivially_copy_constructible::value; + static const bool nothrow_copy = dtl::is_nothrow_copy_constructible::value || trivial_copy; + static const bool trivial_assign = dtl::is_trivially_copy_assignable::value; + static const bool nothrow_assign = dtl::is_nothrow_copy_assignable::value || trivial_assign; }; @@ -278,18 +244,19 @@ struct vector_value_traits typedef vector_value_traits_base base_t; //This is the anti-exception array destructor //to deallocate values already constructed - typedef typename container_detail::if_c + typedef typename dtl::if_c - ,container_detail::scoped_destructor_n + ,dtl::null_scoped_destructor_n + ,dtl::scoped_destructor_n >::type ArrayDestructor; //This is the anti-exception array deallocator - typedef container_detail::scoped_array_deallocator ArrayDeallocator; + typedef dtl::scoped_array_deallocator ArrayDeallocator; }; //!This struct deallocates and allocated memory template < class Allocator - , class AllocatorVersion = typename container_detail::version::type + , class StoredSizeType + , class AllocatorVersion = typename dtl::version::type > struct vector_alloc_holder : public Allocator @@ -298,7 +265,8 @@ struct vector_alloc_holder BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder) public: - typedef Allocator allocator_type; + typedef Allocator allocator_type; + typedef StoredSizeType stored_size_type; typedef boost::container::allocator_traits allocator_traits_type; typedef typename allocator_traits_type::pointer pointer; typedef typename allocator_traits_type::size_type size_type; @@ -322,7 +290,7 @@ struct vector_alloc_holder //Constructor, does not throw vector_alloc_holder() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : Allocator(), m_start(), m_size(), m_capacity() {} @@ -334,28 +302,34 @@ struct vector_alloc_holder //Constructor, does not throw template - vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) + vector_alloc_holder(vector_uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) : Allocator(boost::forward(a)) , m_start() - , m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this + //Size is initialized here so vector should only call uninitialized_xxx after this + , m_size(static_cast(initial_size)) , m_capacity() { if(initial_size){ pointer reuse = pointer(); - m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse); + size_type final_cap = initial_size; + m_start = this->allocation_command(allocate_new, initial_size, final_cap, reuse); + m_capacity = static_cast(final_cap); } } //Constructor, does not throw - vector_alloc_holder(uninitialized_size_t, size_type initial_size) + vector_alloc_holder(vector_uninitialized_size_t, size_type initial_size) : Allocator() , m_start() - , m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this + //Size is initialized here so vector should only call uninitialized_xxx after this + , m_size(static_cast(initial_size)) , m_capacity() { if(initial_size){ pointer reuse = pointer(); - m_start = this->allocation_command(allocate_new, initial_size, m_capacity = initial_size, reuse); + size_type final_cap = initial_size; + m_start = this->allocation_command(allocate_new, initial_size, final_cap, reuse); + m_capacity = static_cast(final_cap); } } @@ -369,17 +343,17 @@ struct vector_alloc_holder holder.m_size = holder.m_capacity = 0; } - vector_alloc_holder(pointer p, size_type capacity, BOOST_RV_REF(vector_alloc_holder) holder) + vector_alloc_holder(initial_capacity_t, pointer p, size_type capacity, BOOST_RV_REF(vector_alloc_holder) holder) : Allocator(BOOST_MOVE_BASE(Allocator, holder)) , m_start(p) , m_size(holder.m_size) - , m_capacity(capacity) + , m_capacity(static_cast(capacity)) { allocator_type &this_alloc = this->alloc(); allocator_type &x_alloc = holder.alloc(); if(this->is_propagable_from(x_alloc, holder.start(), this_alloc, true)){ if(this->m_capacity){ - allocator_traits_type::deallocate(this->alloc(), this->m_start, this->m_capacity); + this->deallocate(this->m_start, this->m_capacity); } m_start = holder.m_start; m_capacity = holder.m_capacity; @@ -389,23 +363,26 @@ struct vector_alloc_holder else if(this->m_capacity < holder.m_size){ size_type const n = holder.m_size; pointer reuse = pointer(); - m_start = this->allocation_command(allocate_new, n, m_capacity = n, reuse); + size_type final_cap = n; + m_start = this->allocation_command(allocate_new, n, final_cap, reuse); + m_capacity = static_cast(final_cap); #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; #endif } } - vector_alloc_holder(pointer p, size_type n) - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) + vector_alloc_holder(initial_capacity_t, pointer p, size_type n) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : Allocator() , m_start(p) , m_size() - , m_capacity(n) + //n is guaranteed to fit into stored_size_type + , m_capacity(static_cast(n)) {} template - vector_alloc_holder(pointer p, size_type n, BOOST_FWD_REF(AllocFwd) a) + vector_alloc_holder(initial_capacity_t, pointer p, size_type n, BOOST_FWD_REF(AllocFwd) a) : Allocator(::boost::forward(a)) , m_start(p) , m_size() @@ -415,17 +392,32 @@ struct vector_alloc_holder BOOST_CONTAINER_FORCEINLINE ~vector_alloc_holder() BOOST_NOEXCEPT_OR_NOTHROW { if(this->m_capacity){ - allocator_traits_type::deallocate(this->alloc(), this->m_start, this->m_capacity); + this->deallocate(this->m_start, this->m_capacity); } } BOOST_CONTAINER_FORCEINLINE pointer allocation_command(boost::container::allocation_type command, size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) { - typedef typename container_detail::version::type alloc_version; + typedef typename dtl::version::type alloc_version; return this->priv_allocation_command(alloc_version(), command, limit_size, prefer_in_recvd_out_size, reuse); } + BOOST_CONTAINER_FORCEINLINE pointer allocate(size_type n) + { + const size_type max_alloc = allocator_traits_type::max_size(this->alloc()); + const size_type max = max_alloc <= stored_size_type(-1) ? max_alloc : stored_size_type(-1); + if ( max < n ) + boost::container::throw_length_error("get_next_capacity, allocator's max size reached"); + + return allocator_traits_type::allocate(this->alloc(), n); + } + + BOOST_CONTAINER_FORCEINLINE void deallocate(const pointer &p, size_type n) + { + allocator_traits_type::deallocate(this->alloc(), p, n); + } + bool try_expand_fwd(size_type at_least) { //There is not enough memory, try to expand the old one @@ -443,17 +435,24 @@ struct vector_alloc_holder return success; } - BOOST_CONTAINER_FORCEINLINE size_type next_capacity(size_type additional_objects) const + template + size_type next_capacity(size_type additional_objects) const { - return next_capacity_calculator - ::get( allocator_traits_type::max_size(this->alloc()) - , this->m_capacity, additional_objects ); + BOOST_ASSERT(additional_objects > size_type(this->m_capacity - this->m_size)); + size_type max = allocator_traits_type::max_size(this->alloc()); + (clamp_by_stored_size_type)(max, stored_size_type()); + const size_type remaining_cap = max - size_type(this->m_capacity); + const size_type min_additional_cap = additional_objects - size_type(this->m_capacity - this->m_size); + + if ( remaining_cap < min_additional_cap ) + boost::container::throw_length_error("get_next_capacity, allocator's max size reached"); + + return GrowthFactorType()( size_type(this->m_capacity), min_additional_cap, max); } - pointer m_start; - size_type m_size; - size_type m_capacity; + pointer m_start; + stored_size_type m_size; + stored_size_type m_capacity; void swap_resources(vector_alloc_holder &x) BOOST_NOEXCEPT_OR_NOTHROW { @@ -477,10 +476,14 @@ struct vector_alloc_holder BOOST_CONTAINER_FORCEINLINE const Allocator &alloc() const BOOST_NOEXCEPT_OR_NOTHROW { return *this; } - const pointer &start() const BOOST_NOEXCEPT_OR_NOTHROW { return m_start; } - const size_type &capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return m_capacity; } - void start(const pointer &p) BOOST_NOEXCEPT_OR_NOTHROW { m_start = p; } - void capacity(const size_type &c) BOOST_NOEXCEPT_OR_NOTHROW { m_capacity = c; } + BOOST_CONTAINER_FORCEINLINE const pointer &start() const BOOST_NOEXCEPT_OR_NOTHROW + { return m_start; } + BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW + { return m_capacity; } + BOOST_CONTAINER_FORCEINLINE void start(const pointer &p) BOOST_NOEXCEPT_OR_NOTHROW + { m_start = p; } + BOOST_CONTAINER_FORCEINLINE void capacity(const size_type &c) BOOST_NOEXCEPT_OR_NOTHROW + { BOOST_ASSERT( c <= stored_size_type(-1)); m_capacity = c; } private: void priv_first_allocation(size_type cap) @@ -495,15 +498,30 @@ struct vector_alloc_holder } } + BOOST_CONTAINER_FORCEINLINE static void clamp_by_stored_size_type(size_type &, size_type) + {} + + template + BOOST_CONTAINER_FORCEINLINE static void clamp_by_stored_size_type(size_type &s, SomeStoredSizeType) + { + if (s >= SomeStoredSizeType(-1) ) + s = SomeStoredSizeType(-1); + } + BOOST_CONTAINER_FORCEINLINE pointer priv_allocation_command(version_1, boost::container::allocation_type command, - size_type , + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) { (void)command; BOOST_ASSERT( (command & allocate_new)); BOOST_ASSERT(!(command & nothrow_allocation)); - pointer const p = allocator_traits_type::allocate(this->alloc(), prefer_in_recvd_out_size, reuse); + //First detect overflow on smaller stored_size_types + if (limit_size > stored_size_type(-1)){ + boost::container::throw_length_error("get_next_capacity, allocator's max size reached"); + } + (clamp_by_stored_size_type)(prefer_in_recvd_out_size, stored_size_type()); + pointer const p = this->allocate(prefer_in_recvd_out_size); reuse = pointer(); return p; } @@ -513,13 +531,22 @@ struct vector_alloc_holder size_type &prefer_in_recvd_out_size, pointer &reuse) { - return this->alloc().allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); + //First detect overflow on smaller stored_size_types + if (limit_size > stored_size_type(-1)){ + boost::container::throw_length_error("get_next_capacity, allocator's max size reached"); + } + (clamp_by_stored_size_type)(prefer_in_recvd_out_size, stored_size_type()); + //Allocate memory + pointer p = this->alloc().allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); + //If after allocation prefer_in_recvd_out_size is not representable by stored_size_type, truncate it. + (clamp_by_stored_size_type)(prefer_in_recvd_out_size, stored_size_type()); + return p; } }; //!This struct deallocates and allocated memory -template -struct vector_alloc_holder +template +struct vector_alloc_holder : public Allocator { private: @@ -530,13 +557,14 @@ struct vector_alloc_holder typedef typename allocator_traits_type::pointer pointer; typedef typename allocator_traits_type::size_type size_type; typedef typename allocator_traits_type::value_type value_type; + typedef StoredSizeType stored_size_type; - template + template friend struct vector_alloc_holder; //Constructor, does not throw vector_alloc_holder() - BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) + BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : Allocator(), m_size() {} @@ -548,7 +576,7 @@ struct vector_alloc_holder //Constructor, does not throw template - vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) + vector_alloc_holder(vector_uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size) : Allocator(boost::forward(a)) , m_size(initial_size) //Size is initialized here... { @@ -557,7 +585,7 @@ struct vector_alloc_holder } //Constructor, does not throw - vector_alloc_holder(uninitialized_size_t, size_type initial_size) + vector_alloc_holder(vector_uninitialized_size_t, size_type initial_size) : Allocator() , m_size(initial_size) //Size is initialized here... { @@ -573,8 +601,8 @@ struct vector_alloc_holder (this->alloc(), boost::movelib::to_raw_pointer(holder.start()), m_size, boost::movelib::to_raw_pointer(this->start())); } - template - vector_alloc_holder(BOOST_RV_REF_BEG vector_alloc_holder BOOST_RV_REF_END holder) + template + vector_alloc_holder(BOOST_RV_REF_BEG vector_alloc_holder BOOST_RV_REF_END holder) : Allocator() , m_size(holder.m_size) //Initialize it to m_size as first_allocation can only succeed or abort { @@ -597,8 +625,8 @@ struct vector_alloc_holder this->priv_deep_swap(x); } - template - void deep_swap(vector_alloc_holder &x) + template + void deep_swap(vector_alloc_holder &x) { if(this->m_size > OtherAllocator::internal_capacity || x.m_size > Allocator::internal_capacity){ throw_bad_alloc(); @@ -628,12 +656,12 @@ struct vector_alloc_holder BOOST_CONTAINER_FORCEINLINE pointer start() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_storage(); } BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW { return Allocator::internal_capacity; } - size_type m_size; + stored_size_type m_size; private: - template - void priv_deep_swap(vector_alloc_holder &x) + template + void priv_deep_swap(vector_alloc_holder &x) { const size_type MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity; value_type *const first_this = boost::movelib::to_raw_pointer(this->start()); @@ -649,7 +677,34 @@ struct vector_alloc_holder } }; -} //namespace container_detail { +struct growth_factor_60; + +template +struct default_if_void +{ + typedef T type; +}; + +template +struct default_if_void +{ + typedef Default type; +}; + +template +struct get_vector_opt +{ + typedef vector_opt< typename default_if_void::type + , typename default_if_void::type + > type; +}; + +template +struct get_vector_opt +{ + typedef vector_opt type; +}; + #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -660,28 +715,32 @@ struct vector_alloc_holder //! //! \tparam T The type of object that is stored in the vector //! \tparam Allocator The allocator used for all internal memory management -template ) > +//! \tparam Options A type produced from \c boost::container::vector_options. +template ), class Options BOOST_CONTAINER_DOCONLY(= void) > class vector { #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - struct value_less - { - typedef typename boost::container::allocator_traits::value_type value_type; - bool operator()(const value_type &a, const value_type &b) const - { return a < b; } - }; + typedef typename boost::container::allocator_traits::size_type alloc_size_type; + typedef typename get_vector_opt::type options_type; + typedef typename options_type::growth_factor_type growth_factor_type; + typedef typename options_type::stored_size_type stored_size_type; + typedef value_less value_less_t; - typedef typename container_detail::version::type alloc_version; - typedef boost::container::container_detail::vector_alloc_holder alloc_holder_t; + //If provided the stored_size option must specify a type that is equal or a type that is smaller. + BOOST_STATIC_ASSERT( (sizeof(stored_size_type) < sizeof(alloc_size_type) || + dtl::is_same::value) ); + + typedef typename dtl::version::type alloc_version; + typedef boost::container::vector_alloc_holder alloc_holder_t; alloc_holder_t m_holder; typedef allocator_traits allocator_traits_type; - template + template friend class vector; typedef typename allocator_traits_type::pointer pointer_impl; - typedef container_detail::vec_iterator iterator_impl; - typedef container_detail::vec_iterator const_iterator_impl; + typedef vec_iterator iterator_impl; + typedef vec_iterator const_iterator_impl; protected: static bool is_propagable_from(const Allocator &from_alloc, pointer_impl p, const Allocator &to_alloc, bool const propagate_allocator) @@ -716,7 +775,7 @@ class vector #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED private: BOOST_COPYABLE_AND_MOVABLE(vector) - typedef container_detail::vector_value_traits value_traits; + typedef vector_value_traits value_traits; typedef constant_iterator cvalue_iterator; protected: @@ -724,14 +783,13 @@ class vector BOOST_CONTAINER_FORCEINLINE void steal_resources(vector &x) { return this->m_holder.steal_resources(x.m_holder); } - struct initial_capacity_t{}; template BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type capacity, BOOST_FWD_REF(AllocFwd) a) - : m_holder(initial_memory, capacity, ::boost::forward(a)) + : m_holder(initial_capacity_t(), initial_memory, capacity, ::boost::forward(a)) {} BOOST_CONTAINER_FORCEINLINE vector(initial_capacity_t, pointer initial_memory, size_type capacity) - : m_holder(initial_memory, capacity) + : m_holder(initial_capacity_t(), initial_memory, capacity) {} #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -748,7 +806,7 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - vector() BOOST_NOEXCEPT_IF(container_detail::is_nothrow_default_constructible::value) + vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible::value) : m_holder() {} @@ -768,7 +826,7 @@ class vector //! //! Complexity: Linear to n. explicit vector(size_type n) - : m_holder(container_detail::uninitialized_size, n) + : m_holder(vector_uninitialized_size, n) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; @@ -785,7 +843,7 @@ class vector //! //! Complexity: Linear to n. explicit vector(size_type n, const allocator_type &a) - : m_holder(container_detail::uninitialized_size, a, n) + : m_holder(vector_uninitialized_size, a, n) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; @@ -804,7 +862,7 @@ class vector //! //! Note: Non-standard extension vector(size_type n, default_init_t) - : m_holder(container_detail::uninitialized_size, n) + : m_holder(vector_uninitialized_size, n) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; @@ -823,7 +881,7 @@ class vector //! //! Note: Non-standard extension vector(size_type n, default_init_t, const allocator_type &a) - : m_holder(container_detail::uninitialized_size, a, n) + : m_holder(vector_uninitialized_size, a, n) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; @@ -840,7 +898,7 @@ class vector //! //! Complexity: Linear to n. vector(size_type n, const T& value) - : m_holder(container_detail::uninitialized_size, n) + : m_holder(vector_uninitialized_size, n) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; @@ -857,7 +915,7 @@ class vector //! //! Complexity: Linear to n. vector(size_type n, const T& value, const allocator_type& a) - : m_holder(container_detail::uninitialized_size, a, n) + : m_holder(vector_uninitialized_size, a, n) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += n != 0; @@ -873,11 +931,17 @@ class vector //! throws or T's constructor taking a dereferenced InIt throws. //! //! Complexity: Linear to the range [first, last). +// template +// vector(InIt first, InIt last +// BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c +// < dtl::is_convertible::value +// BOOST_MOVE_I dtl::nat >::type * = 0) +// ) -> vector::value_type, new_allocator::value_type>>; template 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) + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c + < dtl::is_convertible::value + BOOST_MOVE_I dtl::nat >::type * = 0) ) : m_holder() { this->assign(first, last); } @@ -889,11 +953,17 @@ class vector //! throws or T's constructor taking a dereferenced InIt throws. //! //! Complexity: Linear to the range [first, last). +// template +// vector(InIt first, InIt last, const allocator_type& a +// BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c +// < dtl::is_convertible::value +// BOOST_MOVE_I dtl::nat >::type * = 0) +// ) -> vector::value_type, new_allocator::value_type>>; template 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) + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_c + < dtl::is_convertible::value + BOOST_MOVE_I dtl::nat >::type * = 0) ) : m_holder(a) { this->assign(first, last); } @@ -907,7 +977,7 @@ class vector //! //! Complexity: Linear to the elements x contains. vector(const vector &x) - : m_holder( container_detail::uninitialized_size + : m_holder( vector_uninitialized_size , allocator_traits_type::select_on_container_copy_construction(x.m_holder.alloc()) , x.size()) { @@ -953,8 +1023,8 @@ class vector //! Note: Non-standard extension to support static_vector template vector(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x - , typename container_detail::enable_if_c - < container_detail::is_version::value>::type * = 0 + , typename dtl::enable_if_c + < dtl::is_version::value>::type * = 0 ) : m_holder(boost::move(x.m_holder)) {} @@ -970,7 +1040,7 @@ class vector //! //! Complexity: Linear to the elements x contains. vector(const vector &x, const allocator_type &a) - : m_holder(container_detail::uninitialized_size, a, x.size()) + : m_holder(vector_uninitialized_size, a, x.size()) { #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS this->num_alloc += x.size() != 0; @@ -988,7 +1058,7 @@ class vector //! //! Complexity: Constant if a == x.get_allocator(), linear otherwise. vector(BOOST_RV_REF(vector) x, const allocator_type &a) - : m_holder( container_detail::uninitialized_size, a + : m_holder( vector_uninitialized_size, a , is_propagable_from(x.get_stored_allocator(), x.m_holder.start(), a, true) ? 0 : x.size() ) { @@ -1079,10 +1149,10 @@ class vector //! //! Note: Non-standard extension to support static_vector template - BOOST_CONTAINER_FORCEINLINE typename container_detail::enable_if_and + BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < vector& - , container_detail::is_version - , container_detail::is_different + , dtl::is_version + , dtl::is_different >::type operator=(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x) { @@ -1101,10 +1171,10 @@ class vector //! //! Note: Non-standard extension to support static_vector template - BOOST_CONTAINER_FORCEINLINE typename container_detail::enable_if_and + BOOST_CONTAINER_FORCEINLINE typename dtl::enable_if_and < vector& - , container_detail::is_version - , container_detail::is_different + , dtl::is_version + , dtl::is_different >::type operator=(const vector &x) { @@ -1122,12 +1192,13 @@ class vector //! Complexity: Linear to n. template void assign(InIt first, InIt last - BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_or + //Input iterators or version 0 allocator + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_or < void - BOOST_MOVE_I container_detail::is_convertible - BOOST_MOVE_I container_detail::and_ - < container_detail::is_different - BOOST_MOVE_I container_detail::is_not_input_iterator + BOOST_MOVE_I dtl::is_convertible + BOOST_MOVE_I dtl::and_ + < dtl::is_different + BOOST_MOVE_I dtl::is_not_input_iterator > >::type * = 0) ) @@ -1171,11 +1242,12 @@ class vector //! Complexity: Linear to n. template void assign(FwdIt first, FwdIt last - BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename container_detail::disable_if_or + //Forward iterators and version > 0 allocator + BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I typename dtl::disable_if_or < void - BOOST_MOVE_I container_detail::is_same - BOOST_MOVE_I container_detail::is_convertible - BOOST_MOVE_I container_detail::is_input_iterator + BOOST_MOVE_I dtl::is_same + BOOST_MOVE_I dtl::is_convertible + BOOST_MOVE_I dtl::is_input_iterator >::type * = 0) ) { @@ -1194,7 +1266,7 @@ class vector pointer const old_p = this->m_holder.start(); if(old_p){ this->priv_destroy_all(); - allocator_traits_type::deallocate(this->m_holder.alloc(), old_p, old_capacity); + this->m_holder.deallocate(old_p, old_capacity); } this->m_holder.start(ret); this->m_holder.capacity(real_cap); @@ -1210,21 +1282,9 @@ class vector //Forward expansion, use assignment + back deletion/construction that comes later } } - //Overwrite all elements we can from [first, last) - iterator cur = this->begin(); - const iterator end_it = this->end(); - for ( ; first != last && cur != end_it; ++cur, ++first){ - *cur = *first; - } - if (first == last){ - //There are no more elements in the sequence, erase remaining - this->priv_destroy_last_n(this->size() - input_sz); - } - else{ - //Uninitialized construct at end the remaining range - this->priv_uninitialized_construct_at_end(first, last); - } + boost::container::copy_assign_range_alloc_n(this->m_holder.alloc(), first, input_sz, this->priv_raw_begin(), this->size()); + this->m_holder.m_size = input_sz; } //! Effects: Assigns the n copies of val to *this. @@ -1697,7 +1757,7 @@ class vector return *p; } else{ - typedef container_detail::insert_emplace_proxy type; + typedef dtl::insert_emplace_proxy type; return *this->priv_forward_range_insert_no_capacity (this->back_ptr(), 1, type(::boost::forward(args)...), alloc_version()); } @@ -1738,7 +1798,7 @@ class vector { BOOST_ASSERT(this->priv_in_range_or_end(position)); //Just call more general insert(pos, size, value) and return iterator - typedef container_detail::insert_emplace_proxy type; + typedef dtl::insert_emplace_proxy type; return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1 , type(::boost::forward(args)...)); } @@ -1757,7 +1817,7 @@ class vector return *p;\ }\ else{\ - typedef container_detail::insert_emplace_proxy_arg##N type;\ + typedef dtl::insert_emplace_proxy_arg##N type;\ return *this->priv_forward_range_insert_no_capacity\ ( this->back_ptr(), 1, type(BOOST_MOVE_FWD##N), alloc_version());\ }\ @@ -1779,7 +1839,7 @@ class vector iterator emplace(const_iterator pos BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ {\ BOOST_ASSERT(this->priv_in_range_or_end(pos));\ - typedef container_detail::insert_emplace_proxy_arg##N type;\ + typedef dtl::insert_emplace_proxy_arg##N type;\ return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), 1, type(BOOST_MOVE_FWD##N));\ }\ // @@ -1845,7 +1905,7 @@ class vector iterator insert(const_iterator p, size_type n, const T& x) { BOOST_ASSERT(this->priv_in_range_or_end(p)); - container_detail::insert_n_copies_proxy proxy(x); + dtl::insert_n_copies_proxy proxy(x); return this->priv_forward_range_insert(vector_iterator_get_ptr(p), n, proxy); } @@ -1862,10 +1922,10 @@ class vector template iterator insert(const_iterator pos, InIt first, InIt last #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_convertible - , container_detail::is_not_input_iterator + , dtl::is_convertible + , dtl::is_not_input_iterator >::type * = 0 #endif ) @@ -1883,15 +1943,15 @@ class vector #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) template iterator insert(const_iterator pos, FwdIt first, FwdIt last - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_convertible - , container_detail::is_input_iterator + , dtl::is_convertible + , dtl::is_input_iterator >::type * = 0 ) { BOOST_ASSERT(this->priv_in_range_or_end(pos)); - container_detail::insert_range_proxy proxy(first); + dtl::insert_range_proxy proxy(first); return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), boost::container::iterator_distance(first, last), proxy); } #endif @@ -1916,10 +1976,10 @@ class vector iterator insert(const_iterator pos, size_type num, InIt first, InIt last) { BOOST_ASSERT(this->priv_in_range_or_end(pos)); - BOOST_ASSERT(container_detail::is_input_iterator::value || + BOOST_ASSERT(dtl::is_input_iterator::value || num == static_cast(boost::container::iterator_distance(first, last))); (void)last; - container_detail::insert_range_proxy proxy(first); + dtl::insert_range_proxy proxy(first); return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy); } #endif @@ -1965,7 +2025,7 @@ class vector T *const beg_ptr = this->priv_raw_begin(); T *const new_end_ptr = ::boost::container::move(pos_ptr + 1, beg_ptr + this->m_holder.m_size, pos_ptr); //Move elements forward and destroy last - this->priv_destroy_last(pos_ptr == new_end_ptr); + this->priv_destroy_last(pos_ptr != new_end_ptr); return iterator(p); } @@ -1994,12 +2054,12 @@ class vector //! Throws: Nothing. //! //! Complexity: Constant. - void swap(vector& x) + BOOST_CONTAINER_FORCEINLINE void swap(vector& x) BOOST_NOEXCEPT_IF( ((allocator_traits_type::propagate_on_container_swap::value || allocator_traits_type::is_always_equal::value) && - !container_detail::is_version::value)) + !dtl::is_version::value)) { - this->priv_swap(x, container_detail::bool_::value>()); + this->priv_swap(x, dtl::bool_::value>()); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -2012,11 +2072,11 @@ class vector //! //! Note: Non-standard extension to support static_vector template - void swap(vector & x - , typename container_detail::enable_if_and + BOOST_CONTAINER_FORCEINLINE void swap(vector & x + , typename dtl::enable_if_and < void - , container_detail::is_version - , container_detail::is_different + , dtl::is_version + , dtl::is_different >::type * = 0 ) { this->m_holder.deep_swap(x.m_holder); } @@ -2028,19 +2088,19 @@ class vector //! Throws: Nothing. //! //! Complexity: Linear to the number of elements in the container. - void clear() BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void clear() BOOST_NOEXCEPT_OR_NOTHROW { this->priv_destroy_all(); } //! Effects: Returns true if x and y are equal //! //! Complexity: Linear to the number of elements in the container. - friend bool operator==(const vector& x, const vector& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator==(const vector& x, const vector& y) { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } //! Effects: Returns true if x and y are unequal //! //! Complexity: Linear to the number of elements in the container. - friend bool operator!=(const vector& x, const vector& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const vector& x, const vector& y) { return !(x == y); } //! Effects: Returns true if x is less than y @@ -2060,25 +2120,25 @@ class vector //! Effects: Returns true if x is greater than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator>(const vector& x, const vector& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>(const vector& x, const vector& y) { return y < x; } //! Effects: Returns true if x is equal or less than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator<=(const vector& x, const vector& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const vector& x, const vector& y) { return !(y < x); } //! Effects: Returns true if x is equal or greater than y //! //! Complexity: Linear to the number of elements in the container. - friend bool operator>=(const vector& x, const vector& y) + BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const vector& x, const vector& y) { return !(x < y); } //! Effects: x.swap(y) //! //! Complexity: Constant. - friend void swap(vector& x, vector& y) + BOOST_CONTAINER_FORCEINLINE friend void swap(vector& x, vector& y) { x.swap(y); } #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -2099,27 +2159,51 @@ class vector //Absolutely experimental. This function might change, disappear or simply crash! template - void insert_ordered_at(const size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it) + BOOST_CONTAINER_FORCEINLINE void insert_ordered_at(const size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it) { - typedef container_detail::vector_insert_ordered_cursor inserter_t; + typedef vector_insert_ordered_cursor inserter_t; return this->priv_insert_ordered_at(element_count, inserter_t(last_position_it, last_value_it)); } - template - void merge(BidirIt first, BidirIt last) - { this->merge(first, last, value_less()); } + template + BOOST_CONTAINER_FORCEINLINE void merge(InputIt first, InputIt last) + { this->merge(first, last, value_less_t()); } - template - void merge(BidirIt first, BidirIt last, Compare comp) - { this->priv_merge(container_detail::false_type(), first, last, comp); } + template + BOOST_CONTAINER_FORCEINLINE void merge(InputIt first, InputIt last, Compare comp) + { + size_type const s = this->size(); + size_type const c = this->capacity(); + size_type n = 0; + size_type const free_cap = c - s; + //If not input iterator and new elements don't fit in the remaining capacity, merge in new buffer + if(!dtl::is_input_iterator::value && + free_cap < (n = static_cast(boost::container::iterator_distance(first, last)))){ + this->priv_merge_in_new_buffer(first, n, comp, alloc_version()); + } + else{ + iterator pos(this->insert(this->cend(), first, last)); + T *const raw_beg = this->priv_raw_begin(); + T *const raw_end = this->priv_raw_end(); + T *const raw_pos = raw_beg + s; + boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, free_cap - n); + } + } - template - void merge_unique(BidirIt first, BidirIt last) - { this->priv_merge(container_detail::true_type(), first, last, value_less()); } + template + BOOST_CONTAINER_FORCEINLINE void merge_unique(InputIt first, InputIt last) + { this->merge_unique(first, last, value_less_t()); } - template - void merge_unique(BidirIt first, BidirIt last, Compare comp) - { this->priv_merge(container_detail::true_type(), first, last, comp); } + template + BOOST_CONTAINER_FORCEINLINE void merge_unique(InputIt first, InputIt last, Compare comp) + { + size_type const old_size = this->size(); + this->priv_set_difference_back(first, last, comp); + T *const raw_beg = this->priv_raw_begin(); + T *const raw_end = this->priv_raw_end(); + T *raw_pos = raw_beg + old_size; + boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, this->capacity() - this->size()); + } private: template @@ -2179,43 +2263,48 @@ class vector } } - template - void priv_merge(UniqueBool, BidirIt first, BidirIt last, Compare comp) + template + void priv_set_difference_back(InputIt first1, InputIt last1, Compare comp) { - size_type const n = static_cast(boost::container::iterator_distance(first, last)); - size_type const s = this->size(); - if(BOOST_LIKELY(s)){ - size_type const c = this->capacity(); - size_type const free_c = (c - s); - //Use a new buffer if current one is too small for new elements - if(free_c < n){ - this->priv_merge_in_new_buffer(UniqueBool(), first, n, comp, alloc_version()); + T * old_first2 = this->priv_raw_begin(); + T * first2 = old_first2; + T * last2 = this->priv_raw_end(); + + while (first1 != last1) { + if (first2 == last2){ + this->insert(this->cend(), first1, last1); + return; } - else{ - T *raw_pos = boost::movelib::iterator_to_raw_pointer(this->insert(this->cend(), first, last)); - T *raw_beg = this->priv_raw_begin(); - T *raw_end = this->priv_raw_end(); - boost::movelib::adaptive_merge(raw_beg, raw_pos, raw_end, comp, raw_end, free_c - n); - if(UniqueBool::value){ - size_type const count = - static_cast(raw_end - boost::movelib::unique(raw_beg, raw_end, boost::movelib::negate(comp))); - this->priv_destroy_last_n(count); + + if (comp(*first1, *first2)) { + this->emplace_back(*first1); + T * const raw_begin = this->priv_raw_begin(); + if(old_first2 != raw_begin) + { + //Reallocation happened, update range + first2 = raw_begin + (first2 - old_first2); + last2 = raw_begin + (last2 - old_first2); + old_first2 = raw_begin; } + ++first1; + } + else { + if (!comp(*first2, *first1)) { + ++first1; + } + ++first2; } - } - else{ - this->insert(this->cend(), n, first, last); } } - template - void priv_merge_in_new_buffer(UniqueBool, FwdIt, size_type, Compare, version_0) + template + BOOST_CONTAINER_FORCEINLINE void priv_merge_in_new_buffer(FwdIt, size_type, Compare, version_0) { throw_bad_alloc(); } - template - void priv_merge_in_new_buffer(UniqueBool, FwdIt first, size_type n, Compare comp, Version) + template + void priv_merge_in_new_buffer(FwdIt first, size_type n, Compare comp, Version) { size_type const new_size = this->size() + n; size_type new_cap = new_size; @@ -2249,11 +2338,6 @@ class vector --n; ++d_first; } - else if(UniqueBool::value && !comp(*pbeg, *first)){ - ++first; - --n; - --added; - } else{ allocator_traits_type::construct( this->m_holder.alloc(), d_first, boost::move(*pbeg) ); new_values_destroyer.increment_size(1u); @@ -2266,7 +2350,7 @@ class vector pointer const old_p = this->m_holder.start(); size_type const old_cap = this->m_holder.capacity(); boost::container::destroy_alloc_n(a, boost::movelib::to_raw_pointer(old_p), old_size); - allocator_traits_type::deallocate(a, old_p, old_cap); + this->m_holder.deallocate(old_p, old_cap); this->m_holder.m_size = old_size + added; this->m_holder.start(new_storage); this->m_holder.capacity(new_cap); @@ -2274,10 +2358,10 @@ class vector new_values_destroyer.release(); } - bool room_enough() const + BOOST_CONTAINER_FORCEINLINE bool room_enough() const { return this->m_holder.m_size < this->m_holder.capacity(); } - pointer back_ptr() const + BOOST_CONTAINER_FORCEINLINE pointer back_ptr() const { return this->m_holder.start() + this->m_holder.m_size; } size_type priv_index_of(pointer p) const @@ -2289,10 +2373,10 @@ class vector template void priv_move_assign(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x - , typename container_detail::enable_if_c - < container_detail::is_version::value >::type * = 0) + , typename dtl::enable_if_c + < dtl::is_version::value >::type * = 0) { - if(!container_detail::is_same::value && + if(!dtl::is_same::value && this->capacity() < x.size()){ throw_bad_alloc(); } @@ -2306,10 +2390,10 @@ class vector template void priv_move_assign(BOOST_RV_REF_BEG vector BOOST_RV_REF_END x - , typename container_detail::disable_if_or + , typename dtl::disable_if_or < void - , container_detail::is_version - , container_detail::is_different + , dtl::is_version + , dtl::is_different >::type * = 0) { //for move assignment, no aliasing (&x != this) is assummed. @@ -2331,7 +2415,7 @@ class vector } else if(is_propagable_from_x){ this->clear(); - allocator_traits_type::deallocate(this->m_holder.alloc(), this->m_holder.m_start, this->m_holder.m_capacity); + this->m_holder.deallocate(this->m_holder.m_start, this->m_holder.m_capacity); this->m_holder.steal_resources(x.m_holder); } //Else do a one by one move @@ -2341,15 +2425,15 @@ class vector ); } //Move allocator if needed - container_detail::move_alloc(this_alloc, x_alloc, container_detail::bool_()); + dtl::move_alloc(this_alloc, x_alloc, dtl::bool_()); } template void priv_copy_assign(const vector &x - , typename container_detail::enable_if_c - < container_detail::is_version::value >::type * = 0) + , typename dtl::enable_if_c + < dtl::is_version::value >::type * = 0) { - if(!container_detail::is_same::value && + if(!dtl::is_same::value && this->capacity() < x.size()){ throw_bad_alloc(); } @@ -2362,31 +2446,31 @@ class vector } template - typename container_detail::disable_if_or + typename dtl::disable_if_or < void - , container_detail::is_version - , container_detail::is_different + , dtl::is_version + , dtl::is_different >::type priv_copy_assign(const vector &x) { allocator_type &this_alloc = this->m_holder.alloc(); const allocator_type &x_alloc = x.m_holder.alloc(); - container_detail::bool_ flag; if(flag && this_alloc != x_alloc){ this->clear(); this->shrink_to_fit(); } - container_detail::assign_alloc(this_alloc, x_alloc, flag); + dtl::assign_alloc(this_alloc, x_alloc, flag); this->assign( x.priv_raw_begin(), x.priv_raw_end() ); } template //Template it to avoid it in explicit instantiations - void priv_swap(Vector &x, container_detail::true_type) //version_0 + void priv_swap(Vector &x, dtl::true_type) //version_0 { this->m_holder.deep_swap(x.m_holder); } template //Template it to avoid it in explicit instantiations - void priv_swap(Vector &x, container_detail::false_type) //version_N + void priv_swap(Vector &x, dtl::false_type) //version_N { const bool propagate_alloc = allocator_traits_type::propagate_on_container_swap::value; if(are_swap_propagable( this->get_stored_allocator(), this->m_holder.start() @@ -2413,15 +2497,15 @@ class vector big.erase(big.nth(common_elements), big.cend()); } //And now swap the allocator - container_detail::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), container_detail::bool_()); + dtl::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), dtl::bool_()); } void priv_reserve_no_capacity(size_type, version_0) { throw_bad_alloc(); } - container_detail::insert_range_proxy, T*> priv_dummy_empty_proxy() + dtl::insert_range_proxy, T*> priv_dummy_empty_proxy() { - return container_detail::insert_range_proxy, T*> + return dtl::insert_range_proxy, T*> (::boost::make_move_iterator((T *)0)); } @@ -2429,7 +2513,7 @@ class vector { //There is not enough memory, allocate a new buffer //Pass the hint so that allocators can take advantage of this. - pointer const p = allocator_traits_type::allocate(this->m_holder.alloc(), new_cap, this->m_holder.m_start); + pointer const p = this->m_holder.allocate(new_cap); //We will reuse insert code, so create a dummy input iterator this->priv_forward_range_insert_new_allocation ( boost::movelib::to_raw_pointer(p), new_cap, this->priv_raw_end(), 0, this->priv_dummy_empty_proxy()); @@ -2475,7 +2559,8 @@ class vector void priv_destroy_last(const bool moved = false) BOOST_NOEXCEPT_OR_NOTHROW { (void)moved; - if(!(value_traits::trivial_dctr || (value_traits::trivial_dctr_after_move && moved))){ + const bool skip_destructor = value_traits::trivial_dctr || (value_traits::trivial_dctr_after_move && moved); + if(!skip_destructor){ value_type* const p = this->priv_raw_end() - 1; allocator_traits_type::destroy(this->get_stored_allocator(), p); } @@ -2512,14 +2597,14 @@ class vector { BOOST_ASSERT(this->priv_in_range_or_end(p)); return this->priv_forward_range_insert - ( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy(::boost::forward(x))); + ( vector_iterator_get_ptr(p), 1, dtl::get_insert_value_proxy(::boost::forward(x))); } - container_detail::insert_copy_proxy priv_single_insert_proxy(const T &x) - { return container_detail::insert_copy_proxy (x); } + dtl::insert_copy_proxy priv_single_insert_proxy(const T &x) + { return dtl::insert_copy_proxy (x); } - container_detail::insert_move_proxy priv_single_insert_proxy(BOOST_RV_REF(T) x) - { return container_detail::insert_move_proxy (x); } + dtl::insert_move_proxy priv_single_insert_proxy(BOOST_RV_REF(T) x) + { return dtl::insert_move_proxy (x); } template void priv_push_back(BOOST_FWD_REF(U) u) @@ -2537,14 +2622,14 @@ class vector } } - container_detail::insert_n_copies_proxy priv_resize_proxy(const T &x) - { return container_detail::insert_n_copies_proxy(x); } + BOOST_CONTAINER_FORCEINLINE dtl::insert_n_copies_proxy priv_resize_proxy(const T &x) + { return dtl::insert_n_copies_proxy(x); } - container_detail::insert_default_initialized_n_proxy priv_resize_proxy(default_init_t) - { return container_detail::insert_default_initialized_n_proxy(); } + BOOST_CONTAINER_FORCEINLINE dtl::insert_default_initialized_n_proxy priv_resize_proxy(default_init_t) + { return dtl::insert_default_initialized_n_proxy(); } - container_detail::insert_value_initialized_n_proxy priv_resize_proxy(value_init_t) - { return container_detail::insert_value_initialized_n_proxy(); } + BOOST_CONTAINER_FORCEINLINE dtl::insert_value_initialized_n_proxy priv_resize_proxy(value_init_t) + { return dtl::insert_value_initialized_n_proxy(); } template void priv_resize(size_type new_size, const U& u) @@ -2560,7 +2645,7 @@ class vector } } - void priv_shrink_to_fit(version_0) BOOST_NOEXCEPT_OR_NOTHROW + BOOST_CONTAINER_FORCEINLINE void priv_shrink_to_fit(version_0) BOOST_NOEXCEPT_OR_NOTHROW {} void priv_shrink_to_fit(version_1) @@ -2569,14 +2654,14 @@ class vector if(cp){ const size_type sz = this->size(); if(!sz){ - allocator_traits_type::deallocate(this->m_holder.alloc(), this->m_holder.m_start, cp); + this->m_holder.deallocate(this->m_holder.m_start, cp); this->m_holder.m_start = pointer(); this->m_holder.m_capacity = 0; } else if(sz < cp){ //Allocate a new buffer. //Pass the hint so that allocators can take advantage of this. - pointer const p = allocator_traits_type::allocate(this->m_holder.alloc(), sz, this->m_holder.m_start); + pointer const p = this->m_holder.allocate(sz); //We will reuse insert code, so create a dummy input iterator #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS @@ -2595,7 +2680,7 @@ class vector if(cp){ const size_type sz = this->size(); if(!sz){ - allocator_traits_type::deallocate(this->m_holder.alloc(), this->m_holder.m_start, cp); + this->m_holder.deallocate(this->m_holder.m_start, cp); this->m_holder.m_start = pointer(); this->m_holder.m_capacity = 0; } @@ -2629,10 +2714,9 @@ class vector const size_type n_pos = pos - this->m_holder.start(); T *const raw_pos = boost::movelib::to_raw_pointer(pos); - const size_type new_cap = this->m_holder.next_capacity(n); + const size_type new_cap = this->m_holder.template next_capacity(n); //Pass the hint so that allocators can take advantage of this. - T * const new_buf = boost::movelib::to_raw_pointer - (allocator_traits_type::allocate(this->m_holder.alloc(), new_cap, this->m_holder.m_start)); + T * const new_buf = boost::movelib::to_raw_pointer(this->m_holder.allocate(new_cap)); #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS ++this->num_alloc; #endif @@ -2651,7 +2735,7 @@ class vector //There is not enough memory, allocate a new //buffer or expand the old one. - size_type real_cap = this->m_holder.next_capacity(n); + size_type real_cap = this->m_holder.template next_capacity(n); pointer reuse(this->m_holder.start()); pointer const ret (this->m_holder.allocation_command (allocate_new | expand_fwd | expand_bwd, this->m_holder.m_size + n, real_cap, reuse)); @@ -2725,7 +2809,7 @@ class vector } template - iterator priv_forward_range_insert_at_end + BOOST_CONTAINER_FORCEINLINE iterator priv_forward_range_insert_at_end (const size_type n, const InsertionProxy insert_range_proxy, AllocVersion) { return this->priv_forward_range_insert(this->back_ptr(), n, insert_range_proxy); @@ -2909,10 +2993,10 @@ class vector //If there is allocated memory, destroy and deallocate if(!value_traits::trivial_dctr_after_move) boost::container::destroy_alloc_n(this->get_stored_allocator(), old_buffer, this->m_holder.m_size); - allocator_traits_type::deallocate(this->m_holder.alloc(), this->m_holder.start(), this->m_holder.capacity()); + this->m_holder.deallocate(this->m_holder.start(), this->m_holder.capacity()); } this->m_holder.start(new_start); - this->m_holder.m_size = new_finish - new_start; + this->m_holder.m_size = size_type(new_finish - new_start); this->m_holder.capacity(new_cap); //All construction successful, disable rollbacks new_values_destroyer.release(); @@ -3248,12 +3332,12 @@ class vector } } - bool priv_in_range(const_iterator pos) const + BOOST_CONTAINER_FORCEINLINE bool priv_in_range(const_iterator pos) const { return (this->begin() <= pos) && (pos < this->end()); } - bool priv_in_range_or_end(const_iterator pos) const + BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const { return (this->begin() <= pos) && (pos <= this->end()); } @@ -3270,6 +3354,19 @@ class vector #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED }; +#if __cplusplus >= 201703L + +template +vector(InputIterator, InputIterator) -> + vector::value_type>; + +template +vector(InputIterator, InputIterator, Allocator const&) -> + vector::value_type, Allocator>; + +#endif + + }} //namespace boost::container #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED diff --git a/boost/functional/hash/detail/float_functions.hpp b/boost/container_hash/detail/float_functions.hpp similarity index 100% rename from boost/functional/hash/detail/float_functions.hpp rename to boost/container_hash/detail/float_functions.hpp diff --git a/boost/functional/hash/detail/hash_float.hpp b/boost/container_hash/detail/hash_float.hpp similarity index 98% rename from boost/functional/hash/detail/hash_float.hpp rename to boost/container_hash/detail/hash_float.hpp index 1816c57..f763428 100644 --- a/boost/functional/hash/detail/hash_float.hpp +++ b/boost/container_hash/detail/hash_float.hpp @@ -11,9 +11,9 @@ #pragma once #endif -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/boost/functional/hash/detail/limits.hpp b/boost/container_hash/detail/limits.hpp similarity index 100% rename from boost/functional/hash/detail/limits.hpp rename to boost/container_hash/detail/limits.hpp diff --git a/boost/functional/hash/extensions.hpp b/boost/container_hash/extensions.hpp similarity index 70% rename from boost/functional/hash/extensions.hpp rename to boost/container_hash/extensions.hpp index cb3c856..4eebb4b 100644 --- a/boost/functional/hash/extensions.hpp +++ b/boost/container_hash/extensions.hpp @@ -5,7 +5,7 @@ // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// issue 6.18. // This implements the extensions to the standard. // It's undocumented, so you shouldn't use it.... @@ -18,12 +18,11 @@ #pragma once #endif -#include +#include #include -#include +#include #include -#include -#include +#include #if !defined(BOOST_NO_CXX11_HDR_ARRAY) # include @@ -72,6 +71,56 @@ namespace boost return seed; } + inline std::size_t hash_range( + std::vector::iterator first, + std::vector::iterator last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + + return seed; + } + + inline std::size_t hash_range( + std::vector::const_iterator first, + std::vector::const_iterator last) + { + std::size_t seed = 0; + + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + + return seed; + } + + inline void hash_range( + std::size_t& seed, + std::vector::iterator first, + std::vector::iterator last) + { + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + } + + inline void hash_range( + std::size_t& seed, + std::vector::const_iterator first, + std::vector::const_iterator last) + { + for(; first != last; ++first) + { + hash_combine(seed, *first); + } + } + template std::size_t hash_value(std::vector const& v) { @@ -171,19 +220,66 @@ namespace boost return boost::hash_detail::hash_tuple(v); } -# define BOOST_HASH_TUPLE_F(z, n, _) \ - template< \ - BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ - > \ - inline std::size_t hash_value(std::tuple< \ - BOOST_PP_ENUM_PARAMS_Z(z, n, A) \ - > const& v) \ - { \ - return boost::hash_detail::hash_tuple(v); \ + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); + } + + template + inline std::size_t hash_value(std::tuple const& v) + { + return boost::hash_detail::hash_tuple(v); } - BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _) -# undef BOOST_HASH_TUPLE_F #endif #endif diff --git a/boost/functional/hash/hash.hpp b/boost/container_hash/hash.hpp similarity index 79% rename from boost/functional/hash/hash.hpp rename to boost/container_hash/hash.hpp index b461f5f..76de793 100644 --- a/boost/functional/hash/hash.hpp +++ b/boost/container_hash/hash.hpp @@ -5,7 +5,7 @@ // Based on Peter Dimov's proposal // http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2005/n1756.pdf -// issue 6.18. +// issue 6.18. // // This also contains public domain code from MurmurHash. From the // MurmurHash header: @@ -16,14 +16,14 @@ #if !defined(BOOST_FUNCTIONAL_HASH_HASH_HPP) #define BOOST_FUNCTIONAL_HASH_HASH_HPP -#include +#include #include -#include +#include #include #include #include #include -#include +#include #include #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) @@ -34,6 +34,10 @@ #include #endif +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) +#include +#endif + #if defined(BOOST_MSVC) #pragma warning(push) @@ -58,6 +62,58 @@ # define BOOST_FUNCTIONAL_HASH_ROTL32(x, r) (x << r) | (x >> (32 - r)) #endif +// Detect whether standard library has C++17 headers + +#if !defined(BOOST_HASH_CXX17) +# if defined(BOOST_MSVC) +# if defined(_HAS_CXX17) && _HAS_CXX17 +# define BOOST_HASH_CXX17 1 +# endif +# elif defined(__cplusplus) && __cplusplus >= 201703 +# define BOOST_HASH_CXX17 1 +# endif +#endif + +#if !defined(BOOST_HASH_CXX17) +# define BOOST_HASH_CXX17 0 +#endif + +#if BOOST_HASH_CXX17 && defined(__has_include) +# if !defined(BOOST_HASH_HAS_STRING_VIEW) && __has_include() +# define BOOST_HASH_HAS_STRING_VIEW 1 +# endif +# if !defined(BOOST_HASH_HAS_OPTIONAL) && __has_include() +# define BOOST_HASH_HAS_OPTIONAL 1 +# endif +# if !defined(BOOST_HASH_HAS_VARIANT) && __has_include() +# define BOOST_HASH_HAS_VARIANT 1 +# endif +#endif + +#if !defined(BOOST_HASH_HAS_STRING_VIEW) +# define BOOST_HASH_HAS_STRING_VIEW 0 +#endif + +#if !defined(BOOST_HASH_HAS_OPTIONAL) +# define BOOST_HASH_HAS_OPTIONAL 0 +#endif + +#if !defined(BOOST_HASH_HAS_VARIANT) +# define BOOST_HASH_HAS_VARIANT 0 +#endif + +#if BOOST_HASH_HAS_STRING_VIEW +# include +#endif + +#if BOOST_HASH_HAS_OPTIONAL +# include +#endif + +#if BOOST_HASH_HAS_VARIANT +# include +#endif + namespace boost { namespace hash_detail @@ -176,13 +232,35 @@ namespace boost std::size_t hash_value( std::basic_string, A> const&); +#if BOOST_HASH_HAS_STRING_VIEW + template + std::size_t hash_value( + std::basic_string_view > const&); +#endif + template typename boost::hash_detail::float_numbers::type hash_value(T); +#if BOOST_HASH_HAS_OPTIONAL + template + std::size_t hash_value(std::optional const&); +#endif + +#if BOOST_HASH_HAS_VARIANT + std::size_t hash_value(std::monostate); + template + std::size_t hash_value(std::variant const&); +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::size_t hash_value(std::type_index); #endif +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + std::size_t hash_value(std::error_code const&); + std::size_t hash_value(std::error_condition const&); +#endif + // Implementation namespace hash_detail @@ -410,12 +488,49 @@ namespace boost return hash_range(v.begin(), v.end()); } +#if BOOST_HASH_HAS_STRING_VIEW + template + inline std::size_t hash_value( + std::basic_string_view > const& v) + { + return hash_range(v.begin(), v.end()); + } +#endif + template typename boost::hash_detail::float_numbers::type hash_value(T v) { return boost::hash_detail::float_hash_value(v); } +#if BOOST_HASH_HAS_OPTIONAL + template + inline std::size_t hash_value(std::optional const& v) { + if (!v) { + // Arbitray value for empty optional. + return 0x12345678; + } else { + boost::hash hf; + return hf(*v); + } + } +#endif + +#if BOOST_HASH_HAS_VARIANT + inline std::size_t hash_value(std::monostate) { + return 0x87654321; + } + + template + inline std::size_t hash_value(std::variant const& v) { + std::size_t seed = 0; + hash_combine(seed, v.index()); + std::visit([&seed](auto&& x) { hash_combine(seed, x); }, v); + return seed; + } +#endif + + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) inline std::size_t hash_value(std::type_index v) { @@ -423,14 +538,30 @@ namespace boost } #endif +#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) + inline std::size_t hash_value(std::error_code const& v) { + std::size_t seed = 0; + hash_combine(seed, v.value()); + hash_combine(seed, &v.category()); + return seed; + } + + inline std::size_t hash_value(std::error_condition const& v) { + std::size_t seed = 0; + hash_combine(seed, v.value()); + hash_combine(seed, &v.category()); + return seed; + } +#endif + // // boost::hash // - + // Define the specializations required by the standard. The general purpose // boost::hash is defined later in extensions.hpp if // BOOST_HASH_NO_EXTENSIONS is not defined. - + // BOOST_HASH_SPECIALIZE - define a specialization for a type which is // passed by copy. // @@ -459,6 +590,16 @@ namespace boost } \ }; +#define BOOST_HASH_SPECIALIZE_TEMPLATE_REF(type) \ + struct hash \ + : public boost::hash_detail::hash_base \ + { \ + std::size_t operator()(type const& v) const \ + { \ + return boost::hash_value(v); \ + } \ + }; + BOOST_HASH_SPECIALIZE(bool) BOOST_HASH_SPECIALIZE(char) BOOST_HASH_SPECIALIZE(signed char) @@ -494,6 +635,19 @@ namespace boost BOOST_HASH_SPECIALIZE_REF(std::basic_string) #endif +#if BOOST_HASH_HAS_STRING_VIEW + BOOST_HASH_SPECIALIZE_REF(std::string_view) +# if !defined(BOOST_NO_STD_WSTRING) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) + BOOST_HASH_SPECIALIZE_REF(std::wstring_view) +# endif +# if !defined(BOOST_NO_CXX11_CHAR16_T) + BOOST_HASH_SPECIALIZE_REF(std::basic_string_view) +# endif +# if !defined(BOOST_NO_CXX11_CHAR32_T) + BOOST_HASH_SPECIALIZE_REF(std::basic_string_view) +# endif +#endif + #if !defined(BOOST_NO_LONG_LONG) BOOST_HASH_SPECIALIZE(boost::long_long_type) BOOST_HASH_SPECIALIZE(boost::ulong_long_type) @@ -504,12 +658,24 @@ namespace boost BOOST_HASH_SPECIALIZE(boost::uint128_type) #endif +#if BOOST_HASH_HAS_OPTIONAL + template + BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::optional) +#endif + +#if !defined(BOOST_HASH_HAS_VARIANT) + template + BOOST_HASH_SPECIALIZE_TEMPLATE_REF(std::variant) + BOOST_HASH_SPECIALIZE(std::monostate) +#endif + #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) BOOST_HASH_SPECIALIZE(std::type_index) #endif #undef BOOST_HASH_SPECIALIZE #undef BOOST_HASH_SPECIALIZE_REF +#undef BOOST_HASH_SPECIALIZE_TEMPLATE_REF // Specializing boost::hash for pointers. @@ -591,5 +757,5 @@ namespace boost #if !defined(BOOST_HASH_NO_EXTENSIONS) \ && !defined(BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP) -#include +#include #endif diff --git a/boost/functional/hash/hash_fwd.hpp b/boost/container_hash/hash_fwd.hpp similarity index 93% rename from boost/functional/hash/hash_fwd.hpp rename to boost/container_hash/hash_fwd.hpp index 01fe012..a87c182 100644 --- a/boost/functional/hash/hash_fwd.hpp +++ b/boost/container_hash/hash_fwd.hpp @@ -10,13 +10,13 @@ #if !defined(BOOST_FUNCTIONAL_HASH_FWD_HPP) #define BOOST_FUNCTIONAL_HASH_FWD_HPP -#include +#include +#include + #if defined(BOOST_HAS_PRAGMA_ONCE) #pragma once #endif -#include -#include namespace boost { diff --git a/boost/core/addressof.hpp b/boost/core/addressof.hpp index 8ddda8b..f7eab06 100644 --- a/boost/core/addressof.hpp +++ b/boost/core/addressof.hpp @@ -49,20 +49,20 @@ namespace boost { namespace detail { template -class addressof_ref { +class addrof_ref { public: - BOOST_FORCEINLINE addressof_ref(T& o) BOOST_NOEXCEPT + BOOST_FORCEINLINE addrof_ref(T& o) BOOST_NOEXCEPT : o_(o) { } BOOST_FORCEINLINE operator T&() const BOOST_NOEXCEPT { return o_; } private: - addressof_ref& operator=(const addressof_ref&); + addrof_ref& operator=(const addrof_ref&); T& o_; }; template -struct address_of { +struct addrof { static BOOST_FORCEINLINE T* get(T& o, long) BOOST_NOEXCEPT { return reinterpret_cast(& const_cast(reinterpret_cast(o))); @@ -76,38 +76,38 @@ struct address_of { #if !defined(BOOST_NO_CXX11_DECLTYPE) && \ (defined(__INTEL_COMPILER) || \ (defined(__clang__) && !defined(_LIBCPP_VERSION))) -typedef decltype(nullptr) addressof_null_t; +typedef decltype(nullptr) addrof_null_t; #else -typedef std::nullptr_t addressof_null_t; +typedef std::nullptr_t addrof_null_t; #endif template<> -struct address_of { - typedef addressof_null_t type; +struct addrof { + typedef addrof_null_t type; static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { return &o; } }; template<> -struct address_of { - typedef const addressof_null_t type; +struct addrof { + typedef const addrof_null_t type; static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { return &o; } }; template<> -struct address_of { - typedef volatile addressof_null_t type; +struct addrof { + typedef volatile addrof_null_t type; static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { return &o; } }; template<> -struct address_of { - typedef const volatile addressof_null_t type; +struct addrof { + typedef const volatile addrof_null_t type; static BOOST_FORCEINLINE type* get(type& o, int) BOOST_NOEXCEPT { return &o; } @@ -127,9 +127,9 @@ 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); + return boost::detail::addrof::get(o, 0); #else - return detail::address_of::get(detail::addressof_ref(o), 0); + return boost::detail::addrof::get(boost::detail::addrof_ref(o), 0); #endif } @@ -137,14 +137,14 @@ addressof(T& o) BOOST_NOEXCEPT namespace detail { template -struct addressof_result { +struct addrof_result { typedef T* type; }; } /* detail */ template -BOOST_FORCEINLINE typename detail::addressof_result::type +BOOST_FORCEINLINE typename boost::detail::addrof_result::type addressof(T (&o)[N]) BOOST_NOEXCEPT { return &o; @@ -170,79 +170,79 @@ const T (*addressof(const T (&o)[N]) BOOST_NOEXCEPT)[N] namespace detail { template -T addressof_declval() BOOST_NOEXCEPT; +T addrof_declval() BOOST_NOEXCEPT; template -struct addressof_void { +struct addrof_void { typedef void type; }; template -struct addressof_member_operator { +struct addrof_member_operator { static constexpr bool value = false; }; template -struct addressof_member_operator().operator&())>::type> { +struct addrof_member_operator().operator&())>::type> { static constexpr bool value = true; }; #if BOOST_WORKAROUND(BOOST_INTEL, < 1600) -struct addressof_addressable { }; +struct addrof_addressable { }; -addressof_addressable* -operator&(addressof_addressable&) BOOST_NOEXCEPT; +addrof_addressable* +operator&(addrof_addressable&) BOOST_NOEXCEPT; #endif template -struct addressof_non_member_operator { +struct addrof_non_member_operator { static constexpr bool value = false; }; template -struct addressof_non_member_operator()))>::type> { +struct addrof_non_member_operator()))>::type> { static constexpr bool value = true; }; template -struct addressof_expression { +struct addrof_expression { static constexpr bool value = false; }; template -struct addressof_expression())>::type> { +struct addrof_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; +struct addrof_is_constexpr { + static constexpr bool value = addrof_expression::value && + !addrof_member_operator::value && + !addrof_non_member_operator::value; }; template -struct addressof_if { }; +struct addrof_if { }; template -struct addressof_if { +struct addrof_if { typedef T* type; }; template BOOST_FORCEINLINE -typename addressof_if::value, T>::type +typename addrof_if::value, T>::type addressof(T& o) BOOST_NOEXCEPT { - return address_of::get(addressof_ref(o), 0); + return addrof::get(addrof_ref(o), 0); } template constexpr BOOST_FORCEINLINE -typename addressof_if::value, T>::type +typename addrof_if::value, T>::type addressof(T& o) BOOST_NOEXCEPT { return &o; @@ -254,7 +254,7 @@ template constexpr BOOST_FORCEINLINE T* addressof(T& o) BOOST_NOEXCEPT { - return detail::addressof(o); + return boost::detail::addressof(o); } #endif diff --git a/boost/cstdint.hpp b/boost/cstdint.hpp index 5e1411a..c8474c4 100644 --- a/boost/cstdint.hpp +++ b/boost/cstdint.hpp @@ -34,6 +34,17 @@ #endif #include +// +// For the following code we get several warnings along the lines of: +// +// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant +// +// So we declare this a system header to suppress these warnings. +// See also https://github.com/boostorg/config/issues/190 +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif // // Note that GLIBC is a bit inconsistent about whether int64_t is defined or not @@ -60,7 +71,7 @@ # include // There is a bug in Cygwin two _C macros -# if defined(__STDC_CONSTANT_MACROS) && defined(__CYGWIN__) +# if defined(INTMAX_C) && defined(__CYGWIN__) # undef INTMAX_C # undef UINTMAX_C # define INTMAX_C(c) c##LL @@ -408,16 +419,6 @@ INT#_C macros if they're not already defined (John Maddock). #if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && \ (!defined(INT8_C) || !defined(INT16_C) || !defined(INT32_C) || !defined(INT64_C)) // -// For the following code we get several warnings along the lines of: -// -// boost/cstdint.hpp:428:35: error: use of C99 long long integer constant -// -// So we declare this a system header to suppress these warnings. -// -#if defined(__GNUC__) && (__GNUC__ >= 4) -#pragma GCC system_header -#endif -// // Undef the macros as a precaution, since we may get here if has failed // to define them all, see https://svn.boost.org/trac/boost/ticket/12786 // diff --git a/boost/functional/hash.hpp b/boost/functional/hash.hpp index 44983f1..327a3ec 100644 --- a/boost/functional/hash.hpp +++ b/boost/functional/hash.hpp @@ -3,5 +3,4 @@ // 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 - +#include diff --git a/boost/functional/hash_fwd.hpp b/boost/functional/hash_fwd.hpp index eea9073..62bc23c 100644 --- a/boost/functional/hash_fwd.hpp +++ b/boost/functional/hash_fwd.hpp @@ -3,9 +3,4 @@ // 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_HAS_PRAGMA_ONCE) -#pragma once -#endif - -#include +#include diff --git a/boost/icl/concept/element_associator.hpp b/boost/icl/concept/element_associator.hpp index ce421e0..4d37e25 100644 --- a/boost/icl/concept/element_associator.hpp +++ b/boost/icl/concept/element_associator.hpp @@ -1,4 +1,4 @@ -/*-----------------------------------------------------------------------------+ +/*-----------------------------------------------------------------------------+ Copyright (c) 2010-2010: Joachim Faulhaber +------------------------------------------------------------------------------+ Distributed under the Boost Software License, Version 1.0. @@ -22,25 +22,25 @@ namespace boost{ namespace icl //============================================================================== //= Size //============================================================================== -template +template typename enable_if, std::size_t>::type iterative_size(const Type& object) -{ - return object.size(); +{ + return object.size(); } template typename enable_if, typename Type::size_type>::type size(const Type& object) -{ - return icl::iterative_size(object); +{ + return icl::iterative_size(object); } template typename enable_if, typename Type::size_type>::type cardinality(const Type& object) -{ - return icl::iterative_size(object); +{ + return icl::iterative_size(object); } @@ -54,15 +54,15 @@ cardinality(const Type& object) template typename enable_if, bool>::type within(const typename Type::key_type& key, const Type& super) -{ - return !(super.find(key) == super.end()); +{ + return !(super.find(key) == super.end()); } //------------------------------------------------------------------------------ //- bool within(c P&, c T&) T:{s}|{m} P:{s'} fragment_types|key_types //------------------------------------------------------------------------------ template -typename enable_if +typename enable_if , is_key_container_of >, bool>::type within(const SubT& sub, const SuperT& super) @@ -81,7 +81,7 @@ within(const SubT& sub, const SuperT& super) while(sub_ != sub.end()) { super_ = super.find(key_value(sub_)); - if(super_ == super.end()) + if(super_ == super.end()) return false; else if(!co_equal(sub_, super_, &sub, &super)) return false; @@ -97,8 +97,8 @@ within(const SubT& sub, const SuperT& super) template typename enable_if, bool>::type contains(const Type& super, const typename Type::key_type& key) -{ - return icl::within(key, super); +{ + return icl::within(key, super); } //------------------------------------------------------------------------------ @@ -109,15 +109,15 @@ typename enable_if , is_key_container_of >, bool>::type contains(const SuperT& super, const SubT& sub) -{ - return icl::within(sub, super); +{ + return icl::within(sub, super); } //============================================================================== //= Equivalences and Orderings //============================================================================== -#ifdef BOOST_MSVC +#ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4996) //'std::equal': Function call with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' #endif // I do guarantee here that I am using the parameters correctly :) @@ -128,7 +128,7 @@ template inline typename enable_if, bool>::type operator == (const Type& left, const Type& right) { - return left.size() == right.size() + return left.size() == right.size() && std::equal(left.begin(), left.end(), right.begin()); } @@ -148,17 +148,17 @@ inline typename enable_if, bool>::type operator < (const Type& left, const Type& right) { return std::lexicographical_compare( - left.begin(), left.end(), right.begin(), right.end(), + left.begin(), left.end(), right.begin(), right.end(), typename Type::element_compare() ); } template -typename enable_if, +typename enable_if, int>::type inclusion_compare(const LeftT& left, const RightT& right) { - return Set::subset_compare(left, right, + return Set::subset_compare(left, right, left.begin(), left.end(), right.begin(), right.end()); } @@ -168,29 +168,29 @@ inclusion_compare(const LeftT& left, const RightT& right) //============================================================================== template inline typename enable_if, Type>::type& -operator += (Type& object, const typename Type::value_type& operand) -{ - return icl::add(object, operand); +operator += (Type& object, const typename Type::value_type& operand) +{ + return icl::add(object, operand); } template inline typename enable_if, Type>::type -operator + (Type object, const typename Type::value_type& operand) -{ - return object += operand; +operator + (Type object, const typename Type::value_type& operand) +{ + return object += operand; } template inline typename enable_if, Type>::type -operator + (const typename Type::value_type& operand, Type object) -{ - return object += operand; +operator + (const typename Type::value_type& operand, Type object) +{ + return object += operand; } template inline typename enable_if, Type>::type& -operator += (Type& object, const Type& operand) -{ +operator += (Type& object, const Type& operand) +{ if(&object == &operand) return object; @@ -203,45 +203,45 @@ operator += (Type& object, const Type& operand) template inline typename enable_if, Type>::type -operator + (Type object, const Type& operand) -{ - return object += operand; +operator + (Type object, const Type& operand) +{ + return object += operand; } //============================================================================== template inline typename enable_if, Type>::type& -operator |= (Type& object, const typename Type::value_type& operand) -{ - return icl::add(object, operand); +operator |= (Type& object, const typename Type::value_type& operand) +{ + return icl::add(object, operand); } template inline typename enable_if, Type>::type -operator | (Type object, const typename Type::value_type& operand) -{ - return object += operand; +operator | (Type object, const typename Type::value_type& operand) +{ + return object += operand; } template inline typename enable_if, Type>::type -operator | (const typename Type::value_type& operand, Type object) -{ - return object += operand; +operator | (const typename Type::value_type& operand, Type object) +{ + return object += operand; } template inline typename enable_if, Type>::type& -operator |= (Type& object, const Type& operand) -{ - return object += operand; +operator |= (Type& object, const Type& operand) +{ + return object += operand; } template inline typename enable_if, Type>::type -operator | (Type object, const Type& operand) -{ - return object += operand; +operator | (Type object, const Type& operand) +{ + return object += operand; } @@ -252,7 +252,7 @@ operator | (Type object, const Type& operand) //- V insert(T&, c P&) T:{s}|{m} P:{e}|{b} fragment_type //------------------------------------------------------------------------------ template -typename enable_if, +typename enable_if, std::pair >::type insert(Type& object, const typename Type::value_type& operand) { @@ -260,9 +260,9 @@ insert(Type& object, const typename Type::value_type& operand) } template -typename enable_if, +typename enable_if, typename Type::iterator>::type -insert(Type& object, typename Type::iterator prior, +insert(Type& object, typename Type::iterator prior, const typename Type::value_type& operand) { return object.insert(prior, operand); @@ -278,10 +278,10 @@ insert(Type& object, const Type& addend) typedef typename Type::iterator iterator; iterator prior_ = object.end(); - ICL_const_FORALL(typename Type, elem_, addend) + ICL_const_FORALL(typename Type, elem_, addend) icl::insert(object, prior_, *elem_); - return object; + return object; } @@ -306,10 +306,10 @@ template typename enable_if, Type>::type& erase(Type& object, const Type& erasure) { - ICL_const_FORALL(typename Type, elem_, erasure) - icl::erase(object, *elem_); + ICL_const_FORALL(typename Type, elem_, erasure) + icl::erase(object, *elem_); - return object; + return object; } @@ -319,33 +319,33 @@ erase(Type& object, const Type& erasure) //============================================================================== template inline typename enable_if, Type>::type& -operator -= (Type& object, const typename Type::value_type& operand) -{ - return icl::subtract(object, operand); +operator -= (Type& object, const typename Type::value_type& operand) +{ + return icl::subtract(object, operand); } template inline typename enable_if, Type>::type -operator - (Type object, const typename Type::value_type& operand) -{ - return object -= operand; +operator - (Type object, const typename Type::value_type& operand) +{ + return object -= operand; } template inline typename enable_if, Type>::type& -operator -= (Type& object, const Type& subtrahend) -{ +operator -= (Type& object, const Type& subtrahend) +{ ICL_const_FORALL(typename Type, it_, subtrahend) icl::subtract(object, *it_); - return object; + return object; } template inline typename enable_if, Type>::type -operator - (Type object, const Type& subtrahend) -{ - return object -= subtrahend; +operator - (Type object, const Type& subtrahend) +{ + return object -= subtrahend; } @@ -353,25 +353,25 @@ operator - (Type object, const Type& subtrahend) //= Intersection //============================================================================== //------------------------------------------------------------------------------ -//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{e}{e} key_type +//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{e}{e} key_type //------------------------------------------------------------------------------ template inline typename enable_if, void>::type -add_intersection(Type& section, const Type& object, +add_intersection(Type& section, const Type& object, const typename Type::key_type& operand) { typedef typename Type::const_iterator const_iterator; const_iterator it_ = object.find(operand); - if(it_ != object.end()) + if(it_ != object.end()) icl::add(section, *it_); } //------------------------------------------------------------------------------ -//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{s}{s} set key_type +//- void add_intersection(T&, c T&, c P&) T:{s}{m} P:{s}{s} set key_type //------------------------------------------------------------------------------ template inline typename enable_if, void>::type -add_intersection(Type& section, const Type& object, +add_intersection(Type& section, const Type& object, const typename key_container_type_of::type& operand) { typedef typename key_container_type_of::type key_container_type; @@ -386,12 +386,12 @@ add_intersection(Type& section, const Type& object, } //------------------------------------------------------------------------------ -//- Intersection +//- Intersection //------------------------------------------------------------------------------ template inline typename enable_if, Type>::type& operator &= (Type& object, const typename Type::key_type& operand) -{ +{ Type section; add_intersection(section, object, operand); object.swap(section); @@ -415,7 +415,7 @@ operator & (const typename Type::key_type& operand, Type object) template inline typename enable_if, Type>::type& operator &= (Type& object, const typename key_container_type_of::type& operand) -{ +{ Type section; add_intersection(section, object, operand); object.swap(section); @@ -458,7 +458,7 @@ template inline typename enable_if, Type>::type operator ^ (Type object, const Type& operand) { - return object ^= operand; + return object ^= operand; } @@ -472,7 +472,7 @@ erase_if(const Predicate& pred, Type& object) typename Type::iterator it_ = object.begin(); while(it_ != object.end()) if(pred(*it_)) - icl::erase(object, it_++); + icl::erase(object, it_++); else ++it_; return object; } @@ -483,9 +483,9 @@ add_if(const Predicate& pred, Type& object, const Type& src) { typename Type::const_iterator it_ = src.begin(); while(it_ != src.end()) - if(pred(*it_)) - icl::add(object, *it_++); - + if(pred(*it_)) + icl::add(object, *it_++); + return object; } @@ -502,5 +502,3 @@ assign_if(const Predicate& pred, Type& object, const Type& src) }} // namespace boost icl #endif - - diff --git a/boost/icl/concept/interval.hpp b/boost/icl/concept/interval.hpp index 487d424..1a4654a 100644 --- a/boost/icl/concept/interval.hpp +++ b/boost/icl/concept/interval.hpp @@ -8,7 +8,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber #ifndef BOOST_ICL_CONCEPT_INTERVAL_HPP_JOFA_100323 #define BOOST_ICL_CONCEPT_INTERVAL_HPP_JOFA_100323 -#include +#include #include #include #include @@ -38,7 +38,7 @@ namespace boost{namespace icl //============================================================================== template inline typename enable_if, bool>::type -domain_less(const typename interval_traits::domain_type& left, +domain_less(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { return typename interval_traits::domain_compare()(left, right); @@ -46,7 +46,7 @@ domain_less(const typename interval_traits::domain_type& left, template inline typename enable_if, bool>::type -domain_less_equal(const typename interval_traits::domain_type& left, +domain_less_equal(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { return !(typename interval_traits::domain_compare()(right, left)); @@ -54,7 +54,7 @@ domain_less_equal(const typename interval_traits::domain_type& left, template inline typename enable_if, bool>::type -domain_equal(const typename interval_traits::domain_type& left, +domain_equal(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { typedef typename interval_traits::domain_compare domain_compare; @@ -64,7 +64,7 @@ domain_equal(const typename interval_traits::domain_type& left, template inline typename enable_if< is_interval , typename interval_traits::domain_type>::type -domain_next(const typename interval_traits::domain_type value) +domain_next(const typename interval_traits::domain_type value) { typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; @@ -74,7 +74,7 @@ domain_next(const typename interval_traits::domain_type value) template inline typename enable_if< is_interval , typename interval_traits::domain_type>::type -domain_prior(const typename interval_traits::domain_type value) +domain_prior(const typename interval_traits::domain_type value) { typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; @@ -110,7 +110,7 @@ singleton(const typename interval_traits::domain_type& value) typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(value) )); + ::is_less_than(value) )); return interval_traits::construct(domain_prior(value), value); } @@ -123,7 +123,7 @@ singleton(const typename interval_traits::domain_type& value) typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(value))); + ::is_less_than(value))); return interval_traits::construct( domain_prior(value) , domain_next(value)); @@ -149,10 +149,10 @@ namespace detail //============================================================================== //= Construct unit_trail == generalized singleton -// The smallest interval on an incrementable (and decrementable) type that can +// The smallest interval on an incrementable (and decrementable) type that can // be constructed using ++ and -- and such that it contains a given value. -// If 'Type' is discrete, 'unit_trail' and 'singleton' are identical. So we -// can view 'unit_trail' as a generalized singleton for static intervals of +// If 'Type' is discrete, 'unit_trail' and 'singleton' are identical. So we +// can view 'unit_trail' as a generalized singleton for static intervals of // continuous types. //============================================================================== template @@ -179,7 +179,7 @@ unit_trail(const typename interval_traits::domain_type& value) typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(value) )); + ::is_less_than(value) )); return interval_traits::construct(domain_prior(value), value); } @@ -196,7 +196,7 @@ unit_trail(const typename interval_traits::domain_type& value) typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(value))); + ::is_less_than(value))); return interval_traits::construct( domain_prior(value) , domain_next(value)); @@ -263,7 +263,8 @@ typename enable_if, Type>::type span(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { - if(interval_traits::domain_compare()(left,right)) + typedef typename interval_traits::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct(left, right); else return construct(right, left); @@ -276,7 +277,8 @@ typename enable_if, Type>::type hull(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { - if(interval_traits::domain_compare()(left,right)) + typedef typename interval_traits::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct(left, domain_next(right)); else return construct(right, domain_next(left)); @@ -289,16 +291,16 @@ hull(const typename interval_traits::domain_type& left, { typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; - if(interval_traits::domain_compare()(left,right)) + if(domain_compare()(left,right)) { BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(left) )); + ::is_less_than(left) )); return construct(domain_prior(left), right); } else { BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(right) )); + ::is_less_than(right) )); return construct(domain_prior(right), left); } } @@ -308,7 +310,8 @@ typename enable_if, Type>::type hull(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { - if(interval_traits::domain_compare()(left,right)) + typedef typename interval_traits::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct(left, right); else return construct(right, left); @@ -321,17 +324,17 @@ hull(const typename interval_traits::domain_type& left, { typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; - if(interval_traits::domain_compare()(left,right)) + if(domain_compare()(left,right)) { BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(left) )); + ::is_less_than(left) )); return construct( domain_prior(left) , domain_next(right)); } else { BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(right) )); + ::is_less_than(right) )); return construct( domain_prior(right) , domain_next(left)); } @@ -342,7 +345,8 @@ typename enable_if, Type>::type hull(const typename interval_traits::domain_type& left, const typename interval_traits::domain_type& right) { - if(interval_traits::domain_compare()(left,right)) + typedef typename interval_traits::domain_compare domain_compare; + if(domain_compare()(left,right)) return construct(left, right, interval_bounds::closed()); else return construct(right, left, interval_bounds::closed()); @@ -353,160 +357,160 @@ hull(const typename interval_traits::domain_type& left, //============================================================================== template -inline typename enable_if, +inline typename enable_if, typename interval_traits::domain_type>::type lower(const Type& object) -{ +{ return interval_traits::lower(object); } template -inline typename enable_if, +inline typename enable_if, typename interval_traits::domain_type>::type upper(const Type& object) -{ +{ return interval_traits::upper(object); } //- first ---------------------------------------------------------------------- template -inline typename +inline typename enable_if< mpl::or_, is_static_closed > , typename interval_traits::domain_type>::type first(const Type& object) -{ +{ return lower(object); } template -inline typename +inline typename enable_if< mpl::and_< mpl::or_, is_static_open > , is_discrete::domain_type> > , typename interval_traits::domain_type>::type first(const Type& object) -{ +{ return domain_next(lower(object)); } template -inline typename enable_if, +inline typename enable_if, typename interval_traits::domain_type>::type first(const Type& object) -{ - return is_left_closed(object.bounds()) ? - lower(object) : +{ + return is_left_closed(object.bounds()) ? + lower(object) : domain_next(lower(object)); } //- last ----------------------------------------------------------------------- template -inline typename +inline typename enable_if< mpl::or_, is_static_closed > , typename interval_traits::domain_type>::type last(const Type& object) -{ +{ return upper(object); } template -inline typename +inline typename enable_if< mpl::and_< mpl::or_, is_static_open > , is_discrete::domain_type> > , typename interval_traits::domain_type>::type last(const Type& object) -{ +{ typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; BOOST_ASSERT((numeric_minimum::value> - ::is_less_than(upper(object)) )); + ::is_less_than(upper(object)) )); return domain_prior(upper(object)); } template -inline typename enable_if, +inline typename enable_if, typename interval_traits::domain_type>::type last(const Type& object) -{ +{ typedef typename interval_traits::domain_type domain_type; typedef typename interval_traits::domain_compare domain_compare; BOOST_ASSERT((numeric_minimum::value> - ::is_less_than_or(upper(object), is_right_closed(object.bounds())) )); - return is_right_closed(object.bounds()) ? - upper(object) : + ::is_less_than_or(upper(object), is_right_closed(object.bounds())) )); + return is_right_closed(object.bounds()) ? + upper(object) : domain_prior(upper(object)); } //- last_next ------------------------------------------------------------------ template -inline typename +inline typename enable_if< mpl::and_< mpl::or_, is_static_closed > , is_discrete::domain_type> > , typename interval_traits::domain_type>::type last_next(const Type& object) -{ +{ return domain_next(upper(object)); } template -inline typename +inline typename enable_if< mpl::and_< mpl::or_, is_static_open > , is_discrete::domain_type> > , typename interval_traits::domain_type>::type last_next(const Type& object) -{ +{ //CL typedef typename interval_traits::domain_type domain_type; return upper(object); // NOTE: last_next is implemented to avoid calling pred(object) } // For unsigned integral types this may cause underflow. template -inline typename enable_if, +inline typename enable_if, typename interval_traits::domain_type>::type last_next(const Type& object) -{ - return is_right_closed(object.bounds()) ? - domain_next(upper(object)): +{ + return is_right_closed(object.bounds()) ? + domain_next(upper(object)): upper(object) ; } //------------------------------------------------------------------------------ template -typename enable_if, +typename enable_if, typename Type::bounded_domain_type>::type bounded_lower(const Type& object) -{ - return typename - Type::bounded_domain_type(lower(object), object.bounds().left()); +{ + return typename + Type::bounded_domain_type(lower(object), object.bounds().left()); } template -typename enable_if, +typename enable_if, typename Type::bounded_domain_type>::type reverse_bounded_lower(const Type& object) -{ - return typename - Type::bounded_domain_type(lower(object), - object.bounds().reverse_left()); +{ + return typename + Type::bounded_domain_type(lower(object), + object.bounds().reverse_left()); } template -typename enable_if, +typename enable_if, typename Type::bounded_domain_type>::type bounded_upper(const Type& object) -{ - return typename - Type::bounded_domain_type(upper(object), - object.bounds().right()); +{ + return typename + Type::bounded_domain_type(upper(object), + object.bounds().right()); } template -typename enable_if, +typename enable_if, typename Type::bounded_domain_type>::type reverse_bounded_upper(const Type& object) -{ - return typename - Type::bounded_domain_type(upper(object), - object.bounds().reverse_right()); +{ + return typename + Type::bounded_domain_type(upper(object), + object.bounds().reverse_right()); } //- bounds --------------------------------------------------------------------- @@ -532,36 +536,36 @@ bounds(const Type&) template typename boost::enable_if, bool>::type is_empty(const Type& object) -{ - return domain_less_equal(upper(object), lower(object)); +{ + return domain_less_equal(upper(object), lower(object)); } template typename boost::enable_if, bool>::type is_empty(const Type& object) -{ - return domain_less(upper(object), lower(object)); +{ + return domain_less(upper(object), lower(object)); } template typename boost::enable_if, bool>::type is_empty(const Type& object) -{ - return domain_less_equal(upper(object), lower(object) ) +{ + return domain_less_equal(upper(object), lower(object) ) || domain_less_equal(upper(object), domain_next(lower(object))); } template typename boost::enable_if, bool>::type is_empty(const Type& object) -{ +{ if(object.bounds() == interval_bounds::closed()) - return domain_less(upper(object), lower(object)); + return domain_less(upper(object), lower(object)); else if(object.bounds() == interval_bounds::open()) return domain_less_equal(upper(object), lower(object) ) || domain_less_equal(upper(object), domain_next(lower(object))); else - return domain_less_equal(upper(object), lower(object)); + return domain_less_equal(upper(object), lower(object)); } template @@ -582,32 +586,32 @@ namespace non_empty template inline typename boost::enable_if, bool>::type exclusive_less(const Type& left, const Type& right) - { + { BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less_equal(upper(left), lower(right)); + return domain_less_equal(upper(left), lower(right)); } template inline typename boost::enable_if, bool>::type exclusive_less(const Type& left, const Type& right) - { + { BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less(last(left), first(right)); + return domain_less(last(left), first(right)); } template inline typename boost:: enable_if, bool>::type exclusive_less(const Type& left, const Type& right) - { + { BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); - return domain_less(last(left), first(right)); + return domain_less(last(left), first(right)); } template inline typename boost::enable_if, bool>::type exclusive_less(const Type& left, const Type& right) - { + { BOOST_ASSERT(!(icl::is_empty(left) || icl::is_empty(right))); return domain_less (upper(left), lower(right)) || ( domain_equal(upper(left), lower(right)) @@ -617,7 +621,7 @@ namespace non_empty template inline typename boost::enable_if, bool>::type contains(const Type& super, const Type& sub) - { + { return lower_less_equal(super,sub) && upper_less_equal(sub,super); } @@ -629,7 +633,7 @@ namespace non_empty template inline typename boost::enable_if, bool>::type contains(const Type& super, const Type& sub) -{ +{ return icl::is_empty(sub) || non_empty::contains(super, sub); } @@ -637,7 +641,7 @@ template typename boost::enable_if, bool>::type contains(const Type& super, const typename interval_traits::domain_type& element) { - return domain_less_equal(icl::first(super), element ) + return domain_less_equal(icl::first(super), element ) && domain_less_equal( element, icl::last(super)); } @@ -645,7 +649,7 @@ template typename boost::enable_if, bool>::type contains(const Type& super, const typename interval_traits::domain_type& element) { - return domain_less (icl::lower(super), element ) + return domain_less (icl::lower(super), element ) && domain_less_equal( element, icl::upper(super)); } @@ -653,7 +657,7 @@ template typename boost::enable_if, bool>::type contains(const Type& super, const typename interval_traits::domain_type& element) { - return domain_less_equal(icl::lower(super), element ) + return domain_less_equal(icl::lower(super), element ) && domain_less ( element, icl::upper(super)); } @@ -662,12 +666,12 @@ typename boost::enable_if, bool>::type contains(const Type& super, const typename interval_traits::domain_type& element) { return - (is_left_closed(super.bounds()) - ? domain_less_equal(lower(super), element) + (is_left_closed(super.bounds()) + ? domain_less_equal(lower(super), element) : domain_less(lower(super), element)) && - (is_right_closed(super.bounds()) - ? domain_less_equal(element, upper(super)) + (is_right_closed(super.bounds()) + ? domain_less_equal(element, upper(super)) : domain_less(element, upper(super))); } @@ -675,7 +679,7 @@ contains(const Type& super, const typename interval_traits::domain_type& e template inline typename boost::enable_if, bool>::type within(const Type& sub, const Type& super) -{ +{ return contains(super,sub); } @@ -684,37 +688,37 @@ within(const Type& sub, const Type& super) //= Equivalences and Orderings //============================================================================== //- exclusive_less ------------------------------------------------------------- -/** Maximal element of left is less than the minimal element of +/** Maximal element of left is less than the minimal element of right */ template inline typename boost::enable_if, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) - || domain_less_equal(upper(left), lower(right)); + || domain_less_equal(upper(left), lower(right)); } template inline typename boost::enable_if, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) - || domain_less(last(left), first(right)); + || domain_less(last(left), first(right)); } template inline typename boost:: enable_if, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) - || domain_less(last(left), first(right)); + || domain_less(last(left), first(right)); } template inline typename boost::enable_if, bool>::type exclusive_less(const Type& left, const Type& right) -{ +{ return icl::is_empty(left) || icl::is_empty(right) || domain_less(upper(left), lower(right)) || ( domain_equal(upper(left), lower(right)) @@ -729,24 +733,24 @@ lower_less(const Type& left, const Type& right) { return domain_less(lower(left), lower(right)); } - + template typename boost::enable_if, bool>::type lower_less(const Type& left, const Type& right) { return domain_less(first(left), first(right)); } - + template typename boost::enable_if, bool>::type lower_less(const Type& left, const Type& right) { if(left_bounds(left,right) == interval_bounds::right_open()) //'[(' == 10 return domain_less_equal(lower(left), lower(right)); - else + else return domain_less(lower(left), lower(right)); } - + //------------------------------------------------------------------------------ template @@ -762,7 +766,7 @@ upper_less(const Type& left, const Type& right) { return domain_less(last(left), last(right)); } - + template typename boost::enable_if, bool>::type upper_less(const Type& left, const Type& right) @@ -772,10 +776,10 @@ upper_less(const Type& left, const Type& right) else return domain_less(upper(left), upper(right)); } - + //------------------------------------------------------------------------------ template -typename boost::enable_if, +typename boost::enable_if, typename Type::bounded_domain_type >::type lower_min(const Type& left, const Type& right) { @@ -784,7 +788,7 @@ lower_min(const Type& left, const Type& right) //------------------------------------------------------------------------------ template -typename boost::enable_if, +typename boost::enable_if, typename Type::bounded_domain_type >::type lower_max(const Type& left, const Type& right) { @@ -793,7 +797,7 @@ lower_max(const Type& left, const Type& right) //------------------------------------------------------------------------------ template -typename boost::enable_if, +typename boost::enable_if, typename Type::bounded_domain_type >::type upper_max(const Type& left, const Type& right) { @@ -802,7 +806,7 @@ upper_max(const Type& left, const Type& right) //------------------------------------------------------------------------------ template -typename boost::enable_if, +typename boost::enable_if, typename Type::bounded_domain_type >::type upper_min(const Type& left, const Type& right) { @@ -892,7 +896,7 @@ template typename boost::enable_if, bool>::type operator == (const Type& left, const Type& right) { - return (icl::is_empty(left) && icl::is_empty(right)) + return (icl::is_empty(left) && icl::is_empty(right)) || (lower_equal(left,right) && upper_equal(left,right)); } @@ -908,11 +912,11 @@ template typename boost::enable_if, bool>::type operator < (const Type& left, const Type& right) { - if(icl::is_empty(left)) + if(icl::is_empty(left)) return !icl::is_empty(right); - else - return lower_less(left,right) - || (lower_equal(left,right) && upper_less(left,right)); + else + return lower_less(left,right) + || (lower_equal(left,right) && upper_less(left,right)); } template @@ -928,15 +932,15 @@ operator > (const Type& left, const Type& right) template typename boost::enable_if, bool>::type touches(const Type& left, const Type& right) -{ - return domain_equal(upper(left), lower(right)); +{ + return domain_equal(upper(left), lower(right)); } template typename boost::enable_if, bool>::type touches(const Type& left, const Type& right) -{ - return domain_equal(last_next(left), first(right)); +{ + return domain_equal(last_next(left), first(right)); } template @@ -961,22 +965,22 @@ touches(const Type& left, const Type& right) //- cardinality ---------------------------------------------------------------- template -typename boost::enable_if, +typename boost::enable_if, typename size_type_of >::type>::type cardinality(const Type& object) { typedef typename size_type_of >::type SizeT; if(icl::is_empty(object)) return icl::identity_element::value(); - else if( object.bounds() == interval_bounds::closed() + else if( object.bounds() == interval_bounds::closed() && domain_equal(lower(object), upper(object))) return icl::unit_element::value(); - else + else return icl::infinity::value(); } template -typename boost::enable_if, +typename boost::enable_if, typename size_type_of >::type>::type cardinality(const Type& object) { @@ -986,19 +990,19 @@ cardinality(const Type& object) } template -typename boost::enable_if, +typename boost::enable_if, typename size_type_of >::type>::type cardinality(const Type& object) { typedef typename size_type_of >::type SizeT; if(icl::is_empty(object)) return icl::identity_element::value(); - else + else return icl::infinity::value(); } template -typename boost::enable_if, +typename boost::enable_if, typename size_type_of >::type>::type cardinality(const Type& object) { @@ -1008,7 +1012,7 @@ cardinality(const Type& object) } template -typename boost::enable_if, +typename boost::enable_if, typename size_type_of >::type>::type cardinality(const Type& object) { @@ -1021,7 +1025,7 @@ cardinality(const Type& object) //- size ----------------------------------------------------------------------- template -inline typename enable_if, +inline typename enable_if, typename size_type_of >::type>::type size(const Type& object) { @@ -1030,7 +1034,7 @@ size(const Type& object) //- length --------------------------------------------------------------------- template -inline typename boost::enable_if, +inline typename boost::enable_if, typename difference_type_of >::type>::type length(const Type& object) { @@ -1040,7 +1044,7 @@ length(const Type& object) } template -inline typename boost::enable_if, +inline typename boost::enable_if, typename difference_type_of >::type>::type length(const Type& object) { @@ -1050,7 +1054,7 @@ length(const Type& object) } template -typename boost::enable_if, +typename boost::enable_if, typename difference_type_of >::type>::type length(const Type& object) { @@ -1060,7 +1064,7 @@ length(const Type& object) } template -inline typename boost::enable_if, +inline typename boost::enable_if, typename difference_type_of >::type>::type length(const Type& object) { @@ -1071,7 +1075,7 @@ length(const Type& object) //- iterative_size ------------------------------------------------------------- template -inline typename enable_if, +inline typename enable_if, typename size_type_of >::type>::type iterative_size(const Type&) { @@ -1095,10 +1099,10 @@ hull(Type left, const Type& right) else if(icl::is_empty(left)) return right; - return + return construct ( - (std::min)(lower(left), lower(right), domain_compare()), + (std::min)(lower(left), lower(right), domain_compare()), (std::max)(upper(left), upper(right), domain_compare()) ); } @@ -1114,7 +1118,7 @@ hull(Type left, const Type& right) return dynamic_interval_traits::construct_bounded ( - lower_min(left, right), + lower_min(left, right), upper_max(left, right) ); } @@ -1123,7 +1127,7 @@ hull(Type left, const Type& right) //= Subtraction //============================================================================== //- left_subtract -------------------------------------------------------------- -/** subtract \c left_minuend from the \c right interval on it's left side. +/** subtract \c left_minuend from the \c right interval on it's left side. Return the difference: The part of \c right right of \c left_minuend. \code right_over = right - left_minuend; //on the left. @@ -1137,7 +1141,7 @@ typename boost::enable_if, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; return construct(upper(left_minuend), upper(right)); } @@ -1147,7 +1151,7 @@ typename boost::enable_if, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; else if(upper_less_equal(right, left_minuend)) return identity_element::value(); @@ -1159,7 +1163,7 @@ typename boost::enable_if, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; return construct(domain_prior(upper(left_minuend)), upper(right)); } @@ -1169,14 +1173,14 @@ typename boost::enable_if, Type>::type left_subtract(Type right, const Type& left_minuend) { if(exclusive_less(left_minuend, right)) - return right; + return right; return dynamic_interval_traits::construct_bounded ( reverse_bounded_upper(left_minuend), bounded_upper(right) ); } //- right_subtract ------------------------------------------------------------- -/** subtract \c right_minuend from the \c left interval on it's right side. +/** subtract \c right_minuend from the \c left interval on it's right side. Return the difference: The part of \c left left of \c right_minuend. \code left_over = left - right_minuend; //on the right side. @@ -1190,7 +1194,7 @@ typename boost::enable_if, Type>::type right_subtract(Type left, const Type& right_minuend) { if(exclusive_less(left, right_minuend)) - return left; + return left; return construct(lower(left), lower(right_minuend)); } @@ -1221,7 +1225,7 @@ typename boost::enable_if, Type>::type right_subtract(Type left, const Type& right_minuend) { if(exclusive_less(left, right_minuend)) - return left; + return left; return dynamic_interval_traits::construct_bounded ( bounded_lower(left), reverse_bounded_lower(right_minuend) ); @@ -1272,11 +1276,11 @@ operator & (Type left, const Type& right) { if(icl::is_empty(left) || icl::is_empty(right)) return identity_element::value(); - else + else return dynamic_interval_traits::construct_bounded ( - lower_max(left, right), - upper_min(left, right) + lower_max(left, right), + upper_min(left, right) ); } @@ -1285,18 +1289,18 @@ operator & (Type left, const Type& right) template typename boost::enable_if, bool>::type intersects(const Type& left, const Type& right) -{ - return !( icl::is_empty(left) || icl::is_empty(right) - || exclusive_less(left,right) || exclusive_less(right,left)); +{ + return !( icl::is_empty(left) || icl::is_empty(right) + || exclusive_less(left,right) || exclusive_less(right,left)); } //- disjoint ------------------------------------------------------------------- template typename boost::enable_if, bool>::type disjoint(const Type& left, const Type& right) -{ - return icl::is_empty(left) || icl::is_empty(right) - || exclusive_less(left,right) || exclusive_less(right,left); +{ + return icl::is_empty(left) || icl::is_empty(right) + || exclusive_less(left,right) || exclusive_less(right,left); } //============================================================================== @@ -1362,7 +1366,7 @@ inner_complement(const Type& left, const Type& right) template inline typename boost::enable_if, Type>::type between(const Type& left, const Type& right) -{ +{ return inner_complement(left, right); } @@ -1375,7 +1379,7 @@ template typename boost:: enable_if< mpl::and_< is_interval , has_difference::domain_type> - , is_discrete::domain_type> + , is_discrete::domain_type> > , typename difference_type_of >::type>::type distance(const Type& x1, const Type& x2) @@ -1396,7 +1400,7 @@ template typename boost:: enable_if< mpl::and_< is_interval , has_difference::domain_type> - , is_continuous::domain_type> + , is_continuous::domain_type> > , typename difference_type_of >::type>::type distance(const Type& x1, const Type& x2) @@ -1430,9 +1434,9 @@ left_bracket(const Type&) { return "["; } template typename boost::enable_if, std::string>::type -left_bracket(const Type& object) -{ - return left_bracket(object.bounds()); +left_bracket(const Type& object) +{ + return left_bracket(object.bounds()); } //------------------------------------------------------------------------------ @@ -1450,28 +1454,27 @@ right_bracket(const Type&) { return "]"; } template typename boost::enable_if, std::string>::type -right_bracket(const Type& object) -{ - return right_bracket(object.bounds()); +right_bracket(const Type& object) +{ + return right_bracket(object.bounds()); } //------------------------------------------------------------------------------ template -typename boost::enable_if, +typename boost::enable_if, std::basic_ostream >::type& operator << (std::basic_ostream &stream, Type const& object) { if(boost::icl::is_empty(object)) - return stream << left_bracket(object) << right_bracket(object); + return stream << left_bracket(object) << right_bracket(object); else - return stream << left_bracket(object) - << interval_traits::lower(object) - << "," - << interval_traits::upper(object) + return stream << left_bracket(object) + << interval_traits::lower(object) + << "," + << interval_traits::upper(object) << right_bracket(object) ; } }} // namespace icl boost #endif - diff --git a/boost/icl/concept/interval_associator.hpp b/boost/icl/concept/interval_associator.hpp index 5ffbe62..12377bb 100644 --- a/boost/icl/concept/interval_associator.hpp +++ b/boost/icl/concept/interval_associator.hpp @@ -8,6 +8,7 @@ Copyright (c) 2010-2010: Joachim Faulhaber #ifndef BOOST_ICL_CONCEPT_INTERVAL_ASSOCIATOR_HPP_JOFA_100920 #define BOOST_ICL_CONCEPT_INTERVAL_ASSOCIATOR_HPP_JOFA_100920 +#include #include #include #include @@ -1161,6 +1162,30 @@ elements_end(const Type& object) return typename Type::element_const_iterator(object.end()); } +template +typename enable_if + + , mpl::not_ > >, +iterator_range >::type +elements(Type& object) +{ + return + make_iterator_range( typename Type::element_iterator(object.begin()) + , typename Type::element_iterator(object.end()) ); +} + +template +typename enable_if + + , mpl::not_ > >, +iterator_range >::type +elements(Type const& object) +{ + return + make_iterator_range( typename Type::element_const_iterator(object.begin()) + , typename Type::element_const_iterator(object.end()) ); +} + //-------------------------------------------------------------------------- //- Reverse //-------------------------------------------------------------------------- diff --git a/boost/icl/interval_base_map.hpp b/boost/icl/interval_base_map.hpp index f61990b..f464a6a 100644 --- a/boost/icl/interval_base_map.hpp +++ b/boost/icl/interval_base_map.hpp @@ -18,6 +18,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #include #include #include +#include #include diff --git a/boost/icl/interval_base_set.hpp b/boost/icl/interval_base_set.hpp index 045b23c..d693bd4 100644 --- a/boost/icl/interval_base_set.hpp +++ b/boost/icl/interval_base_set.hpp @@ -20,7 +20,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #endif #include -#include +#include #include #include #include @@ -40,14 +40,14 @@ namespace boost{namespace icl { /** \brief Implements a set as a set of intervals (base class) */ -template +template < typename SubType, - typename DomainT, + typename DomainT, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT), ICL_INTERVAL(ICL_COMPARE) Interval = ICL_INTERVAL_INSTANCE(ICL_INTERVAL_DEFAULT, DomainT, Compare), ICL_ALLOC Alloc = std::allocator -> +> class interval_base_set { public: @@ -115,7 +115,7 @@ public: /// allocator type of the corresponding element set typedef Alloc domain_allocator_type; - /// Container type for the implementation + /// Container type for the implementation typedef typename ICL_IMPL_SPACE::set ImplSetT; /// key type of the implementing container @@ -144,15 +144,15 @@ public: typedef typename ImplSetT::const_reverse_iterator const_reverse_iterator; /// element iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator element_iterator; + typedef boost::icl::element_iterator element_iterator; /// element const iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator element_const_iterator; + typedef boost::icl::element_iterator element_const_iterator; /// element reverse iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator element_reverse_iterator; + typedef boost::icl::element_iterator element_reverse_iterator; /// element const reverse iterator: Depreciated, see documentation. - typedef boost::icl::element_iterator element_const_reverse_iterator; + typedef boost::icl::element_iterator element_const_reverse_iterator; - BOOST_STATIC_CONSTANT(int, fineness = 0); + BOOST_STATIC_CONSTANT(int, fineness = 0); public: //========================================================================== @@ -181,20 +181,20 @@ public: } /** Move assignment operator */ - interval_base_set& operator = (interval_base_set src) + interval_base_set& operator = (interval_base_set src) { //call by value sice 'src' is a "sink value" this->_set = boost::move(src._set); - return *this; + return *this; } //========================================================================== # else /** Copy assignment operator */ - interval_base_set& operator = (const interval_base_set& src) - { + interval_base_set& operator = (const interval_base_set& src) + { this->_set = src._set; - return *this; + return *this; } # endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES @@ -220,9 +220,9 @@ public: } /** Size of the iteration over this container */ - std::size_t iterative_size()const - { - return _set.size(); + std::size_t iterative_size()const + { + return _set.size(); } //========================================================================== @@ -231,15 +231,15 @@ public: /** Find the interval, that contains element \c key_value */ const_iterator find(const element_type& key_value)const - { + { return icl::find(*this, key_value); - //CL return this->_set.find(icl::singleton(key)); + //CL return this->_set.find(icl::singleton(key)); } /** Find the first interval, that collides with interval \c key_interval */ const_iterator find(const interval_type& key_interval)const - { - return this->_set.find(key_interval); + { + return this->_set.find(key_interval); } //========================================================================== @@ -247,23 +247,23 @@ public: //========================================================================== /** Add a single element \c key to the set */ - SubType& add(const element_type& key) + SubType& add(const element_type& key) { return icl::add(*that(), key); } /** Add an interval of elements \c inter_val to the set */ - SubType& add(const segment_type& inter_val) + SubType& add(const segment_type& inter_val) { _add(inter_val); return *that(); } - /** Add an interval of elements \c inter_val to the set. Iterator - \c prior_ is a hint to the position \c inter_val can be + /** Add an interval of elements \c inter_val to the set. Iterator + \c prior_ is a hint to the position \c inter_val can be inserted after. */ - iterator add(iterator prior_, const segment_type& inter_val) - { + iterator add(iterator prior_, const segment_type& inter_val) + { return _add(prior_, inter_val); } @@ -272,35 +272,35 @@ public: //========================================================================== /** Subtract a single element \c key from the set */ - SubType& subtract(const element_type& key) - { + SubType& subtract(const element_type& key) + { return icl::subtract(*that(), key); } /** Subtract an interval of elements \c inter_val from the set */ - SubType& subtract(const segment_type& inter_val); + SubType& subtract(const segment_type& inter_val); //========================================================================== //= Insertion //========================================================================== /** Insert an element \c key into the set */ - SubType& insert(const element_type& key) - { - return add(key); + SubType& insert(const element_type& key) + { + return add(key); } /** Insert an interval of elements \c inter_val to the set */ - SubType& insert(const segment_type& inter_val) - { - return add(inter_val); + SubType& insert(const segment_type& inter_val) + { + return add(inter_val); } - /** Insert an interval of elements \c inter_val to the set. Iterator - \c prior_ is a hint to the position \c inter_val can be + /** Insert an interval of elements \c inter_val to the set. Iterator + \c prior_ is a hint to the position \c inter_val can be inserted after. */ - iterator insert(iterator prior_, const segment_type& inter_val) - { - return add(prior_, inter_val); + iterator insert(iterator prior_, const segment_type& inter_val) + { + return add(prior_, inter_val); } @@ -309,27 +309,27 @@ public: //= Erasure //========================================================================== /** Erase an element \c key from the set */ - SubType& erase(const element_type& key) - { - return subtract(key); + SubType& erase(const element_type& key) + { + return subtract(key); } /** Erase an interval of elements \c inter_val from the set */ - SubType& erase(const segment_type& inter_val) - { - return subtract(inter_val); + SubType& erase(const segment_type& inter_val) + { + return subtract(inter_val); } /** Erase the interval that iterator \c position points to. */ void erase(iterator position) - { - _set.erase(position); + { + _set.erase(position); } /** Erase all intervals in the range [first,past) of iterators. */ void erase(iterator first, iterator past) - { - _set.erase(first, past); + { + _set.erase(first, past); } //========================================================================== @@ -373,16 +373,16 @@ public: { return _set.upper_bound(interval); } std::pair equal_range(const key_type& interval) - { + { return std::pair - (_set.lower_bound(interval), _set.upper_bound(interval)); + (_set.lower_bound(interval), _set.upper_bound(interval)); } - std::pair + std::pair equal_range(const key_type& interval)const - { + { return std::pair - (_set.lower_bound(interval), _set.upper_bound(interval)); + (_set.lower_bound(interval), _set.upper_bound(interval)); } private: @@ -437,7 +437,7 @@ inline void interval_base_set if(!icl::is_empty(lead_gap)) // [lead_gap--- . . . // [prior_) [-- it_ ... - this->_set.insert(prior(it_), lead_gap); + this->_set.insert(cyclic_prior(*this, it_), lead_gap); // . . . --------- . . . addend interval // [-- it_ --) has a common part with the first overval @@ -470,7 +470,7 @@ inline void interval_base_set // [lead_gap--- . . . // [prior_) [-- it_ ... this->_set.insert(prior_, lead_gap); - + interval_type end_gap = left_subtract(inter_val, cur_itv); if(!icl::is_empty(end_gap)) // [---------------end_gap) @@ -495,12 +495,12 @@ inline void interval_base_set //= Addition //============================================================================== template -inline typename interval_base_set::iterator +inline typename interval_base_set::iterator interval_base_set ::_add(const segment_type& addend) { typedef typename interval_base_set::iterator iterator; - if(icl::is_empty(addend)) + if(icl::is_empty(addend)) return this->_set.end(); std::pair insertion = this->_set.insert(addend); @@ -515,7 +515,7 @@ inline typename interval_base_set::itera } template -inline typename interval_base_set::iterator +inline typename interval_base_set::iterator interval_base_set ::_add(iterator prior_, const segment_type& addend) { @@ -541,11 +541,11 @@ template ::subtract(const segment_type& minuend) { - if(icl::is_empty(minuend)) + if(icl::is_empty(minuend)) return *that(); std::pair exterior = equal_range(minuend); - if(exterior.first == exterior.second) + if(exterior.first == exterior.second) return *that(); iterator first_ = exterior.first; @@ -553,7 +553,7 @@ inline SubType& interval_base_set iterator last_ = prior(end_); interval_type left_resid = right_subtract(*first_, minuend); - interval_type right_resid; + interval_type right_resid; if(first_ != end_) right_resid = left_subtract(*last_ , minuend); @@ -574,17 +574,17 @@ inline SubType& interval_base_set template struct is_set > -{ +{ typedef is_set > type; - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true); }; template struct is_interval_container > -{ +{ typedef is_interval_container > type; - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true); }; @@ -592,5 +592,3 @@ struct is_interval_container class add_iterator - : public std::iterator { public: /// The container's type. typedef ContainerT container_type; typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; /** An add_iterator is constructed with a container and a position that has to be maintained. */ @@ -57,12 +60,15 @@ inline add_iterator adder(ContainerT& cont, IteratorT iter_) /** \brief Performes an insertion using a container's memberfunction add, when operator= is called. */ template class insert_iterator - : public std::iterator { public: /// The container's type. typedef ContainerT container_type; typedef std::output_iterator_tag iterator_category; + typedef void value_type; + typedef void difference_type; + typedef void pointer; + typedef void reference; /** An insert_iterator is constructed with a container and a position that has to be maintained. */ diff --git a/boost/icl/map.hpp b/boost/icl/map.hpp index 6f3c851..3877745 100644 --- a/boost/icl/map.hpp +++ b/boost/icl/map.hpp @@ -22,7 +22,7 @@ Copyright (c) 2007-2011: Joachim Faulhaber #endif #include -#include +#include #include #include #include @@ -32,10 +32,10 @@ Copyright (c) 2007-2011: Joachim Faulhaber #include #include #include -#include #include #include +#include namespace boost{namespace icl { @@ -46,7 +46,7 @@ struct partial_absorber enum { is_total = false }; }; -template<> +template<> inline std::string type_to_string::apply() { return "@0"; } struct partial_enricher @@ -55,7 +55,7 @@ struct partial_enricher enum { is_total = false }; }; -template<> +template<> inline std::string type_to_string::apply() { return "e0"; } struct total_absorber @@ -64,7 +64,7 @@ struct total_absorber enum { is_total = true }; }; -template<> +template<> inline std::string type_to_string::apply() { return "^0"; } struct total_enricher @@ -73,23 +73,23 @@ struct total_enricher enum { is_total = true }; }; -template<> +template<> inline std::string type_to_string::apply() { return "e^0"; } /** \brief Addable, subractable and intersectable maps */ -template +template < - typename DomainT, - typename CodomainT, + typename DomainT, + typename CodomainT, class Traits = icl::partial_absorber, ICL_COMPARE Compare = ICL_COMPARE_INSTANCE(ICL_COMPARE_DEFAULT, DomainT), ICL_COMBINE Combine = ICL_COMBINE_INSTANCE(icl::inplace_plus, CodomainT), - ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT), - ICL_ALLOC Alloc = std::allocator + ICL_SECTION Section = ICL_SECTION_INSTANCE(icl::inter_section, CodomainT), + ICL_ALLOC Alloc = std::allocator > -class map: private ICL_IMPL_SPACE::map > > { public: @@ -117,7 +117,7 @@ public: typedef typename inverse::type inverse_codomain_combine; typedef typename mpl::if_ - , ICL_SECTION_CODOMAIN(Section,CodomainT) + , ICL_SECTION_CODOMAIN(Section,CodomainT) , codomain_combine >::type codomain_intersect; typedef typename inverse::type inverse_codomain_intersect; @@ -129,10 +129,10 @@ public: BOOST_STATIC_CONSTANT(bool, _total = (Traits::is_total)); BOOST_STATIC_CONSTANT(bool, _absorbs = (Traits::absorbs_identities)); - BOOST_STATIC_CONSTANT(bool, + BOOST_STATIC_CONSTANT(bool, total_invertible = (mpl::and_, has_inverse >::value)); - typedef on_absorbtion + typedef on_absorbtion on_identity_absorbtion; public: @@ -148,11 +148,11 @@ public: typedef typename base_type::const_reverse_iterator const_reverse_iterator; public: - BOOST_STATIC_CONSTANT(bool, - is_total_invertible = ( Traits::is_total + BOOST_STATIC_CONSTANT(bool, + is_total_invertible = ( Traits::is_total && has_inverse::value)); - BOOST_STATIC_CONSTANT(int, fineness = 4); + BOOST_STATIC_CONSTANT(int, fineness = 4); public: //========================================================================== @@ -170,11 +170,11 @@ public: template map(InputIterator first, InputIterator past) - : base_type(first,past){} + : base_type(first,past){} template map(InputIterator first, InputIterator past, const key_compare& comp) - : base_type(first,past,comp) + : base_type(first,past,comp) {} map(const map& src) @@ -187,8 +187,8 @@ public: } explicit map(const element_type& key_value_pair): base_type::map() - { - insert(key_value_pair); + { + insert(key_value_pair); } # ifndef BOOST_ICL_NO_CXX11_RVALUE_REFERENCES @@ -205,19 +205,19 @@ public: BOOST_CONCEPT_ASSERT((EqualComparableConcept)); } - map& operator = (map src) - { + map& operator = (map src) + { base_type::operator=(boost::move(src)); - return *this; - } + return *this; + } //========================================================================== # else - map& operator = (const map& src) - { + map& operator = (const map& src) + { base_type::operator=(src); - return *this; - } + return *this; + } # endif // BOOST_ICL_NO_CXX11_RVALUE_REFERENCES @@ -254,10 +254,10 @@ public: //========================================================================== template - bool contains(const SubObject& sub)const + bool contains(const SubObject& sub)const { return icl::contains(*this, sub); } - bool within(const map& super)const + bool within(const map& super)const { return icl::contains(super, *this); } //========================================================================== @@ -275,7 +275,7 @@ public: /** Total select function. */ codomain_type operator()(const domain_type& key)const { - const_iterator it = find(key); + const_iterator it = find(key); return it==end() ? identity_element::value() : it->second; } @@ -283,20 +283,20 @@ public: //========================================================================== //= Addition //========================================================================== - /** \c add inserts \c value_pair into the map if it's key does - not exist in the map. + /** \c add inserts \c value_pair into the map if it's key does + not exist in the map. If \c value_pairs's key value exists in the map, it's data value is added to the data value already found in the map. */ - map& add(const value_type& value_pair) - { - return _add(value_pair); + map& add(const value_type& value_pair) + { + return _add(value_pair); } /** \c add add \c value_pair into the map using \c prior as a hint to insert \c value_pair after the position \c prior is pointing to. */ - iterator add(iterator prior, const value_type& value_pair) - { - return _add(prior, value_pair); + iterator add(iterator prior, const value_type& value_pair) + { + return _add(prior, value_pair); } //========================================================================== @@ -322,15 +322,15 @@ public: //========================================================================== std::pair insert(const value_type& value_pair) { - if(on_identity_absorbtion::is_absorbable(value_pair.second)) + if(on_identity_absorbtion::is_absorbable(value_pair.second)) return std::pair(end(),true); else return base_type::insert(value_pair); } - + iterator insert(iterator prior, const value_type& value_pair) { - if(on_identity_absorbtion::is_absorbable(value_pair.second)) + if(on_identity_absorbtion::is_absorbable(value_pair.second)) return end(); else return base_type::insert(prior, value_pair); @@ -346,7 +346,7 @@ public: /** With key_value_pair = (k,v) set value \c v for key \c k */ map& set(const element_type& key_value_pair) - { + { return icl::set_at(*this, key_value_pair); } @@ -354,7 +354,7 @@ public: Erase only if, the exact value content \c val is stored for the given key. */ size_type erase(const element_type& key_value_pair) { - return icl::erase(*this, key_value_pair); + return icl::erase(*this, key_value_pair); } //========================================================================== @@ -400,7 +400,7 @@ private: if(it_ != end()) { section.template _add(*it_); - section.template _add(operand); + section.template _add(operand); } } @@ -441,7 +441,7 @@ private: template struct on_definedness { - static void add_intersection(Type& section, const Type& object, + static void add_intersection(Type& section, const Type& object, const element_type& operand) { object.total_add_intersection(section, operand); } }; @@ -449,7 +449,7 @@ private: template struct on_definedness { - static void add_intersection(Type& section, const Type& object, + static void add_intersection(Type& section, const Type& object, const element_type& operand) { object.partial_add_intersection(section, operand); } }; @@ -465,7 +465,7 @@ private: template struct on_codomain_model { // !codomain_is_set, !absorbs_identities - static void subtract(Type&, typename Type::iterator it_, + static void subtract(Type&, typename Type::iterator it_, const typename Type::codomain_type& ) { (*it_).second = identity_element::value(); } }; @@ -473,7 +473,7 @@ private: template struct on_codomain_model { // !codomain_is_set, absorbs_identities - static void subtract(Type& object, typename Type::iterator it_, + static void subtract(Type& object, typename Type::iterator it_, const typename Type::codomain_type& ) { object.erase(it_); } }; @@ -482,10 +482,10 @@ private: struct on_codomain_model { // !codomain_is_set, !absorbs_identities typedef typename Type::inverse_codomain_intersect inverse_codomain_intersect; - static void subtract(Type&, typename Type::iterator it_, + static void subtract(Type&, typename Type::iterator it_, const typename Type::codomain_type& co_value) - { - inverse_codomain_intersect()((*it_).second, co_value); + { + inverse_codomain_intersect()((*it_).second, co_value); } }; @@ -493,10 +493,10 @@ private: struct on_codomain_model { // !codomain_is_set, absorbs_identities typedef typename Type::inverse_codomain_intersect inverse_codomain_intersect; - static void subtract(Type& object, typename Type::iterator it_, + static void subtract(Type& object, typename Type::iterator it_, const typename Type::codomain_type& co_value) - { - inverse_codomain_intersect()((*it_).second, co_value); + { + inverse_codomain_intersect()((*it_).second, co_value); if((*it_).second == identity_element::value()) object.erase(it_); } @@ -522,7 +522,7 @@ private: typedef typename Type::codomain_type codomain_type; static void flip(Type& object, const element_type& operand) - { + { object.add(operand); ICL_FORALL(typename Type, it_, object) (*it_).second = identity_element::value(); @@ -588,7 +588,7 @@ map& if(on_absorbtion_::is_absorbable(co_val)) return *this; - std::pair insertion + std::pair insertion = base_type::insert(value_type(addend.first, version()(co_val))); if(!insertion.second) @@ -616,8 +616,8 @@ typename map::iterator if(on_absorbtion_::is_absorbable(co_val)) return end(); - iterator inserted_ - = base_type::insert(prior_, + iterator inserted_ + = base_type::insert(prior_, value_type(addend.first, Combiner::identity_element())); Combiner()((*inserted_).second, addend.second); @@ -658,30 +658,30 @@ map& //----------------------------------------------------------------------------- template struct is_map > -{ +{ typedef is_map > type; - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true); }; template struct has_inverse > -{ +{ typedef has_inverse > type; - BOOST_STATIC_CONSTANT(bool, value = (has_inverse::value)); + BOOST_STATIC_CONSTANT(bool, value = (has_inverse::value)); }; template struct absorbs_identities > -{ +{ typedef absorbs_identities type; - BOOST_STATIC_CONSTANT(int, value = Traits::absorbs_identities); + BOOST_STATIC_CONSTANT(int, value = Traits::absorbs_identities); }; template struct is_total > -{ +{ typedef is_total type; - BOOST_STATIC_CONSTANT(int, value = Traits::is_total); + BOOST_STATIC_CONSTANT(int, value = Traits::is_total); }; template @@ -691,7 +691,7 @@ struct type_to_string::apply() + "," + type_to_string::apply() + "," - + type_to_string::apply() +">"; + + type_to_string::apply() +">"; } }; @@ -700,4 +700,3 @@ struct type_to_string #include #include +#include #include namespace boost{ namespace icl @@ -24,7 +25,7 @@ namespace boost{ namespace icl //-------------------------------------------------------------------------- template - struct has_rep_type + struct has_rep_type : mpl::bool_::value> {}; @@ -33,14 +34,14 @@ namespace boost{ namespace icl : mpl::bool_::value> { typedef represents type; - BOOST_STATIC_CONSTANT(bool, + BOOST_STATIC_CONSTANT(bool, value = (mpl::and_< has_rep_type - , is_same >::value) + , boost::is_same >::value) ); }; //-------------------------------------------------------------------------- - template + template struct get_rep_type; template @@ -56,15 +57,13 @@ namespace boost{ namespace icl }; //-------------------------------------------------------------------------- - template + template struct rep_type_of - { - typedef typename + { + typedef typename get_rep_type::value>::type type; }; }} // namespace boost icl #endif - - diff --git a/boost/icl/type_traits/value_size.hpp b/boost/icl/type_traits/value_size.hpp index 4a37f11..94ba80a 100644 --- a/boost/icl/type_traits/value_size.hpp +++ b/boost/icl/type_traits/value_size.hpp @@ -11,7 +11,7 @@ Copyright (c) 1999-2006: Cortex Software GmbH, Kantstrasse 57, Berlin #define BOOST_ICL_VALUE_SIZE_HPP_JOFA_081004 namespace boost{ namespace icl -{ +{ template Type abs(Type val) { return val < 0 ? -val : val; } @@ -33,13 +33,13 @@ struct value_size }; -template<> inline std::size_t value_size::apply(const int& value) +template<> inline std::size_t value_size::apply(const int& value) { return abs(value); } -template<> inline std::size_t value_size::apply(const double& value) +template<> inline std::size_t value_size::apply(const double& value) { return static_cast(abs(value)); } -template +template inline std::size_t value_size::apply(const Type& value) { return icl::iterative_size(value); } @@ -48,5 +48,3 @@ inline std::size_t value_size::apply(const Type& value) }} // namespace boost icl #endif - - diff --git a/boost/intrusive/detail/config_begin.hpp b/boost/intrusive/detail/config_begin.hpp index cef8616..8bd57a3 100644 --- a/boost/intrusive/detail/config_begin.hpp +++ b/boost/intrusive/detail/config_begin.hpp @@ -17,33 +17,20 @@ #ifdef BOOST_MSVC #pragma warning (push) - // - //'function' : resolved overload was found by argument-dependent lookup - //A function found by argument-dependent lookup (Koenig lookup) was eventually - //chosen by overload resolution. - // - //In Visual C++ .NET and earlier compilers, a different function would have - //been called. To pick the original function, use an explicitly qualified name. - // - - //warning C4275: non dll-interface class 'x' used as base for - //dll-interface class 'Y' - #pragma warning (disable : 4275) - //warning C4251: 'x' : class 'y' needs to have dll-interface to - //be used by clients of class 'z' - #pragma warning (disable : 4251) - #pragma warning (disable : 4675) - #pragma warning (disable : 4996) - #pragma warning (disable : 4503) + #pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier" + #pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2" + #pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter + #pragma warning (disable : 4996) // "function": was declared deprecated + #pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated #pragma warning (disable : 4284) // odd return type for operator-> #pragma warning (disable : 4244) // possible loss of data #pragma warning (disable : 4521) ////Disable "multiple copy constructors specified" #pragma warning (disable : 4127) //conditional expression is constant - #pragma warning (disable : 4146) + #pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data #pragma warning (disable : 4541) //'typeid' used on polymorphic type 'boost::exception' with /GR- #pragma warning (disable : 4512) //'typeid' used on polymorphic type 'boost::exception' with /GR- - #pragma warning (disable : 4522) + #pragma warning (disable : 4522) // "class" : multiple assignment operators specified #pragma warning (disable : 4706) //assignment within conditional expression #pragma warning (disable : 4710) // function not inlined #pragma warning (disable : 4714) // "function": marked as __forceinline not inlined diff --git a/boost/intrusive/detail/pointer_element.hpp b/boost/intrusive/detail/pointer_element.hpp deleted file mode 100644 index dd26e3c..0000000 --- a/boost/intrusive/detail/pointer_element.hpp +++ /dev/null @@ -1,168 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-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) -// -// See http://www.boost.org/libs/intrusive for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP -#define BOOST_INTRUSIVE_DETAIL_POINTER_ELEMENT_HPP - -#ifndef BOOST_CONFIG_HPP -# include -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#ifndef BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP -#include -#endif //BOOST_INTRUSIVE_DETAIL_WORKAROUND_HPP - -namespace boost { -namespace intrusive { -namespace detail{ - -////////////////////// -//struct first_param -////////////////////// - -template struct first_param -{ typedef void type; }; - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template