summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/container')
-rw-r--r--3rdParty/Boost/src/boost/container/allocator_traits.hpp119
-rw-r--r--3rdParty/Boost/src/boost/container/container_fwd.hpp160
-rw-r--r--3rdParty/Boost/src/boost/container/detail/advanced_insert_int.hpp356
-rw-r--r--3rdParty/Boost/src/boost/container/detail/algorithms.hpp90
-rw-r--r--3rdParty/Boost/src/boost/container/detail/allocation_type.hpp54
-rw-r--r--3rdParty/Boost/src/boost/container/detail/allocator_version_traits.hpp168
-rw-r--r--3rdParty/Boost/src/boost/container/detail/config_begin.hpp7
-rw-r--r--3rdParty/Boost/src/boost/container/detail/config_end.hpp6
-rw-r--r--3rdParty/Boost/src/boost/container/detail/destroyers.hpp380
-rw-r--r--3rdParty/Boost/src/boost/container/detail/iterators.hpp812
-rw-r--r--3rdParty/Boost/src/boost/container/detail/memory_util.hpp21
-rw-r--r--3rdParty/Boost/src/boost/container/detail/mpl.hpp37
-rw-r--r--3rdParty/Boost/src/boost/container/detail/multiallocation_chain.hpp288
-rw-r--r--3rdParty/Boost/src/boost/container/detail/pair.hpp11
-rw-r--r--3rdParty/Boost/src/boost/container/detail/preprocessor.hpp46
-rw-r--r--3rdParty/Boost/src/boost/container/detail/transform_iterator.hpp177
-rw-r--r--3rdParty/Boost/src/boost/container/detail/type_traits.hpp11
-rw-r--r--3rdParty/Boost/src/boost/container/detail/utilities.hpp1152
-rw-r--r--3rdParty/Boost/src/boost/container/detail/value_init.hpp45
-rw-r--r--3rdParty/Boost/src/boost/container/detail/variadic_templates_tools.hpp154
-rw-r--r--3rdParty/Boost/src/boost/container/detail/version_type.hpp99
-rw-r--r--3rdParty/Boost/src/boost/container/detail/workaround.hpp33
-rw-r--r--3rdParty/Boost/src/boost/container/scoped_allocator.hpp380
-rw-r--r--3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp18
-rw-r--r--3rdParty/Boost/src/boost/container/throw_exception.hpp166
-rw-r--r--3rdParty/Boost/src/boost/container/vector.hpp2755
26 files changed, 7183 insertions, 362 deletions
diff --git a/3rdParty/Boost/src/boost/container/allocator_traits.hpp b/3rdParty/Boost/src/boost/container/allocator_traits.hpp
index 11d948b..4857212 100644
--- a/3rdParty/Boost/src/boost/container/allocator_traits.hpp
+++ b/3rdParty/Boost/src/boost/container/allocator_traits.hpp
@@ -6,7 +6,7 @@
//
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2013. 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)
//
@@ -17,27 +17,32 @@
#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP
#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
+#include <boost/container/container_fwd.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 <boost/move/utility.hpp>
#include <limits> //numeric_limits<>::max()
#include <new> //placement new
#include <memory> //std::allocator
-#include <boost/container/detail/preprocessor.hpp>
-///@cond
+#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+#include <boost/container/detail/preprocessor.hpp>
+#endif
namespace boost {
namespace container {
+
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
namespace container_detail {
//workaround needed for C++03 compilers with no construct()
@@ -52,7 +57,7 @@ struct is_std_allocator< std::allocator<T> >
} //namespace container_detail {
-///@endcond
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! 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
@@ -90,29 +95,29 @@ struct allocator_traits
//!
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.
+ //! type with internal constant static member <code>value</code> == 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.
+ //! type with internal constant static member <code>value</code> == 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.
+ //! type with internal constant static member <code>value</code> == 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
+ //! In C++03 compilers <code>rebind_alloc</code> 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`.
+ //! In C++03 compilers <code>rebind_traits</code> is a struct derived from
+ //! <code>allocator_traits<OtherAlloc></code>, where <code>OtherAlloc</code> is
+ //! the allocator deduced by rules explained in <code>rebind_alloc</code>.
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`.
+ //! <code>type</code> is an allocator related to Alloc deduced deduced by rules explained in <code>rebind_alloc</code>.
template <class T>
struct portable_rebind_alloc
{ typedef see_documentation type; };
@@ -165,22 +170,22 @@ struct allocator_traits
propagate_on_container_swap, boost::false_type)
propagate_on_container_swap;
- #if !defined(BOOST_NO_TEMPLATE_ALIASES)
+ #if !defined(BOOST_NO_CXX11_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)
+ #else // #if !defined(BOOST_NO_CXX11_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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename... Args>
rebind_alloc(BOOST_FWD_REF(Args)... args)
: Base(boost::forward<Args>(args)...)
{}
- #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #else // #if !defined(BOOST_NO_CXX11_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, _)) \
@@ -189,32 +194,32 @@ struct allocator_traits
//
#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_NO_CXX11_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)
+ #endif // #if !defined(BOOST_NO_CXX11_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)`
+ //! <b>Returns</b>: <code>a.allocate(n)</code>
//!
static pointer allocate(Alloc &a, size_type n)
{ return a.allocate(n); }
- //! <b>Returns</b>: `a.deallocate(p, n)`
+ //! <b>Returns</b>: <code>a.deallocate(p, n)</code>
//!
//! <b>Throws</b>: Nothing
static void deallocate(Alloc &a, pointer p, size_type n)
- { return a.deallocate(p, n); }
+ { a.deallocate(p, n); }
- //! <b>Effects</b>: calls `a.allocate(n, p)` if that call is well-formed;
- //! otherwise, invokes `a.allocate(n)`
+ //! <b>Effects</b>: calls <code>a.allocate(n, p)</code> if that call is well-formed;
+ //! otherwise, invokes <code>a.allocate(n)</code>
static pointer allocate(Alloc &a, size_type n, const_void_pointer p)
{
const bool value = boost::container::container_detail::
@@ -224,10 +229,10 @@ struct allocator_traits
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()`.
+ //! <b>Effects</b>: calls <code>a.destroy(p)</code> if that call is well-formed;
+ //! otherwise, invokes <code>p->~T()</code>.
template<class T>
- static void destroy(Alloc &a, T*p)
+ static void destroy(Alloc &a, T*p) BOOST_CONTAINER_NOEXCEPT
{
typedef T* destroy_pointer;
const bool value = boost::container::container_detail::
@@ -237,9 +242,9 @@ struct allocator_traits
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)
+ //! <b>Returns</b>: <code>a.max_size()</code> if that expression is well-formed; otherwise,
+ //! <code>numeric_limits<size_type>::max()</code>.
+ static size_type max_size(const Alloc &a) BOOST_CONTAINER_NOEXCEPT
{
const bool value = boost::container::container_detail::
has_member_function_callable_with_max_size
@@ -248,9 +253,21 @@ struct allocator_traits
return allocator_traits::priv_max_size(flag, a);
}
- //! <b>Returns</b>: `a.select_on_container_copy_construction()` if that expression is well-formed;
+ //! <b>Returns</b>: <code>a.select_on_container_copy_construction()</code> if that expression is well-formed;
//! otherwise, a.
- static Alloc select_on_container_copy_construction(const Alloc &a)
+ static
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ typename container_detail::if_c
+ < boost::container::container_detail::
+ has_member_function_callable_with_select_on_container_copy_construction
+ <const Alloc>::value
+ , Alloc
+ , const Alloc &
+ >::type
+ #else
+ Alloc
+ #endif
+ 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
@@ -259,9 +276,9 @@ struct allocator_traits
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)...)`
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: calls <code>a.construct(p, std::forward<Args>(args)...)</code> if that call is well-formed;
+ //! otherwise, invokes <code>::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)</code>
template <class T, class ...Args>
static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args)
{
@@ -269,7 +286,7 @@ struct allocator_traits
allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...);
}
#endif
- ///@cond
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
private:
static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p)
@@ -279,29 +296,29 @@ struct allocator_traits
{ return allocator_traits::allocate(a, n); }
template<class T>
- static void priv_destroy(boost::true_type, Alloc &a, T* p)
+ static void priv_destroy(boost::true_type, Alloc &a, T* p) BOOST_CONTAINER_NOEXCEPT
{ a.destroy(p); }
template<class T>
- static void priv_destroy(boost::false_type, Alloc &, T* p)
+ static void priv_destroy(boost::false_type, Alloc &, T* p) BOOST_CONTAINER_NOEXCEPT
{ p->~T(); (void)p; }
- static size_type priv_max_size(boost::true_type, const Alloc &a)
+ static size_type priv_max_size(boost::true_type, const Alloc &a) BOOST_CONTAINER_NOEXCEPT
{ return a.max_size(); }
- static size_type priv_max_size(boost::false_type, const Alloc &)
+ static size_type priv_max_size(boost::false_type, const Alloc &) BOOST_CONTAINER_NOEXCEPT
{ 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)
+ static const Alloc &priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) BOOST_CONTAINER_NOEXCEPT
{ return a; }
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class ...Args>
- static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...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;
@@ -322,7 +339,7 @@ struct allocator_traits
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)
+ #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
public:
#define BOOST_PP_LOCAL_MACRO(n) \
template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
@@ -336,7 +353,7 @@ struct allocator_traits
//
#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) > \
@@ -371,10 +388,14 @@ struct allocator_traits
//
#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_NO_CXX11_VARIADIC_TEMPLATES)
+
+ template<class T>
+ static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, ::boost::container::default_init_t)
+ { ::new((void*)p) T; }
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
- ///@endcond
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
} //namespace container {
diff --git a/3rdParty/Boost/src/boost/container/container_fwd.hpp b/3rdParty/Boost/src/boost/container/container_fwd.hpp
index bdefd81..415de0f 100644
--- a/3rdParty/Boost/src/boost/container/container_fwd.hpp
+++ b/3rdParty/Boost/src/boost/container/container_fwd.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2013. 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)
//
@@ -11,15 +11,41 @@
#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP
#define BOOST_CONTAINER_CONTAINER_FWD_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
+//! \file
+//! This header file forward declares the following containers:
+//! - boost::container::vector
+//! - boost::container::stable_vector
+//! - boost::container::static_vector
+//! - boost::container::slist
+//! - boost::container::list
+//! - boost::container::set
+//! - boost::container::multiset
+//! - boost::container::map
+//! - boost::container::multimap
+//! - boost::container::flat_set
+//! - boost::container::flat_multiset
+//! - boost::container::flat_map
+//! - boost::container::flat_multimap
+//! - boost::container::basic_string
+//! - boost::container::string
+//! - boost::container::wstring
+//!
+//! It forward declares the following allocators:
+//! - boost::container::allocator
+//! - boost::container::node_allocator
+//! - boost::container::adaptive_pool
+//!
+//! And finally it defines the following types
+
//////////////////////////////////////////////////////////////////////////////
// Standard predeclarations
//////////////////////////////////////////////////////////////////////////////
-/// @cond
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace boost{
namespace intrusive{
@@ -32,13 +58,14 @@ namespace bi = boost::intrusive;
}}}
+#include <cstddef>
#include <utility>
#include <memory>
#include <functional>
#include <iosfwd>
#include <string>
-/// @endcond
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//////////////////////////////////////////////////////////////////////////////
// Containers
@@ -47,94 +74,155 @@ namespace bi = boost::intrusive;
namespace boost {
namespace container {
-//vector class
+//! Enumeration used to configure ordered associative containers
+//! with a concrete tree implementation.
+enum tree_type_enum
+{
+ red_black_tree,
+ avl_tree,
+ scapegoat_tree,
+ splay_tree
+};
+
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
template <class 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, std::size_t Capacity>
+class static_vector;
+
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<tree_type_enum TreeType, bool OptimizeSize>
+struct tree_opt;
+
+typedef tree_opt<red_black_tree, true> tree_assoc_defaults;
+
template <class Key
,class Compare = std::less<Key>
- ,class Allocator = std::allocator<Key> >
+ ,class Allocator = std::allocator<Key>
+ ,class Options = tree_assoc_defaults >
class set;
-//multiset class
template <class Key
,class Compare = std::less<Key>
- ,class Allocator = std::allocator<Key> >
+ ,class Allocator = std::allocator<Key>
+ ,class Options = tree_assoc_defaults >
class multiset;
-//map class
template <class Key
,class T
,class Compare = std::less<Key>
- ,class Allocator = std::allocator<std::pair<const Key, T> > >
+ ,class Allocator = std::allocator<std::pair<const Key, T> >
+ ,class Options = tree_assoc_defaults >
class map;
-//multimap class
template <class Key
,class T
,class Compare = std::less<Key>
- ,class Allocator = std::allocator<std::pair<const Key, T> > >
+ ,class Allocator = std::allocator<std::pair<const Key, T> >
+ ,class Options = tree_assoc_defaults >
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;
+typedef basic_string
+ <char
+ ,std::char_traits<char>
+ ,std::allocator<char> >
+string;
+
+typedef basic_string
+ <wchar_t
+ ,std::char_traits<wchar_t>
+ ,std::allocator<wchar_t> >
+wstring;
+
+static const std::size_t ADP_nodes_per_block = 256u;
+static const std::size_t ADP_max_free_blocks = 2u;
+static const std::size_t ADP_overhead_percent = 1u;
+static const std::size_t ADP_only_alignment = 0u;
+
+template < class T
+ , std::size_t NodesPerBlock = ADP_nodes_per_block
+ , std::size_t MaxFreeBlocks = ADP_max_free_blocks
+ , std::size_t OverheadPercent = ADP_overhead_percent
+ , unsigned Version = 2
+ >
+class adaptive_pool;
+
+template < class T
+ , unsigned Version = 2
+ , unsigned int AllocationDisableMask = 0>
+class allocator;
+
+static const std::size_t NodeAlloc_nodes_per_block = 256u;
+
+template
+ < class T
+ , std::size_t NodesPerBlock = NodeAlloc_nodes_per_block
+ , std::size_t Version = 2>
+class node_allocator;
+
+#else
+
+//! Default options for tree-based associative containers
+//! - tree_type<red_black_tree>
+//! - optimize_size<true>
+typedef implementation_defined tree_assoc_defaults;
+
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
//! Type used to tag that the input range is
//! guaranteed to be ordered
struct 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();
+
//! Type used to tag that the input range is
//! guaranteed to be ordered and unique
struct ordered_unique_range_t
@@ -142,16 +230,29 @@ struct ordered_unique_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
+//! Type used to tag that the inserted values
+//! should be default initialized
+struct default_init_t
+{};
+
+//! Value used to tag that the inserted values
+//! should be default initialized
+static const default_init_t default_init = default_init_t();
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+//! Type used to tag that the inserted values
+//! should be value initialized
+struct value_init_t
+{};
+
+//! Value used to tag that the inserted values
+//! should be value initialized
+static const value_init_t value_init = value_init_t();
-namespace detail_really_deep_namespace {
+namespace container_detail_really_deep_namespace {
//Otherwise, gcc issues a warning of previously defined
//anonymous_instance and unique_instance
@@ -161,12 +262,13 @@ struct dummy
{
(void)ordered_range;
(void)ordered_unique_range;
+ (void)default_init;
}
};
} //detail_really_deep_namespace {
-/// @endcond
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
}} //namespace boost { namespace container {
diff --git a/3rdParty/Boost/src/boost/container/detail/advanced_insert_int.hpp b/3rdParty/Boost/src/boost/container/detail/advanced_insert_int.hpp
new file mode 100644
index 0000000..b9eb074
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/advanced_insert_int.hpp
@@ -0,0 +1,356 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2008-2013. 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_ADVANCED_INSERT_INT_HPP
+#define BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/allocator_traits.hpp>
+#include <boost/container/detail/destroyers.hpp>
+#include <boost/aligned_storage.hpp>
+#include <boost/move/utility.hpp>
+#include <iterator> //std::iterator_traits
+#include <boost/assert.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
+
+namespace boost { namespace container { namespace container_detail {
+
+template<class A, class FwdIt, class Iterator>
+struct move_insert_range_proxy
+{
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+
+ explicit move_insert_range_proxy(FwdIt first)
+ : first_(first)
+ {}
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n)
+ {
+ this->first_ = ::boost::container::uninitialized_move_alloc_n_source
+ (a, this->first_, n, p);
+ }
+
+ void copy_n_and_update(A &, Iterator p, size_type n)
+ {
+ this->first_ = ::boost::container::move_n_source(this->first_, n, p);
+ }
+
+ FwdIt first_;
+};
+
+
+template<class A, class FwdIt, class Iterator>
+struct insert_range_proxy
+{
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+
+ explicit insert_range_proxy(FwdIt first)
+ : first_(first)
+ {}
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n)
+ {
+ this->first_ = ::boost::container::uninitialized_copy_alloc_n_source(a, this->first_, n, p);
+ }
+
+ void copy_n_and_update(A &, Iterator p, size_type n)
+ {
+ this->first_ = ::boost::container::copy_n_source(this->first_, n, p);
+ }
+
+ FwdIt first_;
+};
+
+
+template<class A, class Iterator>
+struct insert_n_copies_proxy
+{
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+
+ explicit insert_n_copies_proxy(const value_type &v)
+ : v_(v)
+ {}
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
+ { boost::container::uninitialized_fill_alloc_n(a, v_, n, p); }
+
+ void copy_n_and_update(A &, Iterator p, size_type n) const
+ { std::fill_n(p, n, v_); }
+
+ const value_type &v_;
+};
+
+template<class A, class Iterator>
+struct insert_value_initialized_n_proxy
+{
+ typedef ::boost::container::allocator_traits<A> alloc_traits;
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
+ { boost::container::uninitialized_value_init_alloc_n(a, n, p); }
+
+ void copy_n_and_update(A &, Iterator, size_type) const
+ { BOOST_ASSERT(false); }
+};
+
+template<class A, class Iterator>
+struct insert_default_initialized_n_proxy
+{
+ typedef ::boost::container::allocator_traits<A> alloc_traits;
+ typedef typename allocator_traits<A>::size_type size_type;
+ typedef typename allocator_traits<A>::value_type value_type;
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
+ { boost::container::uninitialized_default_init_alloc_n(a, n, p); }
+
+ void copy_n_and_update(A &, Iterator, size_type) const
+ { BOOST_ASSERT(false); }
+};
+
+template<class A, class Iterator>
+struct insert_copy_proxy
+{
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename alloc_traits::size_type size_type;
+ typedef typename alloc_traits::value_type value_type;
+
+ explicit insert_copy_proxy(const value_type &v)
+ : v_(v)
+ {}
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
+ {
+ BOOST_ASSERT(n == 1); (void)n;
+ alloc_traits::construct( a, iterator_to_raw_pointer(p), v_);
+ }
+
+ void copy_n_and_update(A &, Iterator p, size_type n) const
+ {
+ BOOST_ASSERT(n == 1); (void)n;
+ *p =v_;
+ }
+
+ const value_type &v_;
+};
+
+
+template<class A, class Iterator>
+struct insert_move_proxy
+{
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename alloc_traits::size_type size_type;
+ typedef typename alloc_traits::value_type value_type;
+
+ explicit insert_move_proxy(value_type &v)
+ : v_(v)
+ {}
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) const
+ {
+ BOOST_ASSERT(n == 1); (void)n;
+ alloc_traits::construct( a, iterator_to_raw_pointer(p), ::boost::move(v_) );
+ }
+
+ void copy_n_and_update(A &, Iterator p, size_type n) const
+ {
+ BOOST_ASSERT(n == 1); (void)n;
+ *p = ::boost::move(v_);
+ }
+
+ value_type &v_;
+};
+
+template<class It, class A>
+insert_move_proxy<A, It> get_insert_value_proxy(BOOST_RV_REF(typename std::iterator_traits<It>::value_type) v)
+{
+ return insert_move_proxy<A, It>(v);
+}
+
+template<class It, class A>
+insert_copy_proxy<A, It> get_insert_value_proxy(const typename std::iterator_traits<It>::value_type &v)
+{
+ return insert_copy_proxy<A, It>(v);
+}
+
+}}} //namespace boost { namespace container { namespace container_detail {
+
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+#include <boost/container/detail/variadic_templates_tools.hpp>
+#include <boost/move/utility.hpp>
+#include <typeinfo>
+//#include <iostream> //For debugging purposes
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template<class A, class Iterator, class ...Args>
+struct insert_non_movable_emplace_proxy
+{
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename alloc_traits::size_type size_type;
+ typedef typename alloc_traits::value_type value_type;
+
+ typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
+
+ explicit insert_non_movable_emplace_proxy(Args&&... args)
+ : args_(args...)
+ {}
+
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n)
+ { this->priv_uninitialized_copy_some_and_update(a, index_tuple_t(), p, n); }
+
+ private:
+ template<int ...IdxPack>
+ void priv_uninitialized_copy_some_and_update(A &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
+ {
+ BOOST_ASSERT(n == 1); (void)n;
+ alloc_traits::construct( a, iterator_to_raw_pointer(p), ::boost::forward<Args>(get<IdxPack>(this->args_))... );
+ }
+
+ protected:
+ tuple<Args&...> args_;
+};
+
+template<class A, class Iterator, class ...Args>
+struct insert_emplace_proxy
+ : public insert_non_movable_emplace_proxy<A, Iterator, Args...>
+{
+ typedef insert_non_movable_emplace_proxy<A, Iterator, Args...> base_t;
+ typedef boost::container::allocator_traits<A> alloc_traits;
+ typedef typename base_t::value_type value_type;
+ typedef typename base_t::size_type size_type;
+ typedef typename base_t::index_tuple_t index_tuple_t;
+
+ explicit insert_emplace_proxy(Args&&... args)
+ : base_t(::boost::forward<Args>(args)...)
+ {}
+
+ void copy_n_and_update(A &a, Iterator p, size_type n)
+ { this->priv_copy_some_and_update(a, index_tuple_t(), p, n); }
+
+ private:
+
+ template<int ...IdxPack>
+ void priv_copy_some_and_update(A &a, const index_tuple<IdxPack...>&, Iterator p, size_type n)
+ {
+ BOOST_ASSERT(n ==1); (void)n;
+ aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v;
+ value_type *vp = static_cast<value_type *>(static_cast<void *>(&v));
+ alloc_traits::construct(a, vp,
+ ::boost::forward<Args>(get<IdxPack>(this->args_))...);
+ BOOST_TRY{
+ *p = ::boost::move(*vp);
+ }
+ BOOST_CATCH(...){
+ alloc_traits::destroy(a, vp);
+ BOOST_RETHROW
+ }
+ BOOST_CATCH_END
+ alloc_traits::destroy(a, vp);
+ }
+};
+
+}}} //namespace boost { namespace container { namespace container_detail {
+
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+#include <boost/container/detail/preprocessor.hpp>
+#include <boost/container/detail/value_init.hpp>
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+#define BOOST_PP_LOCAL_MACRO(N) \
+template<class A, class Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, class P) > \
+struct BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
+{ \
+ typedef boost::container::allocator_traits<A> alloc_traits; \
+ typedef typename alloc_traits::size_type size_type; \
+ typedef typename alloc_traits::value_type value_type; \
+ \
+ explicit BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
+ ( BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
+ BOOST_PP_EXPR_IF(N, :) BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_INIT, _) \
+ {} \
+ \
+ void uninitialized_copy_n_and_update(A &a, Iterator p, size_type n) \
+ { \
+ BOOST_ASSERT(n == 1); (void)n; \
+ alloc_traits::construct \
+ ( a, iterator_to_raw_pointer(p) \
+ BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) \
+ ); \
+ } \
+ \
+ void copy_n_and_update(A &, Iterator, size_type) \
+ { BOOST_ASSERT(false); } \
+ \
+ protected: \
+ BOOST_PP_REPEAT(N, BOOST_CONTAINER_PP_PARAM_DEFINE, _) \
+}; \
+ \
+template<class A, class Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, class P) > \
+struct BOOST_PP_CAT(insert_emplace_proxy_arg, N) \
+ : BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
+ < A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, P) > \
+{ \
+ typedef BOOST_PP_CAT(insert_non_movable_emplace_proxy_arg, N) \
+ <A, Iterator BOOST_PP_ENUM_TRAILING_PARAMS(N, P) > base_t; \
+ typedef typename base_t::value_type value_type; \
+ typedef typename base_t::size_type size_type; \
+ typedef boost::container::allocator_traits<A> alloc_traits; \
+ \
+ explicit BOOST_PP_CAT(insert_emplace_proxy_arg, N) \
+ ( BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
+ : base_t(BOOST_PP_ENUM(N, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ) \
+ {} \
+ \
+ void copy_n_and_update(A &a, Iterator p, size_type n) \
+ { \
+ BOOST_ASSERT(n == 1); (void)n; \
+ aligned_storage<sizeof(value_type), alignment_of<value_type>::value> v; \
+ value_type *vp = static_cast<value_type *>(static_cast<void *>(&v)); \
+ alloc_traits::construct(a, vp \
+ BOOST_PP_ENUM_TRAILING(N, BOOST_CONTAINER_PP_MEMBER_FORWARD, _)); \
+ BOOST_TRY{ \
+ *p = ::boost::move(*vp); \
+ } \
+ BOOST_CATCH(...){ \
+ alloc_traits::destroy(a, vp); \
+ BOOST_RETHROW \
+ } \
+ BOOST_CATCH_END \
+ alloc_traits::destroy(a, vp); \
+ } \
+}; \
+//!
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+}}} //namespace boost { namespace container { namespace container_detail {
+
+#endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_ADVANCED_INSERT_INT_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/algorithms.hpp b/3rdParty/Boost/src/boost/container/detail/algorithms.hpp
new file mode 100644
index 0000000..9358995
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/algorithms.hpp
@@ -0,0 +1,90 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013.
+//
+// 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_ALGORITHMS_HPP
+#define BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
+
+#include <boost/container/detail/type_traits.hpp>
+#include <boost/container/detail/mpl.hpp>
+#include <boost/container/detail/iterators.hpp>
+
+
+#include <cstring>
+
+namespace boost {
+namespace container {
+
+template<class It>
+struct is_value_init_construct_iterator
+{
+ static const bool value = false;
+};
+
+template<class U, class D>
+struct is_value_init_construct_iterator<value_init_construct_iterator<U, D> >
+{
+ static const bool value = true;
+};
+
+template<class It>
+struct is_emplace_iterator
+{
+ static const bool value = false;
+};
+
+template<class U, class EF, class D>
+struct is_emplace_iterator<emplace_iterator<U, EF, D> >
+{
+ static const bool value = true;
+};
+
+template<class A, class T, class InpIt>
+inline void construct_in_place(A &a, T* dest, InpIt source)
+{ boost::container::allocator_traits<A>::construct(a, dest, *source); }
+//#endif
+
+template<class A, class T, class U, class D>
+inline void construct_in_place(A &a, T *dest, value_init_construct_iterator<U, D>)
+{
+ boost::container::allocator_traits<A>::construct(a, dest);
+}
+
+template<class A, class T, class U, class D>
+inline void construct_in_place(A &a, T *dest, default_init_construct_iterator<U, D>)
+{
+ boost::container::allocator_traits<A>::construct(a, dest, default_init);
+}
+
+template<class A, class T, class U, class EF, class D>
+inline void construct_in_place(A &a, T *dest, emplace_iterator<U, EF, D> ei)
+{
+ ei.construct_in_place(a, dest);
+}
+
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_ALGORITHMS_HPP
+
diff --git a/3rdParty/Boost/src/boost/container/detail/allocation_type.hpp b/3rdParty/Boost/src/boost/container/detail/allocation_type.hpp
new file mode 100644
index 0000000..65d543a
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/allocation_type.hpp
@@ -0,0 +1,54 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013. 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_ALLOCATION_TYPE_HPP
+#define BOOST_CONTAINER_ALLOCATION_TYPE_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+namespace boost {
+namespace container {
+
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+enum allocation_type_v
+{
+ // constants for allocation commands
+ allocate_new_v = 0x01,
+ expand_fwd_v = 0x02,
+ expand_bwd_v = 0x04,
+// expand_both = expand_fwd | expand_bwd,
+// expand_or_new = allocate_new | expand_both,
+ shrink_in_place_v = 0x08,
+ nothrow_allocation_v = 0x10,
+ zero_memory_v = 0x20,
+ try_shrink_in_place_v = 0x40
+};
+
+typedef int allocation_type;
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+static const allocation_type allocate_new = (allocation_type)allocate_new_v;
+static const allocation_type expand_fwd = (allocation_type)expand_fwd_v;
+static const allocation_type expand_bwd = (allocation_type)expand_bwd_v;
+static const allocation_type shrink_in_place = (allocation_type)shrink_in_place_v;
+static const allocation_type try_shrink_in_place= (allocation_type)try_shrink_in_place_v;
+static const allocation_type nothrow_allocation = (allocation_type)nothrow_allocation_v;
+static const allocation_type zero_memory = (allocation_type)zero_memory_v;
+
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //BOOST_CONTAINER_ALLOCATION_TYPE_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/allocator_version_traits.hpp b/3rdParty/Boost/src/boost/container/detail/allocator_version_traits.hpp
new file mode 100644
index 0000000..d4567da
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/allocator_version_traits.hpp
@@ -0,0 +1,168 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2012-2013. 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_ALLOCATOR_VERSION_TRAITS_HPP
+#define BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/allocator_traits.hpp> //allocator_traits
+#include <boost/container/throw_exception.hpp>
+#include <boost/container/detail/multiallocation_chain.hpp> //multiallocation_chain
+#include <boost/container/detail/version_type.hpp> //version_type
+#include <boost/container/detail/allocation_type.hpp> //allocation_type
+#include <boost/container/detail/mpl.hpp> //integral_constant
+#include <boost/intrusive/pointer_traits.hpp> //pointer_traits
+#include <utility> //pair
+#include <boost/detail/no_exceptions_support.hpp> //BOOST_TRY
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template<class Allocator, unsigned Version = boost::container::container_detail::version<Allocator>::value>
+struct allocator_version_traits
+{
+ typedef ::boost::container::container_detail::integral_constant
+ <unsigned, Version> alloc_version;
+
+ typedef typename Allocator::multiallocation_chain multiallocation_chain;
+
+ typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
+ typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
+
+ //Node allocation interface
+ static pointer allocate_one(Allocator &a)
+ { return a.allocate_one(); }
+
+ static void deallocate_one(Allocator &a, const pointer &p)
+ { a.deallocate_one(p); }
+
+ static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
+ { return a.allocate_individual(n, m); }
+
+ static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
+ { a.deallocate_individual(holder); }
+
+ static std::pair<pointer, bool>
+ allocation_command(Allocator &a, allocation_type command,
+ size_type limit_size, size_type preferred_size,
+ size_type &received_size, const pointer &reuse)
+ {
+ return a.allocation_command
+ (command, limit_size, preferred_size, received_size, reuse);
+ }
+};
+
+template<class Allocator>
+struct allocator_version_traits<Allocator, 1>
+{
+ typedef ::boost::container::container_detail::integral_constant
+ <unsigned, 1> alloc_version;
+
+ typedef typename boost::container::allocator_traits<Allocator>::pointer pointer;
+ typedef typename boost::container::allocator_traits<Allocator>::size_type size_type;
+ typedef typename boost::container::allocator_traits<Allocator>::value_type value_type;
+
+ typedef typename boost::intrusive::pointer_traits<pointer>::
+ template rebind_pointer<void>::type void_ptr;
+ typedef container_detail::basic_multiallocation_chain
+ <void_ptr> multialloc_cached_counted;
+ typedef boost::container::container_detail::
+ transform_multiallocation_chain
+ < multialloc_cached_counted, value_type> multiallocation_chain;
+
+ //Node allocation interface
+ static pointer allocate_one(Allocator &a)
+ { return a.allocate(1); }
+
+ static void deallocate_one(Allocator &a, const pointer &p)
+ { a.deallocate(p, 1); }
+
+ static void deallocate_individual(Allocator &a, multiallocation_chain &holder)
+ {
+ size_type n = holder.size();
+ typename multiallocation_chain::iterator it = holder.begin();
+ while(n--){
+ pointer p = boost::intrusive::pointer_traits<pointer>::pointer_to(*it);
+ ++it;
+ a.deallocate(p, 1);
+ }
+ }
+
+ struct allocate_individual_rollback
+ {
+ allocate_individual_rollback(Allocator &a, multiallocation_chain &chain)
+ : mr_a(a), mp_chain(&chain)
+ {}
+
+ ~allocate_individual_rollback()
+ {
+ if(mp_chain)
+ allocator_version_traits::deallocate_individual(mr_a, *mp_chain);
+ }
+
+ void release()
+ {
+ mp_chain = 0;
+ }
+
+ Allocator &mr_a;
+ multiallocation_chain * mp_chain;
+ };
+
+ static void allocate_individual(Allocator &a, size_type n, multiallocation_chain &m)
+ {
+ allocate_individual_rollback rollback(a, m);
+ while(n--){
+ m.push_front(a.allocate(1));
+ }
+ rollback.release();
+ }
+
+ static std::pair<pointer, bool>
+ allocation_command(Allocator &a, allocation_type command,
+ size_type, size_type preferred_size,
+ size_type &received_size, const pointer &)
+ {
+ std::pair<pointer, bool> ret(pointer(), false);
+ if(!(command & allocate_new)){
+ if(!(command & nothrow_allocation)){
+ throw_logic_error("version 1 allocator without allocate_new flag");
+ }
+ }
+ else{
+ received_size = preferred_size;
+ BOOST_TRY{
+ ret.first = a.allocate(received_size);
+ }
+ BOOST_CATCH(...){
+ if(!(command & nothrow_allocation)){
+ BOOST_RETHROW
+ }
+ }
+ BOOST_CATCH_END
+ }
+ return ret;
+ }
+};
+
+} //namespace container_detail {
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif // ! defined(BOOST_CONTAINER_DETAIL_ALLOCATOR_VERSION_TRAITS_HPP)
diff --git a/3rdParty/Boost/src/boost/container/detail/config_begin.hpp b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp
index 83c2cfe..6c54bef 100644
--- a/3rdParty/Boost/src/boost/container/detail/config_begin.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2013. 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)
//
@@ -18,6 +18,10 @@
#define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
+ #ifndef _SCL_SECURE_NO_WARNINGS
+ #define BOOST_CONTAINER_DETAIL_SCL_SECURE_NO_WARNINGS
+ #define _SCL_SECURE_NO_WARNINGS
+ #endif
#pragma warning (push)
#pragma warning (disable : 4702) // unreachable code
#pragma warning (disable : 4706) // assignment within conditional expression
@@ -46,4 +50,5 @@
#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
+ #pragma warning (disable : 4510) // default constructor could not be generated
#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
index 3451371..7217019 100644
--- a/3rdParty/Boost/src/boost/container/detail/config_end.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/config_end.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2013. 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)
//
@@ -13,5 +13,9 @@
#undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE
#undef _CRT_SECURE_NO_DEPRECATE
#endif
+ #ifdef BOOST_CONTAINER_DETAIL_SCL_SECURE_NO_WARNINGS
+ #undef BOOST_CONTAINER_DETAIL_SCL_SECURE_NO_WARNINGS
+ #undef _SCL_SECURE_NO_WARNINGS
+ #endif
#endif
diff --git a/3rdParty/Boost/src/boost/container/detail/destroyers.hpp b/3rdParty/Boost/src/boost/container/detail/destroyers.hpp
new file mode 100644
index 0000000..0645895
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/destroyers.hpp
@@ -0,0 +1,380 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013.
+//
+// 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_DESTROYERS_HPP
+#define BOOST_CONTAINER_DESTROYERS_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/detail/version_type.hpp>
+#include <boost/container/detail/utilities.hpp>
+#include <boost/container/allocator_traits.hpp>
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+//!A deleter for scoped_ptr that deallocates the memory
+//!allocated for an object using a STL allocator.
+template <class A>
+struct scoped_deallocator
+{
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::
+ version<A>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+
+ private:
+ void priv_deallocate(allocator_v1)
+ { m_alloc.deallocate(m_ptr, 1); }
+
+ void priv_deallocate(allocator_v2)
+ { m_alloc.deallocate_one(m_ptr); }
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(scoped_deallocator)
+
+ public:
+
+ pointer m_ptr;
+ A& m_alloc;
+
+ scoped_deallocator(pointer p, A& a)
+ : m_ptr(p), m_alloc(a)
+ {}
+
+ ~scoped_deallocator()
+ { if (m_ptr)priv_deallocate(alloc_version()); }
+
+ scoped_deallocator(BOOST_RV_REF(scoped_deallocator) o)
+ : m_ptr(o.m_ptr), m_alloc(o.m_alloc)
+ { o.release(); }
+
+ pointer get() const
+ { return m_ptr; }
+
+ void set(const pointer &p)
+ { m_ptr = p; }
+
+ void release()
+ { m_ptr = 0; }
+};
+
+template <class Allocator>
+struct null_scoped_deallocator
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
+
+ null_scoped_deallocator(pointer, Allocator&, size_type)
+ {}
+
+ void release()
+ {}
+
+ pointer get() const
+ { return pointer(); }
+
+ void set(const pointer &)
+ {}
+};
+
+//!A deleter for scoped_ptr that deallocates the memory
+//!allocated for an array of objects using a STL allocator.
+template <class Allocator>
+struct scoped_array_deallocator
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
+
+ scoped_array_deallocator(pointer p, Allocator& a, size_type length)
+ : m_ptr(p), m_alloc(a), m_length(length) {}
+
+ ~scoped_array_deallocator()
+ { if (m_ptr) m_alloc.deallocate(m_ptr, m_length); }
+
+ void release()
+ { m_ptr = 0; }
+
+ private:
+ pointer m_ptr;
+ Allocator& m_alloc;
+ size_type m_length;
+};
+
+template <class Allocator>
+struct null_scoped_array_deallocator
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
+
+ null_scoped_array_deallocator(pointer, Allocator&, size_type)
+ {}
+
+ void release()
+ {}
+};
+
+template <class Allocator>
+struct scoped_destroy_deallocator
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::
+ version<Allocator>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+
+ scoped_destroy_deallocator(pointer p, Allocator& a)
+ : m_ptr(p), m_alloc(a) {}
+
+ ~scoped_destroy_deallocator()
+ {
+ if(m_ptr){
+ AllocTraits::destroy(m_alloc, container_detail::to_raw_pointer(m_ptr));
+ priv_deallocate(m_ptr, alloc_version());
+ }
+ }
+
+ void release()
+ { m_ptr = 0; }
+
+ private:
+
+ void priv_deallocate(const pointer &p, allocator_v1)
+ { AllocTraits::deallocate(m_alloc, p, 1); }
+
+ void priv_deallocate(const pointer &p, allocator_v2)
+ { m_alloc.deallocate_one(p); }
+
+ pointer m_ptr;
+ Allocator& m_alloc;
+};
+
+
+//!A deleter for scoped_ptr that destroys
+//!an object using a STL allocator.
+template <class Allocator>
+struct scoped_destructor_n
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::value_type value_type;
+ typedef typename AllocTraits::size_type size_type;
+
+ scoped_destructor_n(pointer p, Allocator& a, size_type n)
+ : m_p(p), m_a(a), m_n(n)
+ {}
+
+ void release()
+ { m_p = 0; }
+
+ void increment_size(size_type inc)
+ { m_n += inc; }
+
+ void increment_size_backwards(size_type inc)
+ { m_n += inc; m_p -= inc; }
+
+ void shrink_forward(size_type inc)
+ { m_n -= inc; m_p += inc; }
+
+ ~scoped_destructor_n()
+ {
+ if(!m_p) return;
+ value_type *raw_ptr = container_detail::to_raw_pointer(m_p);
+ while(m_n--){
+ AllocTraits::destroy(m_a, raw_ptr);
+ }
+ }
+
+ private:
+ pointer m_p;
+ Allocator & m_a;
+ size_type m_n;
+};
+
+//!A deleter for scoped_ptr that destroys
+//!an object using a STL allocator.
+template <class Allocator>
+struct null_scoped_destructor_n
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::pointer pointer;
+ typedef typename AllocTraits::size_type size_type;
+
+ null_scoped_destructor_n(pointer, Allocator&, size_type)
+ {}
+
+ void increment_size(size_type)
+ {}
+
+ void increment_size_backwards(size_type)
+ {}
+
+ void shrink_forward(size_type)
+ {}
+
+ void release()
+ {}
+};
+
+template<class A>
+class scoped_destructor
+{
+ typedef boost::container::allocator_traits<A> AllocTraits;
+ public:
+ typedef typename A::value_type value_type;
+ scoped_destructor(A &a, value_type *pv)
+ : pv_(pv), a_(a)
+ {}
+
+ ~scoped_destructor()
+ {
+ if(pv_){
+ AllocTraits::destroy(a_, pv_);
+ }
+ }
+
+ void release()
+ { pv_ = 0; }
+
+
+ void set(value_type *ptr) { pv_ = ptr; }
+
+ value_type *get() const { return pv_; }
+
+ private:
+ value_type *pv_;
+ A &a_;
+};
+
+
+template<class A>
+class value_destructor
+{
+ typedef boost::container::allocator_traits<A> AllocTraits;
+ public:
+ typedef typename A::value_type value_type;
+ value_destructor(A &a, value_type &rv)
+ : rv_(rv), a_(a)
+ {}
+
+ ~value_destructor()
+ {
+ AllocTraits::destroy(a_, &rv_);
+ }
+
+ private:
+ value_type &rv_;
+ A &a_;
+};
+
+template <class Allocator>
+class allocator_destroyer
+{
+ typedef boost::container::allocator_traits<Allocator> AllocTraits;
+ typedef typename AllocTraits::value_type value_type;
+ typedef typename AllocTraits::pointer pointer;
+ typedef container_detail::integral_constant<unsigned,
+ boost::container::container_detail::
+ version<Allocator>::value> alloc_version;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+
+ private:
+ Allocator & a_;
+
+ private:
+ void priv_deallocate(const pointer &p, allocator_v1)
+ { AllocTraits::deallocate(a_,p, 1); }
+
+ void priv_deallocate(const pointer &p, allocator_v2)
+ { a_.deallocate_one(p); }
+
+ public:
+ allocator_destroyer(Allocator &a)
+ : a_(a)
+ {}
+
+ void operator()(const pointer &p)
+ {
+ AllocTraits::destroy(a_, container_detail::to_raw_pointer(p));
+ this->priv_deallocate(p, alloc_version());
+ }
+};
+
+template <class A>
+class allocator_destroyer_and_chain_builder
+{
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef typename A::multiallocation_chain multiallocation_chain;
+
+ A & a_;
+ multiallocation_chain &c_;
+
+ public:
+ allocator_destroyer_and_chain_builder(A &a, multiallocation_chain &c)
+ : a_(a), c_(c)
+ {}
+
+ void operator()(const typename A::pointer &p)
+ {
+ allocator_traits<A>::destroy(a_, container_detail::to_raw_pointer(p));
+ c_.push_back(p);
+ }
+};
+
+template <class A>
+class allocator_multialloc_chain_node_deallocator
+{
+ typedef allocator_traits<A> allocator_traits_type;
+ typedef typename allocator_traits_type::value_type value_type;
+ typedef typename A::multiallocation_chain multiallocation_chain;
+ typedef allocator_destroyer_and_chain_builder<A> chain_builder;
+
+ A & a_;
+ multiallocation_chain c_;
+
+ public:
+ allocator_multialloc_chain_node_deallocator(A &a)
+ : a_(a), c_()
+ {}
+
+ chain_builder get_chain_builder()
+ { return chain_builder(a_, c_); }
+
+ ~allocator_multialloc_chain_node_deallocator()
+ {
+ a_.deallocate_individual(c_);
+ }
+};
+
+} //namespace container_detail {
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_DESTROYERS_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/iterators.hpp b/3rdParty/Boost/src/boost/container/detail/iterators.hpp
new file mode 100644
index 0000000..ffc7236
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/iterators.hpp
@@ -0,0 +1,812 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013.
+// (C) Copyright Gennaro Prota 2003 - 2004.
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
+#define BOOST_CONTAINER_DETAIL_ITERATORS_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+#include <boost/move/utility.hpp>
+#include <boost/container/allocator_traits.hpp>
+#include <boost/container/detail/type_traits.hpp>
+#include <boost/static_assert.hpp>
+
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+#include <boost/container/detail/variadic_templates_tools.hpp>
+#else
+#include <boost/container/detail/preprocessor.hpp>
+#endif
+
+#include <iterator>
+
+namespace boost {
+namespace container {
+
+template <class T, class Difference = std::ptrdiff_t>
+class constant_iterator
+ : public std::iterator
+ <std::random_access_iterator_tag, T, Difference, const T*, const T &>
+{
+ typedef constant_iterator<T, Difference> this_type;
+
+ public:
+ explicit constant_iterator(const T &ref, Difference range_size)
+ : m_ptr(&ref), m_num(range_size){}
+
+ //Constructors
+ constant_iterator()
+ : m_ptr(0), m_num(0){}
+
+ constant_iterator& operator++()
+ { increment(); return *this; }
+
+ constant_iterator operator++(int)
+ {
+ constant_iterator result (*this);
+ increment();
+ return result;
+ }
+
+ constant_iterator& operator--()
+ { decrement(); return *this; }
+
+ constant_iterator operator--(int)
+ {
+ constant_iterator result (*this);
+ decrement();
+ return result;
+ }
+
+ friend bool operator== (const constant_iterator& i, const constant_iterator& i2)
+ { return i.equal(i2); }
+
+ friend bool operator!= (const constant_iterator& i, const constant_iterator& i2)
+ { return !(i == i2); }
+
+ friend bool operator< (const constant_iterator& i, const constant_iterator& i2)
+ { return i.less(i2); }
+
+ friend bool operator> (const constant_iterator& i, const constant_iterator& i2)
+ { return i2 < i; }
+
+ friend bool operator<= (const constant_iterator& i, const constant_iterator& i2)
+ { return !(i > i2); }
+
+ friend bool operator>= (const constant_iterator& i, const constant_iterator& i2)
+ { return !(i < i2); }
+
+ friend Difference operator- (const constant_iterator& i, const constant_iterator& i2)
+ { return i2.distance_to(i); }
+
+ //Arithmetic
+ constant_iterator& operator+=(Difference off)
+ { this->advance(off); return *this; }
+
+ constant_iterator operator+(Difference off) const
+ {
+ constant_iterator other(*this);
+ other.advance(off);
+ return other;
+ }
+
+ friend constant_iterator operator+(Difference off, const constant_iterator& right)
+ { return right + off; }
+
+ constant_iterator& operator-=(Difference off)
+ { this->advance(-off); return *this; }
+
+ constant_iterator operator-(Difference off) const
+ { return *this + (-off); }
+
+ const T& operator*() const
+ { return dereference(); }
+
+ const T& operator[] (Difference ) const
+ { return dereference(); }
+
+ const T* operator->() const
+ { return &(dereference()); }
+
+ private:
+ const T * m_ptr;
+ Difference m_num;
+
+ void increment()
+ { --m_num; }
+
+ void decrement()
+ { ++m_num; }
+
+ bool equal(const this_type &other) const
+ { return m_num == other.m_num; }
+
+ bool less(const this_type &other) const
+ { return other.m_num < m_num; }
+
+ const T & dereference() const
+ { return *m_ptr; }
+
+ void advance(Difference n)
+ { m_num -= n; }
+
+ Difference distance_to(const this_type &other)const
+ { return m_num - other.m_num; }
+};
+
+template <class T, class Difference = std::ptrdiff_t>
+class value_init_construct_iterator
+ : public std::iterator
+ <std::random_access_iterator_tag, T, Difference, const T*, const T &>
+{
+ typedef value_init_construct_iterator<T, Difference> this_type;
+
+ public:
+ explicit value_init_construct_iterator(Difference range_size)
+ : m_num(range_size){}
+
+ //Constructors
+ value_init_construct_iterator()
+ : m_num(0){}
+
+ value_init_construct_iterator& operator++()
+ { increment(); return *this; }
+
+ value_init_construct_iterator operator++(int)
+ {
+ value_init_construct_iterator result (*this);
+ increment();
+ return result;
+ }
+
+ value_init_construct_iterator& operator--()
+ { decrement(); return *this; }
+
+ value_init_construct_iterator operator--(int)
+ {
+ value_init_construct_iterator result (*this);
+ decrement();
+ return result;
+ }
+
+ friend bool operator== (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return i.equal(i2); }
+
+ friend bool operator!= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return !(i == i2); }
+
+ friend bool operator< (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return i.less(i2); }
+
+ friend bool operator> (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return i2 < i; }
+
+ friend bool operator<= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return !(i > i2); }
+
+ friend bool operator>= (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return !(i < i2); }
+
+ friend Difference operator- (const value_init_construct_iterator& i, const value_init_construct_iterator& i2)
+ { return i2.distance_to(i); }
+
+ //Arithmetic
+ value_init_construct_iterator& operator+=(Difference off)
+ { this->advance(off); return *this; }
+
+ value_init_construct_iterator operator+(Difference off) const
+ {
+ value_init_construct_iterator other(*this);
+ other.advance(off);
+ return other;
+ }
+
+ friend value_init_construct_iterator operator+(Difference off, const value_init_construct_iterator& right)
+ { return right + off; }
+
+ value_init_construct_iterator& operator-=(Difference off)
+ { this->advance(-off); return *this; }
+
+ value_init_construct_iterator operator-(Difference off) const
+ { return *this + (-off); }
+
+ //This pseudo-iterator's dereference operations have no sense since value is not
+ //constructed until ::boost::container::construct_in_place is called.
+ //So comment them to catch bad uses
+ //const T& operator*() const;
+ //const T& operator[](difference_type) const;
+ //const T* operator->() const;
+
+ private:
+ Difference m_num;
+
+ void increment()
+ { --m_num; }
+
+ void decrement()
+ { ++m_num; }
+
+ bool equal(const this_type &other) const
+ { return m_num == other.m_num; }
+
+ bool less(const this_type &other) const
+ { return other.m_num < m_num; }
+
+ const T & dereference() const
+ {
+ static T dummy;
+ return dummy;
+ }
+
+ void advance(Difference n)
+ { m_num -= n; }
+
+ Difference distance_to(const this_type &other)const
+ { return m_num - other.m_num; }
+};
+
+template <class T, class Difference = std::ptrdiff_t>
+class default_init_construct_iterator
+ : public std::iterator
+ <std::random_access_iterator_tag, T, Difference, const T*, const T &>
+{
+ typedef default_init_construct_iterator<T, Difference> this_type;
+
+ public:
+ explicit default_init_construct_iterator(Difference range_size)
+ : m_num(range_size){}
+
+ //Constructors
+ default_init_construct_iterator()
+ : m_num(0){}
+
+ default_init_construct_iterator& operator++()
+ { increment(); return *this; }
+
+ default_init_construct_iterator operator++(int)
+ {
+ default_init_construct_iterator result (*this);
+ increment();
+ return result;
+ }
+
+ default_init_construct_iterator& operator--()
+ { decrement(); return *this; }
+
+ default_init_construct_iterator operator--(int)
+ {
+ default_init_construct_iterator result (*this);
+ decrement();
+ return result;
+ }
+
+ friend bool operator== (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return i.equal(i2); }
+
+ friend bool operator!= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return !(i == i2); }
+
+ friend bool operator< (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return i.less(i2); }
+
+ friend bool operator> (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return i2 < i; }
+
+ friend bool operator<= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return !(i > i2); }
+
+ friend bool operator>= (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return !(i < i2); }
+
+ friend Difference operator- (const default_init_construct_iterator& i, const default_init_construct_iterator& i2)
+ { return i2.distance_to(i); }
+
+ //Arithmetic
+ default_init_construct_iterator& operator+=(Difference off)
+ { this->advance(off); return *this; }
+
+ default_init_construct_iterator operator+(Difference off) const
+ {
+ default_init_construct_iterator other(*this);
+ other.advance(off);
+ return other;
+ }
+
+ friend default_init_construct_iterator operator+(Difference off, const default_init_construct_iterator& right)
+ { return right + off; }
+
+ default_init_construct_iterator& operator-=(Difference off)
+ { this->advance(-off); return *this; }
+
+ default_init_construct_iterator operator-(Difference off) const
+ { return *this + (-off); }
+
+ //This pseudo-iterator's dereference operations have no sense since value is not
+ //constructed until ::boost::container::construct_in_place is called.
+ //So comment them to catch bad uses
+ //const T& operator*() const;
+ //const T& operator[](difference_type) const;
+ //const T* operator->() const;
+
+ private:
+ Difference m_num;
+
+ void increment()
+ { --m_num; }
+
+ void decrement()
+ { ++m_num; }
+
+ bool equal(const this_type &other) const
+ { return m_num == other.m_num; }
+
+ bool less(const this_type &other) const
+ { return other.m_num < m_num; }
+
+ const T & dereference() const
+ {
+ static T dummy;
+ return dummy;
+ }
+
+ void advance(Difference n)
+ { m_num -= n; }
+
+ Difference distance_to(const this_type &other)const
+ { return m_num - other.m_num; }
+};
+
+
+template <class T, class Difference = std::ptrdiff_t>
+class repeat_iterator
+ : public std::iterator
+ <std::random_access_iterator_tag, T, Difference>
+{
+ typedef repeat_iterator<T, Difference> this_type;
+ public:
+ explicit repeat_iterator(T &ref, Difference range_size)
+ : m_ptr(&ref), m_num(range_size){}
+
+ //Constructors
+ repeat_iterator()
+ : m_ptr(0), m_num(0){}
+
+ this_type& operator++()
+ { increment(); return *this; }
+
+ this_type operator++(int)
+ {
+ this_type result (*this);
+ increment();
+ return result;
+ }
+
+ this_type& operator--()
+ { increment(); return *this; }
+
+ this_type operator--(int)
+ {
+ this_type result (*this);
+ increment();
+ return result;
+ }
+
+ friend bool operator== (const this_type& i, const this_type& i2)
+ { return i.equal(i2); }
+
+ friend bool operator!= (const this_type& i, const this_type& i2)
+ { return !(i == i2); }
+
+ friend bool operator< (const this_type& i, const this_type& i2)
+ { return i.less(i2); }
+
+ friend bool operator> (const this_type& i, const this_type& i2)
+ { return i2 < i; }
+
+ friend bool operator<= (const this_type& i, const this_type& i2)
+ { return !(i > i2); }
+
+ friend bool operator>= (const this_type& i, const this_type& i2)
+ { return !(i < i2); }
+
+ friend Difference operator- (const this_type& i, const this_type& i2)
+ { return i2.distance_to(i); }
+
+ //Arithmetic
+ this_type& operator+=(Difference off)
+ { this->advance(off); return *this; }
+
+ this_type operator+(Difference off) const
+ {
+ this_type other(*this);
+ other.advance(off);
+ return other;
+ }
+
+ friend this_type operator+(Difference off, const this_type& right)
+ { return right + off; }
+
+ this_type& operator-=(Difference off)
+ { this->advance(-off); return *this; }
+
+ this_type operator-(Difference off) const
+ { return *this + (-off); }
+
+ T& operator*() const
+ { return dereference(); }
+
+ T& operator[] (Difference ) const
+ { return dereference(); }
+
+ T *operator->() const
+ { return &(dereference()); }
+
+ private:
+ T * m_ptr;
+ Difference m_num;
+
+ void increment()
+ { --m_num; }
+
+ void decrement()
+ { ++m_num; }
+
+ bool equal(const this_type &other) const
+ { return m_num == other.m_num; }
+
+ bool less(const this_type &other) const
+ { return other.m_num < m_num; }
+
+ T & dereference() const
+ { return *m_ptr; }
+
+ void advance(Difference n)
+ { m_num -= n; }
+
+ Difference distance_to(const this_type &other)const
+ { return m_num - other.m_num; }
+};
+
+template <class T, class EmplaceFunctor, class Difference /*= std::ptrdiff_t*/>
+class emplace_iterator
+ : public std::iterator
+ <std::random_access_iterator_tag, T, Difference, const T*, const T &>
+{
+ typedef emplace_iterator this_type;
+
+ public:
+ typedef Difference difference_type;
+ explicit emplace_iterator(EmplaceFunctor&e)
+ : m_num(1), m_pe(&e){}
+
+ emplace_iterator()
+ : m_num(0), m_pe(0){}
+
+ this_type& operator++()
+ { increment(); return *this; }
+
+ this_type operator++(int)
+ {
+ this_type result (*this);
+ increment();
+ return result;
+ }
+
+ this_type& operator--()
+ { decrement(); return *this; }
+
+ this_type operator--(int)
+ {
+ this_type result (*this);
+ decrement();
+ return result;
+ }
+
+ friend bool operator== (const this_type& i, const this_type& i2)
+ { return i.equal(i2); }
+
+ friend bool operator!= (const this_type& i, const this_type& i2)
+ { return !(i == i2); }
+
+ friend bool operator< (const this_type& i, const this_type& i2)
+ { return i.less(i2); }
+
+ friend bool operator> (const this_type& i, const this_type& i2)
+ { return i2 < i; }
+
+ friend bool operator<= (const this_type& i, const this_type& i2)
+ { return !(i > i2); }
+
+ friend bool operator>= (const this_type& i, const this_type& i2)
+ { return !(i < i2); }
+
+ friend difference_type operator- (const this_type& i, const this_type& i2)
+ { return i2.distance_to(i); }
+
+ //Arithmetic
+ this_type& operator+=(difference_type off)
+ { this->advance(off); return *this; }
+
+ this_type operator+(difference_type off) const
+ {
+ this_type other(*this);
+ other.advance(off);
+ return other;
+ }
+
+ friend this_type operator+(difference_type off, const this_type& right)
+ { return right + off; }
+
+ this_type& operator-=(difference_type off)
+ { this->advance(-off); return *this; }
+
+ this_type operator-(difference_type off) const
+ { return *this + (-off); }
+
+ //This pseudo-iterator's dereference operations have no sense since value is not
+ //constructed until ::boost::container::construct_in_place is called.
+ //So comment them to catch bad uses
+ //const T& operator*() const;
+ //const T& operator[](difference_type) const;
+ //const T* operator->() const;
+
+ template<class A>
+ void construct_in_place(A &a, T* ptr)
+ { (*m_pe)(a, ptr); }
+
+ private:
+ difference_type m_num;
+ EmplaceFunctor * m_pe;
+
+ void increment()
+ { --m_num; }
+
+ void decrement()
+ { ++m_num; }
+
+ bool equal(const this_type &other) const
+ { return m_num == other.m_num; }
+
+ bool less(const this_type &other) const
+ { return other.m_num < m_num; }
+
+ const T & dereference() const
+ {
+ static T dummy;
+ return dummy;
+ }
+
+ void advance(difference_type n)
+ { m_num -= n; }
+
+ difference_type distance_to(const this_type &other)const
+ { return difference_type(m_num - other.m_num); }
+};
+
+#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+template<class ...Args>
+struct emplace_functor
+{
+ typedef typename container_detail::build_number_seq<sizeof...(Args)>::type index_tuple_t;
+
+ emplace_functor(Args&&... args)
+ : args_(args...)
+ {}
+
+ template<class A, class T>
+ void operator()(A &a, T *ptr)
+ { emplace_functor::inplace_impl(a, ptr, index_tuple_t()); }
+
+ template<class A, class T, int ...IdxPack>
+ void inplace_impl(A &a, T* ptr, const container_detail::index_tuple<IdxPack...>&)
+ {
+ allocator_traits<A>::construct
+ (a, ptr, ::boost::forward<Args>(container_detail::get<IdxPack>(args_))...);
+ }
+
+ container_detail::tuple<Args&...> args_;
+};
+
+#else //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+#define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template <) \
+ BOOST_PP_ENUM_PARAMS(n, class P) \
+ BOOST_PP_EXPR_IF(n, >) \
+ struct BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
+ { \
+ BOOST_PP_CAT(BOOST_PP_CAT(emplace_functor, n), arg) \
+ ( BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \
+ BOOST_PP_EXPR_IF(n, :) BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_INIT, _){} \
+ \
+ template<class A, class T> \
+ void operator()(A &a, T *ptr) \
+ { \
+ allocator_traits<A>::construct \
+ (a, ptr BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_MEMBER_FORWARD, _) ); \
+ } \
+ BOOST_PP_REPEAT(n, BOOST_CONTAINER_PP_PARAM_DEFINE, _) \
+ }; \
+ //!
+#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+#include BOOST_PP_LOCAL_ITERATE()
+
+#endif
+
+namespace container_detail {
+
+template<class T>
+struct has_iterator_category
+{
+ template <typename X>
+ static char test(int, typename X::iterator_category*);
+
+ template <typename X>
+ static int test(int, ...);
+
+ static const bool value = (1 == sizeof(test<T>(0, 0)));
+};
+
+
+template<class T, bool = has_iterator_category<T>::value >
+struct is_input_iterator
+{
+ static const bool value = is_same<typename T::iterator_category, std::input_iterator_tag>::value;
+};
+
+template<class T>
+struct is_input_iterator<T, false>
+{
+ static const bool value = false;
+};
+
+template<class T, bool = has_iterator_category<T>::value >
+struct is_forward_iterator
+{
+ static const bool value = is_same<typename T::iterator_category, std::forward_iterator_tag>::value;
+};
+
+template<class T>
+struct is_forward_iterator<T, false>
+{
+ static const bool value = false;
+};
+
+template<class T, bool = has_iterator_category<T>::value >
+struct is_bidirectional_iterator
+{
+ static const bool value = is_same<typename T::iterator_category, std::bidirectional_iterator_tag>::value;
+};
+
+template<class T>
+struct is_bidirectional_iterator<T, false>
+{
+ static const bool value = false;
+};
+
+template<class IIterator>
+struct iiterator_types
+{
+ typedef typename IIterator::value_type it_value_type;
+ typedef typename it_value_type::value_type value_type;
+ typedef typename std::iterator_traits<IIterator>::pointer it_pointer;
+ typedef typename std::iterator_traits<IIterator>::difference_type difference_type;
+ typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
+ template rebind_pointer<value_type>::type pointer;
+ typedef typename ::boost::intrusive::pointer_traits<it_pointer>::
+ template rebind_pointer<const value_type>::type const_pointer;
+ typedef typename ::boost::intrusive::
+ pointer_traits<pointer>::reference reference;
+ typedef typename ::boost::intrusive::
+ pointer_traits<const_pointer>::reference const_reference;
+ typedef typename IIterator::iterator_category iterator_category;
+};
+
+template<class IIterator, bool IsConst>
+struct std_iterator
+{
+ typedef typename std::iterator
+ < typename iiterator_types<IIterator>::iterator_category
+ , typename iiterator_types<IIterator>::value_type
+ , typename iiterator_types<IIterator>::difference_type
+ , typename iiterator_types<IIterator>::const_pointer
+ , typename iiterator_types<IIterator>::const_reference> type;
+};
+
+template<class IIterator>
+struct std_iterator<IIterator, false>
+{
+ typedef typename std::iterator
+ < typename iiterator_types<IIterator>::iterator_category
+ , typename iiterator_types<IIterator>::value_type
+ , typename iiterator_types<IIterator>::difference_type
+ , typename iiterator_types<IIterator>::pointer
+ , typename iiterator_types<IIterator>::reference> type;
+};
+
+template<class IIterator, bool IsConst>
+class iterator
+ : public std_iterator<IIterator, IsConst>::type
+{
+ typedef typename std_iterator<IIterator, IsConst>::type types_t;
+
+ public:
+ typedef typename types_t::value_type value_type;
+ typedef typename types_t::pointer pointer;
+ typedef typename types_t::reference reference;
+
+ iterator()
+ {}
+
+ explicit iterator(IIterator iit) BOOST_CONTAINER_NOEXCEPT
+ : m_iit(iit)
+ {}
+
+ iterator(iterator<IIterator, false> const& other) BOOST_CONTAINER_NOEXCEPT
+ : m_iit(other.get())
+ {}
+
+ iterator& operator++() BOOST_CONTAINER_NOEXCEPT
+ { ++this->m_iit; return *this; }
+
+ iterator operator++(int) BOOST_CONTAINER_NOEXCEPT
+ {
+ iterator result (*this);
+ ++this->m_iit;
+ return result;
+ }
+
+ iterator& operator--() BOOST_CONTAINER_NOEXCEPT
+ {
+ //If the iterator is not a bidirectional iterator, operator-- should not exist
+ BOOST_STATIC_ASSERT((is_bidirectional_iterator<iterator>::value));
+ --this->m_iit; return *this;
+ }
+
+ iterator operator--(int) BOOST_CONTAINER_NOEXCEPT
+ {
+ iterator result (*this);
+ --this->m_iit;
+ return result;
+ }
+
+ friend bool operator== (const iterator& l, const iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_iit == r.m_iit; }
+
+ friend bool operator!= (const iterator& l, const iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return !(l == r); }
+
+ reference operator*() const BOOST_CONTAINER_NOEXCEPT
+ { return (*this->m_iit).get_data(); }
+
+ pointer operator->() const BOOST_CONTAINER_NOEXCEPT
+ { return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*()); }
+
+ const IIterator &get() const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_iit; }
+
+ private:
+ IIterator m_iit;
+};
+
+} //namespace container_detail {
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATORS_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/memory_util.hpp b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp
index c00172c..572d30a 100644
--- a/3rdParty/Boost/src/boost/container/detail/memory_util.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2013. 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)
//
@@ -11,26 +11,28 @@
#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP
#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# 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/memory_util.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>))
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (2, 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>))
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
#include BOOST_PP_ITERATE()
#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME max_size
@@ -48,14 +50,19 @@
#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>))
+#define BOOST_PP_ITERATION_PARAMS_1 (3, (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS+1, <boost/intrusive/detail/has_member_function_callable_with.hpp>))
+#include BOOST_PP_ITERATE()
+
+#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME swap
+#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, (1, 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)
@@ -67,6 +74,8 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assig
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)
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(value_compare)
+BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(wrapped_value_compare)
} //namespace container_detail {
} //namespace container {
diff --git a/3rdParty/Boost/src/boost/container/detail/mpl.hpp b/3rdParty/Boost/src/boost/container/detail/mpl.hpp
index 74a1ce0..fc1a8a6 100644
--- a/3rdParty/Boost/src/boost/container/detail/mpl.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/mpl.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012.
+// (C) Copyright Ion Gaztanaga 2005-2013.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,10 +13,13 @@
#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
#define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
#include <cstddef>
namespace boost {
@@ -66,18 +69,32 @@ 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> {};
+#if defined(_MSC_VER) && (_MSC_VER >= 1400)
+
+template <class T, class U>
+struct is_convertible
+{
+ static const bool value = __is_convertible_to(T, U);
+};
+
+#else
+
template <class T, class U>
class is_convertible
{
typedef char true_t;
class false_t { char dummy[2]; };
- static true_t dispatch(U);
+ //use any_conversion as first parameter since in MSVC
+ //overaligned types can't go through ellipsis
static false_t dispatch(...);
- static T trigger();
+ static true_t dispatch(U);
+ static T &trigger();
public:
- enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
+ static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t);
};
+#endif
+
template<
bool C
, typename T1
@@ -110,8 +127,10 @@ struct if_
template <class Pair>
struct select1st
-// : public std::unary_function<Pair, typename Pair::first_type>
{
+ typedef Pair argument_type;
+ typedef typename Pair::first_type result_type;
+
template<class OtherPair>
const typename Pair::first_type& operator()(const OtherPair& x) const
{ return x.first; }
@@ -123,8 +142,10 @@ struct select1st
// identity is an extension: it is not part of the standard.
template <class T>
struct identity
-// : public std::unary_function<T,T>
{
+ typedef T argument_type;
+ typedef T result_type;
+
typedef T type;
const T& operator()(const T& x) const
{ return x; }
@@ -156,5 +177,7 @@ template <> struct unvoid<const void> { struct type { }; };
} //namespace container {
} //namespace boost {
+#include <boost/container/detail/config_end.hpp>
+
#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/multiallocation_chain.hpp b/3rdParty/Boost/src/boost/container/detail/multiallocation_chain.hpp
new file mode 100644
index 0000000..38c331c
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/multiallocation_chain.hpp
@@ -0,0 +1,288 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013. 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_MULTIALLOCATION_CHAIN_HPP
+#define BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/container_fwd.hpp>
+#include <boost/container/detail/utilities.hpp>
+#include <boost/container/detail/type_traits.hpp>
+#include <boost/container/detail/transform_iterator.hpp>
+#include <boost/intrusive/slist.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/move/utility.hpp>
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template<class VoidPointer>
+class basic_multiallocation_chain
+{
+ private:
+ typedef bi::slist_base_hook<bi::void_pointer<VoidPointer>
+ ,bi::link_mode<bi::normal_link>
+ > node;
+
+ typedef typename boost::intrusive::pointer_traits
+ <VoidPointer>::template rebind_pointer<char>::type char_ptr;
+ typedef typename boost::intrusive::
+ pointer_traits<char_ptr>::difference_type difference_type;
+
+ typedef bi::slist< node
+ , bi::linear<true>
+ , bi::cache_last<true>
+ , bi::size_type<typename boost::make_unsigned<difference_type>::type>
+ > slist_impl_t;
+ slist_impl_t slist_impl_;
+
+ typedef typename boost::intrusive::pointer_traits
+ <VoidPointer>::template rebind_pointer<node>::type node_ptr;
+ typedef typename boost::intrusive::
+ pointer_traits<node_ptr> node_ptr_traits;
+
+ static node & to_node(const VoidPointer &p)
+ { return *static_cast<node*>(static_cast<void*>(container_detail::to_raw_pointer(p))); }
+
+ static VoidPointer from_node(node &n)
+ { return node_ptr_traits::pointer_to(n); }
+
+ static node_ptr to_node_ptr(const VoidPointer &p)
+ { return node_ptr_traits::static_cast_from(p); }
+
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
+
+ public:
+
+ typedef VoidPointer void_pointer;
+ typedef typename slist_impl_t::iterator iterator;
+ typedef typename slist_impl_t::size_type size_type;
+
+ basic_multiallocation_chain()
+ : slist_impl_()
+ {}
+
+ basic_multiallocation_chain(const void_pointer &b, const void_pointer &before_e, size_type n)
+ : slist_impl_(to_node_ptr(b), to_node_ptr(before_e), n)
+ {}
+
+ basic_multiallocation_chain(BOOST_RV_REF(basic_multiallocation_chain) other)
+ : slist_impl_(::boost::move(other.slist_impl_))
+ {}
+
+ basic_multiallocation_chain& operator=(BOOST_RV_REF(basic_multiallocation_chain) other)
+ {
+ slist_impl_ = ::boost::move(other.slist_impl_);
+ return *this;
+ }
+
+ bool empty() const
+ { return slist_impl_.empty(); }
+
+ size_type size() const
+ { return slist_impl_.size(); }
+
+ iterator before_begin()
+ { return slist_impl_.before_begin(); }
+
+ iterator begin()
+ { return slist_impl_.begin(); }
+
+ iterator end()
+ { return slist_impl_.end(); }
+
+ iterator last()
+ { return slist_impl_.last(); }
+
+ void clear()
+ { slist_impl_.clear(); }
+
+ iterator insert_after(iterator it, void_pointer m)
+ { return slist_impl_.insert_after(it, to_node(m)); }
+
+ void push_front(const void_pointer &m)
+ { return slist_impl_.push_front(to_node(m)); }
+
+ void push_back(const void_pointer &m)
+ { return slist_impl_.push_back(to_node(m)); }
+
+ void_pointer pop_front()
+ {
+ node & n = slist_impl_.front();
+ void_pointer ret = from_node(n);
+ slist_impl_.pop_front();
+ return ret;
+ }
+
+ void splice_after(iterator after_this, basic_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
+ { slist_impl_.splice_after(after_this, x.slist_impl_, before_b, before_e, n); }
+
+ void splice_after(iterator after_this, basic_multiallocation_chain &x)
+ { slist_impl_.splice_after(after_this, x.slist_impl_); }
+
+ void erase_after(iterator before_b, iterator e, size_type n)
+ { slist_impl_.erase_after(before_b, e, n); }
+
+ void_pointer incorporate_after(iterator after_this, const void_pointer &b, size_type unit_bytes, size_type num_units)
+ {
+ typedef typename boost::intrusive::pointer_traits<char_ptr> char_pointer_traits;
+ char_ptr elem = char_pointer_traits::static_cast_from(b);
+ if(num_units){
+ char_ptr prev_elem = elem;
+ elem += unit_bytes;
+ for(size_type i = 0; i != num_units-1; ++i, elem += unit_bytes){
+ ::new (container_detail::to_raw_pointer(prev_elem)) void_pointer(elem);
+ prev_elem = elem;
+ }
+ slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(prev_elem), num_units);
+ }
+ return elem;
+ }
+
+ void incorporate_after(iterator after_this, void_pointer b, void_pointer before_e, size_type n)
+ { slist_impl_.incorporate_after(after_this, to_node_ptr(b), to_node_ptr(before_e), n); }
+
+ void swap(basic_multiallocation_chain &x)
+ { slist_impl_.swap(x.slist_impl_); }
+
+ static iterator iterator_to(const void_pointer &p)
+ { return slist_impl_t::s_iterator_to(to_node(p)); }
+
+ std::pair<void_pointer, void_pointer> extract_data()
+ {
+ std::pair<void_pointer, void_pointer> ret
+ (slist_impl_.begin().operator->()
+ ,slist_impl_.last().operator->());
+ slist_impl_.clear();
+ return ret;
+ }
+};
+
+template<class T>
+struct cast_functor
+{
+ typedef typename container_detail::add_reference<T>::type result_type;
+ template<class U>
+ result_type operator()(U &ptr) const
+ { return *static_cast<T*>(static_cast<void*>(&ptr)); }
+};
+
+template<class MultiallocationChain, class T>
+class transform_multiallocation_chain
+ : public MultiallocationChain
+{
+ private:
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(transform_multiallocation_chain)
+ //transform_multiallocation_chain(const transform_multiallocation_chain &);
+ //transform_multiallocation_chain & operator=(const transform_multiallocation_chain &);
+
+ typedef typename MultiallocationChain::void_pointer void_pointer;
+ typedef typename boost::intrusive::pointer_traits
+ <void_pointer> void_pointer_traits;
+ typedef typename void_pointer_traits::template
+ rebind_pointer<T>::type pointer;
+ typedef typename boost::intrusive::pointer_traits
+ <pointer> pointer_traits;
+
+ static pointer cast(const void_pointer &p)
+ { return pointer_traits::static_cast_from(p); }
+
+ public:
+ typedef transform_iterator
+ < typename MultiallocationChain::iterator
+ , container_detail::cast_functor <T> > iterator;
+ typedef typename MultiallocationChain::size_type size_type;
+
+ transform_multiallocation_chain()
+ : MultiallocationChain()
+ {}
+
+ transform_multiallocation_chain(BOOST_RV_REF(transform_multiallocation_chain) other)
+ : MultiallocationChain(::boost::move(static_cast<MultiallocationChain&>(other)))
+ {}
+
+ transform_multiallocation_chain(BOOST_RV_REF(MultiallocationChain) other)
+ : MultiallocationChain(::boost::move(static_cast<MultiallocationChain&>(other)))
+ {}
+
+ transform_multiallocation_chain& operator=(BOOST_RV_REF(transform_multiallocation_chain) other)
+ {
+ return static_cast<MultiallocationChain&>
+ (this->MultiallocationChain::operator=(::boost::move(static_cast<MultiallocationChain&>(other))));
+ }
+/*
+ void push_front(const pointer &mem)
+ { holder_.push_front(mem); }
+
+ void push_back(const pointer &mem)
+ { return holder_.push_back(mem); }
+
+ void swap(transform_multiallocation_chain &other_chain)
+ { holder_.swap(other_chain.holder_); }
+
+ void splice_after(iterator after_this, transform_multiallocation_chain &x, iterator before_b, iterator before_e, size_type n)
+ { holder_.splice_after(after_this.base(), x.holder_, before_b.base(), before_e.base(), n); }
+
+ void incorporate_after(iterator after_this, pointer b, pointer before_e, size_type n)
+ { holder_.incorporate_after(after_this.base(), b, before_e, n); }
+*/
+ pointer pop_front()
+ { return cast(this->MultiallocationChain::pop_front()); }
+/*
+ bool empty() const
+ { return holder_.empty(); }
+
+ iterator before_begin()
+ { return iterator(holder_.before_begin()); }
+*/
+ iterator begin()
+ { return iterator(this->MultiallocationChain::begin()); }
+/*
+ iterator end()
+ { return iterator(holder_.end()); }
+
+ iterator last()
+ { return iterator(holder_.last()); }
+
+ size_type size() const
+ { return holder_.size(); }
+
+ void clear()
+ { holder_.clear(); }
+*/
+ iterator insert_after(iterator it, pointer m)
+ { return iterator(this->MultiallocationChain::insert_after(it.base(), m)); }
+
+ static iterator iterator_to(const pointer &p)
+ { return iterator(MultiallocationChain::iterator_to(p)); }
+
+ std::pair<pointer, pointer> extract_data()
+ {
+ std::pair<void_pointer, void_pointer> data(this->MultiallocationChain::extract_data());
+ return std::pair<pointer, pointer>(cast(data.first), cast(data.second));
+ }
+/*
+ MultiallocationChain &extract_multiallocation_chain()
+ { return holder_; }*/
+};
+
+}}}
+
+// namespace container_detail {
+// namespace container {
+// namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //BOOST_CONTAINER_DETAIL_MULTIALLOCATION_CHAIN_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/pair.hpp b/3rdParty/Boost/src/boost/container/detail/pair.hpp
index 2a20ed1..0d7e0a9 100644
--- a/3rdParty/Boost/src/boost/container/detail/pair.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/pair.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012.
+// (C) Copyright Ion Gaztanaga 2005-2013.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -13,11 +13,11 @@
#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
#define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
-#include "config_begin.hpp"
+#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
#include <boost/container/detail/mpl.hpp>
@@ -26,8 +26,9 @@
#include <boost/container/detail/type_traits.hpp>
#include <utility> //std::pair
+#include <algorithm> //std::swap
-#include <boost/move/move.hpp>
+#include <boost/move/utility.hpp>
#include <boost/type_traits/is_class.hpp>
#ifndef BOOST_CONTAINER_PERFECT_FORWARDING
@@ -336,7 +337,7 @@ struct is_class< ::boost::container::container_detail::pair<T1, T2> >
: public ::boost::true_type
{};
-#ifdef BOOST_NO_RVALUE_REFERENCES
+#ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T1, class T2>
struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> >
diff --git a/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp
index 5129ea1..7e4f5eb 100644
--- a/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2008-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2008-2013. 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)
//
@@ -11,12 +11,13 @@
#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
#define BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
+#include <boost/move/utility.hpp>
#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
//#error "This file is not needed when perfect forwarding is available"
@@ -38,6 +39,7 @@
#include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/iteration/iterate.hpp>
+#include <boost/move/utility.hpp>
#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10
@@ -47,7 +49,7 @@
//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
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
//!
@@ -55,13 +57,13 @@
#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
+#endif //#ifndef BOOST_NO_CXX11_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
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM(U, u) \
U && u \
//!
@@ -69,22 +71,22 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
#define BOOST_CONTAINER_PP_PARAM(U, u) \
const U & u \
//!
-#endif //#ifndef BOOST_NO_RVALUE_REFERENCES
+#endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_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
+#else //BOOST_NO_CXX11_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
+#endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
@@ -97,7 +99,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T>
struct ref_holder<T &>
{
- ref_holder(T &t)
+ explicit ref_holder(T &t)
: t_(t)
{}
T &t_;
@@ -107,7 +109,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T>
struct ref_holder<const T>
{
- ref_holder(const T &t)
+ explicit ref_holder(const T &t)
: t_(t)
{}
const T &t_;
@@ -117,7 +119,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T>
struct ref_holder<const T &&>
{
- ref_holder(const T &t)
+ explicit ref_holder(const T &t)
: t_(t)
{}
const T &t_;
@@ -127,7 +129,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T>
struct ref_holder
{
- ref_holder(T &&t)
+ explicit ref_holder(T &&t)
: t_(t)
{}
T &t_;
@@ -137,10 +139,10 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T>
struct ref_holder<T &&>
{
- ref_holder(T &&t)
- : t(t)
+ explicit ref_holder(T &&t)
+ : t_(t)
{}
- T &t;
+ T &t_;
T && get() { return ::boost::move(t_); }
};
@@ -160,25 +162,25 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
-#else //BOOST_NO_RVALUE_REFERENCES
+#else //BOOST_NO_CXX11_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
+#endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#if !defined(BOOST_NO_CXX11_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)
+#else //!defined(BOOST_NO_CXX11_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)
+#endif //!defined(BOOST_NO_CXX11_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) \
diff --git a/3rdParty/Boost/src/boost/container/detail/transform_iterator.hpp b/3rdParty/Boost/src/boost/container/detail/transform_iterator.hpp
new file mode 100644
index 0000000..c4e746c
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/transform_iterator.hpp
@@ -0,0 +1,177 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013.
+// (C) Copyright Gennaro Prota 2003 - 2004.
+//
+// Distributed under the Boost Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/container for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
+#define BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/detail/type_traits.hpp>
+#include <iterator>
+
+namespace boost {
+namespace container {
+
+template <class PseudoReference>
+struct operator_arrow_proxy
+{
+ operator_arrow_proxy(const PseudoReference &px)
+ : m_value(px)
+ {}
+
+ typedef PseudoReference element_type;
+
+ PseudoReference* operator->() const { return &m_value; }
+
+ mutable PseudoReference m_value;
+};
+
+template <class T>
+struct operator_arrow_proxy<T&>
+{
+ operator_arrow_proxy(T &px)
+ : m_value(px)
+ {}
+
+ typedef T element_type;
+
+ T* operator->() const { return const_cast<T*>(&m_value); }
+
+ T &m_value;
+};
+
+template <class Iterator, class UnaryFunction>
+class transform_iterator
+ : public UnaryFunction
+ , public std::iterator
+ < typename Iterator::iterator_category
+ , typename container_detail::remove_reference<typename UnaryFunction::result_type>::type
+ , typename Iterator::difference_type
+ , operator_arrow_proxy<typename UnaryFunction::result_type>
+ , typename UnaryFunction::result_type>
+{
+ public:
+ explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction())
+ : UnaryFunction(f), m_it(it)
+ {}
+
+ explicit transform_iterator()
+ : UnaryFunction(), m_it()
+ {}
+
+ //Constructors
+ transform_iterator& operator++()
+ { increment(); return *this; }
+
+ transform_iterator operator++(int)
+ {
+ transform_iterator result (*this);
+ increment();
+ return result;
+ }
+
+ friend bool operator== (const transform_iterator& i, const transform_iterator& i2)
+ { return i.equal(i2); }
+
+ friend bool operator!= (const transform_iterator& i, const transform_iterator& i2)
+ { return !(i == i2); }
+
+/*
+ friend bool operator> (const transform_iterator& i, const transform_iterator& i2)
+ { return i2 < i; }
+
+ friend bool operator<= (const transform_iterator& i, const transform_iterator& i2)
+ { return !(i > i2); }
+
+ friend bool operator>= (const transform_iterator& i, const transform_iterator& i2)
+ { return !(i < i2); }
+*/
+ friend typename Iterator::difference_type operator- (const transform_iterator& i, const transform_iterator& i2)
+ { return i2.distance_to(i); }
+
+ //Arithmetic
+ transform_iterator& operator+=(typename Iterator::difference_type off)
+ { this->advance(off); return *this; }
+
+ transform_iterator operator+(typename Iterator::difference_type off) const
+ {
+ transform_iterator other(*this);
+ other.advance(off);
+ return other;
+ }
+
+ friend transform_iterator operator+(typename Iterator::difference_type off, const transform_iterator& right)
+ { return right + off; }
+
+ transform_iterator& operator-=(typename Iterator::difference_type off)
+ { this->advance(-off); return *this; }
+
+ transform_iterator operator-(typename Iterator::difference_type off) const
+ { return *this + (-off); }
+
+ typename UnaryFunction::result_type operator*() const
+ { return dereference(); }
+
+ operator_arrow_proxy<typename UnaryFunction::result_type>
+ operator->() const
+ { return operator_arrow_proxy<typename UnaryFunction::result_type>(dereference()); }
+
+ Iterator & base()
+ { return m_it; }
+
+ const Iterator & base() const
+ { return m_it; }
+
+ private:
+ Iterator m_it;
+
+ void increment()
+ { ++m_it; }
+
+ void decrement()
+ { --m_it; }
+
+ bool equal(const transform_iterator &other) const
+ { return m_it == other.m_it; }
+
+ bool less(const transform_iterator &other) const
+ { return other.m_it < m_it; }
+
+ typename UnaryFunction::result_type dereference() const
+ { return UnaryFunction::operator()(*m_it); }
+
+ void advance(typename Iterator::difference_type n)
+ { std::advance(m_it, n); }
+
+ typename Iterator::difference_type distance_to(const transform_iterator &other)const
+ { return std::distance(other.m_it, m_it); }
+};
+
+template <class Iterator, class UnaryFunc>
+transform_iterator<Iterator, UnaryFunc>
+make_transform_iterator(Iterator it, UnaryFunc fun)
+{
+ return transform_iterator<Iterator, UnaryFunc>(it, fun);
+}
+
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_TRANSFORM_ITERATORS_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/type_traits.hpp b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp
index 0e096e5..6f20bd5 100644
--- a/3rdParty/Boost/src/boost/container/detail/type_traits.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
// (C) Copyright John Maddock 2000.
-// (C) Copyright Ion Gaztanaga 2005-2012.
+// (C) Copyright Ion Gaztanaga 2005-2013.
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
@@ -15,13 +15,14 @@
#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
-#include "config_begin.hpp"
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
-#include <boost/move/move.hpp>
+#include <boost/move/utility.hpp>
namespace boost {
namespace container {
@@ -90,7 +91,7 @@ struct remove_reference<T&>
typedef T type;
};
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T>
struct remove_reference<T&&>
diff --git a/3rdParty/Boost/src/boost/container/detail/utilities.hpp b/3rdParty/Boost/src/boost/container/detail/utilities.hpp
index ece9a2e..5aca542 100644
--- a/3rdParty/Boost/src/boost/container/detail/utilities.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/utilities.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2013. 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)
//
@@ -11,21 +11,92 @@
#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP
#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP
-#include "config_begin.hpp"
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
#include <cstdio>
+#include <cstring> //for ::memmove / ::memcpy
#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/type_traits/is_integral.hpp>
+#include <boost/type_traits/is_floating_point.hpp>
+#include <boost/type_traits/is_pointer.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/move/core.hpp>
+#include <boost/move/utility.hpp>
+#include <boost/move/iterator.hpp>
+#include <boost/assert.hpp>
+#include <boost/container/throw_exception.hpp>
#include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/type_traits.hpp>
#include <boost/container/allocator_traits.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/container/detail/memory_util.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/aligned_storage.hpp>
#include <algorithm>
+#include <iterator>
+#include <utility> //std::distance
namespace boost {
namespace container {
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// swap
+//
+//////////////////////////////////////////////////////////////////////////////
+
+namespace container_swap {
+
+template<class T, bool IsClass = boost::is_class<T>::value >
+struct has_member_swap
+{
+ static const bool value = boost::container::container_detail::
+ has_member_function_callable_with_swap<T, T &>::value;
+};
+
+template<class T>
+struct has_member_swap<T, false>
+{
+ static const bool value = false;
+};
+
+} //namespace container_swap {
+
+template<class T> inline
+typename container_detail::enable_if_c
+ <container_swap::has_member_swap<T>::value, void>::type
+swap_dispatch(T &left, T &right) //swap using member swap
+{
+ left.swap(right); // may throw
+}
+
+template<class T> inline
+typename container_detail::enable_if_c
+ <!container_swap::has_member_swap<T>::value && boost::has_move_emulation_enabled<T>::value, void>::type
+ swap_dispatch(T &left, T &right)
+{
+ T temp(boost::move(left)); // may throw
+ left = boost::move(right); // may throw
+ right = boost::move(temp); // may throw
+}
+
+template<class T> inline
+typename container_detail::enable_if_c
+ <!container_swap::has_member_swap<T>::value && !boost::has_move_emulation_enabled<T>::value, void>::type
+ swap_dispatch(T &left, T &right)
+{
+ using std::swap;
+ swap(left, right); // may throw
+}
+
namespace container_detail {
template <typename T>
@@ -46,42 +117,73 @@ 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)
+enum NextCapacityOption { NextCapacityDouble, NextCapacity60Percent };
+
+template<class SizeType, NextCapacityOption Option>
+struct next_capacity_calculator;
+
+template<class SizeType>
+struct next_capacity_calculator<SizeType, NextCapacityDouble>
{
-// if (n > max_size - capacity)
-// throw std::length_error("get_next_capacity");
+ static SizeType get(const SizeType max_size
+ ,const SizeType capacity
+ ,const SizeType n)
+ {
+ const SizeType remaining = max_size - capacity;
+ if ( remaining < n )
+ boost::container::throw_length_error("get_next_capacity, allocator's max_size reached");
+ const SizeType additional = max_value(n, capacity);
+ return ( remaining < additional ) ? max_size : ( capacity + additional );
+ }
+};
- const SizeType m3 = max_size/3;
- if (capacity < m3)
- return capacity + max_value(3*(capacity+1)/5, n);
+template<class SizeType>
+struct next_capacity_calculator<SizeType, NextCapacity60Percent>
+{
+ static SizeType get(const SizeType max_size
+ ,const SizeType capacity
+ ,const SizeType n)
+ {
+ const SizeType remaining = max_size - capacity;
+ if ( remaining < n )
+ boost::container::throw_length_error("get_next_capacity, allocator's max_size reached");
+ const SizeType m3 = max_size/3;
- if (capacity < m3*2)
- return capacity + max_value((capacity+1)/2, n);
+ if (capacity < m3)
+ return capacity + max_value(3*(capacity+1)/5, n);
- return max_size;
-}
+ 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*
+inline typename boost::intrusive::pointer_traits<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);
-}
+inline T* iterator_to_pointer(T* i)
+{ return i; }
+
+template <class Iterator>
+inline typename std::iterator_traits<Iterator>::pointer
+ iterator_to_pointer(const Iterator &i)
+{ return i.operator->(); }
+
+template <class Iterator>
+inline
+ typename boost::intrusive::pointer_traits
+ <typename std::iterator_traits<Iterator>::pointer>::element_type*
+ iterator_to_raw_pointer(const Iterator &i)
+{ return (to_raw_pointer)((iterator_to_pointer)(i)); }
+
template<class AllocatorType>
inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type)
@@ -90,7 +192,7 @@ inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false
template<class AllocatorType>
inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type)
-{ container_detail::do_swap(l, r); }
+{ boost::container::swap_dispatch(l, r); }
template<class AllocatorType>
inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type)
@@ -123,70 +225,339 @@ struct ct_rounded_size
enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
};
+template<class I>
+struct are_elements_contiguous
+{
+ static const bool value = false;
+};
+
+/////////////////////////
+// raw pointers
+/////////////////////////
+
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)
- >
+struct are_elements_contiguous<T*>
+{
+ static const bool value = true;
+};
+
+/////////////////////////
+// predeclarations
+/////////////////////////
+
+#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+template<class Pointer>
+class vector_iterator;
+
+template<class Pointer>
+class vector_const_iterator;
+
+#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+} //namespace container_detail {
+} //namespace container {
+
+namespace interprocess {
+
+template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
+class offset_ptr;
+
+} //namespace interprocess {
+
+namespace container {
+
+namespace container_detail {
+
+/////////////////////////
+//vector_[const_]iterator
+/////////////////////////
+
+#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+template<class Pointer>
+struct are_elements_contiguous<boost::container::container_detail::vector_iterator<Pointer> >
+{
+ static const bool value = true;
+};
+
+template<class Pointer>
+struct are_elements_contiguous<boost::container::container_detail::vector_const_iterator<Pointer> >
+{
+ static const bool value = true;
+};
+
+#endif //BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+/////////////////////////
+// offset_ptr
+/////////////////////////
+
+template <class PointedType, class DifferenceType, class OffsetType, std::size_t OffsetAlignment>
+struct are_elements_contiguous< ::boost::interprocess::offset_ptr<PointedType, DifferenceType, OffsetType, OffsetAlignment> >
+{
+ static const bool value = true;
+};
+
+template <typename I, typename O>
+struct are_contiguous_and_same
+{
+ static const bool is_same_io =
+ is_same< typename remove_const< typename ::std::iterator_traits<I>::value_type >::type
+ , typename ::std::iterator_traits<O>::value_type
+ >::value;
+ static const bool value = is_same_io &&
+ are_elements_contiguous<I>::value &&
+ are_elements_contiguous<O>::value;
+};
+
+template <typename I, typename O>
+struct is_memtransfer_copy_assignable
+{
+ static const bool value = are_contiguous_and_same<I, O>::value &&
+ boost::has_trivial_assign< typename ::std::iterator_traits<I>::value_type >::value;
+};
+
+template <typename I, typename O>
+struct is_memtransfer_copy_constructible
+{
+ static const bool value = are_contiguous_and_same<I, O>::value &&
+ boost::has_trivial_copy< typename ::std::iterator_traits<I>::value_type >::value;
+};
+
+template <typename I, typename O, typename R>
+struct enable_if_memtransfer_copy_constructible
+ : public enable_if_c<container_detail::is_memtransfer_copy_constructible<I, O>::value, R>
+{};
+
+template <typename I, typename O, typename R>
+struct disable_if_memtransfer_copy_constructible
+ : public enable_if_c<!container_detail::is_memtransfer_copy_constructible<I, O>::value, R>
+{};
+
+template <typename I, typename O, typename R>
+struct enable_if_memtransfer_copy_assignable
+ : public enable_if_c<container_detail::is_memtransfer_copy_assignable<I, O>::value, R>
+{};
+
+template <typename I, typename O, typename R>
+struct disable_if_memtransfer_copy_assignable
+ : public enable_if_c<!container_detail::is_memtransfer_copy_assignable<I, O>::value, R>
+{};
+
+template
+ <typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline F memmove(I f, I l, F r) BOOST_CONTAINER_NOEXCEPT
+{
+ typedef typename std::iterator_traits<I>::value_type value_type;
+ typename std::iterator_traits<I>::difference_type n = std::distance(f, l);
+ ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
+ std::advance(r, n);
+ return r;
+}
+
+template
+ <typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+F memmove_n(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{
+ typedef typename std::iterator_traits<I>::value_type value_type;
+ ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
+ std::advance(r, n);
+ return r;
+}
+
+template
+ <typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+I memmove_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{
+ typedef typename std::iterator_traits<I>::value_type value_type;
+ ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
+ std::advance(f, n);
+ return f;
+}
+
+template
+ <typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+I memmove_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
+{
+ typedef typename std::iterator_traits<I>::value_type value_type;
+ ::memmove((iterator_to_raw_pointer)(r), (iterator_to_raw_pointer)(f), sizeof(value_type)*n);
+ std::advance(f, n);
+ std::advance(r, n);
+ return f;
+}
+
+template <typename O>
+struct is_memzero_initializable
+{
+ typedef typename ::std::iterator_traits<O>::value_type value_type;
+ static const bool value = are_elements_contiguous<O>::value &&
+ ( ::boost::is_integral<value_type>::value || ::boost::is_enum<value_type>::value
+ #if defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL)
+ || ::boost::is_pointer<value_type>::value
+ #endif
+ #if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO)
+ || ::boost::is_floating_point<value_type>::value
+ #endif
+ #if defined(BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO) && defined(BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL)
+ || ::boost::is_pod<value_type>::value
+ #endif
+ );
+};
+
+template <typename O, typename R>
+struct enable_if_memzero_initializable
+ : public enable_if_c<container_detail::is_memzero_initializable<O>::value, R>
+{};
+
+template <typename O, typename R>
+struct disable_if_memzero_initializable
+ : public enable_if_c<!container_detail::is_memzero_initializable<O>::value, R>
{};
} //namespace container_detail {
+
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move_alloc
//
//////////////////////////////////////////////////////////////////////////////
+
//! <b>Effects</b>:
//! \code
-//! for (; first != last; ++result, ++first)
-//! allocator_traits::construct(a, &*result, boost::move(*first));
+//! for (; f != l; ++r, ++f)
+//! allocator_traits::construct(a, &*r, boost::move(*f));
//! \endcode
//!
-//! <b>Returns</b>: result
+//! <b>Returns</b>: r
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)
+inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
+ 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;
+ F back = r;
+ BOOST_TRY{
+ while (f != l) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
return r;
}
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_move_alloc(A &, I f, I l, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove(f, l, r); }
+
//////////////////////////////////////////////////////////////////////////////
//
-// uninitialized_copy_alloc
+// uninitialized_move_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
-//! for (; first != last; ++result, ++first)
-//! allocator_traits::construct(a, &*result, *first);
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r, boost::move(*f));
//! \endcode
//!
-//! <b>Returns</b>: result
+//! <b>Returns</b>: r
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)
+inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_move_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
{
- while (f != l) {
- allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f);
- ++f; ++r;
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
}
+ BOOST_CATCH_END
return r;
}
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_move_alloc_n(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_move_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r, boost::move(*f));
+//! \endcode
+//!
+//! <b>Returns</b>: f (after incremented)
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type
+ uninitialized_move_alloc_n_source(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), boost::move(*f));
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return f;
+}
+
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type
+ uninitialized_move_alloc_n_source(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n_source(f, n, r); }
+
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_alloc
@@ -195,58 +566,701 @@ F uninitialized_copy_alloc(A &a, I f, I l, F r)
//! <b>Effects</b>:
//! \code
-//! for (; first != last; ++result, ++first)
-//! allocator_traits::construct(a, &*result, *first);
+//! for (; f != l; ++r, ++f)
+//! allocator_traits::construct(a, &*r, *f);
+//! \endcode
+//!
+//! <b>Returns</b>: r
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_copy_alloc(A &a, I f, I l, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (f != l) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return r;
+}
+
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_copy_alloc(A &, I f, I l, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove(f, l, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_copy_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r, *f);
+//! \endcode
+//!
+//! <b>Returns</b>: r
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_copy_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return r;
+}
+
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, F>::type
+ uninitialized_copy_alloc_n(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_copy_alloc_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r, *f);
+//! \endcode
+//!
+//! <b>Returns</b>: f (after incremented)
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_constructible<I, F, I>::type
+ uninitialized_copy_alloc_n_source(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), *f);
+ ++f; ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return f;
+}
+
+template
+ <typename A,
+ typename I, // I models InputIterator
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_constructible<I, F, I>::type
+ uninitialized_copy_alloc_n_source(A &, I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n_source(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_value_init_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r);
+//! \endcode
+//!
+//! <b>Returns</b>: r
+template
+ <typename A,
+ typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memzero_initializable<F, F>::type
+ uninitialized_value_init_alloc_n(A &a, typename allocator_traits<A>::difference_type n, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r));
+ ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return r;
+}
+
+template
+ <typename A,
+ typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memzero_initializable<F, F>::type
+ uninitialized_value_init_alloc_n(A &, typename allocator_traits<A>::difference_type n, F r)
+{
+ typedef typename std::iterator_traits<F>::value_type value_type;
+ ::memset((void*)container_detail::iterator_to_raw_pointer(r), 0, sizeof(value_type)*n);
+ std::advance(r, n);
+ return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_default_init_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r);
//! \endcode
//!
-//! <b>Returns</b>: result
+//! <b>Returns</b>: r
+template
+ <typename A,
+ typename F> // F models ForwardIterator
+inline F uninitialized_default_init_alloc_n(A &a, typename allocator_traits<A>::difference_type n, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), default_init);
+ ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_fill_alloc
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; f != l; ++r, ++f)
+//! allocator_traits::construct(a, &*r, *f);
+//! \endcode
+//!
+//! <b>Returns</b>: r
template
<typename A,
typename F, // F models ForwardIterator
typename T>
-void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
+inline void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
+{
+ F back = f;
+ BOOST_TRY{
+ while (f != l) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(f), t);
+ ++f;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != l; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// uninitialized_fill_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//! <b>Effects</b>:
+//! \code
+//! for (; n--; ++r, ++f)
+//! allocator_traits::construct(a, &*r, v);
+//! \endcode
+//!
+//! <b>Returns</b>: r
+template
+ <typename A,
+ typename T,
+ typename F> // F models ForwardIterator
+inline F uninitialized_fill_alloc_n(A &a, const T &v, typename allocator_traits<A>::difference_type n, F r)
+{
+ F back = r;
+ BOOST_TRY{
+ while (n--) {
+ allocator_traits<A>::construct(a, container_detail::iterator_to_raw_pointer(r), v);
+ ++r;
+ }
+ }
+ BOOST_CATCH(...){
+ for (; back != r; ++back){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(back));
+ }
+ BOOST_RETHROW;
+ }
+ BOOST_CATCH_END
+ return r;
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// copy
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
+ copy(I f, I l, F r)
{
while (f != l) {
- allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t);
- ++f;
+ *r = *f;
+ ++f; ++r;
+ }
+ return r;
+}
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
+ copy(I f, I l, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove(f, l, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// copy_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
+ copy_n(I f, typename std::iterator_traits<I>::difference_type n, F r)
+{
+ while (n--) {
+ *r = *f;
+ ++f; ++r;
}
+ return r;
}
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
+ copy_n(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n(f, n, r); }
+
//////////////////////////////////////////////////////////////////////////////
//
-// uninitialized_copy_or_move_alloc
+// copy_n_source
//
//////////////////////////////////////////////////////////////////////////////
template
-<typename A
-,typename I // I models InputIterator
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
+ copy_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r)
+{
+ while (n--) {
+ *r = *f;
+ ++f; ++r;
+ }
+ return f;
+}
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
+ copy_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n_source(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// copy_n_source_dest
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
+ copy_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r)
+{
+ while (n--) {
+ *r = *f;
+ ++f; ++r;
+ }
+ return f;
+}
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
+ copy_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n_source_dest(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// move
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
+ move(I f, I l, F r)
+{
+ while (f != l) {
+ *r = ::boost::move(*f);
+ ++f; ++r;
+ }
+ return r;
+}
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
+ move(I f, I l, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove(f, l, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// move_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, F>::type
+ move_n(I f, typename std::iterator_traits<I>::difference_type n, F r)
+{
+ while (n--) {
+ *r = ::boost::move(*f);
+ ++f; ++r;
+ }
+ return r;
+}
+
+template
+<typename I, // I models InputIterator
+typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, F>::type
+ move_n(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// move_n_source
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<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)
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
+ move_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r)
{
- return ::boost::container::uninitialized_move_alloc(a, f, l, r);
+ while (n--) {
+ *r = ::boost::move(*f);
+ ++f; ++r;
+ }
+ return f;
}
template
-<typename A
-,typename I // I models InputIterator
+<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)
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
+ move_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n_source(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// move_n_source_dest
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+<typename I // I models InputIterator
+,typename F> // F models ForwardIterator
+inline typename container_detail::disable_if_memtransfer_copy_assignable<I, F, I>::type
+ move_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r)
{
- return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
+ while (n--) {
+ *r = ::boost::move(*f);
+ ++f; ++r;
+ }
+ return f;
}
+template
+<typename I // I models InputIterator
+,typename F> // F models ForwardIterator
+inline typename container_detail::enable_if_memtransfer_copy_assignable<I, F, I>::type
+ move_n_source_dest(I f, typename std::iterator_traits<I>::difference_type n, F &r) BOOST_CONTAINER_NOEXCEPT
+{ return container_detail::memmove_n_source_dest(f, n, r); }
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// destroy_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+ <typename A
+ ,typename I> // I models InputIterator
+inline void destroy_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n
+ ,typename boost::container::container_detail::enable_if_c
+ < !boost::has_trivial_destructor<typename std::iterator_traits<I>::value_type>::value >::type* = 0)
+{
+ while(n--){
+ allocator_traits<A>::destroy(a, container_detail::iterator_to_raw_pointer(f++));
+ }
+}
+
+template
+ <typename A
+ ,typename I> // I models InputIterator
+inline void destroy_alloc_n(A &, I, typename std::iterator_traits<I>::difference_type
+ ,typename boost::container::container_detail::enable_if_c
+ < boost::has_trivial_destructor<typename std::iterator_traits<I>::value_type>::value >::type* = 0)
+{}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// deep_swap_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+ <std::size_t MaxTmpBytes
+ ,typename A
+ ,typename F // F models ForwardIterator
+ ,typename G // G models ForwardIterator
+ >
+inline typename container_detail::disable_if_memtransfer_copy_assignable<F, G, void>::type
+ deep_swap_alloc_n( A &a, F short_range_f, typename allocator_traits<A>::size_type n_i
+ , G large_range_f, typename allocator_traits<A>::size_type n_j)
+{
+ typename allocator_traits<A>::size_type n = 0;
+ for (; n != n_i ; ++short_range_f, ++large_range_f, ++n){
+ boost::container::swap_dispatch(*short_range_f, *large_range_f);
+ }
+ boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
+ boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
+}
+
+static const std::size_t DeepSwapAllocNMaxStorage = std::size_t(1) << std::size_t(11); //2K bytes
+
+template
+ <std::size_t MaxTmpBytes
+ ,typename A
+ ,typename F // F models ForwardIterator
+ ,typename G // G models ForwardIterator
+ >
+inline typename container_detail::enable_if_c
+ < container_detail::is_memtransfer_copy_assignable<F, G>::value && (MaxTmpBytes <= DeepSwapAllocNMaxStorage) && false
+ , void>::type
+ deep_swap_alloc_n( A &a, F short_range_f, typename allocator_traits<A>::size_type n_i
+ , G large_range_f, typename allocator_traits<A>::size_type n_j)
+{
+ typedef typename allocator_traits<A>::value_type value_type;
+ typedef typename boost::aligned_storage
+ <MaxTmpBytes, container_detail::alignment_of<value_type>::value>::type storage_type;
+ storage_type storage;
+
+ const std::size_t n_i_bytes = sizeof(value_type)*n_i;
+ void *const large_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f));
+ void *const short_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f));
+ void *const stora_ptr = static_cast<void*>(container_detail::iterator_to_raw_pointer(storage));
+ ::memcpy(stora_ptr, large_ptr, n_i_bytes);
+ ::memcpy(large_ptr, short_ptr, n_i_bytes);
+ ::memcpy(short_ptr, stora_ptr, n_i_bytes);
+ std::advance(large_range_f, n_i);
+ std::advance(short_range_f, n_i);
+ boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
+ boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
+}
+
+template
+ <std::size_t MaxTmpBytes
+ ,typename A
+ ,typename F // F models ForwardIterator
+ ,typename G // G models ForwardIterator
+ >
+inline typename container_detail::enable_if_c
+ < container_detail::is_memtransfer_copy_assignable<F, G>::value && true//(MaxTmpBytes > DeepSwapAllocNMaxStorage)
+ , void>::type
+ deep_swap_alloc_n( A &a, F short_range_f, typename allocator_traits<A>::size_type n_i
+ , G large_range_f, typename allocator_traits<A>::size_type n_j)
+{
+ typedef typename allocator_traits<A>::value_type value_type;
+ typedef typename boost::aligned_storage
+ <DeepSwapAllocNMaxStorage, container_detail::alignment_of<value_type>::value>::type storage_type;
+ storage_type storage;
+ const std::size_t sizeof_storage = sizeof(storage);
+
+ std::size_t n_i_bytes = sizeof(value_type)*n_i;
+ char *large_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(large_range_f)));
+ char *short_ptr = static_cast<char*>(static_cast<void*>(container_detail::iterator_to_raw_pointer(short_range_f)));
+ char *stora_ptr = static_cast<char*>(static_cast<void*>(&storage));
+
+ std::size_t szt_times = n_i_bytes/sizeof_storage;
+ const std::size_t szt_rem = n_i_bytes%sizeof_storage;
+
+ //Loop unrolling using Duff's device, as it seems it helps on some architectures
+ const std::size_t Unroll = 4;
+ std::size_t n = (szt_times + (Unroll-1))/Unroll;
+ const std::size_t branch_number = (!szt_times)*Unroll + (szt_times % Unroll);
+ switch(branch_number){
+ case 4:
+ break;
+ case 0: do{
+ ::memcpy(stora_ptr, large_ptr, sizeof_storage);
+ ::memcpy(large_ptr, short_ptr, sizeof_storage);
+ ::memcpy(short_ptr, stora_ptr, sizeof_storage);
+ large_ptr += sizeof_storage;
+ short_ptr += sizeof_storage;
+ BOOST_CONTAINER_FALLTHOUGH
+ case 3:
+ ::memcpy(stora_ptr, large_ptr, sizeof_storage);
+ ::memcpy(large_ptr, short_ptr, sizeof_storage);
+ ::memcpy(short_ptr, stora_ptr, sizeof_storage);
+ large_ptr += sizeof_storage;
+ short_ptr += sizeof_storage;
+ BOOST_CONTAINER_FALLTHOUGH
+ case 2:
+ ::memcpy(stora_ptr, large_ptr, sizeof_storage);
+ ::memcpy(large_ptr, short_ptr, sizeof_storage);
+ ::memcpy(short_ptr, stora_ptr, sizeof_storage);
+ large_ptr += sizeof_storage;
+ short_ptr += sizeof_storage;
+ BOOST_CONTAINER_FALLTHOUGH
+ case 1:
+ ::memcpy(stora_ptr, large_ptr, sizeof_storage);
+ ::memcpy(large_ptr, short_ptr, sizeof_storage);
+ ::memcpy(short_ptr, stora_ptr, sizeof_storage);
+ large_ptr += sizeof_storage;
+ short_ptr += sizeof_storage;
+ } while(--n);
+ }
+ ::memcpy(stora_ptr, large_ptr, szt_rem);
+ ::memcpy(large_ptr, short_ptr, szt_rem);
+ ::memcpy(short_ptr, stora_ptr, szt_rem);
+ std::advance(large_range_f, n_i);
+ std::advance(short_range_f, n_i);
+ boost::container::uninitialized_move_alloc_n(a, large_range_f, n_j - n_i, short_range_f); // may throw
+ boost::container::destroy_alloc_n(a, large_range_f, n_j - n_i);
+}
+
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// copy_assign_range_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+ <typename A
+ ,typename I // F models InputIterator
+ ,typename O // G models OutputIterator
+ >
+void copy_assign_range_alloc_n( A &a, I inp_start, typename allocator_traits<A>::size_type n_i
+ , O out_start, typename allocator_traits<A>::size_type n_o )
+{
+ if (n_o < n_i){
+ inp_start = boost::container::copy_n_source_dest(inp_start, n_o, out_start); // may throw
+ boost::container::uninitialized_copy_alloc_n(a, inp_start, n_i - n_o, out_start);// may throw
+ }
+ else{
+ out_start = boost::container::copy_n(inp_start, n_i, out_start); // may throw
+ boost::container::destroy_alloc_n(a, out_start, n_o - n_i);
+ }
+}
+
+//////////////////////////////////////////////////////////////////////////////
+//
+// move_assign_range_alloc_n
+//
+//////////////////////////////////////////////////////////////////////////////
+
+template
+ <typename A
+ ,typename I // F models InputIterator
+ ,typename O // G models OutputIterator
+ >
+void move_assign_range_alloc_n( A &a, I inp_start, typename allocator_traits<A>::size_type n_i
+ , O out_start, typename allocator_traits<A>::size_type n_o )
+{
+ if (n_o < n_i){
+ inp_start = boost::container::move_n_source_dest(inp_start, n_o, out_start); // may throw
+ boost::container::uninitialized_move_alloc_n(a, inp_start, n_i - n_o, out_start); // may throw
+ }
+ else{
+ out_start = boost::container::move_n(inp_start, n_i, out_start); // may throw
+ boost::container::destroy_alloc_n(a, out_start, n_o - n_i);
+ }
+}
} //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/value_init.hpp b/3rdParty/Boost/src/boost/container/detail/value_init.hpp
new file mode 100644
index 0000000..68f9678
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/value_init.hpp
@@ -0,0 +1,45 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013.
+//
+// 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_VALUE_INIT_HPP
+#define BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template<class T>
+struct value_init
+{
+ value_init()
+ : m_t()
+ {}
+
+ operator T &() { return m_t; }
+
+ T m_t;
+};
+
+} //namespace container_detail {
+} //namespace container {
+} //namespace boost {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_VALUE_INIT_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/variadic_templates_tools.hpp b/3rdParty/Boost/src/boost/container/detail/variadic_templates_tools.hpp
new file mode 100644
index 0000000..b07fe30
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/variadic_templates_tools.hpp
@@ -0,0 +1,154 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2008-2013. 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_VARIADIC_TEMPLATES_TOOLS_HPP
+#define BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/detail/type_traits.hpp>
+#include <cstddef> //std::size_t
+
+namespace boost {
+namespace container {
+namespace container_detail {
+
+template<typename... Values>
+class tuple;
+
+template<> class tuple<>
+{};
+
+template<typename Head, typename... Tail>
+class tuple<Head, Tail...>
+ : private tuple<Tail...>
+{
+ typedef tuple<Tail...> inherited;
+
+ public:
+ tuple() { }
+
+ // implicit copy-constructor is okay
+ // Construct tuple from separate arguments.
+ tuple(typename add_const_reference<Head>::type v,
+ typename add_const_reference<Tail>::type... vtail)
+ : inherited(vtail...), m_head(v)
+ {}
+
+ // Construct tuple from another tuple.
+ template<typename... VValues>
+ tuple(const tuple<VValues...>& other)
+ : m_head(other.head()), inherited(other.tail())
+ {}
+
+ template<typename... VValues>
+ tuple& operator=(const tuple<VValues...>& other)
+ {
+ m_head = other.head();
+ tail() = other.tail();
+ return this;
+ }
+
+ typename add_reference<Head>::type head() { return m_head; }
+ typename add_reference<const Head>::type head() const { return m_head; }
+
+ inherited& tail() { return *this; }
+ const inherited& tail() const { return *this; }
+
+ protected:
+ Head m_head;
+};
+
+
+template<typename... Values>
+tuple<Values&&...> tie_forward(Values&&... values)
+{ return tuple<Values&&...>(values...); }
+
+template<int I, typename Tuple>
+struct tuple_element;
+
+template<int I, typename Head, typename... Tail>
+struct tuple_element<I, tuple<Head, Tail...> >
+{
+ typedef typename tuple_element<I-1, tuple<Tail...> >::type type;
+};
+
+template<typename Head, typename... Tail>
+struct tuple_element<0, tuple<Head, Tail...> >
+{
+ typedef Head type;
+};
+
+template<int I, typename Tuple>
+class get_impl;
+
+template<int I, typename Head, typename... Values>
+class get_impl<I, tuple<Head, Values...> >
+{
+ typedef typename tuple_element<I-1, tuple<Values...> >::type Element;
+ typedef get_impl<I-1, tuple<Values...> > Next;
+
+ public:
+ typedef typename add_reference<Element>::type type;
+ typedef typename add_const_reference<Element>::type const_type;
+ static type get(tuple<Head, Values...>& t) { return Next::get(t.tail()); }
+ static const_type get(const tuple<Head, Values...>& t) { return Next::get(t.tail()); }
+};
+
+template<typename Head, typename... Values>
+class get_impl<0, tuple<Head, Values...> >
+{
+ public:
+ typedef typename add_reference<Head>::type type;
+ typedef typename add_const_reference<Head>::type const_type;
+ static type get(tuple<Head, Values...>& t) { return t.head(); }
+ static const_type get(const tuple<Head, Values...>& t){ return t.head(); }
+};
+
+template<int I, typename... Values>
+typename get_impl<I, tuple<Values...> >::type get(tuple<Values...>& t)
+{ return get_impl<I, tuple<Values...> >::get(t); }
+
+template<int I, typename... Values>
+typename get_impl<I, tuple<Values...> >::const_type get(const tuple<Values...>& t)
+{ return get_impl<I, tuple<Values...> >::get(t); }
+
+////////////////////////////////////////////////////
+// Builds an index_tuple<0, 1, 2, ..., Num-1>, that will
+// be used to "unpack" into comma-separated values
+// in a function call.
+////////////////////////////////////////////////////
+
+template<int... Indexes>
+struct index_tuple{};
+
+template<std::size_t Num, typename Tuple = index_tuple<> >
+struct build_number_seq;
+
+template<std::size_t Num, int... Indexes>
+struct build_number_seq<Num, index_tuple<Indexes...> >
+ : build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
+{};
+
+template<int... Indexes>
+struct build_number_seq<0, index_tuple<Indexes...> >
+{ typedef index_tuple<Indexes...> type; };
+
+
+}}} //namespace boost { namespace container { namespace container_detail {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/version_type.hpp b/3rdParty/Boost/src/boost/container/detail/version_type.hpp
new file mode 100644
index 0000000..548fe3b
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/detail/version_type.hpp
@@ -0,0 +1,99 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013. 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.
+//
+//////////////////////////////////////////////////////////////////////////////
+//
+// This code comes from N1953 document by Howard E. Hinnant
+//
+//////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
+#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#include <boost/container/detail/mpl.hpp>
+#include <boost/container/detail/type_traits.hpp>
+
+namespace boost{
+namespace container {
+namespace container_detail {
+
+//using namespace boost;
+
+template <class T, unsigned V>
+struct version_type
+ : public container_detail::integral_constant<unsigned, V>
+{
+ typedef T type;
+
+ version_type(const version_type<T, 0>&);
+};
+
+namespace impl{
+
+template <class T,
+ bool = container_detail::is_convertible<version_type<T, 0>, typename T::version>::value>
+struct extract_version
+{
+ static const unsigned value = 1;
+};
+
+template <class T>
+struct extract_version<T, true>
+{
+ static const unsigned value = T::version::value;
+};
+
+template <class T>
+struct has_version
+{
+ private:
+ struct two {char _[2];};
+ template <class U> static two test(...);
+ template <class U> static char test(const typename U::version*);
+ public:
+ static const bool value = sizeof(test<T>(0)) == 1;
+ void dummy(){}
+};
+
+template <class T, bool = has_version<T>::value>
+struct version
+{
+ static const unsigned value = 1;
+};
+
+template <class T>
+struct version<T, true>
+{
+ static const unsigned value = extract_version<T>::value;
+};
+
+} //namespace impl
+
+template <class T>
+struct version
+ : public container_detail::integral_constant<unsigned, impl::version<T>::value>
+{};
+
+template<class T, unsigned N>
+struct is_version
+{
+ static const bool value =
+ is_same< typename version<T>::type, integral_constant<unsigned, N> >::value;
+};
+
+} //namespace container_detail {
+} //namespace container {
+} //namespace boost{
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#define BOOST_CONTAINER_DETAIL_VERSION_TYPE_HPP
diff --git a/3rdParty/Boost/src/boost/container/detail/workaround.hpp b/3rdParty/Boost/src/boost/container/detail/workaround.hpp
index 7838a5d..c290861 100644
--- a/3rdParty/Boost/src/boost/container/detail/workaround.hpp
+++ b/3rdParty/Boost/src/boost/container/detail/workaround.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2013. 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)
//
@@ -13,28 +13,51 @@
#include <boost/container/detail/config_begin.hpp>
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)\
&& !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
#define BOOST_CONTAINER_PERFECT_FORWARDING
#endif
-#if defined(BOOST_NO_NOEXCEPT)
- #define BOOST_CONTAINER_NOEXCEPT
+#if defined(BOOST_NO_CXX11_NOEXCEPT)
+ #if defined(BOOST_MSVC)
+ #define BOOST_CONTAINER_NOEXCEPT throw()
+ #else
+ #define BOOST_CONTAINER_NOEXCEPT
+ #endif
#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__)\
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\
&& (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700)
#define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
#endif
+#if !defined(BOOST_FALLTHOUGH)
+ #define BOOST_CONTAINER_FALLTHOUGH
+#else
+ #define BOOST_CONTAINER_FALLTHOUGH BOOST_FALLTHOUGH;
+#endif
+
//Macros for documentation purposes. For code, expands to the argument
#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE
#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE
+//Macros for memset optimization. In most platforms
+//memsetting pointers and floatings is safe and faster.
+//
+//If your platform does not offer these guarantees
+//define these to value zero.
+#ifndef BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_NOT_ZERO
+#define BOOST_CONTAINER_MEMZEROED_FLOATING_POINT_IS_ZERO 1
+#endif
+
+#ifndef BOOST_CONTAINER_MEMZEROED_POINTER_IS_NOT_NULL
+#define BOOST_CONTAINER_MEMZEROED_POINTER_IS_NULL
+#endif
+
#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
index 5111d37..e594c0a 100644
--- a/3rdParty/Boost/src/boost/container/scoped_allocator.hpp
+++ b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp
@@ -6,7 +6,7 @@
//
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2013. 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)
//
@@ -17,7 +17,7 @@
#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP
-#if (defined MSC_VER) && (_MSC_VER >= 1200)
+#if defined (_MSC_VER)
# pragma once
#endif
@@ -30,8 +30,8 @@
#include <boost/container/detail/utilities.hpp>
#include <utility>
#include <boost/container/detail/pair.hpp>
-#include <boost/move/move.hpp>
-
+#include <boost/move/utility.hpp>
+#include <boost/detail/no_exceptions_support.hpp>
namespace boost { namespace container {
@@ -46,8 +46,8 @@ namespace boost { namespace container {
//! 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> >
+//! <code>
+//! template <class T, class Allocator = allocator<T> >
//! class Z {
//! public:
//! typedef Allocator allocator_type;
@@ -62,9 +62,9 @@ namespace boost { namespace container {
//!
//! // Specialize trait for class template Z
//! template <class T, class Allocator = allocator<T> >
-//! struct constructible_with_allocator_suffix<Z<T,Allocator> >
+//! struct constructible_with_allocator_suffix<Z<T,Allocator> >
//! : ::boost::true_type { };
-//! -- end example]
+//! </code>
//!
//! <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
@@ -80,7 +80,7 @@ struct constructible_with_allocator_suffix
{};
//! <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.
+//! 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.
//!
@@ -90,32 +90,32 @@ struct constructible_with_allocator_suffix
//! 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:
+//! <code>
//! 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>
+//! 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> >
+//! struct constructible_with_allocator_prefix<Y<T,Allocator> >
//! : ::boost::true_type { };
-//!
-//! -- end example]
+//!
+//! </code>
//!
//! <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
@@ -130,7 +130,7 @@ struct constructible_with_allocator_prefix
: ::boost::false_type
{};
-///@cond
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail {
@@ -159,7 +159,7 @@ struct uses_allocator_imp
} //namespace container_detail {
-///@endcond
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <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
@@ -173,7 +173,7 @@ struct uses_allocator
: boost::integral_constant<bool, container_detail::uses_allocator_imp<T, Alloc>::value>
{};
-///@cond
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
namespace container_detail {
@@ -259,7 +259,7 @@ namespace container_detail {
//! Thanks Mathias!
//With variadic templates, we need a single class to implement the trait
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class ...Args>
struct is_constructible_impl
@@ -290,7 +290,7 @@ namespace container_detail {
: is_constructible<T, allocator_arg_t, InnerAlloc, Args...>
{};
- #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//Without variadic templates, we need to use de preprocessor to generate
//some specializations.
@@ -382,14 +382,14 @@ namespace container_detail {
>
{};*/
- #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #endif // #if !defined(BOOST_NO_CXX11_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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template < class T, class InnerAlloc, class ...Args>
struct is_constructible_with_allocator_prefix
@@ -401,7 +401,7 @@ namespace container_detail {
: constructible_with_allocator_suffix<T>
{};*/
- #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template < class T
, class InnerAlloc
@@ -423,11 +423,11 @@ namespace container_detail {
: constructible_with_allocator_suffix<T>
{};*/
- #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#endif // #if !defined(BOOST_NO_SFINAE_EXPR)
-#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template < typename OutermostAlloc
, typename InnerAlloc
@@ -489,7 +489,7 @@ inline void dispatch_uses_allocator
(outermost_alloc, p, ::boost::forward<Args>(args)...);
}
-#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_PP_LOCAL_MACRO(n) \
template < typename OutermostAlloc \
@@ -564,9 +564,9 @@ inline void dispatch_uses_allocator(boost::false_type uses_allocator
#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_NO_CXX11_VARIADIC_TEMPLATES)
-#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename OuterAlloc, class ...InnerAllocs>
class scoped_allocator_adaptor_base
@@ -583,7 +583,10 @@ class scoped_allocator_adaptor_base
};
typedef OuterAlloc outer_allocator_type;
- typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
+ typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type;
+ typedef allocator_traits<inner_allocator_type> inner_traits_type;
+ typedef scoped_allocator_adaptor
+ <OuterAlloc, InnerAllocs...> scoped_allocator_type;
typedef boost::integral_constant<
bool,
outer_traits_type::propagate_on_container_copy_assignment::value ||
@@ -634,7 +637,7 @@ class scoped_allocator_adaptor_base
, m_inner(other.inner_allocator())
{}
- protected:
+ public:
struct internal_type_t{};
template <class OuterA2>
@@ -663,23 +666,41 @@ class scoped_allocator_adaptor_base
return *this;
}
- inner_allocator_type& inner_allocator()
+ void swap(scoped_allocator_adaptor_base &r)
+ {
+ boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());
+ boost::container::swap_dispatch(this->m_inner, r.inner_allocator());
+ }
+
+ friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)
+ { l.swap(r); }
+
+ inner_allocator_type& inner_allocator() BOOST_CONTAINER_NOEXCEPT
{ return m_inner; }
- inner_allocator_type const& inner_allocator() const
+ inner_allocator_type const& inner_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return m_inner; }
- outer_allocator_type & outer_allocator()
+ outer_allocator_type & outer_allocator() BOOST_CONTAINER_NOEXCEPT
{ return static_cast<outer_allocator_type&>(*this); }
- const outer_allocator_type &outer_allocator() const
+ const outer_allocator_type &outer_allocator() const BOOST_CONTAINER_NOEXCEPT
{ return static_cast<const outer_allocator_type&>(*this); }
+ scoped_allocator_type select_on_container_copy_construction() const
+ {
+ return scoped_allocator_type
+ (internal_type_t()
+ ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
+ ,inner_traits_type::select_on_container_copy_construction(this->inner_allocator())
+ );
+ }
+
private:
inner_allocator_type m_inner;
};
-#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//Let's add a dummy first template parameter to allow creating
//specializations up to maximum InnerAlloc count
@@ -723,6 +744,12 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \
, BOOST_CONTAINER_PP_IDENTITY, nat) \
> inner_allocator_type; \
+ typedef scoped_allocator_adaptor<OuterAlloc, BOOST_PP_ENUM_PARAMS(n, Q) \
+ BOOST_PP_ENUM_TRAILING \
+ ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \
+ , BOOST_CONTAINER_PP_IDENTITY, nat) \
+ > scoped_allocator_type; \
+ typedef allocator_traits<inner_allocator_type> inner_traits_type; \
typedef boost::integral_constant< \
bool, \
outer_traits_type::propagate_on_container_copy_assignment::value || \
@@ -782,7 +809,7 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
, m_inner(other.inner_allocator()) \
{} \
\
- protected: \
+ public: \
struct internal_type_t{}; \
\
template <class OuterA2> \
@@ -810,6 +837,15 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
return *this; \
} \
\
+ void swap(scoped_allocator_adaptor_base &r) \
+ { \
+ boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator()); \
+ boost::container::swap_dispatch(this->m_inner, r.inner_allocator()); \
+ } \
+ \
+ friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r) \
+ { l.swap(r); } \
+ \
inner_allocator_type& inner_allocator() \
{ return m_inner; } \
\
@@ -822,6 +858,14 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
const outer_allocator_type &outer_allocator() const \
{ return static_cast<const outer_allocator_type&>(*this); } \
\
+ scoped_allocator_type select_on_container_copy_construction() const \
+ { \
+ return scoped_allocator_type \
+ (internal_type_t() \
+ ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator()) \
+ ,inner_traits_type::select_on_container_copy_construction(this->inner_allocator()) \
+ ); \
+ } \
private: \
inner_allocator_type m_inner; \
}; \
@@ -829,13 +873,13 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE()
-#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//Specialization for adaptor without any InnerAlloc
template <typename OuterAlloc>
class scoped_allocator_adaptor_base
< OuterAlloc
- #if defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat)
#endif
@@ -850,7 +894,7 @@ class scoped_allocator_adaptor_base
{
typedef scoped_allocator_adaptor_base
<typename allocator_traits<OuterAlloc>::template portable_rebind_alloc<U>::type
- #if defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
#endif
@@ -860,6 +904,8 @@ class scoped_allocator_adaptor_base
typedef OuterAlloc outer_allocator_type;
typedef allocator_traits<OuterAlloc> outer_traits_type;
typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type;
+ typedef inner_allocator_type scoped_allocator_type;
+ typedef allocator_traits<inner_allocator_type> inner_traits_type;
typedef typename outer_traits_type::
propagate_on_container_copy_assignment propagate_on_container_copy_assignment;
typedef typename outer_traits_type::
@@ -887,7 +933,7 @@ class scoped_allocator_adaptor_base
scoped_allocator_adaptor_base
(const scoped_allocator_adaptor_base<
OuterA2
- #if defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
#endif
@@ -899,7 +945,7 @@ class scoped_allocator_adaptor_base
scoped_allocator_adaptor_base
(BOOST_RV_REF_BEG scoped_allocator_adaptor_base<
OuterA2
- #if defined(BOOST_NO_VARIADIC_TEMPLATES)
+ #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
#endif
@@ -907,14 +953,14 @@ class scoped_allocator_adaptor_base
: outer_allocator_type(other.outer_allocator())
{}
- protected:
+ public:
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)
{
@@ -928,6 +974,14 @@ class scoped_allocator_adaptor_base
return *this;
}
+ void swap(scoped_allocator_adaptor_base &r)
+ {
+ boost::container::swap_dispatch(this->outer_allocator(), r.outer_allocator());
+ }
+
+ friend void swap(scoped_allocator_adaptor_base &l, scoped_allocator_adaptor_base &r)
+ { l.swap(r); }
+
inner_allocator_type& inner_allocator()
{ return static_cast<inner_allocator_type&>(*this); }
@@ -939,14 +993,25 @@ class scoped_allocator_adaptor_base
const outer_allocator_type &outer_allocator() const
{ return static_cast<const outer_allocator_type&>(*this); }
+
+ scoped_allocator_type select_on_container_copy_construction() const
+ {
+ return scoped_allocator_type
+ (internal_type_t()
+ ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator())
+ //Don't use inner_traits_type::select_on_container_copy_construction(this->inner_allocator())
+ //as inner_allocator() is equal to *this and that would trigger an infinite loop
+ , this->inner_allocator()
+ );
+ }
};
} //namespace container_detail {
-///@endcond
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//Scoped allocator
-#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
@@ -973,14 +1038,14 @@ class scoped_allocator_adaptor_base
//! 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))>`.
+ //! In the construct member functions, <code>OUTERMOST(x)</code> is x if x does not have
+ //! an <code>outer_allocator()</code> member function and
+ //! <code>OUTERMOST(x.outer_allocator())</code> otherwise; <code>OUTERMOST_ALLOC_TRAITS(x)</code> is
+ //! <code>allocator_traits<decltype(OUTERMOST(x))></code>.
//!
- //! [<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.
+ //! [<b>Note</b>: <code>OUTERMOST(x)</code> and
+ //! <code>OUTERMOST_ALLOC_TRAITS(x)</code> are recursive operations. It is incumbent upon
+ //! the definition of <code>outer_allocator()</code> 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
@@ -992,7 +1057,7 @@ class scoped_allocator_adaptor_base
#endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
-#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template <typename OuterAlloc
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
@@ -1001,7 +1066,7 @@ class scoped_allocator_adaptor
#endif
: public container_detail::scoped_allocator_adaptor_base
<OuterAlloc
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs...
#else
, true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@@ -1011,24 +1076,25 @@ class scoped_allocator_adaptor
BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor)
public:
- /// @cond
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
typedef container_detail::scoped_allocator_adaptor_base
<OuterAlloc
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_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 typename base_type::internal_type_t internal_type_t;
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
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...>`.
+ //! Type: <code>scoped_allocator_adaptor<OuterAlloc></code> if <code>sizeof...(InnerAllocs)</code> is zero; otherwise,
+ //! <code>scoped_allocator_adaptor<InnerAllocs...></code>.
typedef typename base_type::inner_allocator_type inner_allocator_type;
+ typedef allocator_traits<inner_allocator_type> inner_traits_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;
@@ -1036,29 +1102,29 @@ class scoped_allocator_adaptor
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.
+ //! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_copy_assignment::value</code> is
+ //! true for any <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; 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.
+ //! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_move_assignment::value</code> is
+ //! true for any <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; 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.
+ //! Type: <code>true_type</code> if <code>allocator_traits<Allocator>::propagate_on_container_swap::value</code> is true for any
+ //! <code>Allocator</code> in the set of <code>OuterAlloc</code> and <code>InnerAllocs...</code>; otherwise, false_type.
typedef typename base_type::
propagate_on_container_swap propagate_on_container_swap;
//! Type: Rebinds scoped allocator to
- //! `typedef scoped_allocator_adaptor
+ //! <code>typedef scoped_allocator_adaptor
//! < typename outer_traits_type::template portable_rebind_alloc<U>::type
- //! , InnerAllocs... >`
+ //! , InnerAllocs... ></code>
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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs...
#else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@@ -1086,7 +1152,7 @@ class scoped_allocator_adaptor
: base_type(::boost::move(other.base()))
{}
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
//!
@@ -1097,7 +1163,7 @@ class scoped_allocator_adaptor
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)
+ #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#define BOOST_PP_LOCAL_MACRO(n) \
template <class OuterA2> \
@@ -1111,14 +1177,14 @@ class scoped_allocator_adaptor
#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)
+ #endif // #if !defined(BOOST_NO_CXX11_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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs...
#else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@@ -1133,7 +1199,7 @@ class scoped_allocator_adaptor
//! 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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs...
#else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@@ -1143,120 +1209,117 @@ class scoped_allocator_adaptor
{}
scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other)
- {
- base_type::operator=(static_cast<const base_type &>(other));
- return *this;
- }
+ { return static_cast<scoped_allocator_adaptor&>(base_type::operator=(static_cast<const base_type &>(other))); }
scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other)
- {
- base_type::operator=(boost::move(static_cast<scoped_allocator_adaptor&>(other)));
- return *this;
- }
+ { return static_cast<scoped_allocator_adaptor&>(base_type::operator=(boost::move(static_cast<base_type&>(other)))); }
+
+ #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
+ //! <b>Effects</b>: swaps *this with r.
+ //!
+ void swap(scoped_allocator_adaptor &r);
+
+ //! <b>Effects</b>: swaps *this with r.
+ //!
+ friend void swap(scoped_allocator_adaptor &l, scoped_allocator_adaptor &r);
//! <b>Returns</b>:
- //! `static_cast<OuterAlloc&>(*this)`.
- outer_allocator_type & outer_allocator()
- { return *this; }
+ //! <code>static_cast<OuterAlloc&>(*this)</code>.
+ outer_allocator_type & outer_allocator() BOOST_CONTAINER_NOEXCEPT;
//! <b>Returns</b>:
- //! `static_cast<const OuterAlloc&>(*this)`.
- const outer_allocator_type &outer_allocator() const
- { return *this; }
+ //! <code>static_cast<const OuterAlloc&>(*this)</code>.
+ const outer_allocator_type &outer_allocator() const BOOST_CONTAINER_NOEXCEPT;
//! <b>Returns</b>:
- //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
- inner_allocator_type& inner_allocator()
- { return base_type::inner_allocator(); }
+ //! *this if <code>sizeof...(InnerAllocs)</code> is zero; otherwise, inner.
+ inner_allocator_type& inner_allocator() BOOST_CONTAINER_NOEXCEPT;
//! <b>Returns</b>:
- //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner.
- inner_allocator_type const& inner_allocator() const
- { return base_type::inner_allocator(); }
+ //! *this if <code>sizeof...(InnerAllocs)</code> is zero; otherwise, inner.
+ inner_allocator_type const& inner_allocator() const BOOST_CONTAINER_NOEXCEPT;
+
+ #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
//! <b>Returns</b>:
- //! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`.
- size_type max_size() const
+ //! <code>allocator_traits<OuterAlloc>::max_size(outer_allocator())</code>.
+ size_type max_size() const BOOST_CONTAINER_NOEXCEPT
{
return outer_traits_type::max_size(this->outer_allocator());
}
//! <b>Effects</b>:
- //! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`.
+ //! calls <code>OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)</code>.
template <class T>
- void destroy(T* p)
+ void destroy(T* p) BOOST_CONTAINER_NOEXCEPT
{
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)`.
+ //! <code>allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)</code>.
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)`.
+ //! <code>allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)</code>.
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)`.
+ //! <code>allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)</code>.
void deallocate(pointer p, size_type n)
{
outer_traits_type::deallocate(this->outer_allocator(), p, n);
}
+ #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
//! <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
+ //! <code>allocator_traits<Allocator>::select_on_container_copy_construction()</code> 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
+ scoped_allocator_adaptor select_on_container_copy_construction() const;
+ #endif //BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
base_type &base() { return *this; }
const base_type &base() const { return *this; }
- /// @endcond
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_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)...)`.
+ //! 1) If <code>uses_allocator<T, inner_allocator_type>::value</code> is false calls
+ //! <code>OUTERMOST_ALLOC_TRAITS(*this)::construct
+ //! (OUTERMOST(*this), p, std::forward<Args>(args)...)</code>.
//!
- //! 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)...)`.
+ //! 2) Otherwise, if <code>uses_allocator<T, inner_allocator_type>::value</code> is true and
+ //! <code>is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value</code> is true, calls
+ //! <code>OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg,
+ //! inner_allocator(), std::forward<Args>(args)...)</code>.
//!
- //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't
+ //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, <code>is_constructible</code> 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())`.
+ //! <code>is_constructible<T, Args..., inner_allocator_type>::value</code> is true, calls
+ //! <code>OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p,
+ //! std::forward<Args>(args)..., inner_allocator())</code>.
//!
- //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be
+ //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, <code>is_constructible</code> can't be
//! implemented so that condition will be replaced by
- //! `constructible_with_allocator_suffix<T>::value`. -end note]
+ //! <code>constructible_with_allocator_suffix<T>::value</code>. -end note]
//!
//! 4) Otherwise, the program is ill-formed.
//!
- //! [<b>Note</b>: An error will result if `uses_allocator` evaluates
+ //! [<b>Note</b>: An error will result if <code>uses_allocator</code> 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>
@@ -1274,7 +1337,7 @@ class scoped_allocator_adaptor
, p, ::boost::forward<Args>(args)...);
}
- #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #else // #if !defined(BOOST_NO_CXX11_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.
@@ -1295,7 +1358,7 @@ class scoped_allocator_adaptor
#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)
+ #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template <class T1, class T2>
void construct(std::pair<T1,T2>* p)
@@ -1312,7 +1375,7 @@ class scoped_allocator_adaptor
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); }
@@ -1321,7 +1384,7 @@ class scoped_allocator_adaptor
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)
@@ -1332,74 +1395,79 @@ class scoped_allocator_adaptor
, BOOST_RV_REF_BEG container_detail::pair<U, V> BOOST_RV_REF_END x)
{ this->construct_pair(p, x); }
- /// @cond
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
private:
template <class Pair>
void construct_pair(Pair* p)
{
this->construct(container_detail::addressof(p->first));
- try {
+ BOOST_TRY{
this->construct(container_detail::addressof(p->second));
}
- catch (...) {
+ BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first));
- throw;
+ BOOST_RETHROW
}
+ BOOST_CATCH_END
}
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 {
+ BOOST_TRY{
this->construct(container_detail::addressof(p->second), ::boost::forward<V>(y));
}
- catch (...) {
+ BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first));
- throw;
+ BOOST_RETHROW
}
+ BOOST_CATCH_END
}
template <class Pair, class Pair2>
void construct_pair(Pair* p, const Pair2& pr)
{
this->construct(container_detail::addressof(p->first), pr.first);
- try {
+ BOOST_TRY{
this->construct(container_detail::addressof(p->second), pr.second);
}
- catch (...) {
+ BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first));
- throw;
+ BOOST_RETHROW
}
+ BOOST_CATCH_END
}
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 {
+ BOOST_TRY{
this->construct(container_detail::addressof(p->second), ::boost::move(pr.second));
}
- catch (...) {
+ BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first));
- throw;
+ BOOST_RETHROW
}
+ BOOST_CATCH_END
}
//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:
+ public:
+ //Internal function
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
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
};
template <typename OuterA1, typename OuterA2
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename... InnerAllocs
#else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
@@ -1407,21 +1475,21 @@ template <typename OuterA1, typename OuterA2
>
inline bool operator==(
const scoped_allocator_adaptor<OuterA1
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_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)
+ #if !defined(BOOST_NO_CXX11_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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
const bool has_zero_inner = sizeof...(InnerAllocs) == 0u;
#else
const bool has_zero_inner =
@@ -1434,7 +1502,7 @@ inline bool operator==(
}
template <typename OuterA1, typename OuterA2
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename... InnerAllocs
#else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
@@ -1442,14 +1510,14 @@ template <typename OuterA1, typename OuterA2
>
inline bool operator!=(
const scoped_allocator_adaptor<OuterA1
- #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ #if !defined(BOOST_NO_CXX11_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)
+ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
,InnerAllocs...
#else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp
index 0814a50..f19e27e 100644
--- a/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp
+++ b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2011-2012. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2011-2013. 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)
//
@@ -11,23 +11,27 @@
#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP
-#if (defined MSC_VER) && (_MSC_VER >= 1200)
+//! \file
+//! This header file forward declares boost::container::scoped_allocator_adaptor
+//! and defines the following types:
+
+#if defined(_MSC_VER)
# pragma once
#endif
#include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp>
-#if defined(BOOST_NO_VARIADIC_TEMPLATES)
+#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/container/detail/preprocessor.hpp>
#include <boost/container/detail/type_traits.hpp>
#endif
namespace boost { namespace container {
-///@cond
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
-#if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
@@ -45,7 +49,7 @@ namespace boost { namespace container {
#endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
-#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename OuterAlloc
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS
@@ -55,7 +59,7 @@ class scoped_allocator_adaptor;
#endif
-///@endcond
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
//! The allocator_arg_t struct is an empty structure type used as a unique type to
//! disambiguate constructor and function overloading. Specifically, several types
diff --git a/3rdParty/Boost/src/boost/container/throw_exception.hpp b/3rdParty/Boost/src/boost/container/throw_exception.hpp
new file mode 100644
index 0000000..ab01c30
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/throw_exception.hpp
@@ -0,0 +1,166 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2012-2013. 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_THROW_EXCEPTION_HPP
+#define BOOST_CONTAINER_THROW_EXCEPTION_HPP
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#ifndef BOOST_NO_EXCEPTIONS
+ #include <stdexcept> //for std exception types
+ #include <new> //for std::bad_alloc
+#else
+ #include <boost/assert.hpp>
+ #include <cstdlib> //for std::abort
+#endif
+
+namespace boost {
+namespace container {
+
+#if defined(BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS)
+ //The user must provide definitions for the following functions
+
+ void throw_bad_alloc();
+
+ void throw_out_of_range(const char* str);
+
+ void throw_length_error(const char* str);
+
+ void throw_logic_error(const char* str);
+
+ void throw_runtime_error(const char* str);
+
+#elif defined(BOOST_NO_EXCEPTIONS)
+
+ inline void throw_bad_alloc()
+ {
+ BOOST_ASSERT(!"boost::container bad_alloc thrown");
+ std::abort();
+ }
+
+ inline void throw_out_of_range(const char* str)
+ {
+ BOOST_ASSERT_MSG(!"boost::container out_of_range thrown", str);
+ std::abort();
+ }
+
+ inline void throw_length_error(const char* str)
+ {
+ BOOST_ASSERT_MSG(!"boost::container length_error thrown", str);
+ std::abort();
+ }
+
+ inline void throw_logic_error(const char* str)
+ {
+ BOOST_ASSERT_MSG(!"boost::container logic_error thrown", str);
+ std::abort();
+ }
+
+ inline void throw_runtime_error(const char* str)
+ {
+ BOOST_ASSERT_MSG(!"boost::container runtime_error thrown", str);
+ std::abort();
+ }
+
+#else //defined(BOOST_NO_EXCEPTIONS)
+
+ //! Exception callback called by Boost.Container when fails to allocate the requested storage space.
+ //! <ul>
+ //! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::bad_alloc()</code> is thrown.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
+ //! is NOT defined <code>BOOST_ASSERT(!"boost::container bad_alloc thrown")</code> is called
+ //! and <code>std::abort()</code> if the former returns.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
+ //! the user must provide an implementation and the function should not return.</li>
+ //! </ul>
+ inline void throw_bad_alloc()
+ {
+ throw std::bad_alloc();
+ }
+
+ //! Exception callback called by Boost.Container to signal arguments out of range.
+ //! <ul>
+ //! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::out_of_range(str)</code> is thrown.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
+ //! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container out_of_range thrown", str)</code> is called
+ //! and <code>std::abort()</code> if the former returns.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
+ //! the user must provide an implementation and the function should not return.</li>
+ //! </ul>
+ inline void throw_out_of_range(const char* str)
+ {
+ throw std::out_of_range(str);
+ }
+
+ //! Exception callback called by Boost.Container to signal errors resizing.
+ //! <ul>
+ //! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::length_error(str)</code> is thrown.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
+ //! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container length_error thrown", str)</code> is called
+ //! and <code>std::abort()</code> if the former returns.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
+ //! the user must provide an implementation and the function should not return.</li>
+ //! </ul>
+ inline void throw_length_error(const char* str)
+ {
+ throw std::length_error(str);
+ }
+
+ //! Exception callback called by Boost.Container to report errors in the internal logical
+ //! of the program, such as violation of logical preconditions or class invariants.
+ //! <ul>
+ //! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::logic_error(str)</code> is thrown.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
+ //! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container logic_error thrown", str)</code> is called
+ //! and <code>std::abort()</code> if the former returns.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
+ //! the user must provide an implementation and the function should not return.</li>
+ //! </ul>
+ inline void throw_logic_error(const char* str)
+ {
+ throw std::logic_error(str);
+ }
+
+ //! Exception callback called by Boost.Container to report errors that can only be detected during runtime.
+ //! <ul>
+ //! <li>If BOOST_NO_EXCEPTIONS is NOT defined <code>std::runtime_error(str)</code> is thrown.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS is defined and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS
+ //! is NOT defined <code>BOOST_ASSERT_MSG(!"boost::container runtime_error thrown", str)</code> is called
+ //! and <code>std::abort()</code> if the former returns.</li>
+ //!
+ //! <li>If BOOST_NO_EXCEPTIONS and BOOST_CONTAINER_USER_DEFINED_THROW_CALLBACKS are defined
+ //! the user must provide an implementation and the function should not return.</li>
+ //! </ul>
+ inline void throw_runtime_error(const char* str)
+ {
+ throw std::runtime_error(str);
+ }
+
+#endif
+
+}} //namespace boost { namespace container {
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif //#ifndef BOOST_CONTAINER_THROW_EXCEPTION_HPP
diff --git a/3rdParty/Boost/src/boost/container/vector.hpp b/3rdParty/Boost/src/boost/container/vector.hpp
new file mode 100644
index 0000000..16f52d3
--- /dev/null
+++ b/3rdParty/Boost/src/boost/container/vector.hpp
@@ -0,0 +1,2755 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2005-2013. 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_VECTOR_HPP
+#define BOOST_CONTAINER_CONTAINER_VECTOR_HPP
+
+#if defined(_MSC_VER)
+# pragma once
+#endif
+
+#include <boost/container/detail/config_begin.hpp>
+#include <boost/container/detail/workaround.hpp>
+#include <boost/container/container_fwd.hpp>
+
+#include <cstddef>
+#include <memory>
+#include <algorithm>
+#include <iterator>
+#include <utility>
+#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/type_traits/has_trivial_destructor.hpp>
+#include <boost/type_traits/has_trivial_copy.hpp>
+#include <boost/type_traits/has_trivial_assign.hpp>
+#include <boost/type_traits/has_nothrow_copy.hpp>
+#include <boost/type_traits/has_nothrow_assign.hpp>
+#include <boost/type_traits/has_nothrow_constructor.hpp>
+#include <boost/container/container_fwd.hpp>
+#include <boost/container/detail/version_type.hpp>
+#include <boost/container/detail/allocation_type.hpp>
+#include <boost/container/detail/utilities.hpp>
+#include <boost/container/detail/iterators.hpp>
+#include <boost/container/detail/algorithms.hpp>
+#include <boost/container/detail/destroyers.hpp>
+#include <boost/container/allocator_traits.hpp>
+#include <boost/container/detail/allocator_version_traits.hpp>
+#include <boost/container/throw_exception.hpp>
+#include <boost/move/utility.hpp>
+#include <boost/move/iterator.hpp>
+#include <boost/move/detail/move_helpers.hpp>
+#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/container/detail/mpl.hpp>
+#include <boost/container/detail/type_traits.hpp>
+#include <boost/container/detail/advanced_insert_int.hpp>
+#include <boost/assert.hpp>
+
+namespace boost {
+namespace container {
+
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+//#define BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+namespace container_detail {
+
+#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+template <class Pointer, bool IsConst>
+class vec_iterator
+{
+ public:
+ typedef std::random_access_iterator_tag iterator_category;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type;
+ typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type;
+ typedef typename if_c
+ < IsConst
+ , typename boost::intrusive::pointer_traits<Pointer>::template
+ rebind_pointer<const value_type>::type
+ , Pointer
+ >::type pointer;
+ typedef typename boost::intrusive::pointer_traits<Pointer> ptr_traits;
+ typedef typename ptr_traits::reference reference;
+
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+ private:
+ Pointer m_ptr;
+
+ public:
+ const Pointer &get_ptr() const BOOST_CONTAINER_NOEXCEPT
+ { return m_ptr; }
+
+ Pointer &get_ptr() BOOST_CONTAINER_NOEXCEPT
+ { return m_ptr; }
+
+ explicit vec_iterator(Pointer ptr) BOOST_CONTAINER_NOEXCEPT
+ : m_ptr(ptr)
+ {}
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ public:
+
+ //Constructors
+ vec_iterator() BOOST_CONTAINER_NOEXCEPT
+ #ifndef NDEBUG
+ : m_ptr()
+ #else
+ // No value initialization of m_ptr() to speed up things a bit:
+ #endif
+ {}
+
+ vec_iterator(vec_iterator<Pointer, false> const& other) BOOST_CONTAINER_NOEXCEPT
+ : m_ptr(other.get_ptr())
+ {}
+
+ //Pointer like operators
+ reference operator*() const BOOST_CONTAINER_NOEXCEPT
+ { return *m_ptr; }
+
+ pointer operator->() const BOOST_CONTAINER_NOEXCEPT
+ { return ::boost::intrusive::pointer_traits<pointer>::pointer_to(this->operator*()); }
+
+ reference operator[](difference_type off) const BOOST_CONTAINER_NOEXCEPT
+ { return m_ptr[off]; }
+
+ //Increment / Decrement
+ vec_iterator& operator++() BOOST_CONTAINER_NOEXCEPT
+ { ++m_ptr; return *this; }
+
+ vec_iterator operator++(int) BOOST_CONTAINER_NOEXCEPT
+ { return vec_iterator(m_ptr++); }
+
+ vec_iterator& operator--() BOOST_CONTAINER_NOEXCEPT
+ { --m_ptr; return *this; }
+
+ vec_iterator operator--(int) BOOST_CONTAINER_NOEXCEPT
+ { return vec_iterator(m_ptr--); }
+
+ //Arithmetic
+ vec_iterator& operator+=(difference_type off) BOOST_CONTAINER_NOEXCEPT
+ { m_ptr += off; return *this; }
+
+ vec_iterator& operator-=(difference_type off) BOOST_CONTAINER_NOEXCEPT
+ { m_ptr -= off; return *this; }
+
+ friend vec_iterator operator+(const vec_iterator &x, difference_type off) BOOST_CONTAINER_NOEXCEPT
+ { return vec_iterator(x.m_ptr+off); }
+
+ friend vec_iterator operator+(difference_type off, vec_iterator right) BOOST_CONTAINER_NOEXCEPT
+ { right.m_ptr += off; return right; }
+
+ friend vec_iterator operator-(vec_iterator left, difference_type off) BOOST_CONTAINER_NOEXCEPT
+ { left.m_ptr -= off; return left; }
+
+ friend difference_type operator-(const vec_iterator &left, const vec_iterator& right) BOOST_CONTAINER_NOEXCEPT
+ { return left.m_ptr - right.m_ptr; }
+
+ //Comparison operators
+ friend bool operator== (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_ptr == r.m_ptr; }
+
+ friend bool operator!= (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_ptr != r.m_ptr; }
+
+ friend bool operator< (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_ptr < r.m_ptr; }
+
+ friend bool operator<= (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_ptr <= r.m_ptr; }
+
+ friend bool operator> (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_ptr > r.m_ptr; }
+
+ friend bool operator>= (const vec_iterator& l, const vec_iterator& r) BOOST_CONTAINER_NOEXCEPT
+ { return l.m_ptr >= r.m_ptr; }
+};
+
+} //namespace container_detail {
+
+template<class Pointer, bool IsConst>
+const Pointer &vector_iterator_get_ptr(const container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_CONTAINER_NOEXCEPT
+{ return it.get_ptr(); }
+
+template<class Pointer, bool IsConst>
+Pointer &get_ptr(container_detail::vec_iterator<Pointer, IsConst> &it) BOOST_CONTAINER_NOEXCEPT
+{ return it.get_ptr(); }
+
+namespace container_detail {
+
+#else //ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+template< class MaybeConstPointer
+ , bool ElementTypeIsConst
+ = is_const< typename boost::intrusive::pointer_traits<MaybeConstPointer>::element_type>::value >
+struct vector_get_ptr_pointer_to_non_const
+{
+ typedef MaybeConstPointer const_pointer;
+ typedef boost::intrusive::pointer_traits<const_pointer> pointer_traits_t;
+ typedef typename pointer_traits_t::element_type element_type;
+ typedef typename remove_const<element_type>::type non_const_element_type;
+ typedef typename pointer_traits_t
+ ::template rebind_pointer<non_const_element_type>::type return_type;
+
+ static return_type get_ptr(const const_pointer &ptr) BOOST_CONTAINER_NOEXCEPT
+ { return boost::intrusive::pointer_traits<return_type>::const_cast_from(ptr); }
+};
+
+template<class Pointer>
+struct vector_get_ptr_pointer_to_non_const<Pointer, false>
+{
+ typedef const Pointer & return_type;
+ static return_type get_ptr(const Pointer &ptr) BOOST_CONTAINER_NOEXCEPT
+ { return ptr; }
+};
+
+} //namespace container_detail {
+
+template<class MaybeConstPointer>
+typename container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::return_type
+ vector_iterator_get_ptr(const MaybeConstPointer &ptr) BOOST_CONTAINER_NOEXCEPT
+{
+ return container_detail::vector_get_ptr_pointer_to_non_const<MaybeConstPointer>::get_ptr(ptr);
+}
+
+namespace container_detail {
+
+#endif //#ifndef BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER
+
+struct uninitialized_size_t {};
+static const uninitialized_size_t uninitialized_size = uninitialized_size_t();
+
+template <class T, class Allocator>
+struct vector_value_traits
+{
+ typedef T value_type;
+ typedef Allocator allocator_type;
+ static const bool trivial_dctr = boost::has_trivial_destructor<value_type>::value;
+ static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move<value_type>::value;
+ static const bool trivial_copy = has_trivial_copy<value_type>::value;
+ static const bool nothrow_copy = has_nothrow_copy<value_type>::value || trivial_copy;
+ static const bool trivial_assign = has_trivial_assign<value_type>::value;
+ static const bool nothrow_assign = has_nothrow_assign<value_type>::value || trivial_assign;
+
+ //This is the anti-exception array destructor
+ //to deallocate values already constructed
+ typedef typename container_detail::if_c
+ <trivial_dctr
+ ,container_detail::null_scoped_destructor_n<Allocator>
+ ,container_detail::scoped_destructor_n<Allocator>
+ >::type ArrayDestructor;
+ //This is the anti-exception array deallocator
+ typedef typename container_detail::if_c
+ <false//nothrow_copy
+ ,container_detail::null_scoped_array_deallocator<Allocator>
+ ,container_detail::scoped_array_deallocator<Allocator>
+ >::type ArrayDeallocator;
+};
+
+//!This struct deallocates and allocated memory
+template < class Allocator
+ , class AllocatorVersion = typename container_detail::version<Allocator>::type
+ >
+struct vector_alloc_holder
+ : public Allocator
+{
+ private:
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder)
+
+ public:
+ typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::size_type size_type;
+ typedef typename allocator_traits_type::value_type value_type;
+
+ //Constructor, does not throw
+ vector_alloc_holder()
+ BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value)
+ : Allocator(), m_start(), m_size(), m_capacity()
+ {}
+
+ //Constructor, does not throw
+ template<class AllocConvertible>
+ explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT
+ : Allocator(boost::forward<AllocConvertible>(a)), m_start(), m_size(), m_capacity()
+ {}
+
+ //Constructor, does not throw
+ template<class AllocConvertible>
+ vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size)
+ : Allocator(boost::forward<AllocConvertible>(a))
+ , m_start()
+ , m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
+ , m_capacity()
+ {
+ if(initial_size){
+ m_start = this->allocation_command(allocate_new, initial_size, initial_size, m_capacity, m_start).first;
+ }
+ }
+
+ //Constructor, does not throw
+ vector_alloc_holder(uninitialized_size_t, size_type initial_size)
+ : Allocator()
+ , m_start()
+ , m_size(initial_size) //Size is initialized here so vector should only call uninitialized_xxx after this
+ , m_capacity()
+ {
+ if(initial_size){
+ m_start = this->allocation_command
+ (allocate_new, initial_size, initial_size, m_capacity, m_start).first;
+ }
+ }
+
+ vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder) BOOST_CONTAINER_NOEXCEPT
+ : Allocator(boost::move(static_cast<Allocator&>(holder)))
+ , m_start(holder.m_start)
+ , m_size(holder.m_size)
+ , m_capacity(holder.m_capacity)
+ {
+ holder.m_start = pointer();
+ holder.m_size = holder.m_capacity = 0;
+ }
+
+ void first_allocation(size_type cap)
+ {
+ if(cap){
+ m_start = this->allocation_command
+ (allocate_new, cap, cap, m_capacity, m_start).first;
+ }
+ }
+
+ void first_allocation_same_allocator_type(size_type cap)
+ { this->first_allocation(cap); }
+
+ ~vector_alloc_holder() BOOST_CONTAINER_NOEXCEPT
+ {
+ if(this->m_capacity){
+ this->alloc().deallocate(this->m_start, this->m_capacity);
+ }
+ }
+
+ std::pair<pointer, bool>
+ allocation_command(boost::container::allocation_type command,
+ size_type limit_size,
+ size_type preferred_size,
+ size_type &received_size, const pointer &reuse = pointer())
+ {
+ return allocator_version_traits<Allocator>::allocation_command
+ (this->alloc(), command, limit_size, preferred_size, received_size, reuse);
+ }
+
+ size_type next_capacity(size_type additional_objects) const
+ {
+ return next_capacity_calculator
+ <size_type, NextCapacityDouble/*NextCapacity60Percent*/>::
+ get( allocator_traits_type::max_size(this->alloc())
+ , this->m_capacity, additional_objects );
+ }
+
+ pointer m_start;
+ size_type m_size;
+ size_type m_capacity;
+
+ void swap(vector_alloc_holder &x) BOOST_CONTAINER_NOEXCEPT
+ {
+ boost::container::swap_dispatch(this->m_start, x.m_start);
+ boost::container::swap_dispatch(this->m_size, x.m_size);
+ boost::container::swap_dispatch(this->m_capacity, x.m_capacity);
+ }
+
+ void move_from_empty(vector_alloc_holder &x) BOOST_CONTAINER_NOEXCEPT
+ {
+ //this->m_size was previously initialized
+ this->m_start = x.m_start;
+ this->m_capacity = x.m_capacity;
+ x.m_start = pointer();
+ x.m_size = x.m_capacity = 0;
+ }
+
+ Allocator &alloc() BOOST_CONTAINER_NOEXCEPT
+ { return *this; }
+
+ const Allocator &alloc() const BOOST_CONTAINER_NOEXCEPT
+ { return *this; }
+
+ const pointer &start() const BOOST_CONTAINER_NOEXCEPT { return m_start; }
+ const size_type &capacity() const BOOST_CONTAINER_NOEXCEPT { return m_capacity; }
+ void start(const pointer &p) BOOST_CONTAINER_NOEXCEPT { m_start = p; }
+ void capacity(const size_type &c) BOOST_CONTAINER_NOEXCEPT { m_capacity = c; }
+};
+
+//!This struct deallocates and allocated memory
+template <class Allocator>
+struct vector_alloc_holder<Allocator, container_detail::integral_constant<unsigned, 0> >
+ : public Allocator
+{
+ private:
+ BOOST_MOVABLE_BUT_NOT_COPYABLE(vector_alloc_holder)
+
+ public:
+ typedef boost::container::allocator_traits<Allocator> allocator_traits_type;
+ typedef typename allocator_traits_type::pointer pointer;
+ typedef typename allocator_traits_type::size_type size_type;
+ typedef typename allocator_traits_type::value_type value_type;
+
+ template <class OtherAllocator, class OtherAllocatorVersion>
+ friend struct vector_alloc_holder;
+
+ //Constructor, does not throw
+ vector_alloc_holder()
+ BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value)
+ : Allocator(), m_size()
+ {}
+
+ //Constructor, does not throw
+ template<class AllocConvertible>
+ explicit vector_alloc_holder(BOOST_FWD_REF(AllocConvertible) a) BOOST_CONTAINER_NOEXCEPT
+ : Allocator(boost::forward<AllocConvertible>(a)), m_size()
+ {}
+
+ //Constructor, does not throw
+ template<class AllocConvertible>
+ vector_alloc_holder(uninitialized_size_t, BOOST_FWD_REF(AllocConvertible) a, size_type initial_size)
+ : Allocator(boost::forward<AllocConvertible>(a))
+ , m_size(initial_size) //Size is initialized here...
+ {
+ //... and capacity here, so vector, must call uninitialized_xxx in the derived constructor
+ this->first_allocation(initial_size);
+ }
+
+ //Constructor, does not throw
+ vector_alloc_holder(uninitialized_size_t, size_type initial_size)
+ : Allocator()
+ , m_size(initial_size) //Size is initialized here...
+ {
+ //... and capacity here, so vector, must call uninitialized_xxx in the derived constructor
+ this->first_allocation(initial_size);
+ }
+
+ vector_alloc_holder(BOOST_RV_REF(vector_alloc_holder) holder)
+ : Allocator(boost::move(static_cast<Allocator&>(holder)))
+ , m_size(holder.m_size) //Size is initialized here so vector should only call uninitialized_xxx after this
+ {
+ ::boost::container::uninitialized_move_alloc_n
+ (this->alloc(), container_detail::to_raw_pointer(holder.start()), m_size, container_detail::to_raw_pointer(this->start()));
+ }
+
+ template<class OtherAllocator, class OtherAllocatorVersion>
+ vector_alloc_holder(BOOST_RV_REF_BEG vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> BOOST_RV_REF_END holder)
+ : Allocator()
+ , m_size(holder.m_size) //Initialize it to m_size as first_allocation can only succeed or abort
+ {
+ //Different allocator type so we must check we have enough storage
+ const size_type n = holder.m_size;
+ this->first_allocation(n);
+ ::boost::container::uninitialized_move_alloc_n
+ (this->alloc(), container_detail::to_raw_pointer(holder.start()), n, container_detail::to_raw_pointer(this->start()));
+ }
+
+ void first_allocation(size_type cap)
+ {
+ if(cap > Allocator::internal_capacity){
+ throw_bad_alloc();
+ }
+ }
+
+ void first_allocation_same_allocator_type(size_type) BOOST_CONTAINER_NOEXCEPT
+ {}
+
+ //Destructor
+ ~vector_alloc_holder() BOOST_CONTAINER_NOEXCEPT
+ {}
+
+ void swap(vector_alloc_holder &x)
+ {
+ this->priv_swap_members_impl(x);
+ }
+
+ template<class OtherAllocator, class OtherAllocatorVersion>
+ void swap(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x)
+ {
+ if(this->m_size > OtherAllocator::internal_capacity || x.m_size > Allocator::internal_capacity){
+ throw_bad_alloc();
+ }
+ this->priv_swap_members_impl(x);
+ }
+
+ void move_from_empty(vector_alloc_holder &)
+ { //Containers with version 0 allocators can't be moved without move elements one by one
+ throw_bad_alloc();
+ }
+
+ Allocator &alloc() BOOST_CONTAINER_NOEXCEPT
+ { return *this; }
+
+ const Allocator &alloc() const BOOST_CONTAINER_NOEXCEPT
+ { return *this; }
+
+ pointer start() const BOOST_CONTAINER_NOEXCEPT { return Allocator::internal_storage(); }
+ size_type capacity() const BOOST_CONTAINER_NOEXCEPT { return Allocator::internal_capacity; }
+ size_type m_size;
+
+ private:
+
+ template<class OtherAllocator, class OtherAllocatorVersion>
+ void priv_swap_members_impl(vector_alloc_holder<OtherAllocator, OtherAllocatorVersion> &x)
+ {
+ const std::size_t MaxTmpStorage = sizeof(value_type)*Allocator::internal_capacity;
+ value_type *const first_this = container_detail::to_raw_pointer(this->start());
+ value_type *const first_x = container_detail::to_raw_pointer(x.start());
+
+ if(this->m_size < x.m_size){
+ boost::container::deep_swap_alloc_n<MaxTmpStorage>(this->alloc(), first_this, this->m_size, first_x, x.m_size);
+ }
+ else{
+ boost::container::deep_swap_alloc_n<MaxTmpStorage>(this->alloc(), first_x, x.m_size, first_this, this->m_size);
+ }
+ boost::container::swap_dispatch(this->m_size, x.m_size);
+ }
+};
+
+} //namespace container_detail {
+
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+//! A vector is a sequence that supports random access to elements, constant
+//! time insertion and removal of elements at the end, and linear time insertion
+//! and removal of elements at the beginning or in the middle. The number of
+//! elements in a vector may vary dynamically; memory management is automatic.
+//!
+//! \tparam T The type of object that is stored in the vector
+//! \tparam Allocator The allocator used for all internal memory management
+#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED
+template <class T, class Allocator = std::allocator<T> >
+#else
+template <class T, class Allocator>
+#endif
+class vector
+{
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ typedef typename container_detail::version<Allocator>::type alloc_version;
+ boost::container::container_detail::vector_alloc_holder
+ <Allocator, alloc_version> m_holder;
+ typedef allocator_traits<Allocator> allocator_traits_type;
+ template <class U, class UAllocator>
+ friend class vector;
+
+ typedef typename ::boost::container::allocator_traits
+ <Allocator>::pointer pointer_impl;
+ typedef container_detail::vec_iterator<pointer_impl, false> iterator_impl;
+ typedef container_detail::vec_iterator<pointer_impl, true > const_iterator_impl;
+
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+ public:
+ //////////////////////////////////////////////
+ //
+ // types
+ //
+ //////////////////////////////////////////////
+
+ typedef T value_type;
+ typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer;
+ typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer;
+ typedef typename ::boost::container::allocator_traits<Allocator>::reference reference;
+ typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference;
+ typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type;
+ typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type;
+ typedef Allocator allocator_type;
+ typedef Allocator stored_allocator_type;
+ #if defined BOOST_CONTAINER_VECTOR_ITERATOR_IS_POINTER && !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ typedef BOOST_CONTAINER_IMPDEF(pointer) iterator;
+ typedef BOOST_CONTAINER_IMPDEF(const_pointer) const_iterator;
+ #else
+ typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator;
+ typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator;
+ #endif
+ typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<iterator>) reverse_iterator;
+ typedef BOOST_CONTAINER_IMPDEF(std::reverse_iterator<const_iterator>) const_reverse_iterator;
+
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+ private:
+ BOOST_COPYABLE_AND_MOVABLE(vector)
+ typedef container_detail::vector_value_traits<value_type, Allocator> value_traits;
+
+ typedef container_detail::integral_constant<unsigned, 0> allocator_v0;
+ typedef container_detail::integral_constant<unsigned, 1> allocator_v1;
+ typedef container_detail::integral_constant<unsigned, 2> allocator_v2;
+
+ typedef constant_iterator<T, difference_type> cvalue_iterator;
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ public:
+ //////////////////////////////////////////////
+ //
+ // construct/copy/destroy
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ vector()
+ BOOST_CONTAINER_NOEXCEPT_IF(::boost::has_nothrow_default_constructor<Allocator>::value)
+ : m_holder()
+ {}
+
+ //! <b>Effects</b>: Constructs a vector taking the allocator as parameter.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ explicit vector(const Allocator& a) BOOST_CONTAINER_NOEXCEPT
+ : m_holder(a)
+ {}
+
+ //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
+ //! and inserts n value initialized values.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's value initialization throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ explicit vector(size_type n)
+ : m_holder(container_detail::uninitialized_size, n)
+ {
+ boost::container::uninitialized_value_init_alloc_n
+ (this->m_holder.alloc(), n, container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+
+ //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
+ //! and inserts n default initialized values.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's default initialization throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ //!
+ //! <b>Note</b>: Non-standard extension
+ vector(size_type n, default_init_t)
+ : m_holder(container_detail::uninitialized_size, n)
+ {
+ boost::container::uninitialized_default_init_alloc_n
+ (this->m_holder.alloc(), n, container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+
+ //! <b>Effects</b>: Constructs a vector
+ //! and inserts n copies of value.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ vector(size_type n, const T& value)
+ : m_holder(container_detail::uninitialized_size, n)
+ {
+ boost::container::uninitialized_fill_alloc_n
+ (this->m_holder.alloc(), value, n, container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+
+ //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
+ //! and inserts n copies of value.
+ //!
+ //! <b>Throws</b>: If allocation
+ //! throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ vector(size_type n, const T& value, const allocator_type& a)
+ : m_holder(container_detail::uninitialized_size, a, n)
+ {
+ boost::container::uninitialized_fill_alloc_n
+ (this->m_holder.alloc(), value, n, container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+
+ //! <b>Effects</b>: Constructs a vector
+ //! and inserts a copy of the range [first, last) in the vector.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's constructor taking a dereferenced InIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to the range [first, last).
+ template <class InIt>
+ vector(InIt first, InIt last)
+ : m_holder()
+ { this->insert(this->cend(), first, last); }
+
+ //! <b>Effects</b>: Constructs a vector that will use a copy of allocator a
+ //! and inserts a copy of the range [first, last) in the vector.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's constructor taking a dereferenced InIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to the range [first, last).
+ template <class InIt>
+ vector(InIt first, InIt last, const allocator_type& a)
+ : m_holder(a)
+ { this->insert(this->cend(), first, last); }
+
+ //! <b>Effects</b>: Copy constructs a vector.
+ //!
+ //! <b>Postcondition</b>: x == *this.
+ //!
+ //! <b>Throws</b>: If allocator_type's default constructor or allocation
+ //! throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the elements x contains.
+ vector(const vector &x)
+ : m_holder( container_detail::uninitialized_size
+ , allocator_traits_type::select_on_container_copy_construction(x.m_holder.alloc())
+ , x.size())
+ {
+ ::boost::container::uninitialized_copy_alloc_n
+ ( this->m_holder.alloc(), container_detail::to_raw_pointer(x.m_holder.start())
+ , x.size(), container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+
+ //! <b>Effects</b>: Move constructor. Moves x's resources to *this.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ vector(BOOST_RV_REF(vector) x) BOOST_CONTAINER_NOEXCEPT
+ : m_holder(boost::move(x.m_holder))
+ {}
+
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+ //! <b>Effects</b>: Move constructor. Moves x's resources to *this.
+ //!
+ //! <b>Throws</b>: If T's move constructor or allocation throws
+ //!
+ //! <b>Complexity</b>: Linear.
+ //!
+ //! <b>Note</b>: Non-standard extension to support static_vector
+ template<class OtherAllocator>
+ vector(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x
+ , typename container_detail::enable_if_c
+ < container_detail::is_version<OtherAllocator, 0>::value>::type * = 0
+ )
+ : m_holder(boost::move(x.m_holder))
+ {}
+
+ #endif //!defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+ //! <b>Effects</b>: Copy constructs a vector using the specified allocator.
+ //!
+ //! <b>Postcondition</b>: x == *this.
+ //!
+ //! <b>Throws</b>: If allocation
+ //! throws or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the elements x contains.
+ vector(const vector &x, const allocator_type &a)
+ : m_holder(container_detail::uninitialized_size, a, x.size())
+ {
+ ::boost::container::uninitialized_copy_alloc_n_source
+ ( this->m_holder.alloc(), container_detail::to_raw_pointer(x.m_holder.start())
+ , x.size(), container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+
+ //! <b>Effects</b>: Move constructor using the specified allocator.
+ //! Moves x's resources to *this if a == allocator_type().
+ //! Otherwise copies values from x to *this.
+ //!
+ //! <b>Throws</b>: If allocation or T's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise.
+ vector(BOOST_RV_REF(vector) x, const allocator_type &a)
+ : m_holder(container_detail::uninitialized_size, a, x.size())
+ {
+ if(x.m_holder.alloc() == a){
+ this->m_holder.move_from_empty(x.m_holder);
+ }
+ else{
+ const size_type n = x.size();
+ this->m_holder.first_allocation_same_allocator_type(n);
+ ::boost::container::uninitialized_move_alloc_n_source
+ ( this->m_holder.alloc(), container_detail::to_raw_pointer(x.m_holder.start())
+ , n, container_detail::to_raw_pointer(this->m_holder.start()));
+ }
+ }
+
+ //! <b>Effects</b>: Destroys the vector. All stored values are destroyed
+ //! and used memory is deallocated.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements.
+ ~vector() BOOST_CONTAINER_NOEXCEPT
+ {
+ boost::container::destroy_alloc_n
+ (this->get_stored_allocator(), container_detail::to_raw_pointer(this->m_holder.start()), this->m_holder.m_size);
+ //vector_alloc_holder deallocates the data
+ }
+
+ //! <b>Effects</b>: Makes *this contain the same elements as x.
+ //!
+ //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy
+ //! of each of x's elements.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in x.
+ vector& operator=(BOOST_COPY_ASSIGN_REF(vector) x)
+ {
+ if (&x != this){
+ this->priv_copy_assign(x);
+ }
+ return *this;
+ }
+
+ //! <b>Effects</b>: Move assignment. All x's values are transferred to *this.
+ //!
+ //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
+ //! before the function.
+ //!
+ //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment
+ //! is false and (allocation throws or value_type's move constructor throws)
+ //!
+ //! <b>Complexity</b>: Constant if allocator_traits_type::
+ //! propagate_on_container_move_assignment is true or
+ //! this->get>allocator() == x.get_allocator(). Linear otherwise.
+ vector& operator=(BOOST_RV_REF(vector) x)
+ BOOST_CONTAINER_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value)
+ {
+ this->priv_move_assign(boost::move(x));
+ return *this;
+ }
+
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+
+ //! <b>Effects</b>: Move assignment. All x's values are transferred to *this.
+ //!
+ //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
+ //! before the function.
+ //!
+ //! <b>Throws</b>: If move constructor/assignment of T throws or allocation throws
+ //!
+ //! <b>Complexity</b>: Linear.
+ //!
+ //! <b>Note</b>: Non-standard extension to support static_vector
+ template<class OtherAllocator>
+ typename container_detail::enable_if_c
+ < container_detail::is_version<OtherAllocator, 0>::value &&
+ !container_detail::is_same<OtherAllocator, allocator_type>::value
+ , vector& >::type
+ operator=(BOOST_RV_REF_BEG vector<value_type, OtherAllocator> BOOST_RV_REF_END x)
+ {
+ this->priv_move_assign(boost::move(x));
+ return *this;
+ }
+
+ //! <b>Effects</b>: Copy assignment. All x's values are copied to *this.
+ //!
+ //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had
+ //! before the function.
+ //!
+ //! <b>Throws</b>: If move constructor/assignment of T throws or allocation throws
+ //!
+ //! <b>Complexity</b>: Linear.
+ //!
+ //! <b>Note</b>: Non-standard extension to support static_vector
+ template<class OtherAllocator>
+ typename container_detail::enable_if_c
+ < container_detail::is_version<OtherAllocator, 0>::value &&
+ !container_detail::is_same<OtherAllocator, allocator_type>::value
+ , vector& >::type
+ operator=(const vector<value_type, OtherAllocator> &x)
+ {
+ this->priv_copy_assign(x);
+ return *this;
+ }
+
+ #endif
+
+ //! <b>Effects</b>: Assigns the the range [first, last) to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
+ //! T's constructor/assignment from dereferencing InpIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ template <class InIt>
+ void assign(InIt first, InIt last
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ , typename container_detail::enable_if_c
+ < !container_detail::is_convertible<InIt, size_type>::value &&
+ ( container_detail::is_input_iterator<InIt>::value ||
+ container_detail::is_same<alloc_version, allocator_v0>::value )
+ >::type * = 0
+ #endif
+ )
+ {
+ //Overwrite all elements we can from [first, last)
+ iterator cur = this->begin();
+ const iterator end_it = this->end();
+ for ( ; first != last && cur != end_it; ++cur, ++first){
+ *cur = *first;
+ }
+
+ if (first == last){
+ //There are no more elements in the sequence, erase remaining
+ T* const end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ size_type n = static_cast<size_type>(end_pos - container_detail::to_raw_pointer(vector_iterator_get_ptr(cur)));
+ this->priv_destroy_last_n(n);
+ }
+ else{
+ //There are more elements in the range, insert the remaining ones
+ this->insert(this->cend(), first, last);
+ }
+ }
+
+ //! <b>Effects</b>: Assigns the the range [first, last) to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment or
+ //! T's constructor/assignment from dereferencing InpIt throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ template <class FwdIt>
+ void assign(FwdIt first, FwdIt last
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ , typename container_detail::enable_if_c
+ < !container_detail::is_convertible<FwdIt, size_type>::value &&
+ ( !container_detail::is_input_iterator<FwdIt>::value &&
+ !container_detail::is_same<alloc_version, allocator_v0>::value )
+ >::type * = 0
+ #endif
+ )
+ {
+ //For Fwd iterators the standard only requires EmplaceConstructible and assignable from *first
+ //so we can't do any backwards allocation
+ const size_type input_sz = static_cast<size_type>(std::distance(first, last));
+ const size_type old_capacity = this->capacity();
+ if(input_sz > old_capacity){ //If input range is too big, we need to reallocate
+ size_type real_cap = 0;
+ std::pair<pointer, bool> ret =
+ this->m_holder.allocation_command(allocate_new, input_sz, input_sz, real_cap, this->m_holder.start());
+ if(!ret.second){ //New allocation, just emplace new values
+ pointer const old_p = this->m_holder.start();
+ if(old_p){
+ this->priv_destroy_all();
+ this->m_holder.alloc().deallocate(old_p, old_capacity);
+ }
+ this->m_holder.start(ret.first);
+ this->m_holder.capacity(real_cap);
+ this->m_holder.m_size = 0;
+ this->priv_uninitialized_construct_at_end(first, last);
+ return;
+ }
+ else{
+ //Forward expansion, use assignment + back deletion/construction that comes later
+ }
+ }
+ //Overwrite all elements we can from [first, last)
+ iterator cur = this->begin();
+ const iterator end_it = this->end();
+ for ( ; first != last && cur != end_it; ++cur, ++first){
+ *cur = *first;
+ }
+
+ if (first == last){
+ //There are no more elements in the sequence, erase remaining
+ this->priv_destroy_last_n(this->size() - input_sz);
+ }
+ else{
+ //Uninitialized construct at end the remaining range
+ this->priv_uninitialized_construct_at_end(first, last);
+ }
+ }
+
+ //! <b>Effects</b>: Assigns the n copies of val to *this.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy/move constructor/assignment throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ void assign(size_type n, const value_type& val)
+ { this->assign(cvalue_iterator(val, n), cvalue_iterator()); }
+
+ //! <b>Effects</b>: Returns a copy of the internal allocator.
+ //!
+ //! <b>Throws</b>: If allocator's copy constructor throws.
+ //!
+ //! <b>Complexity</b>: Constant.
+ allocator_type get_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.alloc(); }
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ stored_allocator_type &get_stored_allocator() BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.alloc(); }
+
+ //! <b>Effects</b>: Returns a reference to the internal allocator.
+ //!
+ //! <b>Throws</b>: Nothing
+ //!
+ //! <b>Complexity</b>: Constant.
+ //!
+ //! <b>Note</b>: Non-standard extension.
+ const stored_allocator_type &get_stored_allocator() const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.alloc(); }
+
+ //////////////////////////////////////////////
+ //
+ // iterators
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Effects</b>: Returns an iterator to the first element contained in the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ iterator begin() BOOST_CONTAINER_NOEXCEPT
+ { return iterator(this->m_holder.start()); }
+
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator begin() const BOOST_CONTAINER_NOEXCEPT
+ { return const_iterator(this->m_holder.start()); }
+
+ //! <b>Effects</b>: Returns an iterator to the end of the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ iterator end() BOOST_CONTAINER_NOEXCEPT
+ { return iterator(this->m_holder.start() + this->m_holder.m_size); }
+
+ //! <b>Effects</b>: Returns a const_iterator to the end of the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator end() const BOOST_CONTAINER_NOEXCEPT
+ { return this->cend(); }
+
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reverse_iterator rbegin() BOOST_CONTAINER_NOEXCEPT
+ { return reverse_iterator(this->end()); }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator rbegin() const BOOST_CONTAINER_NOEXCEPT
+ { return this->crbegin(); }
+
+ //! <b>Effects</b>: Returns a reverse_iterator pointing to the end
+ //! of the reversed vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reverse_iterator rend() BOOST_CONTAINER_NOEXCEPT
+ { return reverse_iterator(this->begin()); }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator rend() const BOOST_CONTAINER_NOEXCEPT
+ { return this->crend(); }
+
+ //! <b>Effects</b>: Returns a const_iterator to the first element contained in the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator cbegin() const BOOST_CONTAINER_NOEXCEPT
+ { return const_iterator(this->m_holder.start()); }
+
+ //! <b>Effects</b>: Returns a const_iterator to the end of the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_iterator cend() const BOOST_CONTAINER_NOEXCEPT
+ { return const_iterator(this->m_holder.start() + this->m_holder.m_size); }
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning
+ //! of the reversed vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator crbegin() const BOOST_CONTAINER_NOEXCEPT
+ { return const_reverse_iterator(this->end());}
+
+ //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end
+ //! of the reversed vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reverse_iterator crend() const BOOST_CONTAINER_NOEXCEPT
+ { return const_reverse_iterator(this->begin()); }
+
+ //////////////////////////////////////////////
+ //
+ // capacity
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Effects</b>: Returns true if the vector contains no elements.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ bool empty() const BOOST_CONTAINER_NOEXCEPT
+ { return !this->m_holder.m_size; }
+
+ //! <b>Effects</b>: Returns the number of the elements contained in the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ size_type size() const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.m_size; }
+
+ //! <b>Effects</b>: Returns the largest possible size of the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ size_type max_size() const BOOST_CONTAINER_NOEXCEPT
+ { return allocator_traits_type::max_size(this->m_holder.alloc()); }
+
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are value initialized.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy/move or value initialization throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
+ void resize(size_type new_size)
+ { this->priv_resize(new_size, value_init); }
+
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are default initialized.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy/move or default initialization throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
+ //!
+ //! <b>Note</b>: Non-standard extension
+ void resize(size_type new_size, default_init_t)
+ { this->priv_resize(new_size, default_init); }
+
+ //! <b>Effects</b>: Inserts or erases elements at the end such that
+ //! the size becomes n. New elements are copy constructed from x.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to the difference between size() and new_size.
+ void resize(size_type new_size, const T& x)
+ { this->priv_resize(new_size, x); }
+
+ //! <b>Effects</b>: Number of elements for which memory has been allocated.
+ //! capacity() is always greater than or equal to size().
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ size_type capacity() const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.capacity(); }
+
+ //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no
+ //! effect. Otherwise, it is a request for allocation of additional memory.
+ //! If the request is successful, then capacity() is greater than or equal to
+ //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged.
+ //!
+ //! <b>Throws</b>: If memory allocation allocation throws or T's copy/move constructor throws.
+ void reserve(size_type new_cap)
+ {
+ if (this->capacity() < new_cap){
+ this->priv_reserve(new_cap, alloc_version());
+ }
+ }
+
+ //! <b>Effects</b>: Tries to deallocate the excess of memory created
+ //! with previous allocations. The size of the vector is unchanged
+ //!
+ //! <b>Throws</b>: If memory allocation throws, or T's copy/move constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to size().
+ void shrink_to_fit()
+ { this->priv_shrink_to_fit(alloc_version()); }
+
+ //////////////////////////////////////////////
+ //
+ // element access
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the first
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference front() BOOST_CONTAINER_NOEXCEPT
+ { return *this->m_holder.start(); }
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the first
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference front() const BOOST_CONTAINER_NOEXCEPT
+ { return *this->m_holder.start(); }
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a reference to the last
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference back() BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.start()[this->m_holder.m_size - 1]; }
+
+ //! <b>Requires</b>: !empty()
+ //!
+ //! <b>Effects</b>: Returns a const reference to the last
+ //! element of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference back() const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.start()[this->m_holder.m_size - 1]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference operator[](size_type n) BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.start()[n]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference operator[](size_type n) const BOOST_CONTAINER_NOEXCEPT
+ { return this->m_holder.start()[n]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
+ reference at(size_type n)
+ { this->priv_check_range(n); return this->m_holder.start()[n]; }
+
+ //! <b>Requires</b>: size() > n.
+ //!
+ //! <b>Effects</b>: Returns a const reference to the nth element
+ //! from the beginning of the container.
+ //!
+ //! <b>Throws</b>: std::range_error if n >= size()
+ //!
+ //! <b>Complexity</b>: Constant.
+ const_reference at(size_type n) const
+ { this->priv_check_range(n); return this->m_holder.start()[n]; }
+
+ //////////////////////////////////////////////
+ //
+ // data access
+ //
+ //////////////////////////////////////////////
+
+ //! <b>Returns</b>: Allocator pointer such that [data(),data() + size()) is a valid range.
+ //! For a non-empty vector, data() == &front().
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ T* data() BOOST_CONTAINER_NOEXCEPT
+ { return container_detail::to_raw_pointer(this->m_holder.start()); }
+
+ //! <b>Returns</b>: Allocator pointer such that [data(),data() + size()) is a valid range.
+ //! For a non-empty vector, data() == &front().
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ const T * data() const BOOST_CONTAINER_NOEXCEPT
+ { return container_detail::to_raw_pointer(this->m_holder.start()); }
+
+ //////////////////////////////////////////////
+ //
+ // modifiers
+ //
+ //////////////////////////////////////////////
+
+ #if defined(BOOST_CONTAINER_PERFECT_FORWARDING) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts an object of type T constructed with
+ //! std::forward<Args>(args)... in the end of the vector.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
+ //! T's copy/move constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ template<class ...Args>
+ void emplace_back(Args &&...args)
+ {
+ T* back_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ if (this->m_holder.m_size < this->m_holder.capacity()){
+ //There is more memory, just construct a new object at the end
+ allocator_traits_type::construct(this->m_holder.alloc(), back_pos, ::boost::forward<Args>(args)...);
+ ++this->m_holder.m_size;
+ }
+ else{
+ typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
+ this->priv_forward_range_insert_no_capacity
+ (vector_iterator_get_ptr(this->cend()), 1, type(::boost::forward<Args>(args)...), alloc_version());
+ }
+ }
+
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Inserts an object of type T constructed with
+ //! std::forward<Args>(args)... before position
+ //!
+ //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws or
+ //! T's copy/move constructor/assignment throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ template<class ...Args>
+ iterator emplace(const_iterator position, Args && ...args)
+ {
+ //Just call more general insert(pos, size, value) and return iterator
+ typedef container_detail::insert_emplace_proxy<Allocator, T*, Args...> type;
+ return this->priv_forward_range_insert( vector_iterator_get_ptr(position), 1
+ , type(::boost::forward<Args>(args)...), alloc_version());
+ }
+
+ #else
+
+ #define BOOST_PP_LOCAL_MACRO(n) \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ void emplace_back(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ T* back_pos = container_detail::to_raw_pointer \
+ (this->m_holder.start()) + this->m_holder.m_size; \
+ if (this->m_holder.m_size < this->m_holder.capacity()){ \
+ allocator_traits_type::construct (this->m_holder.alloc() \
+ , back_pos BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \
+ ++this->m_holder.m_size; \
+ } \
+ else{ \
+ typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
+ <Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
+ this->priv_forward_range_insert_no_capacity \
+ ( vector_iterator_get_ptr(this->cend()), 1 \
+ , type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version()); \
+ } \
+ } \
+ \
+ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
+ iterator emplace(const_iterator pos \
+ BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
+ { \
+ typedef container_detail::BOOST_PP_CAT(insert_emplace_proxy_arg, n) \
+ <Allocator, T* BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \
+ return this->priv_forward_range_insert \
+ ( container_detail::to_raw_pointer(vector_iterator_get_ptr(pos)), 1 \
+ , type(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)), alloc_version()); \
+ } \
+ //!
+ #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
+ #include BOOST_PP_LOCAL_ITERATE()
+
+ #endif //#ifdef BOOST_CONTAINER_PERFECT_FORWARDING
+
+ #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Effects</b>: Inserts a copy of x at the end of the vector.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy/move constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(const T &x);
+
+ //! <b>Effects</b>: Constructs a new element in the end of the vector
+ //! and moves the resources of x to this new element.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or
+ //! T's copy/move constructor throws.
+ //!
+ //! <b>Complexity</b>: Amortized constant time.
+ void push_back(T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back)
+ #endif
+
+ #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of x before position.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor/assignment throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, const T &x);
+
+ //! <b>Requires</b>: position must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a new element before position with x's resources.
+ //!
+ //! <b>Throws</b>: If memory allocation throws.
+ //!
+ //! <b>Complexity</b>: If position is end(), amortized constant time
+ //! Linear time otherwise.
+ iterator insert(const_iterator position, T &&x);
+ #else
+ BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator)
+ #endif
+
+ //! <b>Requires</b>: p must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert n copies of x before pos.
+ //!
+ //! <b>Returns</b>: an iterator to the first inserted element or p if n is 0.
+ //!
+ //! <b>Throws</b>: If memory allocation throws or T's copy/move constructor throws.
+ //!
+ //! <b>Complexity</b>: Linear to n.
+ iterator insert(const_iterator p, size_type n, const T& x)
+ {
+ container_detail::insert_n_copies_proxy<Allocator, T*> proxy(x);
+ return this->priv_forward_range_insert(vector_iterator_get_ptr(p), n, proxy, alloc_version());
+ }
+
+ //! <b>Requires</b>: p must be a valid iterator of *this.
+ //!
+ //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
+ //!
+ //! <b>Returns</b>: an iterator to the first inserted element or pos if first == last.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, T's constructor from a
+ //! dereferenced InpIt throws or T's copy/move constructor/assignment throws.
+ //!
+ //! <b>Complexity</b>: Linear to std::distance [first, last).
+ template <class InIt>
+ iterator insert(const_iterator pos, InIt first, InIt last
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ , typename container_detail::enable_if_c
+ < !container_detail::is_convertible<InIt, size_type>::value
+ && container_detail::is_input_iterator<InIt>::value
+ >::type * = 0
+ #endif
+ )
+ {
+ const size_type n_pos = pos - this->cbegin();
+ iterator it(vector_iterator_get_ptr(pos));
+ for(;first != last; ++first){
+ it = this->emplace(it, *first);
+ ++it;
+ }
+ return iterator(this->m_holder.start() + n_pos);
+ }
+
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ template <class FwdIt>
+ iterator insert(const_iterator pos, FwdIt first, FwdIt last
+ , typename container_detail::enable_if_c
+ < !container_detail::is_convertible<FwdIt, size_type>::value
+ && !container_detail::is_input_iterator<FwdIt>::value
+ >::type * = 0
+ )
+ {
+ container_detail::insert_range_proxy<Allocator, FwdIt, T*> proxy(first);
+ return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), std::distance(first, last), proxy, alloc_version());
+ }
+ #endif
+
+ //! <b>Requires</b>: p must be a valid iterator of *this. num, must
+ //! be equal to std::distance(first, last)
+ //!
+ //! <b>Effects</b>: Insert a copy of the [first, last) range before pos.
+ //!
+ //! <b>Returns</b>: an iterator to the first inserted element or pos if first == last.
+ //!
+ //! <b>Throws</b>: If memory allocation throws, T's constructor from a
+ //! dereferenced InpIt throws or T's copy/move constructor/assignment throws.
+ //!
+ //! <b>Complexity</b>: Linear to std::distance [first, last).
+ //!
+ //! <b>Note</b>: This function avoids a linear operation to calculate std::distance[first, last)
+ //! for forward and bidirectional iterators, and a one by one insertion for input iterators. This is a
+ //! a non-standard extension.
+ #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
+ template <class InIt>
+ iterator insert(const_iterator pos, size_type num, InIt first, InIt last)
+ {
+ BOOST_ASSERT(container_detail::is_input_iterator<InIt>::value ||
+ num == static_cast<size_type>(std::distance(first, last)));
+ container_detail::insert_range_proxy<Allocator, InIt, T*> proxy(first);
+ return this->priv_forward_range_insert(vector_iterator_get_ptr(pos), num, proxy, alloc_version());
+ }
+ #endif
+
+ //! <b>Effects</b>: Removes the last element from the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant time.
+ void pop_back() BOOST_CONTAINER_NOEXCEPT
+ {
+ //Destroy last element
+ --this->m_holder.m_size;
+ this->priv_destroy(container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size);
+ }
+
+ //! <b>Effects</b>: Erases the element at position pos.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the elements between pos and the
+ //! last element. Constant if pos is the last element.
+ iterator erase(const_iterator position)
+ {
+ T *const pos = container_detail::to_raw_pointer(vector_iterator_get_ptr(position));
+ T *const beg = container_detail::to_raw_pointer(this->m_holder.start());
+ //Move elements forward and destroy last
+ this->priv_destroy(::boost::move(pos + 1, beg + this->m_holder.m_size, pos));
+ --this->m_holder.m_size;
+ return iterator(vector_iterator_get_ptr(position));
+ }
+
+ //! <b>Effects</b>: Erases the elements pointed by [first, last).
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the distance between first and last
+ //! plus linear to the elements between pos and the last element.
+ iterator erase(const_iterator first, const_iterator last)
+ {
+ if (first != last){
+ T* const end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ T* const ptr = container_detail::to_raw_pointer(boost::move
+ (container_detail::to_raw_pointer(vector_iterator_get_ptr(last))
+ ,end_pos
+ ,container_detail::to_raw_pointer(vector_iterator_get_ptr(first))
+ ));
+ const size_type destroyed = (end_pos - ptr);
+ boost::container::destroy_alloc_n(this->get_stored_allocator(), ptr, destroyed);
+ this->m_holder.m_size -= destroyed;
+ }
+ return iterator(vector_iterator_get_ptr(first));
+ }
+
+ //! <b>Effects</b>: Swaps the contents of *this and x.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Constant.
+ void swap(vector& x) BOOST_CONTAINER_NOEXCEPT_IF((!container_detail::is_version<Allocator, 0>::value))
+ {
+ //Just swap internals in case of !allocator_v0. Otherwise, deep swap
+ this->m_holder.swap(x.m_holder);
+ //And now the allocator
+ container_detail::bool_<allocator_traits_type::propagate_on_container_swap::value> flag;
+ container_detail::swap_alloc(this->m_holder.alloc(), x.m_holder.alloc(), flag);
+ }
+
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ //! <b>Effects</b>: Swaps the contents of *this and x.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear
+ //!
+ //! <b>Note</b>: Non-standard extension to support static_vector
+ template<class OtherAllocator>
+ void swap(vector<T, OtherAllocator> & x
+ , typename container_detail::enable_if_c
+ < container_detail::is_version<OtherAllocator, 0>::value &&
+ !container_detail::is_same<OtherAllocator, allocator_type>::value >::type * = 0
+ )
+ { this->m_holder.swap(x.m_holder); }
+
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ //! <b>Effects</b>: Erases all the elements of the vector.
+ //!
+ //! <b>Throws</b>: Nothing.
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ void clear() BOOST_CONTAINER_NOEXCEPT
+ { this->priv_destroy_all(); }
+
+ //! <b>Effects</b>: Returns true if x and y are equal
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ friend bool operator==(const vector& x, const vector& y)
+ { return x.size() == y.size() && std::equal(x.begin(), x.end(), y.begin()); }
+
+ //! <b>Effects</b>: Returns true if x and y are unequal
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ friend bool operator!=(const vector& x, const vector& y)
+ { return !(x == y); }
+
+ //! <b>Effects</b>: Returns true if x is less than y
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ friend bool operator<(const vector& x, const vector& y)
+ { return std::lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); }
+
+ //! <b>Effects</b>: Returns true if x is greater than y
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ friend bool operator>(const vector& x, const vector& y)
+ { return y < x; }
+
+ //! <b>Effects</b>: Returns true if x is equal or less than y
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ friend bool operator<=(const vector& x, const vector& y)
+ { return !(y < x); }
+
+ //! <b>Effects</b>: Returns true if x is equal or greater than y
+ //!
+ //! <b>Complexity</b>: Linear to the number of elements in the container.
+ friend bool operator>=(const vector& x, const vector& y)
+ { return !(x < y); }
+
+ //! <b>Effects</b>: x.swap(y)
+ //!
+ //! <b>Complexity</b>: Constant.
+ friend void swap(vector& x, vector& y)
+ { x.swap(y); }
+
+ #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+ //Absolutely experimental. This function might change, disappear or simply crash!
+ template<class BiDirPosConstIt, class BiDirValueIt>
+ void insert_ordered_at(size_type element_count, BiDirPosConstIt last_position_it, BiDirValueIt last_value_it)
+ {
+ const size_type *dummy = 0;
+ this->priv_insert_ordered_at(element_count, last_position_it, false, dummy, last_value_it);
+ }
+
+ //Absolutely experimental. This function might change, disappear or simply crash!
+ template<class BiDirPosConstIt, class BiDirSkipConstIt, class BiDirValueIt>
+ void insert_ordered_at( size_type element_count, BiDirPosConstIt last_position_it
+ , BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
+ {
+ this->priv_insert_ordered_at(element_count, last_position_it, true, last_skip_it, last_value_it);
+ }
+
+ private:
+
+ template<class OtherAllocator>
+ void priv_move_assign(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x
+ , typename container_detail::enable_if_c
+ < container_detail::is_version<OtherAllocator, 0>::value >::type * = 0)
+ {
+ if(!container_detail::is_same<OtherAllocator, allocator_type>::value &&
+ this->capacity() < x.size()){
+ throw_bad_alloc();
+ }
+ T* const this_start = container_detail::to_raw_pointer(m_holder.start());
+ T* const other_start = container_detail::to_raw_pointer(x.m_holder.start());
+ const size_type this_sz = m_holder.m_size;
+ const size_type other_sz = static_cast<size_type>(x.m_holder.m_size);
+ boost::container::move_assign_range_alloc_n(this->m_holder.alloc(), other_start, other_sz, this_start, this_sz);
+ this->m_holder.m_size = other_sz;
+ }
+
+ template<class OtherAllocator>
+ void priv_move_assign(BOOST_RV_REF_BEG vector<T, OtherAllocator> BOOST_RV_REF_END x
+ , typename container_detail::enable_if_c
+ < !container_detail::is_version<OtherAllocator, 0>::value &&
+ container_detail::is_same<OtherAllocator, allocator_type>::value>::type * = 0)
+ {
+ //for move constructor, no aliasing (&x != this) is assummed.
+ BOOST_ASSERT(this != &x);
+ allocator_type &this_alloc = this->m_holder.alloc();
+ allocator_type &x_alloc = x.m_holder.alloc();
+ const bool propagate_alloc = allocator_traits_type::
+ propagate_on_container_move_assignment::value;
+ container_detail::bool_<propagate_alloc> flag;
+ const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal;
+ //Resources can be transferred if both allocators are
+ //going to be equal after this function (either propagated or already equal)
+ if(propagate_alloc || allocators_equal){
+ //Destroy objects but retain memory in case x reuses it in the future
+ this->clear();
+ //Move allocator if needed
+ container_detail::move_alloc(this_alloc, x_alloc, flag);
+ //Nothrow swap
+ this->m_holder.swap(x.m_holder);
+ }
+ //Else do a one by one move
+ else{
+ this->assign( boost::make_move_iterator(x.begin())
+ , boost::make_move_iterator(x.end()));
+ }
+ }
+
+ template<class OtherAllocator>
+ void priv_copy_assign(const vector<T, OtherAllocator> &x
+ , typename container_detail::enable_if_c
+ < container_detail::is_version<OtherAllocator, 0>::value >::type * = 0)
+ {
+ if(!container_detail::is_same<OtherAllocator, allocator_type>::value &&
+ this->capacity() < x.size()){
+ throw_bad_alloc();
+ }
+ T* const this_start = container_detail::to_raw_pointer(m_holder.start());
+ T* const other_start = container_detail::to_raw_pointer(x.m_holder.start());
+ const size_type this_sz = m_holder.m_size;
+ const size_type other_sz = static_cast<size_type>(x.m_holder.m_size);
+ boost::container::copy_assign_range_alloc_n(this->m_holder.alloc(), other_start, other_sz, this_start, this_sz);
+ this->m_holder.m_size = other_sz;
+ }
+
+ template<class OtherAllocator>
+ void priv_copy_assign(const vector<T, OtherAllocator> &x
+ , typename container_detail::enable_if_c
+ < !container_detail::is_version<OtherAllocator, 0>::value &&
+ container_detail::is_same<OtherAllocator, allocator_type>::value >::type * = 0)
+ {
+ allocator_type &this_alloc = this->m_holder.alloc();
+ const allocator_type &x_alloc = x.m_holder.alloc();
+ container_detail::bool_<allocator_traits_type::
+ propagate_on_container_copy_assignment::value> flag;
+ if(flag && this_alloc != x_alloc){
+ this->clear();
+ this->shrink_to_fit();
+ }
+ container_detail::assign_alloc(this_alloc, x_alloc, flag);
+ this->assign( container_detail::to_raw_pointer(x.m_holder.start())
+ , container_detail::to_raw_pointer(x.m_holder.start() + x.m_holder.m_size));
+ }
+
+ void priv_reserve(size_type, allocator_v0)
+ { throw_bad_alloc(); }
+
+ container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*> priv_dummy_empty_proxy()
+ {
+ return container_detail::insert_range_proxy<Allocator, boost::move_iterator<T*>, T*>
+ (::boost::make_move_iterator((T *)0));
+ }
+
+ void priv_reserve(size_type new_cap, allocator_v1)
+ {
+ //There is not enough memory, allocate a new buffer
+ pointer p = this->m_holder.allocate(new_cap);
+ //We will reuse insert code, so create a dummy input iterator
+ this->priv_forward_range_insert_new_allocation
+ ( container_detail::to_raw_pointer(p), new_cap
+ , container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size
+ , 0, this->priv_dummy_empty_proxy());
+ }
+
+ void priv_reserve(size_type new_cap, allocator_v2)
+ {
+ //There is not enough memory, allocate a new
+ //buffer or expand the old one.
+ bool same_buffer_start;
+ size_type real_cap = 0;
+ std::pair<pointer, bool> ret = this->m_holder.allocation_command
+ (allocate_new | expand_fwd | expand_bwd, new_cap, new_cap, real_cap, this->m_holder.start());
+
+ //Check for forward expansion
+ same_buffer_start = ret.second && this->m_holder.start() == ret.first;
+ if(same_buffer_start){
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_expand_fwd;
+ #endif
+ this->m_holder.capacity(real_cap);
+ }
+ else{ //If there is no forward expansion, move objects, we will reuse insertion code
+ T * const new_mem = container_detail::to_raw_pointer(ret.first);
+ T * const ins_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ if(ret.second){ //Backwards (and possibly forward) expansion
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_expand_bwd;
+ #endif
+ this->priv_forward_range_insert_expand_backwards
+ ( new_mem , real_cap, ins_pos, 0, this->priv_dummy_empty_proxy());
+ }
+ else{ //New buffer
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_alloc;
+ #endif
+ this->priv_forward_range_insert_new_allocation
+ ( new_mem, real_cap, ins_pos, 0, this->priv_dummy_empty_proxy());
+ }
+ }
+ }
+
+ void priv_destroy(value_type* p) BOOST_CONTAINER_NOEXCEPT
+ {
+ if(!value_traits::trivial_dctr)
+ allocator_traits_type::destroy(this->get_stored_allocator(), p);
+ }
+
+ void priv_destroy_last_n(size_type n) BOOST_CONTAINER_NOEXCEPT
+ {
+ T* const end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ boost::container::destroy_alloc_n(this->get_stored_allocator(), end_pos-n, n);
+ this->m_holder.m_size -= n;
+ }
+
+ template<class InpIt>
+ void priv_uninitialized_construct_at_end(InpIt first, InpIt last)
+ {
+ T* end_pos = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ for(; first != last; ++first, ++end_pos, ++this->m_holder.m_size){
+ //There is more memory, just construct a new object at the end
+ allocator_traits_type::construct(this->m_holder.alloc(), end_pos, *first);
+ }
+ }
+
+ void priv_destroy_all() BOOST_CONTAINER_NOEXCEPT
+ {
+ boost::container::destroy_alloc_n
+ (this->get_stored_allocator(), container_detail::to_raw_pointer(this->m_holder.start()), this->m_holder.m_size);
+ this->m_holder.m_size = 0;
+ }
+
+ template<class U>
+ iterator priv_insert(const const_iterator &p, BOOST_FWD_REF(U) x)
+ {
+ return this->priv_forward_range_insert
+ ( vector_iterator_get_ptr(p), 1, container_detail::get_insert_value_proxy<T*, Allocator>
+ (::boost::forward<U>(x)), alloc_version());
+ }
+
+ container_detail::insert_copy_proxy<Allocator, T*> priv_single_insert_proxy(const T &x)
+ { return container_detail::insert_copy_proxy<Allocator, T*> (x); }
+
+ container_detail::insert_move_proxy<Allocator, T*> priv_single_insert_proxy(BOOST_RV_REF(T) x)
+ { return container_detail::insert_move_proxy<Allocator, T*> (x); }
+
+ template <class U>
+ void priv_push_back(BOOST_FWD_REF(U) u)
+ {
+ if (this->m_holder.m_size < this->m_holder.capacity()){
+ //There is more memory, just construct a new object at the end
+ allocator_traits_type::construct
+ ( this->m_holder.alloc()
+ , container_detail::to_raw_pointer(this->m_holder.start() + this->m_holder.m_size)
+ , ::boost::forward<U>(u) );
+ ++this->m_holder.m_size;
+ }
+ else{
+ this->priv_forward_range_insert_no_capacity
+ ( vector_iterator_get_ptr(this->cend()), 1
+ , this->priv_single_insert_proxy(::boost::forward<U>(u)), alloc_version());
+ }
+ }
+
+ container_detail::insert_n_copies_proxy<Allocator, T*> priv_resize_proxy(const T &x)
+ { return container_detail::insert_n_copies_proxy<Allocator, T*>(x); }
+
+ container_detail::insert_default_initialized_n_proxy<Allocator, T*> priv_resize_proxy(default_init_t)
+ { return container_detail::insert_default_initialized_n_proxy<Allocator, T*>(); }
+
+ container_detail::insert_value_initialized_n_proxy<Allocator, T*> priv_resize_proxy(value_init_t)
+ { return container_detail::insert_value_initialized_n_proxy<Allocator, T*>(); }
+
+ template <class U>
+ void priv_resize(size_type new_size, const U& u)
+ {
+ const size_type sz = this->size();
+ if (new_size < sz){
+ //Destroy last elements
+ this->priv_destroy_last_n(sz - new_size);
+ }
+ else{
+ const size_type n = new_size - this->size();
+ this->priv_forward_range_insert_at_end(n, this->priv_resize_proxy(u), alloc_version());
+ }
+ }
+
+ void priv_shrink_to_fit(allocator_v0) BOOST_CONTAINER_NOEXCEPT
+ {}
+
+ void priv_shrink_to_fit(allocator_v1)
+ {
+ const size_type cp = this->m_holder.capacity();
+ if(cp){
+ const size_type sz = this->size();
+ if(!sz){
+ this->m_holder.alloc().deallocate(this->m_holder.m_start, cp);
+ this->m_holder.m_start = pointer();
+ this->m_holder.m_capacity = 0;
+ }
+ else if(sz < cp){
+ //Allocate a new buffer.
+ pointer p = this->m_holder.allocate(sz);
+
+ //We will reuse insert code, so create a dummy input iterator
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_alloc;
+ #endif
+ this->priv_forward_range_insert_new_allocation
+ ( container_detail::to_raw_pointer(p), sz
+ , container_detail::to_raw_pointer(this->m_holder.start())
+ , 0, this->priv_dummy_empty_proxy());
+ }
+ }
+ }
+
+ void priv_shrink_to_fit(allocator_v2) BOOST_CONTAINER_NOEXCEPT
+ {
+ const size_type cp = this->m_holder.capacity();
+ if(cp){
+ const size_type sz = this->size();
+ if(!sz){
+ this->m_holder.alloc().deallocate(this->m_holder.m_start, cp);
+ this->m_holder.m_start = pointer();
+ this->m_holder.m_capacity = 0;
+ }
+ else{
+ size_type received_size;
+ if(this->m_holder.allocation_command
+ ( shrink_in_place | nothrow_allocation
+ , cp, sz, received_size, this->m_holder.start()).first){
+ this->m_holder.capacity(received_size);
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_shrink;
+ #endif
+ }
+ }
+ }
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert_no_capacity
+ (const pointer &pos, const size_type, const InsertionProxy , allocator_v0)
+ {
+ throw_bad_alloc();
+ return iterator(pos);
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert_no_capacity
+ (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v1)
+ {
+ //Check if we have enough memory or try to expand current memory
+ const size_type n_pos = pos - this->m_holder.start();
+ T *const raw_pos = container_detail::to_raw_pointer(pos);
+
+ const size_type new_cap = this->m_holder.next_capacity(n);
+ T * new_buf = container_detail::to_raw_pointer(this->m_holder.alloc().allocate(new_cap));
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_alloc;
+ #endif
+ this->priv_forward_range_insert_new_allocation
+ ( new_buf, new_cap, raw_pos, n, insert_range_proxy);
+ return iterator(this->m_holder.start() + n_pos);
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert_no_capacity
+ (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v2)
+ {
+ //Check if we have enough memory or try to expand current memory
+ T *const raw_pos = container_detail::to_raw_pointer(pos);
+ const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start());
+
+ size_type real_cap = 0;
+ //There is not enough memory, allocate a new
+ //buffer or expand the old one.
+ std::pair<pointer, bool> ret = (this->m_holder.allocation_command
+ (allocate_new | expand_fwd | expand_bwd,
+ this->m_holder.m_size + n, this->m_holder.next_capacity(n), real_cap, this->m_holder.start()));
+
+ //Buffer reallocated
+ if(ret.second){
+ //Forward expansion, delay insertion
+ if(this->m_holder.start() == ret.first){
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_expand_fwd;
+ #endif
+ this->m_holder.capacity(real_cap);
+ //Expand forward
+ this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
+ }
+ //Backwards (and possibly forward) expansion
+ else{
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_expand_bwd;
+ #endif
+ this->priv_forward_range_insert_expand_backwards
+ ( container_detail::to_raw_pointer(ret.first)
+ , real_cap, raw_pos, n, insert_range_proxy);
+ }
+ }
+ //New buffer
+ else{
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ ++this->num_alloc;
+ #endif
+ this->priv_forward_range_insert_new_allocation
+ ( container_detail::to_raw_pointer(ret.first)
+ , real_cap, raw_pos, n, insert_range_proxy);
+ }
+
+ return iterator(this->m_holder.start() + n_pos);
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert
+ (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v0)
+ {
+ //Check if we have enough memory or try to expand current memory
+ const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size;
+
+ if (n > remaining){
+ //This will trigger an error
+ throw_bad_alloc();
+ }
+ const size_type n_pos = pos - this->m_holder.start();
+ T *const raw_pos = container_detail::to_raw_pointer(pos);
+ this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
+ return iterator(this->m_holder.start() + n_pos);
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert
+ (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v1)
+ {
+ //Check if we have enough memory or try to expand current memory
+ const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size;
+ T *const raw_pos = container_detail::to_raw_pointer(pos);
+
+ if (n <= remaining){
+ const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start());
+ this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
+ return iterator(this->m_holder.start() + n_pos);
+ }
+ else{
+ return this->priv_forward_range_insert_no_capacity(pos, n, insert_range_proxy, alloc_version());
+ }
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert
+ (const pointer &pos, const size_type n, const InsertionProxy insert_range_proxy, allocator_v2)
+ {
+ //Check if we have enough memory or try to expand current memory
+ const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size;
+
+ bool same_buffer_start = n <= remaining;
+ if (!same_buffer_start){
+ return priv_forward_range_insert_no_capacity(pos, n, insert_range_proxy, alloc_version());
+ }
+ else{
+ //Expand forward
+ T *const raw_pos = container_detail::to_raw_pointer(pos);
+ const size_type n_pos = raw_pos - container_detail::to_raw_pointer(this->m_holder.start());
+ this->priv_forward_range_insert_expand_forward(raw_pos, n, insert_range_proxy);
+ return iterator(this->m_holder.start() + n_pos);
+ }
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert_at_end
+ (const size_type n, const InsertionProxy insert_range_proxy, allocator_v0)
+ {
+ //Check if we have enough memory or try to expand current memory
+ const size_type remaining = this->m_holder.capacity() - this->m_holder.m_size;
+
+ if (n > remaining){
+ //This will trigger an error
+ throw_bad_alloc();
+ }
+ this->priv_forward_range_insert_at_end_expand_forward(n, insert_range_proxy);
+ return this->end();
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert_at_end
+ (const size_type n, const InsertionProxy insert_range_proxy, allocator_v1)
+ {
+ return this->priv_forward_range_insert(vector_iterator_get_ptr(this->cend()), n, insert_range_proxy, allocator_v1());
+ }
+
+ template <class InsertionProxy>
+ iterator priv_forward_range_insert_at_end
+ (const size_type n, const InsertionProxy insert_range_proxy, allocator_v2)
+ {
+ return this->priv_forward_range_insert(vector_iterator_get_ptr(this->cend()), n, insert_range_proxy, allocator_v2());
+ }
+
+ //Absolutely experimental. This function might change, disappear or simply crash!
+ template<class BiDirPosConstIt, class BiDirSkipConstIt, class BiDirValueIt>
+ void priv_insert_ordered_at( size_type element_count, BiDirPosConstIt last_position_it
+ , bool do_skip, BiDirSkipConstIt last_skip_it, BiDirValueIt last_value_it)
+ {
+ const size_type old_size_pos = this->size();
+ this->reserve(old_size_pos + element_count);
+ T* const begin_ptr = container_detail::to_raw_pointer(this->m_holder.start());
+ size_type insertions_left = element_count;
+ size_type next_pos = old_size_pos;
+ size_type hole_size = element_count;
+
+ //Exception rollback. If any copy throws before the hole is filled, values
+ //already inserted/copied at the end of the buffer will be destroyed.
+ typename value_traits::ArrayDestructor past_hole_values_destroyer
+ (begin_ptr + old_size_pos + element_count, this->m_holder.alloc(), size_type(0u));
+ //Loop for each insertion backwards, first moving the elements after the insertion point,
+ //then inserting the element.
+ while(insertions_left){
+ if(do_skip){
+ size_type n = *(--last_skip_it);
+ std::advance(last_value_it, -difference_type(n));
+ }
+ const size_type pos = static_cast<size_type>(*(--last_position_it));
+ BOOST_ASSERT(pos <= old_size_pos);
+ //If needed shift the range after the insertion point and the previous insertion point.
+ //Function will take care if the shift crosses the size() boundary, using copy/move
+ //or uninitialized copy/move if necessary.
+ size_type new_hole_size = (pos != next_pos)
+ ? priv_insert_ordered_at_shift_range(pos, next_pos, this->size(), insertions_left)
+ : hole_size
+ ;
+ if(new_hole_size > 0){
+ //The hole was reduced by priv_insert_ordered_at_shift_range so expand exception rollback range backwards
+ past_hole_values_destroyer.increment_size_backwards(next_pos - pos);
+ //Insert the new value in the hole
+ allocator_traits_type::construct(this->m_holder.alloc(), begin_ptr + pos + insertions_left - 1, *(--last_value_it));
+ --new_hole_size;
+ if(new_hole_size == 0){
+ //Hole was just filled, disable exception rollback and change vector size
+ past_hole_values_destroyer.release();
+ this->m_holder.m_size += element_count;
+ }
+ else{
+ //The hole was reduced by the new insertion by one
+ past_hole_values_destroyer.increment_size_backwards(size_type(1u));
+ }
+ }
+ else{
+ if(hole_size){
+ //Hole was just filled by priv_insert_ordered_at_shift_range, disable exception rollback and change vector size
+ past_hole_values_destroyer.release();
+ this->m_holder.m_size += element_count;
+ }
+ //Insert the new value in the already constructed range
+ begin_ptr[pos + insertions_left - 1] = *(--last_value_it);
+ }
+ --insertions_left;
+ hole_size = new_hole_size;
+ next_pos = pos;
+ }
+ }
+
+ //Takes the range pointed by [first_pos, last_pos) and shifts it to the right
+ //by 'shift_count'. 'limit_pos' marks the end of constructed elements.
+ //
+ //Precondition: first_pos <= last_pos <= limit_pos
+ //
+ //The shift operation might cross limit_pos so elements to moved beyond limit_pos
+ //are uninitialized_moved with an allocator. Other elements are moved.
+ //
+ //The shift operation might left uninitialized elements after limit_pos
+ //and the number of uninitialized elements is returned by the function.
+ //
+ //Old situation:
+ // first_pos last_pos old_limit
+ // | | |
+ // ____________V_______V__________________V_____________
+ //| prefix | range | suffix |raw_mem ~
+ //|____________|_______|__________________|_____________~
+ //
+ //New situation in Case Allocator (hole_size == 0):
+ // range is moved through move assignments
+ //
+ // first_pos last_pos limit_pos
+ // | | |
+ // ____________V_______V__________________V_____________
+ //| prefix' | | | range |suffix'|raw_mem ~
+ //|________________+______|___^___|_______|_____________~
+ // | |
+ // |_>_>_>_>_>^
+ //
+ //
+ //New situation in Case B (hole_size > 0):
+ // range is moved through uninitialized moves
+ //
+ // first_pos last_pos limit_pos
+ // | | |
+ // ____________V_______V__________________V________________
+ //| prefix' | | | [hole] | range |
+ //|_______________________________________|________|___^___|
+ // | |
+ // |_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_^
+ //
+ //New situation in Case C (hole_size == 0):
+ // range is moved through move assignments and uninitialized moves
+ //
+ // first_pos last_pos limit_pos
+ // | | |
+ // ____________V_______V__________________V___
+ //| prefix' | | | range |
+ //|___________________________________|___^___|
+ // | |
+ // |_>_>_>_>_>_>_>_>_>_>_>^
+ size_type priv_insert_ordered_at_shift_range
+ (size_type first_pos, size_type last_pos, size_type limit_pos, size_type shift_count)
+ {
+ BOOST_ASSERT(first_pos <= last_pos);
+ BOOST_ASSERT(last_pos <= limit_pos);
+ //
+ T* const begin_ptr = container_detail::to_raw_pointer(this->m_holder.start());
+ T* const first_ptr = begin_ptr + first_pos;
+ T* const last_ptr = begin_ptr + last_pos;
+
+ size_type hole_size = 0;
+ //Case A:
+ if((last_pos + shift_count) <= limit_pos){
+ //All move assigned
+ boost::move_backward(first_ptr, last_ptr, last_ptr + shift_count);
+ }
+ //Case B:
+ else if((first_pos + shift_count) >= limit_pos){
+ //All uninitialized_moved
+ ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), first_ptr, last_ptr, first_ptr + shift_count);
+ hole_size = last_pos + shift_count - limit_pos;
+ }
+ //Case C:
+ else{
+ //Some uninitialized_moved
+ T* const limit_ptr = begin_ptr + limit_pos;
+ T* const boundary_ptr = limit_ptr - shift_count;
+ ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), boundary_ptr, last_ptr, limit_ptr);
+ //The rest is move assigned
+ boost::move_backward(first_ptr, boundary_ptr, limit_ptr);
+ }
+ return hole_size;
+ }
+
+ private:
+ template <class InsertionProxy>
+ void priv_forward_range_insert_at_end_expand_forward(const size_type n, InsertionProxy insert_range_proxy)
+ {
+ T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
+ this->m_holder.m_size += n;
+ }
+
+ template <class InsertionProxy>
+ void priv_forward_range_insert_expand_forward(T* const pos, const size_type n, InsertionProxy insert_range_proxy)
+ {
+ //n can't be 0, because there is nothing to do in that case
+ if(!n) return;
+ //There is enough memory
+ T* const old_finish = container_detail::to_raw_pointer(this->m_holder.start()) + this->m_holder.m_size;
+ const size_type elems_after = old_finish - pos;
+
+ if (!elems_after){
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
+ this->m_holder.m_size += n;
+ }
+ else if (elems_after >= n){
+ //New elements can be just copied.
+ //Move to uninitialized memory last objects
+ ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), old_finish - n, old_finish, old_finish);
+ this->m_holder.m_size += n;
+ //Copy previous to last objects to the initialized end
+ boost::move_backward(pos, old_finish - n, old_finish);
+ //Insert new objects in the pos
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, n);
+ }
+ else {
+ //The new elements don't fit in the [pos, end()) range.
+
+ //Copy old [pos, end()) elements to the uninitialized memory (a gap is created)
+ ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), pos, old_finish, pos + n);
+ BOOST_TRY{
+ //Copy first new elements in pos (gap is still there)
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, elems_after);
+ //Copy to the beginning of the unallocated zone the last new elements (the gap is closed).
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n - elems_after);
+ this->m_holder.m_size += n;
+ }
+ BOOST_CATCH(...){
+ boost::container::destroy_alloc_n(this->get_stored_allocator(), pos + n, elems_after);
+ BOOST_RETHROW
+ }
+ BOOST_CATCH_END
+ }
+ }
+
+ template <class InsertionProxy>
+ void priv_forward_range_insert_new_allocation
+ (T* const new_start, size_type new_cap, T* const pos, const size_type n, InsertionProxy insert_range_proxy)
+ {
+ //n can be zero, if we want to reallocate!
+ T *new_finish = new_start;
+ T *old_finish;
+ //Anti-exception rollbacks
+ typename value_traits::ArrayDeallocator new_buffer_deallocator(new_start, this->m_holder.alloc(), new_cap);
+ typename value_traits::ArrayDestructor new_values_destroyer(new_start, this->m_holder.alloc(), 0u);
+
+ //Initialize with [begin(), pos) old buffer
+ //the start of the new buffer
+ T * const old_buffer = container_detail::to_raw_pointer(this->m_holder.start());
+ if(old_buffer){
+ new_finish = ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), container_detail::to_raw_pointer(this->m_holder.start()), pos, old_finish = new_finish);
+ new_values_destroyer.increment_size(new_finish - old_finish);
+ }
+ //Initialize new objects, starting from previous point
+ old_finish = new_finish;
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, n);
+ new_finish += n;
+ new_values_destroyer.increment_size(new_finish - old_finish);
+ //Initialize from the rest of the old buffer,
+ //starting from previous point
+ if(old_buffer){
+ new_finish = ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), pos, old_buffer + this->m_holder.m_size, new_finish);
+ //Destroy and deallocate old elements
+ //If there is allocated memory, destroy and deallocate
+ if(!value_traits::trivial_dctr_after_move)
+ boost::container::destroy_alloc_n(this->get_stored_allocator(), old_buffer, this->m_holder.m_size);
+ this->m_holder.alloc().deallocate(this->m_holder.start(), this->m_holder.capacity());
+ }
+ this->m_holder.start(new_start);
+ this->m_holder.m_size = new_finish - new_start;
+ this->m_holder.capacity(new_cap);
+ //All construction successful, disable rollbacks
+ new_values_destroyer.release();
+ new_buffer_deallocator.release();
+ }
+
+ template <class InsertionProxy>
+ void priv_forward_range_insert_expand_backwards
+ (T* const new_start, const size_type new_capacity,
+ T* const pos, const size_type n, InsertionProxy insert_range_proxy)
+ {
+ //n can be zero to just expand capacity
+ //Backup old data
+ T* const old_start = container_detail::to_raw_pointer(this->m_holder.start());
+ const size_type old_size = this->m_holder.m_size;
+ T* const old_finish = old_start + old_size;
+
+ //We can have 8 possibilities:
+ const size_type elemsbefore = static_cast<size_type>(pos - old_start);
+ const size_type s_before = static_cast<size_type>(old_start - new_start);
+ const size_type before_plus_new = elemsbefore + n;
+
+ //Update the vector buffer information to a safe state
+ this->m_holder.start(new_start);
+ this->m_holder.capacity(new_capacity);
+ this->m_holder.m_size = 0;
+
+ //If anything goes wrong, this object will destroy
+ //all the old objects to fulfill previous vector state
+ typename value_traits::ArrayDestructor old_values_destroyer(old_start, this->m_holder.alloc(), old_size);
+ //Check if s_before is big enough to hold the beginning of old data + new data
+ if(s_before >= before_plus_new){
+ //Copy first old values before pos, after that the new objects
+ T *const new_elem_pos =
+ ::boost::container::uninitialized_move_alloc(this->m_holder.alloc(), old_start, pos, new_start);
+ this->m_holder.m_size = elemsbefore;
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), new_elem_pos, n);
+ this->m_holder.m_size = before_plus_new;
+ const size_type new_size = old_size + n;
+ //Check if s_before is so big that even copying the old data + new data
+ //there is a gap between the new data and the old data
+ if(s_before >= new_size){
+ //Old situation:
+ // _________________________________________________________
+ //| raw_mem | old_begin | old_end |
+ //| __________________________________|___________|_________|
+ //
+ //New situation:
+ // _________________________________________________________
+ //| old_begin | new | old_end | raw_mem |
+ //|___________|__________|_________|________________________|
+ //
+ //Now initialize the rest of memory with the last old values
+ if(before_plus_new != new_size){ //Special case to avoid operations in back insertion
+ ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), pos, old_finish, new_start + before_plus_new);
+ //All new elements correctly constructed, avoid new element destruction
+ this->m_holder.m_size = new_size;
+ }
+ //Old values destroyed automatically with "old_values_destroyer"
+ //when "old_values_destroyer" goes out of scope unless the have trivial
+ //destructor after move.
+ if(value_traits::trivial_dctr_after_move)
+ old_values_destroyer.release();
+ }
+ //s_before is so big that divides old_end
+ else{
+ //Old situation:
+ // __________________________________________________
+ //| raw_mem | old_begin | old_end |
+ //| ___________________________|___________|_________|
+ //
+ //New situation:
+ // __________________________________________________
+ //| old_begin | new | old_end | raw_mem |
+ //|___________|__________|_________|_________________|
+ //
+ //Now initialize the rest of memory with the last old values
+ //All new elements correctly constructed, avoid new element destruction
+ const size_type raw_gap = s_before - before_plus_new;
+ if(!value_traits::trivial_dctr){
+ //Now initialize the rest of s_before memory with the
+ //first of elements after new values
+ ::boost::container::uninitialized_move_alloc_n
+ (this->m_holder.alloc(), pos, raw_gap, new_start + before_plus_new);
+ //Now we have a contiguous buffer so program trailing element destruction
+ //and update size to the final size.
+ old_values_destroyer.shrink_forward(elemsbefore + raw_gap);
+ this->m_holder.m_size = new_size;
+ //Now move remaining last objects in the old buffer begin
+ ::boost::move(pos + raw_gap, old_finish, old_start);
+ //Once moved, avoid calling the destructors if trivial after move
+ if(value_traits::trivial_dctr_after_move){
+ old_values_destroyer.release();
+ }
+ }
+ else{ //If trivial destructor, we can uninitialized copy + copy in a single uninitialized copy
+ ::boost::container::uninitialized_move_alloc_n
+ (this->m_holder.alloc(), pos, old_finish - pos, new_start + before_plus_new);
+ this->m_holder.m_size = new_size;
+ old_values_destroyer.release();
+ }
+ }
+ }
+ else{
+ //Check if we have to do the insertion in two phases
+ //since maybe s_before is not big enough and
+ //the buffer was expanded both sides
+ //
+ //Old situation:
+ // _________________________________________________
+ //| raw_mem | old_begin + old_end | raw_mem |
+ //|_________|_____________________|_________________|
+ //
+ //New situation with do_after:
+ // _________________________________________________
+ //| old_begin + new + old_end | raw_mem |
+ //|___________________________________|_____________|
+ //
+ //New without do_after:
+ // _________________________________________________
+ //| old_begin + new + old_end | raw_mem |
+ //|____________________________|____________________|
+ //
+ const bool do_after = n > s_before;
+
+ //Now we can have two situations: the raw_mem of the
+ //beginning divides the old_begin, or the new elements:
+ if (s_before <= elemsbefore) {
+ //The raw memory divides the old_begin group:
+ //
+ //If we need two phase construction (do_after)
+ //new group is divided in new = new_beg + new_end groups
+ //In this phase only new_beg will be inserted
+ //
+ //Old situation:
+ // _________________________________________________
+ //| raw_mem | old_begin | old_end | raw_mem |
+ //|_________|___________|_________|_________________|
+ //
+ //New situation with do_after(1):
+ //This is not definitive situation, the second phase
+ //will include
+ // _________________________________________________
+ //| old_begin | new_beg | old_end | raw_mem |
+ //|___________|_________|_________|_________________|
+ //
+ //New situation without do_after:
+ // _________________________________________________
+ //| old_begin | new | old_end | raw_mem |
+ //|___________|_____|_________|_____________________|
+ //
+ //Copy the first part of old_begin to raw_mem
+ ::boost::container::uninitialized_move_alloc_n
+ (this->m_holder.alloc(), old_start, s_before, new_start);
+ //The buffer is all constructed until old_end
+ if(do_after){
+ //release destroyer and update size
+ old_values_destroyer.release();
+ this->m_holder.m_size = old_size + s_before;
+ //Now copy the second part of old_begin overwriting itself
+ T *const next = ::boost::move(old_start + s_before, pos, old_start);
+ //Now copy the new_beg elements
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), next, s_before);
+ }
+ else{
+ //The buffer is all constructed until old_end,
+ //so program trailing destruction and assign final size
+ this->m_holder.m_size = old_size + n;
+ const size_type n_destroy = s_before - n;
+ old_values_destroyer.shrink_forward(old_size - n_destroy);
+ //Now copy the second part of old_begin overwriting itself
+ T *const next = ::boost::move(old_start + s_before, pos, old_start);
+ //Now copy the all the new elements
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), next, n);
+ //Now displace old_end elements
+ ::boost::move(pos, old_finish, next + n);
+ if(value_traits::trivial_dctr_after_move)
+ old_values_destroyer.release();
+ }
+ }
+ else {
+ //If we have to expand both sides,
+ //we will play if the first new values so
+ //calculate the upper bound of new values
+
+ //The raw memory divides the new elements
+ //
+ //If we need two phase construction (do_after)
+ //new group is divided in new = new_beg + new_end groups
+ //In this phase only new_beg will be inserted
+ //
+ //Old situation:
+ // _______________________________________________________
+ //| raw_mem | old_begin | old_end | raw_mem |
+ //|_______________|___________|_________|_________________|
+ //
+ //New situation with do_after():
+ // ____________________________________________________
+ //| old_begin | new_beg | old_end | raw_mem |
+ //|___________|_______________|_________|______________|
+ //
+ //New situation without do_after:
+ // ______________________________________________________
+ //| old_begin | new | old_end | raw_mem |
+ //|___________|_____|_________|__________________________|
+ //
+ //First copy whole old_begin and part of new to raw_mem
+ T * const new_pos = ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), old_start, pos, new_start);
+ this->m_holder.m_size = elemsbefore;
+ const size_type mid_n = s_before - elemsbefore;
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), new_pos, mid_n);
+ //The buffer is all constructed until old_end,
+ //release destroyer
+ this->m_holder.m_size = old_size + s_before;
+ old_values_destroyer.release();
+
+ if(do_after){
+ //Copy new_beg part
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, elemsbefore);
+ }
+ else{
+ //Copy all new elements
+ const size_type rest_new = n - mid_n;
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), old_start, rest_new);
+ T* const move_start = old_start + rest_new;
+ //Displace old_end
+ T* const move_end = ::boost::move(pos, old_finish, move_start);
+ //Destroy remaining moved elements from old_end except if they
+ //have trivial destructor after being moved
+ size_type n_destroy = s_before - n;
+ if(!value_traits::trivial_dctr_after_move)
+ boost::container::destroy_alloc_n(this->get_stored_allocator(), move_end, n_destroy);
+ this->m_holder.m_size -= n_destroy;
+ }
+ }
+
+ //This is only executed if two phase construction is needed
+ if(do_after){
+ //The raw memory divides the new elements
+ //
+ //Old situation:
+ // ______________________________________________________
+ //| raw_mem | old_begin | old_end | raw_mem |
+ //|______________|___________|____________|______________|
+ //
+ //New situation with do_after(1):
+ // _______________________________________________________
+ //| old_begin + new_beg | new_end |old_end | raw_mem |
+ //|__________________________|_________|________|_________|
+ //
+ //New situation with do_after(2):
+ // ______________________________________________________
+ //| old_begin + new | old_end |raw |
+ //|_______________________________________|_________|____|
+ //
+ const size_type n_after = n - s_before;
+ const size_type elemsafter = old_size - elemsbefore;
+
+ //We can have two situations:
+ if (elemsafter >= n_after){
+ //The raw_mem from end will divide displaced old_end
+ //
+ //Old situation:
+ // ______________________________________________________
+ //| raw_mem | old_begin | old_end | raw_mem |
+ //|______________|___________|____________|______________|
+ //
+ //New situation with do_after(1):
+ // _______________________________________________________
+ //| old_begin + new_beg | new_end |old_end | raw_mem |
+ //|__________________________|_________|________|_________|
+ //
+ //First copy the part of old_end raw_mem
+ T* finish_n = old_finish - n_after;
+ ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), finish_n, old_finish, old_finish);
+ this->m_holder.m_size += n_after;
+ //Displace the rest of old_end to the new position
+ boost::move_backward(pos, finish_n, old_finish);
+ //Now overwrite with new_end
+ //The new_end part is [first + (n - n_after), last)
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, n_after);
+ }
+ else {
+ //The raw_mem from end will divide new_end part
+ //
+ //Old situation:
+ // _____________________________________________________________
+ //| raw_mem | old_begin | old_end | raw_mem |
+ //|______________|___________|____________|_____________________|
+ //
+ //New situation with do_after(2):
+ // _____________________________________________________________
+ //| old_begin + new_beg | new_end |old_end | raw_mem |
+ //|__________________________|_______________|________|_________|
+ //
+
+ const size_type mid_last_dist = n_after - elemsafter;
+ //First initialize data in raw memory
+
+ //Copy to the old_end part to the uninitialized zone leaving a gap.
+ ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), pos, old_finish, old_finish + mid_last_dist);
+
+ BOOST_TRY{
+ //Copy the first part to the already constructed old_end zone
+ insert_range_proxy.copy_n_and_update(this->m_holder.alloc(), pos, elemsafter);
+ //Copy the rest to the uninitialized zone filling the gap
+ insert_range_proxy.uninitialized_copy_n_and_update(this->m_holder.alloc(), old_finish, mid_last_dist);
+ this->m_holder.m_size += n_after;
+ }
+ BOOST_CATCH(...){
+ boost::container::destroy_alloc_n(this->get_stored_allocator(), pos, mid_last_dist);
+ BOOST_RETHROW
+ }
+ BOOST_CATCH_END
+/*
+ size_type mid_last_dist = n_after - elemsafter;
+ //First initialize data in raw memory
+
+ //The new_end part is [first + (n - n_after), last)
+ insert_range_proxy.uninitialized_copy_last_and_update(old_finish, elemsafter);
+ this->m_holder.m_size += mid_last_dist;
+ ::boost::container::uninitialized_move_alloc
+ (this->m_holder.alloc(), pos, old_finish, old_finish + mid_last_dist);
+ this->m_holder.m_size += n_after - mid_last_dist;
+ //Now copy the part of new_end over constructed elements
+ insert_range_proxy.copy_remaining_to(pos);*/
+ }
+ }
+ }
+ }
+
+ void priv_check_range(size_type n) const
+ {
+ //If n is out of range, throw an out_of_range exception
+ if (n >= this->size()){
+ throw_out_of_range("vector::at out of range");
+ }
+ }
+
+ #ifdef BOOST_CONTAINER_VECTOR_ALLOC_STATS
+ public:
+ unsigned int num_expand_fwd;
+ unsigned int num_expand_bwd;
+ unsigned int num_shrink;
+ unsigned int num_alloc;
+ void reset_alloc_stats()
+ { num_expand_fwd = num_expand_bwd = num_alloc = 0, num_shrink = 0; }
+ #endif
+ #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+};
+
+}}
+
+#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+namespace boost {
+
+
+//!has_trivial_destructor_after_move<> == true_type
+//!specialization for optimizations
+template <class T, class Allocator>
+struct has_trivial_destructor_after_move<boost::container::vector<T, Allocator> >
+ : public ::boost::has_trivial_destructor_after_move<Allocator>
+{};
+
+
+}
+
+//#define BOOST_CONTAINER_PUT_SWAP_OVERLOAD_IN_NAMESPACE_STD
+
+#ifdef BOOST_CONTAINER_PUT_SWAP_OVERLOAD_IN_NAMESPACE_STD
+
+namespace std {
+
+template <class T, class Allocator>
+inline void swap(boost::container::vector<T, Allocator>& x, boost::container::vector<T, Allocator>& y)
+{ x.swap(y); }
+
+} //namespace std {
+
+#endif
+
+#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED
+
+#include <boost/container/detail/config_end.hpp>
+
+#endif // #ifndef BOOST_CONTAINER_CONTAINER_VECTOR_HPP