diff options
author | Remko Tronçon <git@el-tramo.be> | 2012-12-23 13:16:26 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2012-12-23 14:43:26 (GMT) |
commit | 491ddd570a752cf9bda85933bed0c6942e39b1f9 (patch) | |
tree | 10c25c1be8cc08d0497df1dccd56a10fbb30beee /3rdParty/Boost/src/boost/container | |
parent | da7d7a0ca71b80281aa9ff2526290b61ccb0cc60 (diff) | |
download | swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.zip swift-491ddd570a752cf9bda85933bed0c6942e39b1f9.tar.bz2 |
Update Boost to 1.52.0.
Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77
Diffstat (limited to '3rdParty/Boost/src/boost/container')
13 files changed, 3495 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/container/allocator_traits.hpp b/3rdParty/Boost/src/boost/container/allocator_traits.hpp new file mode 100644 index 0000000..11d948b --- /dev/null +++ b/3rdParty/Boost/src/boost/container/allocator_traits.hpp @@ -0,0 +1,385 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP +#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/intrusive/pointer_traits.hpp> +#include <boost/intrusive/detail/memory_util.hpp> +#include <boost/container/detail/memory_util.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/move/move.hpp> +#include <limits> //numeric_limits<>::max() +#include <new> //placement new +#include <memory> //std::allocator +#include <boost/container/detail/preprocessor.hpp> + +///@cond + +namespace boost { +namespace container { +namespace container_detail { + +//workaround needed for C++03 compilers with no construct() +//supporting rvalue references +template<class A> +struct is_std_allocator +{ static const bool value = false; }; + +template<class T> +struct is_std_allocator< std::allocator<T> > +{ static const bool value = true; }; + +} //namespace container_detail { + +///@endcond + +//! The class template allocator_traits supplies a uniform interface to all allocator types. +//! This class is a C++03-compatible implementation of std::allocator_traits +template <typename Alloc> +struct allocator_traits +{ + //allocator_type + typedef Alloc allocator_type; + //value_type + typedef typename Alloc::value_type value_type; + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! Alloc::pointer if such a type exists; otherwise, value_type* + //! + typedef unspecified pointer; + //! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const + //! + typedef see_documentation const_pointer; + //! Non-standard extension + //! Alloc::reference if such a type exists; otherwise, value_type& + typedef see_documentation reference; + //! Non-standard extension + //! Alloc::const_reference if such a type exists ; otherwise, const value_type& + typedef see_documentation const_reference; + //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>. + //! + typedef see_documentation void_pointer; + //! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const + //! + typedef see_documentation const_void_pointer; + //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type. + //! + typedef see_documentation difference_type; + //! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type + //! + typedef see_documentation size_type; + //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_copy_assignment; + //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_move_assignment; + //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_swap; + //! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args> + //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or + //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + //! + //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator + //! deduced by previously detailed rules. + template <class T> using rebind_alloc = see_documentation; + + //! In C++03 compilers `rebind_traits` is a struct derived from + //! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is + //! the allocator deduced by rules explained in `rebind_alloc`. + template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >; + + //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. + //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`. + template <class T> + struct portable_rebind_alloc + { typedef see_documentation type; }; + #else + //pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + pointer, value_type*) + pointer; + //const_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + const_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<const value_type>) + const_pointer; + //reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + reference, typename container_detail::unvoid<value_type>::type&) + reference; + //const_reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + const_reference, const typename container_detail::unvoid<value_type>::type&) + const_reference; + //void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + void_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<void>) + void_pointer; + //const_void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<const void>) + const_void_pointer; + //difference_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + difference_type, std::ptrdiff_t) + difference_type; + //size_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + size_type, std::size_t) + size_type; + //propagate_on_container_copy_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_copy_assignment, boost::false_type) + propagate_on_container_copy_assignment; + //propagate_on_container_move_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_move_assignment, boost::false_type) + propagate_on_container_move_assignment; + //propagate_on_container_swap + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_swap, boost::false_type) + propagate_on_container_swap; + + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + //C++11 + template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder<Alloc, T>::type; + template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; + #else // #if !defined(BOOST_NO_TEMPLATE_ALIASES) + //Some workaround for C++03 or C++11 compilers with no template aliases + template <typename T> + struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type + { + typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base; + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template <typename... Args> + rebind_alloc(BOOST_FWD_REF(Args)... args) + : Base(boost::forward<Args>(args)...) + {} + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + #define BOOST_PP_LOCAL_MACRO(n) \ + BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ + rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + : Base(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ + {} \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + }; + + template <typename T> + struct rebind_traits + : allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type> + {}; + #endif // #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class T> + struct portable_rebind_alloc + { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; }; + #endif //BOOST_CONTAINER_DOXYGEN_INVOKED + + //! <b>Returns</b>: `a.allocate(n)` + //! + static pointer allocate(Alloc &a, size_type n) + { return a.allocate(n); } + + //! <b>Returns</b>: `a.deallocate(p, n)` + //! + //! <b>Throws</b>: Nothing + static void deallocate(Alloc &a, pointer p, size_type n) + { return a.deallocate(p, n); } + + //! <b>Effects</b>: calls `a.allocate(n, p)` if that call is well-formed; + //! otherwise, invokes `a.allocate(n)` + static pointer allocate(Alloc &a, size_type n, const_void_pointer p) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_allocate + <Alloc, const size_type, const const_void_pointer>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_allocate(flag, a, n, p); + } + + //! <b>Effects</b>: calls `a.destroy(p)` if that call is well-formed; + //! otherwise, invokes `p->~T()`. + template<class T> + static void destroy(Alloc &a, T*p) + { + typedef T* destroy_pointer; + const bool value = boost::container::container_detail:: + has_member_function_callable_with_destroy + <Alloc, const destroy_pointer>::value; + ::boost::integral_constant<bool, value> flag; + allocator_traits::priv_destroy(flag, a, p); + } + + //! <b>Returns</b>: `a.max_size()` if that expression is well-formed; otherwise, + //! `numeric_limits<size_type>::max()`. + static size_type max_size(const Alloc &a) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_max_size + <const Alloc>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_max_size(flag, a); + } + + //! <b>Returns</b>: `a.select_on_container_copy_construction()` if that expression is well-formed; + //! otherwise, a. + static Alloc select_on_container_copy_construction(const Alloc &a) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_select_on_container_copy_construction + <const Alloc>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_select_on_container_copy_construction(flag, a); + } + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed; + //! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)` + template <class T, class ...Args> + static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args) + { + ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; + allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...); + } + #endif + ///@cond + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + private: + static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p) + { return a.allocate(n, p); } + + static pointer priv_allocate(boost::false_type, Alloc &a, size_type n, const_void_pointer) + { return allocator_traits::allocate(a, n); } + + template<class T> + static void priv_destroy(boost::true_type, Alloc &a, T* p) + { a.destroy(p); } + + template<class T> + static void priv_destroy(boost::false_type, Alloc &, T* p) + { p->~T(); (void)p; } + + static size_type priv_max_size(boost::true_type, const Alloc &a) + { return a.max_size(); } + + static size_type priv_max_size(boost::false_type, const Alloc &) + { return (std::numeric_limits<size_type>::max)(); } + + static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a) + { return a.select_on_container_copy_construction(); } + + static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) + { return a; } + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template<class T, class ...Args> + static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_construct + < Alloc, T*, Args... >::value; + ::boost::integral_constant<bool, value> flag; + priv_construct_dispatch2(flag, a, p, ::boost::forward<Args>(args)...); + } + + template<class T, class ...Args> + static void priv_construct(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { + priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward<Args>(args)...); + } + + template<class T, class ...Args> + static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { a.construct( p, ::boost::forward<Args>(args)...); } + + template<class T, class ...Args> + static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args) + { ::new((void*)p) T(::boost::forward<Args>(args)...); } + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + public: + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void construct(Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + { \ + ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; \ + allocator_traits::priv_construct(flag, a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ + } \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + private: + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct(boost::false_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { \ + const bool value = \ + boost::container::container_detail::has_member_function_callable_with_construct \ + < Alloc, T* BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_FWD_TYPE, _) >::value; \ + ::boost::integral_constant<bool, value> flag; \ + priv_construct_dispatch2(flag, a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ + } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct(boost::true_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { \ + priv_construct_dispatch2(boost::false_type(), a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ + } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { a.construct( p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \ + { ::new((void*)p) T(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + ///@endcond +}; + +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP) diff --git a/3rdParty/Boost/src/boost/container/container_fwd.hpp b/3rdParty/Boost/src/boost/container/container_fwd.hpp new file mode 100644 index 0000000..bdefd81 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/container_fwd.hpp @@ -0,0 +1,173 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP +#define BOOST_CONTAINER_CONTAINER_FWD_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +////////////////////////////////////////////////////////////////////////////// +// Standard predeclarations +////////////////////////////////////////////////////////////////////////////// + +/// @cond + +namespace boost{ +namespace intrusive{ + //Create namespace to avoid compilation errors +}} + +namespace boost{ namespace container{ namespace container_detail{ + +namespace bi = boost::intrusive; + +}}} + +#include <utility> +#include <memory> +#include <functional> +#include <iosfwd> +#include <string> + +/// @endcond + +////////////////////////////////////////////////////////////////////////////// +// Containers +////////////////////////////////////////////////////////////////////////////// + +namespace boost { +namespace container { + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class vector; + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class stable_vector; + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class deque; + +//list class +template <class T + ,class Allocator = std::allocator<T> > +class list; + +//slist class +template <class T + ,class Allocator = std::allocator<T> > +class slist; + +//set class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class set; + +//multiset class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class multiset; + +//map class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<const Key, T> > > +class map; + +//multimap class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<const Key, T> > > +class multimap; + +//flat_set class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class flat_set; + +//flat_multiset class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class flat_multiset; + +//flat_map class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<Key, T> > > +class flat_map; + +//flat_multimap class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<Key, T> > > +class flat_multimap; + +//basic_string class +template <class CharT + ,class Traits = std::char_traits<CharT> + ,class Allocator = std::allocator<CharT> > +class basic_string; + +//! Type used to tag that the input range is +//! guaranteed to be ordered +struct ordered_range_t +{}; + +//! Type used to tag that the input range is +//! guaranteed to be ordered and unique +struct ordered_unique_range_t + : public ordered_range_t +{}; + +//! Value used to tag that the input range is +//! guaranteed to be ordered +static const ordered_range_t ordered_range = ordered_range_t(); + +//! Value used to tag that the input range is +//! guaranteed to be ordered and unique +static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); + +/// @cond + +namespace detail_really_deep_namespace { + +//Otherwise, gcc issues a warning of previously defined +//anonymous_instance and unique_instance +struct dummy +{ + dummy() + { + (void)ordered_range; + (void)ordered_unique_range; + } +}; + +} //detail_really_deep_namespace { + +/// @endcond + +}} //namespace boost { namespace container { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/config_begin.hpp b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp new file mode 100644 index 0000000..83c2cfe --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp @@ -0,0 +1,49 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#define BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#include <boost/config.hpp> + +#endif //BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED + +#ifdef BOOST_MSVC + #ifndef _CRT_SECURE_NO_DEPRECATE + #define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #pragma warning (push) + #pragma warning (disable : 4702) // unreachable code + #pragma warning (disable : 4706) // assignment within conditional expression + #pragma warning (disable : 4127) // conditional expression is constant + #pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4244) // possible loss of data + #pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2" + #pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data + #pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier" + #pragma warning (disable : 4355) // "this" : used in base member initializer list + #pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated + #pragma warning (disable : 4511) // copy constructor could not be generated + #pragma warning (disable : 4512) // assignment operator could not be generated + #pragma warning (disable : 4514) // unreferenced inline removed + #pragma warning (disable : 4521) // Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) // "class" : multiple assignment operators specified + #pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter + #pragma warning (disable : 4710) // function not inlined + #pragma warning (disable : 4711) // function selected for automatic inline expansion + #pragma warning (disable : 4786) // identifier truncated in debug info + #pragma warning (disable : 4996) // "function": was declared deprecated + #pragma warning (disable : 4197) // top-level volatile in cast is ignored + #pragma warning (disable : 4541) // 'typeid' used on polymorphic type 'boost::exception' + // with /GR-; unpredictable behavior may result + #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site + #pragma warning (disable : 4671) // the copy constructor is inaccessible + #pragma warning (disable : 4584) // X is already a base-class of Y +#endif //BOOST_MSVC diff --git a/3rdParty/Boost/src/boost/container/detail/config_end.hpp b/3rdParty/Boost/src/boost/container/detail/config_end.hpp new file mode 100644 index 0000000..3451371 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/config_end.hpp @@ -0,0 +1,17 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined BOOST_MSVC + #pragma warning (pop) + #ifdef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #undef _CRT_SECURE_NO_DEPRECATE + #endif +#endif + diff --git a/3rdParty/Boost/src/boost/container/detail/memory_util.hpp b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp new file mode 100644 index 0000000..c00172c --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp @@ -0,0 +1,77 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/detail/preprocessor.hpp> +#include <boost/intrusive/detail/has_member_function_callable_with.hpp> + + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 2, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 3, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME max_size +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME select_on_container_copy_construction +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS+1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace container { +namespace container_detail { + + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP) diff --git a/3rdParty/Boost/src/boost/container/detail/mpl.hpp b/3rdParty/Boost/src/boost/container/detail/mpl.hpp new file mode 100644 index 0000000..74a1ce0 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/mpl.hpp @@ -0,0 +1,160 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <cstddef> + +namespace boost { +namespace container { +namespace container_detail { + +template <class T, T val> +struct integral_constant +{ + static const T value = val; + typedef integral_constant<T,val> type; +}; + +template< bool C_ > +struct bool_ : integral_constant<bool, C_> +{ + static const bool value = C_; + operator bool() const { return bool_::value; } +}; + +typedef bool_<true> true_; +typedef bool_<false> false_; + +typedef true_ true_type; +typedef false_ false_type; + +typedef char yes_type; +struct no_type +{ + char padding[8]; +}; + +template <bool B, class T = void> +struct enable_if_c { + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +template <class Cond, class T = void> +struct enable_if : public enable_if_c<Cond::value, T> {}; + +template <class Cond, class T = void> +struct disable_if : public enable_if_c<!Cond::value, T> {}; + +template <bool B, class T = void> +struct disable_if_c : public enable_if_c<!B, T> {}; + +template <class T, class U> +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static T trigger(); + public: + enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; +}; + +template< + bool C + , typename T1 + , typename T2 + > +struct if_c +{ + typedef T1 type; +}; + +template< + typename T1 + , typename T2 + > +struct if_c<false,T1,T2> +{ + typedef T2 type; +}; + +template< + typename T1 + , typename T2 + , typename T3 + > +struct if_ +{ + typedef typename if_c<0 != T1::value, T2, T3>::type type; +}; + + +template <class Pair> +struct select1st +// : public std::unary_function<Pair, typename Pair::first_type> +{ + template<class OtherPair> + const typename Pair::first_type& operator()(const OtherPair& x) const + { return x.first; } + + const typename Pair::first_type& operator()(const typename Pair::first_type& x) const + { return x; } +}; + +// identity is an extension: it is not part of the standard. +template <class T> +struct identity +// : public std::unary_function<T,T> +{ + typedef T type; + const T& operator()(const T& x) const + { return x; } +}; + +template<std::size_t S> +struct ls_zeros +{ + static const std::size_t value = (S & std::size_t(1)) ? 0 : (1u + ls_zeros<(S >> 1u)>::value); +}; + +template<> +struct ls_zeros<0> +{ + static const std::size_t value = 0; +}; + +template<> +struct ls_zeros<1> +{ + static const std::size_t value = 0; +}; + +template <typename T> struct unvoid { typedef T type; }; +template <> struct unvoid<void> { struct type { }; }; +template <> struct unvoid<const void> { struct type { }; }; + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP + diff --git a/3rdParty/Boost/src/boost/container/detail/pair.hpp b/3rdParty/Boost/src/boost/container/detail/pair.hpp new file mode 100644 index 0000000..2a20ed1 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/pair.hpp @@ -0,0 +1,353 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include "config_begin.hpp" +#include <boost/container/detail/workaround.hpp> + +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> + +#include <utility> //std::pair + +#include <boost/move/move.hpp> +#include <boost/type_traits/is_class.hpp> + +#ifndef BOOST_CONTAINER_PERFECT_FORWARDING +#include <boost/container/detail/preprocessor.hpp> +#endif + +namespace boost { +namespace container { +namespace container_detail { + +template <class T1, class T2> +struct pair; + +template <class T> +struct is_pair +{ + static const bool value = false; +}; + +template <class T1, class T2> +struct is_pair< pair<T1, T2> > +{ + static const bool value = true; +}; + +template <class T1, class T2> +struct is_pair< std::pair<T1, T2> > +{ + static const bool value = true; +}; + +struct pair_nat; + +struct piecewise_construct_t { }; +static const piecewise_construct_t piecewise_construct = piecewise_construct_t(); + +/* +template <class T1, class T2> +struct pair +{ + template <class U, class V> pair(pair<U, V>&& p); + template <class... Args1, class... Args2> + pair(piecewise_construct_t, tuple<Args1...> first_args, + tuple<Args2...> second_args); + + template <class U, class V> pair& operator=(const pair<U, V>& p); + pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value && + is_nothrow_move_assignable<T2>::value); + template <class U, class V> pair& operator=(pair<U, V>&& p); + + void swap(pair& p) noexcept(noexcept(swap(first, p.first)) && + noexcept(swap(second, p.second))); +}; + +template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); +*/ + + +template <class T1, class T2> +struct pair +{ + private: + BOOST_COPYABLE_AND_MOVABLE(pair) + + public: + typedef T1 first_type; + typedef T2 second_type; + + T1 first; + T2 second; + + //Default constructor + pair() + : first(), second() + {} + + //pair copy assignment + pair(const pair& x) + : first(x.first), second(x.second) + {} + + //pair move constructor + pair(BOOST_RV_REF(pair) p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + template <class D, class S> + pair(const pair<D, S> &p) + : first(p.first), second(p.second) + {} + + template <class D, class S> + pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + //pair from two values + pair(const T1 &t1, const T2 &t2) + : first(t1) + , second(t2) + {} + + template<class U, class V> + pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v) + : first(::boost::forward<U>(u)) + , second(::boost::forward<V>(v)) + {} + + //And now compatibility with std::pair + pair(const std::pair<T1, T2>& x) + : first(x.first), second(x.second) + {} + + template <class D, class S> + pair(const std::pair<D, S>& p) + : first(p.first), second(p.second) + {} + + pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + template <class D, class S> + pair(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + //piecewise_construct missing + //template <class U, class V> pair(pair<U, V>&& p); + //template <class... Args1, class... Args2> + // pair(piecewise_construct_t, tuple<Args1...> first_args, + // tuple<Args2...> second_args); +/* + //Variadic versions + template<class U> + pair(BOOST_CONTAINER_PP_PARAM(U, u), typename container_detail::disable_if + < container_detail::is_pair< typename container_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0) + : first(::boost::forward<U>(u)) + , second() + {} + + #ifdef BOOST_CONTAINER_PERFECT_FORWARDING + + template<class U, class V, class ...Args> + pair(U &&u, V &&v) + : first(::boost::forward<U>(u)) + , second(::boost::forward<V>(v), ::boost::forward<Args>(args)...) + {} + + #else + + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \ + pair(BOOST_CONTAINER_PP_PARAM(U, u) \ + ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + : first(::boost::forward<U>(u)) \ + , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ + {} \ + //! + #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif +*/ + //pair copy assignment + pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p) + { + first = p.first; + second = p.second; + return *this; + } + + //pair move assignment + pair& operator=(BOOST_RV_REF(pair) p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + template <class D, class S> + typename ::boost::container::container_detail::enable_if_c + < !(::boost::container::container_detail::is_same<T1, D>::value && + ::boost::container::container_detail::is_same<T2, S>::value) + , pair &>::type + operator=(const pair<D, S>&p) + { + first = p.first; + second = p.second; + return *this; + } + + template <class D, class S> + typename ::boost::container::container_detail::enable_if_c + < !(::boost::container::container_detail::is_same<T1, D>::value && + ::boost::container::container_detail::is_same<T2, S>::value) + , pair &>::type + operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //std::pair copy assignment + pair& operator=(const std::pair<T1, T2> &p) + { + first = p.first; + second = p.second; + return *this; + } + + template <class D, class S> + pair& operator=(const std::pair<D, S> &p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //std::pair move assignment + pair& operator=(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + template <class D, class S> + pair& operator=(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //swap + void swap(pair& p) + { + using std::swap; + swap(this->first, p.first); + swap(this->second, p.second); + } +}; + +template <class T1, class T2> +inline bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(x.first == y.first && x.second == y.second); } + +template <class T1, class T2> +inline bool operator< (const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(x.first < y.first || + (!(y.first < x.first) && x.second < y.second)); } + +template <class T1, class T2> +inline bool operator!=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(x == y)); } + +template <class T1, class T2> +inline bool operator> (const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return y < x; } + +template <class T1, class T2> +inline bool operator>=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(x < y)); } + +template <class T1, class T2> +inline bool operator<=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(y < x)); } + +template <class T1, class T2> +inline pair<T1, T2> make_pair(T1 x, T2 y) +{ return pair<T1, T2>(x, y); } + +template <class T1, class T2> +inline void swap(pair<T1, T2>& x, pair<T1, T2>& y) +{ + swap(x.first, y.first); + swap(x.second, y.second); +} + +} //namespace container_detail { +} //namespace container { + + +//Without this specialization recursive flat_(multi)map instantiation fails +//because is_enum needs to instantiate the recursive pair, leading to a compilation error). +//This breaks the cycle clearly stating that pair is not an enum avoiding any instantiation. +template<class T> +struct is_enum; + +template<class T, class U> +struct is_enum< ::boost::container::container_detail::pair<T, U> > +{ + static const bool value = false; +}; + +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +template <class T1, class T2> +struct is_class< ::boost::container::container_detail::pair<T1, T2> > + : public ::boost::true_type +{}; + +#ifdef BOOST_NO_RVALUE_REFERENCES + +template<class T1, class T2> +struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> > + : ::boost::true_type +{}; + +#endif + + +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_PAIR_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp new file mode 100644 index 0000000..5129ea1 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp @@ -0,0 +1,230 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP +#define BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> + +#ifdef BOOST_CONTAINER_PERFECT_FORWARDING +//#error "This file is not needed when perfect forwarding is available" +#endif //BOOST_CONTAINER_PERFECT_FORWARDING + +#include <boost/preprocessor/iteration/local.hpp> +#include <boost/preprocessor/punctuation/paren_if.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/repetition/enum_shifted.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/arithmetic/sub.hpp> +#include <boost/preprocessor/arithmetic/add.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> + +#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10 + +//Note: +//We define template parameters as const references to +//be able to bind temporaries. After that we will un-const them. +//This cast is ugly but it is necessary until "perfect forwarding" +//is achieved in C++0x. Meanwhile, if we want to be able to +//bind rvalues with non-const references, we have to be ugly +#ifndef BOOST_NO_RVALUE_REFERENCES + #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ + //! +#else + #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ + const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \ +const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \ +//! + +#ifndef BOOST_NO_RVALUE_REFERENCES + #define BOOST_CONTAINER_PP_PARAM(U, u) \ + U && u \ + //! +#else + #define BOOST_CONTAINER_PP_PARAM(U, u) \ + const U & u \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ + //! + +#else //BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + + #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + namespace boost { + namespace container { + namespace container_detail { + template<class T> + struct ref_holder; + + template<class T> + struct ref_holder<T &> + { + ref_holder(T &t) + : t_(t) + {} + T &t_; + T & get() { return t_; } + }; + + template<class T> + struct ref_holder<const T> + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + }; + + template<class T> + struct ref_holder<const T &&> + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + }; + + template<class T> + struct ref_holder + { + ref_holder(T &&t) + : t_(t) + {} + T &t_; + T && get() { return ::boost::move(t_); } + }; + + template<class T> + struct ref_holder<T &&> + { + ref_holder(T &&t) + : t(t) + {} + T &t; + T && get() { return ::boost::move(t_); } + }; + + } //namespace container_detail { + } //namespace container { + } //namespace boost { + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + ::boost::container::container_detail::ref_holder<BOOST_PP_CAT(P, n)> BOOST_PP_CAT(m_p, n); \ + //! + + #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ + //! + + #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#else //BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \ + //! + +#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \ + ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \ + //! + +#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#define BOOST_CONTAINER_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++this->m_p, n) \ +//! + +#define BOOST_CONTAINER_PP_IDENTITY(z, n, data) data + + +#define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \ +::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ +//! + +#define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \ +::boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \ +//! + +#define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \ +BOOST_PP_CAT(*this->m_p, n) \ +//! + +#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \ + BOOST_PP_CAT(class P, n) = void \ +//! + +#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT(z, n, default_type) \ + BOOST_PP_CAT(class P, n) = default_type \ +//! + +#define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \ + static BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n); \ +//! + +#define BOOST_CONTAINER_PP_PARAM_PASS(z, n, data) \ + BOOST_PP_CAT(p, n) \ +//! + +#define BOOST_CONTAINER_PP_FWD_TYPE(z, n, data) \ + typename ::boost::move_detail::forward_type< BOOST_PP_CAT(P, n) >::type \ +//! + +#include <boost/container/detail/config_end.hpp> + +//#else + +//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING +//#error "This file is not needed when perfect forwarding is available" +//#endif //BOOST_CONTAINER_PERFECT_FORWARDING + +#endif //#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/type_traits.hpp b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp new file mode 100644 index 0000000..0e096e5 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp @@ -0,0 +1,210 @@ +////////////////////////////////////////////////////////////////////////////// +// (C) Copyright John Maddock 2000. +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +// The alignment_of implementation comes from John Maddock's boost::alignment_of code +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include "config_begin.hpp" + +#include <boost/move/move.hpp> + +namespace boost { +namespace container { +namespace container_detail { + +struct nat{}; + +template <typename U> +struct LowPriorityConversion +{ + // Convertible from T with user-defined-conversion rank. + LowPriorityConversion(const U&) { } +}; + +//boost::alignment_of yields to 10K lines of preprocessed code, so we +//need an alternative +template <typename T> struct alignment_of; + +template <typename T> +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template <unsigned A, unsigned S> +struct alignment_logic +{ + enum{ value = A < S ? A : S }; +}; + +template< typename T > +struct alignment_of +{ + enum{ value = alignment_logic + < sizeof(alignment_of_hack<T>) - sizeof(T) + , sizeof(T)>::value }; +}; + +//This is not standard, but should work with all compilers +union max_align +{ + char char_; + short short_; + int int_; + long long_; + #ifdef BOOST_HAS_LONG_LONG + long long long_long_; + #endif + float float_; + double double_; + long double long_double_; + void * void_ptr_; +}; + +template<class T> +struct remove_reference +{ + typedef T type; +}; + +template<class T> +struct remove_reference<T&> +{ + typedef T type; +}; + +#ifndef BOOST_NO_RVALUE_REFERENCES + +template<class T> +struct remove_reference<T&&> +{ + typedef T type; +}; + +#else + +template<class T> +struct remove_reference< ::boost::rv<T> > +{ + typedef T type; +}; + +#endif + +template<class T> +struct is_reference +{ + enum { value = false }; +}; + +template<class T> +struct is_reference<T&> +{ + enum { value = true }; +}; + +template<class T> +struct is_pointer +{ + enum { value = false }; +}; + +template<class T> +struct is_pointer<T*> +{ + enum { value = true }; +}; + +template <typename T> +struct add_reference +{ + typedef T& type; +}; + +template<class T> +struct add_reference<T&> +{ + typedef T& type; +}; + +template<> +struct add_reference<void> +{ + typedef nat &type; +}; + +template<> +struct add_reference<const void> +{ + typedef const nat &type; +}; + +template <class T> +struct add_const_reference +{ typedef const T &type; }; + +template <class T> +struct add_const_reference<T&> +{ typedef T& type; }; + +template <typename T, typename U> +struct is_same +{ + typedef char yes_type; + struct no_type + { + char padding[8]; + }; + + template <typename V> + static yes_type is_same_tester(V*, V*); + static no_type is_same_tester(...); + + static T *t; + static U *u; + + static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); +}; + +template<class T> +struct remove_const +{ + typedef T type; +}; + +template<class T> +struct remove_const< const T> +{ + typedef T type; +}; + +template<class T> +struct remove_ref_const +{ + typedef typename remove_const< typename remove_reference<T>::type >::type type; +}; + +} // namespace container_detail +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/utilities.hpp b/3rdParty/Boost/src/boost/container/detail/utilities.hpp new file mode 100644 index 0000000..ece9a2e --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/utilities.hpp @@ -0,0 +1,252 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP + +#include "config_begin.hpp" +#include <cstdio> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/move/move.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/allocator_traits.hpp> +#include <algorithm> + +namespace boost { +namespace container { +namespace container_detail { + +template <typename T> +inline T* addressof(T& obj) +{ + return static_cast<T*>( + static_cast<void*>( + const_cast<char*>( + &reinterpret_cast<const char&>(obj) + ))); +} + +template<class T> +const T &max_value(const T &a, const T &b) +{ return a > b ? a : b; } + +template<class T> +const T &min_value(const T &a, const T &b) +{ return a < b ? a : b; } + +template <class SizeType> +SizeType + get_next_capacity(const SizeType max_size + ,const SizeType capacity + ,const SizeType n) +{ +// if (n > max_size - capacity) +// throw std::length_error("get_next_capacity"); + + const SizeType m3 = max_size/3; + + if (capacity < m3) + return capacity + max_value(3*(capacity+1)/5, n); + + if (capacity < m3*2) + return capacity + max_value((capacity+1)/2, n); + + return max_size; +} + +template <class T> +inline T* to_raw_pointer(T* p) +{ return p; } + +template <class Pointer> +inline typename Pointer::element_type* + to_raw_pointer(const Pointer &p) +{ return boost::container::container_detail::to_raw_pointer(p.operator->()); } + +//!To avoid ADL problems with swap +template <class T> +inline void do_swap(T& x, T& y) +{ + using std::swap; + swap(x, y); +} + +template<class AllocatorType> +inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +{ container_detail::do_swap(l, r); } + +template<class AllocatorType> +inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type) +{ l = r; } + +template<class AllocatorType> +inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +{ l = ::boost::move(r); } + +//Rounds "orig_size" by excess to round_to bytes +template<class SizeType> +inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to) +{ + return ((orig_size-1)/round_to+1)*round_to; +} + +template <std::size_t OrigSize, std::size_t RoundTo> +struct ct_rounded_size +{ + enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo }; +}; + +template<class T> +struct move_const_ref_type + : if_c +// < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value + < !::boost::is_class<T>::value + ,const T & + ,BOOST_CATCH_CONST_RLVALUE(T) + > +{}; + +} //namespace container_detail { + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_move_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, boost::move(*first)); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move_alloc(A &a, I f, I l, F r) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f)); + ++f; ++r; + } + return r; +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, *first); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_copy_alloc(A &a, I f, I l, F r) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f); + ++f; ++r; + } + return r; +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, *first); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename F, // F models ForwardIterator + typename T> +void uninitialized_fill_alloc(A &a, F f, F l, const T &t) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t); + ++f; + } +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_or_move_alloc +// +////////////////////////////////////////////////////////////////////////////// + +template +<typename A +,typename I // I models InputIterator +,typename F> // F models ForwardIterator +F uninitialized_copy_or_move_alloc + (A &a, I f, I l, F r + ,typename boost::container::container_detail::enable_if + < boost::move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::container::uninitialized_move_alloc(a, f, l, r); +} + +template +<typename A +,typename I // I models InputIterator +,typename F> // F models ForwardIterator +F uninitialized_copy_or_move_alloc + (A &a, I f, I l, F r + ,typename boost::container::container_detail::disable_if + < boost::move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::container::uninitialized_copy_alloc(a, f, l, r); +} + + +} //namespace container { +} //namespace boost { + + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/workaround.hpp b/3rdParty/Boost/src/boost/container/detail/workaround.hpp new file mode 100644 index 0000000..7838a5d --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/workaround.hpp @@ -0,0 +1,40 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#define BOOST_CONTAINER_DETAIL_WORKAROUND_HPP + +#include <boost/container/detail/config_begin.hpp> + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ + && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) + #define BOOST_CONTAINER_PERFECT_FORWARDING +#endif + +#if defined(BOOST_NO_NOEXCEPT) + #define BOOST_CONTAINER_NOEXCEPT + #define BOOST_CONTAINER_NOEXCEPT_IF(x) +#else + #define BOOST_CONTAINER_NOEXCEPT noexcept + #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x) +#endif + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\ + && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700) + #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST +#endif + +//Macros for documentation purposes. For code, expands to the argument +#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE +#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp new file mode 100644 index 0000000..5111d37 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp @@ -0,0 +1,1466 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP +#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP + +#if (defined MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/scoped_allocator_fwd.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/container/allocator_traits.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/detail/utilities.hpp> +#include <utility> +#include <boost/container/detail/pair.hpp> +#include <boost/move/move.hpp> + + +namespace boost { namespace container { + +//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed +//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the +//! copy and move constructors) should have a variant that accepts a final argument of +//! allocator_type. +//! +//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type, +//! allocator_type and at least one constructor for which allocator_type is the last +//! parameter. If not all constructors of T can be called with a final allocator_type argument, +//! and if T is used in a context where a container must call such a constructor, then the program is +//! ill-formed. +//! +//! [Example: +//! template <class T, class Allocator = allocator<T> > +//! class Z { +//! public: +//! typedef Allocator allocator_type; +//! +//! // Default constructor with optional allocator suffix +//! Z(const allocator_type& a = allocator_type()); +//! +//! // Copy constructor and allocator-extended copy constructor +//! Z(const Z& zz); +//! Z(const Z& zz, const allocator_type& a); +//! }; +//! +//! // Specialize trait for class template Z +//! template <class T, class Allocator = allocator<T> > +//! struct constructible_with_allocator_suffix<Z<T,Allocator> > +//! : ::boost::true_type { }; +//! -- end example] +//! +//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as +//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. +//! Applications aiming portability with several compilers should always define this trait. +//! +//! In conforming C++11 compilers or compilers supporting SFINAE expressions +//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used +//! to detect if a type should be constructed with suffix or prefix allocator arguments. +template <class T> +struct constructible_with_allocator_suffix + : ::boost::false_type +{}; + +//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed +//! with allocator_arg and T::allocator_type as its first two constructor arguments. +//! Ideally, all constructors of T (including the copy and move constructors) should have a variant +//! that accepts these two initial arguments. +//! +//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type, +//! allocator_type and at least one constructor for which allocator_arg_t is the first +//! parameter and allocator_type is the second parameter. If not all constructors of T can be +//! called with these initial arguments, and if T is used in a context where a container must call such +//! a constructor, then the program is ill-formed. +//! +//! [Example: +//! template <class T, class Allocator = allocator<T> > +//! class Y { +//! public: +//! typedef Allocator allocator_type; +//! +//! // Default constructor with and allocator-extended default constructor +//! Y(); +//! Y(allocator_arg_t, const allocator_type& a); +//! +//! // Copy constructor and allocator-extended copy constructor +//! Y(const Y& yy); +//! Y(allocator_arg_t, const allocator_type& a, const Y& yy); +//! +//! // Variadic constructor and allocator-extended variadic constructor +//! template<class ...Args> Y(Args&& args...); +//! template<class ...Args> +//! Y(allocator_arg_t, const allocator_type& a, Args&&... args); +//! }; +//! +//! // Specialize trait for class template Y +//! template <class T, class Allocator = allocator<T> > +//! struct constructible_with_allocator_prefix<Y<T,Allocator> > +//! : ::boost::true_type { }; +//! +//! -- end example] +//! +//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as +//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. +//! Applications aiming portability with several compilers should always define this trait. +//! +//! In conforming C++11 compilers or compilers supporting SFINAE expressions +//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used +//! to detect if a type should be constructed with suffix or prefix allocator arguments. +template <class T> +struct constructible_with_allocator_prefix + : ::boost::false_type +{}; + +///@cond + +namespace container_detail { + +template<typename T, typename Alloc> +struct uses_allocator_imp +{ + // Use SFINAE (Substitution Failure Is Not An Error) to detect the + // presence of an 'allocator_type' nested type convertilble from Alloc. + + private: + // Match this function if TypeT::allocator_type exists and is + // implicitly convertible from Alloc + template <typename U> + static char test(int, typename U::allocator_type); + + // Match this function if TypeT::allocator_type does not exist or is + // not convertible from Alloc. + template <typename U> + static int test(LowPriorityConversion<int>, LowPriorityConversion<Alloc>); + + static Alloc alloc; // Declared but not defined + + public: + enum { value = sizeof(test<T>(0, alloc)) == sizeof(char) }; +}; + +} //namespace container_detail { + +///@endcond + +//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from +//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may +//! specialize this type to derive from true_type for a T of user-defined type if T does not +//! have a nested allocator_type but is nonetheless constructible using the specified Alloc. +//! +//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and +//! derived from false_type otherwise. +template <typename T, typename Alloc> +struct uses_allocator + : boost::integral_constant<bool, container_detail::uses_allocator_imp<T, Alloc>::value> +{}; + +///@cond + +namespace container_detail { + +template <typename Alloc> +struct is_scoped_allocator_imp +{ + template <typename T> + static char test(int, typename T::outer_allocator_type*); + + template <typename T> + static int test(LowPriorityConversion<int>, void*); + + static const bool value = (sizeof(char) == sizeof(test<Alloc>(0, 0))); +}; + +template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > +struct outermost_allocator_type_impl +{ + typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; + typedef typename outermost_allocator_type_impl<outer_type>::type type; +}; + +template<class MaybeScopedAlloc> +struct outermost_allocator_type_impl<MaybeScopedAlloc, false> +{ + typedef MaybeScopedAlloc type; +}; + +template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > +struct outermost_allocator_imp +{ + typedef MaybeScopedAlloc type; + + static type &get(MaybeScopedAlloc &a) + { return a; } + + static const type &get(const MaybeScopedAlloc &a) + { return a; } +}; + +template<class MaybeScopedAlloc> +struct outermost_allocator_imp<MaybeScopedAlloc, true> +{ + typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; + typedef typename outermost_allocator_type_impl<outer_type>::type type; + + static type &get(MaybeScopedAlloc &a) + { return outermost_allocator_imp<outer_type>::get(a.outer_allocator()); } + + static const type &get(const MaybeScopedAlloc &a) + { return outermost_allocator_imp<outer_type>::get(a.outer_allocator()); } +}; + +} //namespace container_detail { + +template <typename Alloc> +struct is_scoped_allocator + : boost::integral_constant<bool, container_detail::is_scoped_allocator_imp<Alloc>::value> +{}; + +template <typename Alloc> +struct outermost_allocator + : container_detail::outermost_allocator_imp<Alloc> +{}; + +template <typename Alloc> +typename container_detail::outermost_allocator_imp<Alloc>::type & + get_outermost_allocator(Alloc &a) +{ return container_detail::outermost_allocator_imp<Alloc>::get(a); } + +template <typename Alloc> +const typename container_detail::outermost_allocator_imp<Alloc>::type & + get_outermost_allocator(const Alloc &a) +{ return container_detail::outermost_allocator_imp<Alloc>::get(a); } + +namespace container_detail { + +// Check if we can detect is_convertible using advanced SFINAE expressions +#if !defined(BOOST_NO_SFINAE_EXPR) + + //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list + //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html + //! Thanks Mathias! + + //With variadic templates, we need a single class to implement the trait + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template<class T, class ...Args> + struct is_constructible_impl + { + typedef char yes_type; + struct no_type + { char padding[2]; }; + + template<std::size_t N> + struct dummy; + + template<class X> + static yes_type test(dummy<sizeof(X(boost::move_detail::declval<Args>()...))>*); + + template<class X> + static no_type test(...); + + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); + }; + + template<class T, class ...Args> + struct is_constructible + : boost::integral_constant<bool, is_constructible_impl<T, Args...>::value> + {}; + + template <class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_prefix + : is_constructible<T, allocator_arg_t, InnerAlloc, Args...> + {}; + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + //Without variadic templates, we need to use de preprocessor to generate + //some specializations. + + #define BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS \ + BOOST_PP_ADD(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, 3) + //! + + //Generate N+1 template parameters so that we can specialize N + template<class T + BOOST_PP_ENUM_TRAILING( BOOST_PP_ADD(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_impl; + + //Generate N specializations, from 0 to + //BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS parameters + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \ + struct is_constructible_impl \ + <T BOOST_PP_ENUM_TRAILING_PARAMS(n, P) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, void) \ + , void> \ + { \ + typedef char yes_type; \ + struct no_type \ + { char padding[2]; }; \ + \ + template<std::size_t N> \ + struct dummy; \ + \ + template<class X> \ + static yes_type test(dummy<sizeof(X(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_DECLVAL, ~)))>*); \ + \ + template<class X> \ + static no_type test(...); \ + \ + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); \ + }; \ + //! + + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + //Finally just inherit from the implementation to define he trait + template< class T + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible + : boost::integral_constant + < bool + , is_constructible_impl + < T + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P) + , void>::value + > + {}; + + //Finally just inherit from the implementation to define he trait + template <class T + ,class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_prefix + : is_constructible + < T, allocator_arg_t, InnerAlloc + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2), P) + > + {}; +/* + template <class T + ,class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_suffix + : is_constructible + < T + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1), P) + , InnerAlloc + > + {};*/ + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#else // #if !defined(BOOST_NO_SFINAE_EXPR) + + //Without advanced SFINAE expressions, we can't use is_constructible + //so backup to constructible_with_allocator_xxx + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template < class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix<T> + {}; +/* + template < class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix<T> + {};*/ + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template < class T + , class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix<T> + {}; +/* + template < class T + , class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix<T> + {};*/ + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#endif // #if !defined(BOOST_NO_SFINAE_EXPR) + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_allocator_prefix_suffix + ( boost::true_type use_alloc_prefix, OutermostAlloc& outermost_alloc + , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args) +{ + (void)use_alloc_prefix; + allocator_traits<OutermostAlloc>::construct + ( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward<Args>(args)...); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_allocator_prefix_suffix + ( boost::false_type use_alloc_prefix, OutermostAlloc& outermost_alloc + , InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)use_alloc_prefix; + allocator_traits<OutermostAlloc>::construct + (outermost_alloc, p, ::boost::forward<Args>(args)..., inner_alloc); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_uses_allocator + ( boost::true_type uses_allocator, OutermostAlloc& outermost_alloc + , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)uses_allocator; + //BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value || + // is_constructible_with_allocator_suffix<T, InnerAlloc, Args...>::value )); + dispatch_allocator_prefix_suffix + ( is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>() + , outermost_alloc, inner_alloc, p, ::boost::forward<Args>(args)...); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_uses_allocator + ( boost::false_type uses_allocator, OutermostAlloc & outermost_alloc + , InnerAlloc & inner_alloc + ,T* p, BOOST_FWD_REF(Args)...args) +{ + (void)uses_allocator; (void)inner_alloc; + allocator_traits<OutermostAlloc>::construct + (outermost_alloc, p, ::boost::forward<Args>(args)...); +} + +#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#define BOOST_PP_LOCAL_MACRO(n) \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_allocator_prefix_suffix( \ + boost::true_type use_alloc_prefix, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)use_alloc_prefix, \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p, allocator_arg, inner_alloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_allocator_prefix_suffix( \ + boost::false_type use_alloc_prefix, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)use_alloc_prefix; \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \ + , inner_alloc); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_uses_allocator(boost::true_type uses_allocator, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)uses_allocator; \ + dispatch_allocator_prefix_suffix \ + (is_constructible_with_allocator_prefix \ + < T, InnerAlloc BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>() \ + , outermost_alloc, inner_alloc, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_uses_allocator(boost::false_type uses_allocator \ + ,OutermostAlloc & outermost_alloc \ + ,InnerAlloc & inner_alloc \ + ,T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)uses_allocator; (void)inner_alloc; \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ +//! +#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <typename OuterAlloc, class ...InnerAllocs> +class scoped_allocator_adaptor_base + : public OuterAlloc +{ + typedef allocator_traits<OuterAlloc> outer_traits_type; + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) + + public: + template <class OuterA2> + struct rebind_base + { + typedef scoped_allocator_adaptor_base<OuterA2, InnerAllocs...> other; + }; + + typedef OuterAlloc outer_allocator_type; + typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_copy_assignment::value || + inner_allocator_type::propagate_on_container_copy_assignment::value + > propagate_on_container_copy_assignment; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_move_assignment::value || + inner_allocator_type::propagate_on_container_move_assignment::value + > propagate_on_container_move_assignment; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_swap::value || + inner_allocator_type::propagate_on_container_swap::value + > propagate_on_container_swap; + + scoped_allocator_adaptor_base() + {} + + template <class OuterA2> + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + , m_inner(args...) + {} + + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + : outer_allocator_type(::boost::move(other.outer_allocator())) + , m_inner(::boost::move(other.inner_allocator())) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (const scoped_allocator_adaptor_base<OuterA2, InnerAllocs...>& other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base + <OuterA2, InnerAllocs...> BOOST_RV_REF_END other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + protected: + struct internal_type_t{}; + + template <class OuterA2> + scoped_allocator_adaptor_base + ( internal_type_t + , BOOST_FWD_REF(OuterA2) outerAlloc + , const inner_allocator_type &inner) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + , m_inner(inner) + {} + + public: + + scoped_allocator_adaptor_base &operator= + (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(other.outer_allocator()); + m_inner = other.inner_allocator(); + return *this; + } + + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(boost::move(other.outer_allocator())); + m_inner = ::boost::move(other.inner_allocator()); + return *this; + } + + inner_allocator_type& inner_allocator() + { return m_inner; } + + inner_allocator_type const& inner_allocator() const + { return m_inner; } + + outer_allocator_type & outer_allocator() + { return static_cast<outer_allocator_type&>(*this); } + + const outer_allocator_type &outer_allocator() const + { return static_cast<const outer_allocator_type&>(*this); } + + private: + inner_allocator_type m_inner; +}; + +#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +//Let's add a dummy first template parameter to allow creating +//specializations up to maximum InnerAlloc count +template < + typename OuterAlloc + , bool Dummy + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + > +class scoped_allocator_adaptor_base; + +//Specializations for the adaptor with InnerAlloc allocators + +#define BOOST_PP_LOCAL_MACRO(n) \ +template <typename OuterAlloc \ +BOOST_PP_ENUM_TRAILING_PARAMS(n, class Q) \ +> \ +class scoped_allocator_adaptor_base<OuterAlloc, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > \ + : public OuterAlloc \ +{ \ + typedef allocator_traits<OuterAlloc> outer_traits_type; \ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) \ + \ + public: \ + template <class OuterA2> \ + struct rebind_base \ + { \ + typedef scoped_allocator_adaptor_base<OuterA2, true BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > other; \ + }; \ + \ + typedef OuterAlloc outer_allocator_type; \ + typedef scoped_allocator_adaptor<BOOST_PP_ENUM_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > inner_allocator_type; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_copy_assignment::value || \ + inner_allocator_type::propagate_on_container_copy_assignment::value \ + > propagate_on_container_copy_assignment; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_move_assignment::value || \ + inner_allocator_type::propagate_on_container_move_assignment::value \ + > propagate_on_container_move_assignment; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_swap::value || \ + inner_allocator_type::propagate_on_container_swap::value \ + > propagate_on_container_swap; \ + \ + scoped_allocator_adaptor_base() \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \ + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \ + , m_inner(BOOST_PP_ENUM_PARAMS(n, q)) \ + {} \ + \ + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \ + : outer_allocator_type(::boost::move(other.outer_allocator())) \ + , m_inner(::boost::move(other.inner_allocator())) \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base<OuterA2, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + >& other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base \ + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base<OuterA2, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > BOOST_RV_REF_END other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + protected: \ + struct internal_type_t{}; \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base \ + ( internal_type_t \ + , BOOST_FWD_REF(OuterA2) outerAlloc \ + , const inner_allocator_type &inner) \ + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \ + , m_inner(inner) \ + {} \ + \ + public: \ + scoped_allocator_adaptor_base &operator= \ + (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) \ + { \ + outer_allocator_type::operator=(other.outer_allocator()); \ + m_inner = other.inner_allocator(); \ + return *this; \ + } \ + \ + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \ + { \ + outer_allocator_type::operator=(boost::move(other.outer_allocator())); \ + m_inner = ::boost::move(other.inner_allocator()); \ + return *this; \ + } \ + \ + inner_allocator_type& inner_allocator() \ + { return m_inner; } \ + \ + inner_allocator_type const& inner_allocator() const \ + { return m_inner; } \ + \ + outer_allocator_type & outer_allocator() \ + { return static_cast<outer_allocator_type&>(*this); } \ + \ + const outer_allocator_type &outer_allocator() const \ + { return static_cast<const outer_allocator_type&>(*this); } \ + \ + private: \ + inner_allocator_type m_inner; \ +}; \ +//! +#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +//Specialization for adaptor without any InnerAlloc +template <typename OuterAlloc> +class scoped_allocator_adaptor_base + < OuterAlloc + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat) + #endif + > + : public OuterAlloc +{ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) + public: + + template <class U> + struct rebind_base + { + typedef scoped_allocator_adaptor_base + <typename allocator_traits<OuterAlloc>::template portable_rebind_alloc<U>::type + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + > other; + }; + + typedef OuterAlloc outer_allocator_type; + typedef allocator_traits<OuterAlloc> outer_traits_type; + typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type; + typedef typename outer_traits_type:: + propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + typedef typename outer_traits_type:: + propagate_on_container_move_assignment propagate_on_container_move_assignment; + typedef typename outer_traits_type:: + propagate_on_container_swap propagate_on_container_swap; + + scoped_allocator_adaptor_base() + {} + + template <class OuterA2> + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + {} + + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + : outer_allocator_type(other.outer_allocator()) + {} + + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + : outer_allocator_type(::boost::move(other.outer_allocator())) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (const scoped_allocator_adaptor_base< + OuterA2 + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + >& other) + : outer_allocator_type(other.outer_allocator()) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base< + OuterA2 + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + > BOOST_RV_REF_END other) + : outer_allocator_type(other.outer_allocator()) + {} + + protected: + struct internal_type_t{}; + + template <class OuterA2> + scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + {} + + public: + scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(other.outer_allocator()); + return *this; + } + + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(boost::move(other.outer_allocator())); + return *this; + } + + inner_allocator_type& inner_allocator() + { return static_cast<inner_allocator_type&>(*this); } + + inner_allocator_type const& inner_allocator() const + { return static_cast<const inner_allocator_type&>(*this); } + + outer_allocator_type & outer_allocator() + { return static_cast<outer_allocator_type&>(*this); } + + const outer_allocator_type &outer_allocator() const + { return static_cast<const outer_allocator_type&>(*this); } +}; + +} //namespace container_detail { + +///@endcond + +//Scoped allocator +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + //! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor. + //! The class template scoped_allocator_adaptor is an allocator template that specifies + //! the memory resource (the outer allocator) to be used by a container (as any other + //! allocator does) and also specifies an inner allocator resource to be passed to + //! the constructor of every element within the container. + //! + //! This adaptor is + //! instantiated with one outer and zero or more inner allocator types. If + //! instantiated with only one allocator type, the inner allocator becomes the + //! scoped_allocator_adaptor itself, thus using the same allocator resource for the + //! container and every element within the container and, if the elements themselves + //! are containers, each of their elements recursively. If instantiated with more than + //! one allocator, the first allocator is the outer allocator for use by the container, + //! the second allocator is passed to the constructors of the container's elements, + //! and, if the elements themselves are containers, the third allocator is passed to + //! the elements' elements, and so on. If containers are nested to a depth greater + //! than the number of allocators, the last allocator is used repeatedly, as in the + //! single-allocator case, for any remaining recursions. + //! + //! [<b>Note</b>: The + //! scoped_allocator_adaptor is derived from the outer allocator type so it can be + //! substituted for the outer allocator type in most expressions. -end note] + //! + //! In the construct member functions, `OUTERMOST(x)` is x if x does not have + //! an `outer_allocator()` member function and + //! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is + //! `allocator_traits<decltype(OUTERMOST(x))>`. + //! + //! [<b>Note</b>: `OUTERMOST(x)` and + //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon + //! the definition of `outer_allocator()` to ensure that the recursion terminates. + //! It will terminate for all instantiations of scoped_allocator_adaptor. -end note] + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor + + #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...> + + #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + +#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +template <typename OuterAlloc + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + > +class scoped_allocator_adaptor +#endif + : public container_detail::scoped_allocator_adaptor_base + <OuterAlloc + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > +{ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor) + + public: + /// @cond + typedef container_detail::scoped_allocator_adaptor_base + <OuterAlloc + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > base_type; + typedef typename base_type::internal_type_t internal_type_t; + /// @endcond + typedef OuterAlloc outer_allocator_type; + //! Type: For exposition only + //! + typedef allocator_traits<OuterAlloc> outer_traits_type; + //! Type: `scoped_allocator_adaptor<OuterAlloc>` if `sizeof...(InnerAllocs)` is zero; otherwise, + //! `scoped_allocator_adaptor<InnerAllocs...>`. + typedef typename base_type::inner_allocator_type inner_allocator_type; + typedef typename outer_traits_type::value_type value_type; + typedef typename outer_traits_type::size_type size_type; + typedef typename outer_traits_type::difference_type difference_type; + typedef typename outer_traits_type::pointer pointer; + typedef typename outer_traits_type::const_pointer const_pointer; + typedef typename outer_traits_type::void_pointer void_pointer; + typedef typename outer_traits_type::const_void_pointer const_void_pointer; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_copy_assignment::value` is + //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_move_assignment::value` is + //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_move_assignment propagate_on_container_move_assignment; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_swap::value` is true for any + //! `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_swap propagate_on_container_swap; + + //! Type: Rebinds scoped allocator to + //! `typedef scoped_allocator_adaptor + //! < typename outer_traits_type::template portable_rebind_alloc<U>::type + //! , InnerAllocs... >` + template <class U> + struct rebind + { + typedef scoped_allocator_adaptor + < typename outer_traits_type::template portable_rebind_alloc<U>::type + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > other; + }; + + //! <b>Effects</b>: value-initializes the OuterAlloc base class + //! and the inner allocator object. + scoped_allocator_adaptor() + {} + + ~scoped_allocator_adaptor() + {} + + //! <b>Effects</b>: initializes each allocator within the adaptor with + //! the corresponding allocator from other. + scoped_allocator_adaptor(const scoped_allocator_adaptor& other) + : base_type(other.base()) + {} + + //! <b>Effects</b>: move constructs each allocator within the adaptor with + //! the corresponding allocator from other. + scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other) + : base_type(::boost::move(other.base())) + {} + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes the OuterAlloc base class with boost::forward<OuterA2>(outerAlloc) and inner + //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the + //! corresponding allocator from the argument list). + template <class OuterA2> + scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs) + : base_type(::boost::forward<OuterA2>(outerAlloc), innerAllocs...) + {} + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + #define BOOST_PP_LOCAL_MACRO(n) \ + template <class OuterA2> \ + scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \ + : base_type(::boost::forward<OuterA2>(outerAlloc) \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, q) \ + ) \ + {} \ + //! + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator from other. + template <class OuterA2> + scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > &other) + : base_type(other.base()) + {} + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator + //! rvalue from other. + template <class OuterA2> + scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > BOOST_RV_REF_END other) + : base_type(::boost::move(other.base())) + {} + + scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other) + { + base_type::operator=(static_cast<const base_type &>(other)); + return *this; + } + + scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other) + { + base_type::operator=(boost::move(static_cast<scoped_allocator_adaptor&>(other))); + return *this; + } + + //! <b>Returns</b>: + //! `static_cast<OuterAlloc&>(*this)`. + outer_allocator_type & outer_allocator() + { return *this; } + + //! <b>Returns</b>: + //! `static_cast<const OuterAlloc&>(*this)`. + const outer_allocator_type &outer_allocator() const + { return *this; } + + //! <b>Returns</b>: + //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. + inner_allocator_type& inner_allocator() + { return base_type::inner_allocator(); } + + //! <b>Returns</b>: + //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. + inner_allocator_type const& inner_allocator() const + { return base_type::inner_allocator(); } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`. + size_type max_size() const + { + return outer_traits_type::max_size(this->outer_allocator()); + } + + //! <b>Effects</b>: + //! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`. + template <class T> + void destroy(T* p) + { + allocator_traits<typename outermost_allocator<OuterAlloc>::type> + ::destroy(get_outermost_allocator(this->outer_allocator()), p); + } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`. + pointer allocate(size_type n) + { + return outer_traits_type::allocate(this->outer_allocator(), n); + } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`. + pointer allocate(size_type n, const_void_pointer hint) + { + return outer_traits_type::allocate(this->outer_allocator(), n, hint); + } + + //! <b>Effects</b>: + //! `allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)`. + void deallocate(pointer p, size_type n) + { + outer_traits_type::deallocate(this->outer_allocator(), p, n); + } + + //! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator + //! A in the adaptor is initialized from the result of calling + //! `allocator_traits<Allocator>::select_on_container_copy_construction()` on + //! the corresponding allocator in *this. + scoped_allocator_adaptor select_on_container_copy_construction() const + { + return scoped_allocator_adaptor + (internal_type_t() + ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator()) + ,outer_traits_type::select_on_container_copy_construction(this->inner_allocator()) + ); + } + /// @cond + base_type &base() { return *this; } + + const base_type &base() const { return *this; } + /// @endcond + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Effects</b>: + //! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct + //! (OUTERMOST(*this), p, std::forward<Args>(args)...)`. + //! + //! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and + //! `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value` is true, calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg, + //! inner_allocator(), std::forward<Args>(args)...)`. + //! + //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't + //! be implemented so that condition will be replaced by + //! constructible_with_allocator_prefix<T>::value. -end note] + //! + //! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and + //! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, + //! std::forward<Args>(args)..., inner_allocator())`. + //! + //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be + //! implemented so that condition will be replaced by + //! `constructible_with_allocator_suffix<T>::value`. -end note] + //! + //! 4) Otherwise, the program is ill-formed. + //! + //! [<b>Note</b>: An error will result if `uses_allocator` evaluates + //! to true but the specific constructor does not take an allocator. This definition prevents a silent + //! failure to pass an inner allocator to a contained element. -end note] + template < typename T, class ...Args> + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + void + #else + typename container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type + #endif + construct(T* p, BOOST_FWD_REF(Args)...args) + { + container_detail::dispatch_uses_allocator + ( uses_allocator<T, inner_allocator_type>() + , get_outermost_allocator(this->outer_allocator()) + , this->inner_allocator() + , p, ::boost::forward<Args>(args)...); + } + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //Disable this overload if the first argument is pair as some compilers have + //overload selection problems when the first parameter is a pair. + #define BOOST_PP_LOCAL_MACRO(n) \ + template < typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ + typename container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type \ + construct(T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + { \ + container_detail::dispatch_uses_allocator \ + ( uses_allocator<T, inner_allocator_type>() \ + , get_outermost_allocator(this->outer_allocator()) \ + , this->inner_allocator() \ + , p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ + } \ + //! + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + template <class T1, class T2> + void construct(std::pair<T1,T2>* p) + { this->construct_pair(p); } + + template <class T1, class T2> + void construct(container_detail::pair<T1,T2>* p) + { this->construct_pair(p); } + + template <class T1, class T2, class U, class V> + void construct(std::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); } + + template <class T1, class T2, class U, class V> + void construct(container_detail::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); } + + template <class T1, class T2, class U, class V> + void construct(std::pair<T1, T2>* p, const std::pair<U, V>& x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( container_detail::pair<T1, T2>* p + , const container_detail::pair<U, V>& x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( std::pair<T1, T2>* p + , BOOST_RV_REF_BEG std::pair<U, V> BOOST_RV_REF_END x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( container_detail::pair<T1, T2>* p + , BOOST_RV_REF_BEG container_detail::pair<U, V> BOOST_RV_REF_END x) + { this->construct_pair(p, x); } + + /// @cond + private: + template <class Pair> + void construct_pair(Pair* p) + { + this->construct(container_detail::addressof(p->first)); + try { + this->construct(container_detail::addressof(p->second)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class U, class V> + void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { + this->construct(container_detail::addressof(p->first), ::boost::forward<U>(x)); + try { + this->construct(container_detail::addressof(p->second), ::boost::forward<V>(y)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class Pair2> + void construct_pair(Pair* p, const Pair2& pr) + { + this->construct(container_detail::addressof(p->first), pr.first); + try { + this->construct(container_detail::addressof(p->second), pr.second); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class Pair2> + void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr) + { + this->construct(container_detail::addressof(p->first), ::boost::move(pr.first)); + try { + this->construct(container_detail::addressof(p->second), ::boost::move(pr.second)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + //template <class T1, class T2, class... Args1, class... Args2> + //void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y); + + private: + template <class OuterA2> + scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner) + : base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner) + {} + + /// @endcond +}; + +template <typename OuterA1, typename OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename... InnerAllocs + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + #endif + > +inline bool operator==( + const scoped_allocator_adaptor<OuterA1 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& a, + const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& b) +{ + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + const bool has_zero_inner = sizeof...(InnerAllocs) == 0u; + #else + const bool has_zero_inner = + boost::container::container_detail::is_same + <Q0, container_detail::nat>::value; + #endif + + return a.outer_allocator() == b.outer_allocator() + && (has_zero_inner || a.inner_allocator() == b.inner_allocator()); +} + +template <typename OuterA1, typename OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename... InnerAllocs + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + #endif + > +inline bool operator!=( + const scoped_allocator_adaptor<OuterA1 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& a, + const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& b) +{ + return ! (a == b); +} + +}} // namespace boost { namespace container { + +#include <boost/container/detail/config_end.hpp> + +#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp new file mode 100644 index 0000000..0814a50 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp @@ -0,0 +1,83 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost +// Software License, Version 1.0. (See accompanying file +// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP +#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP + +#if (defined MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> + +#if defined(BOOST_NO_VARIADIC_TEMPLATES) +#include <boost/container/detail/preprocessor.hpp> +#include <boost/container/detail/type_traits.hpp> +#endif + +namespace boost { namespace container { + +///@cond + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor; + + #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename ...InnerAllocs> + class scoped_allocator_adaptor; + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>; + + #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + +#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <typename OuterAlloc +BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT, container_detail::nat) +> +class scoped_allocator_adaptor; + +#endif + +///@endcond + +//! The allocator_arg_t struct is an empty structure type used as a unique type to +//! disambiguate constructor and function overloading. Specifically, several types +//! have constructors with allocator_arg_t as the first argument, immediately followed +//! by an argument of a type that satisfies the Allocator requirements +struct allocator_arg_t{}; + +//! A instance of type allocator_arg_t +//! +static const allocator_arg_t allocator_arg = allocator_arg_t(); + +template <class T> +struct constructible_with_allocator_suffix; + +template <class T> +struct constructible_with_allocator_prefix; + +template <typename T, typename Alloc> +struct uses_allocator; + +}} // namespace boost { namespace container { + +#include <boost/container/detail/config_end.hpp> + +#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP |