diff options
author | Tobias Markmann <tm@ayena.de> | 2014-10-19 20:22:58 (GMT) |
---|---|---|
committer | Tobias Markmann <tm@ayena.de> | 2014-10-20 13:49:33 (GMT) |
commit | 6b22dfcf59474dd016a0355a3102a1dd3692d92c (patch) | |
tree | 2b1fd33be433a91e81fee84fdc2bf1b52575d934 /3rdParty/Boost/src/boost/container/detail | |
parent | 38b0cb785fea8eae5e48fae56440695fdfd10ee1 (diff) | |
download | swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.zip swift-6b22dfcf59474dd016a0355a3102a1dd3692d92c.tar.bz2 |
Update Boost in 3rdParty to version 1.56.0.
This updates Boost in our 3rdParty directory to version 1.56.0.
Updated our update.sh script to stop on error.
Changed error reporting in SwiftTools/CrashReporter.cpp to SWIFT_LOG due to
missing include of <iostream> with newer Boost.
Change-Id: I4b35c77de951333979a524097f35f5f83d325edc
Diffstat (limited to '3rdParty/Boost/src/boost/container/detail')
20 files changed, 3826 insertions, 121 deletions
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 |