diff options
author | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-08-12 16:24:18 +0300 |
---|---|---|
committer | bugaevskiy <bugaevskiy@yandex-team.com> | 2022-08-12 16:24:18 +0300 |
commit | 2e691a0c66273f10e03c37063a36caac49003d05 (patch) | |
tree | ae5500ba55a7e31590ebd43bd181e708cc0f5587 | |
parent | 04e2f0cc097bf5f211d7e2297d9ea8d2a410d4a2 (diff) | |
download | ydb-2e691a0c66273f10e03c37063a36caac49003d05.tar.gz |
Reimport boost/container as a separate project
115 files changed, 52 insertions, 19507 deletions
diff --git a/CMakeLists.darwin.txt b/CMakeLists.darwin.txt index ce7866efa4..9698c4039d 100644 --- a/CMakeLists.darwin.txt +++ b/CMakeLists.darwin.txt @@ -292,6 +292,8 @@ add_subdirectory(contrib/restricted/boost/move) add_subdirectory(contrib/restricted/boost/array) add_subdirectory(contrib/restricted/boost/bind) add_subdirectory(contrib/restricted/boost/concept_check) +add_subdirectory(contrib/restricted/boost/container) +add_subdirectory(contrib/restricted/boost/intrusive) add_subdirectory(contrib/restricted/boost/conversion) add_subdirectory(contrib/restricted/boost/typeof) add_subdirectory(contrib/restricted/boost/endian) @@ -308,7 +310,6 @@ add_subdirectory(contrib/restricted/boost/iterator) add_subdirectory(contrib/restricted/boost/fusion) add_subdirectory(contrib/restricted/boost/interval) add_subdirectory(contrib/restricted/boost/logic) -add_subdirectory(contrib/restricted/boost/intrusive) add_subdirectory(contrib/restricted/boost/io) add_subdirectory(contrib/restricted/boost/lambda) add_subdirectory(contrib/restricted/boost/mp11) diff --git a/CMakeLists.linux.txt b/CMakeLists.linux.txt index 5d3560f6e1..204fca2593 100644 --- a/CMakeLists.linux.txt +++ b/CMakeLists.linux.txt @@ -295,6 +295,8 @@ add_subdirectory(contrib/restricted/boost/move) add_subdirectory(contrib/restricted/boost/array) add_subdirectory(contrib/restricted/boost/bind) add_subdirectory(contrib/restricted/boost/concept_check) +add_subdirectory(contrib/restricted/boost/container) +add_subdirectory(contrib/restricted/boost/intrusive) add_subdirectory(contrib/restricted/boost/conversion) add_subdirectory(contrib/restricted/boost/typeof) add_subdirectory(contrib/restricted/boost/endian) @@ -311,7 +313,6 @@ add_subdirectory(contrib/restricted/boost/iterator) add_subdirectory(contrib/restricted/boost/fusion) add_subdirectory(contrib/restricted/boost/interval) add_subdirectory(contrib/restricted/boost/logic) -add_subdirectory(contrib/restricted/boost/intrusive) add_subdirectory(contrib/restricted/boost/io) add_subdirectory(contrib/restricted/boost/lambda) add_subdirectory(contrib/restricted/boost/mp11) diff --git a/contrib/restricted/boost/CMakeLists.txt b/contrib/restricted/boost/CMakeLists.txt index 6551bb6308..baa24d3430 100644 --- a/contrib/restricted/boost/CMakeLists.txt +++ b/contrib/restricted/boost/CMakeLists.txt @@ -20,6 +20,7 @@ target_link_libraries(contrib-restricted-boost INTERFACE restricted-boost-bind restricted-boost-concept_check restricted-boost-config + restricted-boost-container restricted-boost-container_hash restricted-boost-conversion restricted-boost-core diff --git a/contrib/restricted/boost/boost/container/adaptive_pool.hpp b/contrib/restricted/boost/boost/container/adaptive_pool.hpp deleted file mode 100644 index 900806a649..0000000000 --- a/contrib/restricted/boost/boost/container/adaptive_pool.hpp +++ /dev/null @@ -1,349 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_ADAPTIVE_POOL_HPP -#define BOOST_CONTAINER_ADAPTIVE_POOL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/detail/version_type.hpp> -#include <boost/container/throw_exception.hpp> -#include <boost/container/detail/adaptive_node_pool.hpp> -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/dlmalloc.hpp> -#include <boost/container/detail/singleton.hpp> -#include <boost/container/detail/placement_new.hpp> - -#include <boost/assert.hpp> -#include <boost/static_assert.hpp> -#include <boost/move/utility_core.hpp> -#include <cstddef> - - -namespace boost { -namespace container { - -//!An STL node allocator that uses a modified DLMalloc as memory -//!source. -//! -//!This node allocator shares a segregated storage between all instances -//!of adaptive_pool with equal sizeof(T). -//! -//!NodesPerBlock is the number of nodes allocated at once when the allocator -//!needs runs out of nodes. MaxFreeBlocks is the maximum number of totally free blocks -//!that the adaptive node pool will hold. The rest of the totally free blocks will be -//!deallocated to the memory manager. -//! -//!OverheadPercent is the (approximated) maximum size overhead (1-20%) of the allocator: -//!(memory usable for nodes / total memory allocated from the memory allocator) -template < class T - , std::size_t NodesPerBlock BOOST_CONTAINER_DOCONLY(= ADP_nodes_per_block) - , std::size_t MaxFreeBlocks BOOST_CONTAINER_DOCONLY(= ADP_max_free_blocks) - , std::size_t OverheadPercent BOOST_CONTAINER_DOCONLY(= ADP_overhead_percent) - BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I unsigned Version) - > -class adaptive_pool -{ - //!If Version is 1, the allocator is a STL conforming allocator. If Version is 2, - //!the allocator offers advanced expand in place and burst allocation capabilities. - public: - typedef unsigned int allocation_type; - typedef adaptive_pool - <T, NodesPerBlock, MaxFreeBlocks, OverheadPercent - BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I Version) - > self_t; - - static const std::size_t nodes_per_block = NodesPerBlock; - static const std::size_t max_free_blocks = MaxFreeBlocks; - static const std::size_t overhead_percent = OverheadPercent; - static const std::size_t real_nodes_per_block = NodesPerBlock; - - BOOST_CONTAINER_DOCIGN(BOOST_STATIC_ASSERT((Version <=2))); - - public: - //------- - typedef T value_type; - typedef T * pointer; - typedef const T * const_pointer; - typedef typename ::boost::container:: - dtl::unvoid_ref<T>::type reference; - typedef typename ::boost::container:: - dtl::unvoid_ref<const T>::type const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - typedef boost::container::dtl:: - version_type<self_t, Version> version; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef boost::container::dtl:: - basic_multiallocation_chain<void*> multiallocation_chain_void; - typedef boost::container::dtl:: - transform_multiallocation_chain - <multiallocation_chain_void, T> multiallocation_chain; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - //!Obtains adaptive_pool from - //!adaptive_pool - template<class T2> - struct rebind - { - typedef adaptive_pool - < T2 - , NodesPerBlock - , MaxFreeBlocks - , OverheadPercent - BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I Version) - > other; - }; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - //!Not assignable from related adaptive_pool - template<class T2, unsigned Version2, std::size_t N2, std::size_t F2> - adaptive_pool& operator= - (const adaptive_pool<T2, Version2, N2, F2>&); - - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - //!Default constructor - adaptive_pool() BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Copy constructor from other adaptive_pool. - adaptive_pool(const adaptive_pool &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Copy constructor from related adaptive_pool. - template<class T2> - adaptive_pool - (const adaptive_pool<T2, NodesPerBlock, MaxFreeBlocks, OverheadPercent - BOOST_CONTAINER_DOCIGN(BOOST_MOVE_I Version)> &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Destructor - ~adaptive_pool() BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Returns the number of elements that could be allocated. - //!Never throws - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return size_type(-1)/sizeof(T); } - - //!Allocate memory for an array of count elements. - //!Throws std::bad_alloc if there is no enough memory - pointer allocate(size_type count, const void * = 0) - { - if(BOOST_UNLIKELY(count > this->max_size())) - boost::container::throw_bad_alloc(); - - if(Version == 1 && count == 1){ - typedef typename dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - return pointer(static_cast<T*>(singleton_t::instance().allocate_node())); - } - else{ - return static_cast<pointer>(dlmalloc_malloc(count*sizeof(T))); - } - } - - //!Deallocate allocated memory. - //!Never throws - void deallocate(const pointer &ptr, size_type count) BOOST_NOEXCEPT_OR_NOTHROW - { - (void)count; - if(Version == 1 && count == 1){ - typedef dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().deallocate_node(ptr); - } - else{ - dlmalloc_free(ptr); - } - } - - pointer allocation_command(allocation_type command, - size_type limit_size, - size_type &prefer_in_recvd_out_size, - pointer &reuse) - { - pointer ret = this->priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); - if(BOOST_UNLIKELY(!ret && !(command & BOOST_CONTAINER_NOTHROW_ALLOCATION))) - boost::container::throw_bad_alloc(); - return ret; - } - - //!Returns maximum the number of objects the previously allocated memory - //!pointed by p can hold. - size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW - { return dlmalloc_size(p); } - - //!Allocates just one object. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - //!Throws bad_alloc if there is no enough memory - pointer allocate_one() - { - typedef dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - return (pointer)singleton_t::instance().allocate_node(); - } - - //!Allocates many elements of size == 1. - //!Elements must be individually deallocated with deallocate_one() - void allocate_individual(std::size_t num_elements, multiallocation_chain &chain) - { - typedef dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().allocate_nodes(num_elements, static_cast<typename shared_pool_t::multiallocation_chain&>(chain)); - //typename shared_pool_t::multiallocation_chain ch; - //singleton_t::instance().allocate_nodes(num_elements, ch); - //chain.incorporate_after - //(chain.before_begin(), (T*)&*ch.begin(), (T*)&*ch.last(), ch.size()); - } - - //!Deallocates memory previously allocated with allocate_one(). - //!You should never use deallocate_one to deallocate memory allocated - //!with other functions different from allocate_one(). Never throws - void deallocate_one(pointer p) BOOST_NOEXCEPT_OR_NOTHROW - { - typedef dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().deallocate_node(p); - } - - void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW - { - typedef dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - //typename shared_pool_t::multiallocation_chain ch(&*chain.begin(), &*chain.last(), chain.size()); - //singleton_t::instance().deallocate_nodes(ch); - singleton_t::instance().deallocate_nodes(chain); - } - - //!Allocates many elements of size elem_size. - //!Elements must be individually deallocated with deallocate() - void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 ));/* - dlmalloc_memchain ch; - BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ - boost::container::throw_bad_alloc(); - } - chain.incorporate_after(chain.before_begin() - ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) - ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/ - if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes - (n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain)))){ - boost::container::throw_bad_alloc(); - } - } - - //!Allocates n_elements elements, each one of size elem_sizes[i] - //!Elements must be individually deallocated with deallocate() - void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 ));/* - dlmalloc_memchain ch; - BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ - boost::container::throw_bad_alloc(); - } - chain.incorporate_after(chain.before_begin() - ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) - ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/ - if(BOOST_UNLIKELY(!dlmalloc_multialloc_arrays - (n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain)))){ - boost::container::throw_bad_alloc(); - } - } - - void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW - {/* - dlmalloc_memchain ch; - void *beg(&*chain.begin()), *last(&*chain.last()); - size_t size(chain.size()); - BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size); - dlmalloc_multidealloc(&ch);*/ - dlmalloc_multidealloc(reinterpret_cast<dlmalloc_memchain *>(&chain)); - } - - //!Deallocates all free blocks of the pool - static void deallocate_free_blocks() BOOST_NOEXCEPT_OR_NOTHROW - { - typedef dtl::shared_adaptive_node_pool - <sizeof(T), NodesPerBlock, MaxFreeBlocks, OverheadPercent> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().deallocate_free_blocks(); - } - - //!Swaps allocators. Does not throw. If each allocator is placed in a - //!different memory segment, the result is undefined. - friend void swap(adaptive_pool &, adaptive_pool &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!An allocator always compares to true, as memory allocated with one - //!instance can be deallocated by another instance - friend bool operator==(const adaptive_pool &, const adaptive_pool &) BOOST_NOEXCEPT_OR_NOTHROW - { return true; } - - //!An allocator always compares to false, as memory allocated with one - //!instance can be deallocated by another instance - friend bool operator!=(const adaptive_pool &, const adaptive_pool &) BOOST_NOEXCEPT_OR_NOTHROW - { return false; } - - private: - pointer priv_allocation_command - (allocation_type command, std::size_t limit_size - ,size_type &prefer_in_recvd_out_size, pointer &reuse_ptr) - { - std::size_t const preferred_size = prefer_in_recvd_out_size; - dlmalloc_command_ret_t ret = {0 , 0}; - if(BOOST_UNLIKELY(limit_size > this->max_size() || preferred_size > this->max_size())){ - return pointer(); - } - std::size_t l_size = limit_size*sizeof(T); - std::size_t p_size = preferred_size*sizeof(T); - std::size_t r_size; - { - void* reuse_ptr_void = reuse_ptr; - ret = dlmalloc_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); - reuse_ptr = ret.second ? static_cast<T*>(reuse_ptr_void) : 0; - } - prefer_in_recvd_out_size = r_size/sizeof(T); - return (pointer)ret.first; - } -}; - -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_ADAPTIVE_POOL_HPP diff --git a/contrib/restricted/boost/boost/container/allocator.hpp b/contrib/restricted/boost/boost/container/allocator.hpp deleted file mode 100644 index c0deb0a108..0000000000 --- a/contrib/restricted/boost/boost/container/allocator.hpp +++ /dev/null @@ -1,368 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2007-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_ALLOCATOR_HPP -#define BOOST_CONTAINER_ALLOCATOR_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/detail/version_type.hpp> -#include <boost/container/throw_exception.hpp> -#include <boost/container/detail/dlmalloc.hpp> -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/static_assert.hpp> -#include <cstddef> -#include <cassert> - -//!\file - -namespace boost { -namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -template<unsigned Version, unsigned int AllocationDisableMask> -class allocator<void, Version, AllocationDisableMask> -{ - typedef allocator<void, Version, AllocationDisableMask> self_t; - public: - typedef void value_type; - typedef void * pointer; - typedef const void* const_pointer; - typedef int & reference; - typedef const int & const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef boost::container::dtl:: - version_type<self_t, Version> version; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef boost::container::dtl:: - basic_multiallocation_chain<void*> multiallocation_chain; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - //!Obtains an allocator that allocates - //!objects of type T2 - template<class T2> - struct rebind - { - typedef allocator< T2 - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - , Version, AllocationDisableMask - #endif - > other; - }; - - //!Default constructor - //!Never throws - allocator() - {} - - //!Constructor from other allocator. - //!Never throws - allocator(const allocator &) - {} - - //!Constructor from related allocator. - //!Never throws - template<class T2> - allocator(const allocator<T2, Version, AllocationDisableMask> &) - {} -}; - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! This class is an extended STL-compatible that offers advanced allocation mechanism -//!(in-place expansion, shrinking, burst-allocation...) -//! -//! This allocator is a wrapper around a modified DLmalloc. -//! If Version is 1, the allocator is a STL conforming allocator. If Version is 2, -//! the allocator offers advanced expand in place and burst allocation capabilities. -//! -//! AllocationDisableMask works only if Version is 2 and it can be an inclusive OR -//! of allocation types the user wants to disable. -template< class T - , unsigned Version BOOST_CONTAINER_DOCONLY(=2) - , unsigned int AllocationDisableMask BOOST_CONTAINER_DOCONLY(=0)> -class allocator -{ - typedef unsigned int allocation_type; - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - - //Self type - typedef allocator<T, Version, AllocationDisableMask> self_t; - - //Not assignable from related allocator - template<class T2, unsigned int Version2, unsigned int AllocationDisableMask2> - allocator& operator=(const allocator<T2, Version2, AllocationDisableMask2>&); - - static const unsigned int ForbiddenMask = - BOOST_CONTAINER_ALLOCATE_NEW | BOOST_CONTAINER_EXPAND_BWD | BOOST_CONTAINER_EXPAND_FWD ; - - //The mask can't disable all the allocation types - BOOST_STATIC_ASSERT(( (AllocationDisableMask & ForbiddenMask) != ForbiddenMask )); - - //The mask is only valid for version 2 allocators - BOOST_STATIC_ASSERT(( Version != 1 || (AllocationDisableMask == 0) )); - - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - typedef T value_type; - typedef T * pointer; - typedef const T * const_pointer; - typedef T & reference; - typedef const T & const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - typedef boost::container::dtl:: - version_type<self_t, Version> version; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef boost::container::dtl:: - basic_multiallocation_chain<void*> void_multiallocation_chain; - - typedef boost::container::dtl:: - transform_multiallocation_chain - <void_multiallocation_chain, T> multiallocation_chain; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - //!Obtains an allocator that allocates - //!objects of type T2 - template<class T2> - struct rebind - { - typedef allocator<T2, Version, AllocationDisableMask> other; - }; - - //!Default constructor - //!Never throws - allocator() BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Constructor from other allocator. - //!Never throws - allocator(const allocator &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Constructor from related allocator. - //!Never throws - template<class T2> - allocator(const allocator<T2 - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - , Version, AllocationDisableMask - #endif - > &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Allocates memory for an array of count elements. - //!Throws std::bad_alloc if there is no enough memory - //!If Version is 2, this allocated memory can only be deallocated - //!with deallocate() or (for Version == 2) deallocate_many() - pointer allocate(size_type count, const void * hint= 0) - { - (void)hint; - if(count > this->max_size()) - boost::container::throw_bad_alloc(); - void *ret = dlmalloc_malloc(count*sizeof(T)); - if(!ret) - boost::container::throw_bad_alloc(); - return static_cast<pointer>(ret); - } - - //!Deallocates previously allocated memory. - //!Never throws - void deallocate(pointer ptr, size_type) BOOST_NOEXCEPT_OR_NOTHROW - { dlmalloc_free(ptr); } - - //!Returns the maximum number of elements that could be allocated. - //!Never throws - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return size_type(-1)/sizeof(T); } - - //!Swaps two allocators, does nothing - //!because this allocator is stateless - friend void swap(self_t &, self_t &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!An allocator always compares to true, as memory allocated with one - //!instance can be deallocated by another instance - friend bool operator==(const allocator &, const allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return true; } - - //!An allocator always compares to false, as memory allocated with one - //!instance can be deallocated by another instance - friend bool operator!=(const allocator &, const allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return false; } - - //!An advanced function that offers in-place expansion shrink to fit and new allocation - //!capabilities. Memory allocated with this function can only be deallocated with deallocate() - //!or deallocate_many(). - //!This function is available only with Version == 2 - pointer allocation_command(allocation_type command, - size_type limit_size, - size_type &prefer_in_recvd_out_size, - pointer &reuse) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - const allocation_type mask(AllocationDisableMask); - command &= ~mask; - pointer ret = this->priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); - if(!ret && !(command & BOOST_CONTAINER_NOTHROW_ALLOCATION)) - boost::container::throw_bad_alloc(); - return ret; - } - - //!Returns maximum the number of objects the previously allocated memory - //!pointed by p can hold. - //!Memory must not have been allocated with - //!allocate_one or allocate_individual. - //!This function is available only with Version == 2 - size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - return dlmalloc_size(p); - } - - //!Allocates just one object. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - //!Throws bad_alloc if there is no enough memory - //!This function is available only with Version == 2 - pointer allocate_one() - { - BOOST_STATIC_ASSERT(( Version > 1 )); - return this->allocate(1); - } - - //!Allocates many elements of size == 1. - //!Elements must be individually deallocated with deallocate_one() - //!This function is available only with Version == 2 - void allocate_individual(std::size_t num_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - this->allocate_many(1, num_elements, chain); - } - - //!Deallocates memory previously allocated with allocate_one(). - //!You should never use deallocate_one to deallocate memory allocated - //!with other functions different from allocate_one() or allocate_individual. - //Never throws - void deallocate_one(pointer p) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - return this->deallocate(p, 1); - } - - //!Deallocates memory allocated with allocate_one() or allocate_individual(). - //!This function is available only with Version == 2 - void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - return this->deallocate_many(chain); - } - - //!Allocates many elements of size elem_size. - //!Elements must be individually deallocated with deallocate() - //!This function is available only with Version == 2 - void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 ));/* - dlmalloc_memchain ch; - BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){ - boost::container::throw_bad_alloc(); - } - chain.incorporate_after(chain.before_begin() - ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) - ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) );*/ - if(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain))){ - boost::container::throw_bad_alloc(); - } - } - - //!Allocates n_elements elements, each one of size elem_sizes[i] - //!Elements must be individually deallocated with deallocate() - //!This function is available only with Version == 2 - void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - dlmalloc_memchain ch; - BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch)){ - boost::container::throw_bad_alloc(); - } - chain.incorporate_after(chain.before_begin() - ,(T*)BOOST_CONTAINER_MEMCHAIN_FIRSTMEM(&ch) - ,(T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - ,BOOST_CONTAINER_MEMCHAIN_SIZE(&ch) ); - /* - if(!dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, reinterpret_cast<dlmalloc_memchain *>(&chain))){ - boost::container::throw_bad_alloc(); - }*/ - } - - //!Deallocates several elements allocated by - //!allocate_many(), allocate(), or allocation_command(). - //!This function is available only with Version == 2 - void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - dlmalloc_memchain ch; - void *beg(&*chain.begin()), *last(&*chain.last()); - size_t size(chain.size()); - BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, beg, last, size); - dlmalloc_multidealloc(&ch); - //dlmalloc_multidealloc(reinterpret_cast<dlmalloc_memchain *>(&chain)); - } - - private: - - pointer priv_allocation_command - (allocation_type command, std::size_t limit_size - ,size_type &prefer_in_recvd_out_size - ,pointer &reuse_ptr) - { - std::size_t const preferred_size = prefer_in_recvd_out_size; - dlmalloc_command_ret_t ret = {0 , 0}; - if((limit_size > this->max_size()) | (preferred_size > this->max_size())){ - return pointer(); - } - std::size_t l_size = limit_size*sizeof(T); - std::size_t p_size = preferred_size*sizeof(T); - std::size_t r_size; - { - void* reuse_ptr_void = reuse_ptr; - ret = dlmalloc_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); - reuse_ptr = ret.second ? static_cast<T*>(reuse_ptr_void) : 0; - } - prefer_in_recvd_out_size = r_size/sizeof(T); - return (pointer)ret.first; - } -}; - -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //BOOST_CONTAINER_ALLOCATOR_HPP - diff --git a/contrib/restricted/boost/boost/container/deque.hpp b/contrib/restricted/boost/boost/container/deque.hpp deleted file mode 100644 index b8483ed775..0000000000 --- a/contrib/restricted/boost/boost/container/deque.hpp +++ /dev/null @@ -1,2275 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DEQUE_HPP -#define BOOST_CONTAINER_DEQUE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -// container -#include <boost/container/allocator_traits.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/new_allocator.hpp> //new_allocator -#include <boost/container/throw_exception.hpp> -// container/detail -#include <boost/container/detail/advanced_insert_int.hpp> -#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare -#include <boost/container/detail/alloc_helpers.hpp> -#include <boost/container/detail/copy_move_algo.hpp> -#include <boost/container/detail/iterator.hpp> -#include <boost/move/detail/iterator_to_raw_pointer.hpp> -#include <boost/container/detail/iterators.hpp> -#include <boost/container/detail/min_max.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/move/detail/to_raw_pointer.hpp> -#include <boost/container/detail/type_traits.hpp> -// move -#include <boost/move/adl_move_swap.hpp> -#include <boost/move/iterator.hpp> -#include <boost/move/traits.hpp> -#include <boost/move/utility_core.hpp> -// move/detail -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -#include <boost/move/detail/fwd_macros.hpp> -#endif -#include <boost/move/detail/move_helpers.hpp> -// other -#include <boost/assert.hpp> -#include <boost/core/no_exceptions_support.hpp> -// std -#include <cstddef> - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -namespace boost { -namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class T, class Allocator> -class deque; - -template <class T> -struct deque_value_traits -{ - typedef T value_type; - static const bool trivial_dctr = dtl::is_trivially_destructible<value_type>::value; - static const bool trivial_dctr_after_move = ::boost::has_trivial_destructor_after_move<value_type>::value; -}; - -// Note: this function is simply a kludge to work around several compilers' -// bugs in handling constant expressions. -template<class T> -struct deque_buf_size -{ - static const std::size_t min_size = 512u; - static const std::size_t sizeof_t = sizeof(T); - static const std::size_t value = sizeof_t < min_size ? (min_size/sizeof_t) : std::size_t(1); -}; - -namespace dtl { - -// Class invariants: -// For any nonsingular iterator i: -// i.node is the address of an element in the map array. The -// contents of i.node is a pointer to the beginning of a node. -// i.first == //(i.node) -// i.last == i.first + node_size -// i.cur is a pointer in the range [i.first, i.last). NOTE: -// the implication of this is that i.cur is always a dereferenceable -// pointer, even if i is a past-the-end iterator. -// Start and Finish are always nonsingular iterators. NOTE: this means -// that an empty deque must have one node, and that a deque -// with N elements, where N is the buffer size, must have two nodes. -// For every node other than start.node and finish.node, every element -// in the node is an initialized object. If start.node == finish.node, -// then [start.cur, finish.cur) are initialized objects, and -// the elements outside that range are uninitialized storage. Otherwise, -// [start.cur, start.last) and [finish.first, finish.cur) are initialized -// objects, and [start.first, start.cur) and [finish.cur, finish.last) -// are uninitialized storage. -// [map, map + map_size) is a valid, non-empty range. -// [start.node, finish.node] is a valid range contained within -// [map, map + map_size). -// A pointer in the range [map, map + map_size) points to an allocated node -// if and only if the pointer is in the range [start.node, finish.node]. -template<class Pointer, bool IsConst> -class deque_iterator -{ - public: - typedef std::random_access_iterator_tag iterator_category; - typedef typename boost::intrusive::pointer_traits<Pointer>::element_type value_type; - typedef typename boost::intrusive::pointer_traits<Pointer>::difference_type difference_type; - typedef typename if_c - < IsConst - , typename boost::intrusive::pointer_traits<Pointer>::template - rebind_pointer<const value_type>::type - , Pointer - >::type pointer; - typedef typename if_c - < IsConst - , const value_type& - , value_type& - >::type reference; - - class nat; - typedef typename dtl::if_c< IsConst - , deque_iterator<Pointer, false> - , nat>::type nonconst_iterator; - - BOOST_CONTAINER_FORCEINLINE static std::size_t s_buffer_size() - { return deque_buf_size<value_type>::value; } - - typedef Pointer val_alloc_ptr; - typedef typename boost::intrusive::pointer_traits<Pointer>:: - template rebind_pointer<Pointer>::type index_pointer; - - Pointer m_cur; - Pointer m_first; - Pointer m_last; - index_pointer m_node; - - public: - - Pointer get_cur() const { return m_cur; } - Pointer get_first() const { return m_first; } - Pointer get_last() const { return m_last; } - index_pointer get_node() const { return m_node; } - - deque_iterator(val_alloc_ptr x, index_pointer y) BOOST_NOEXCEPT_OR_NOTHROW - : m_cur(x), m_first(*y), m_last(*y + s_buffer_size()), m_node(y) - {} - - deque_iterator() BOOST_NOEXCEPT_OR_NOTHROW - : m_cur(), m_first(), m_last(), m_node() //Value initialization to achieve "null iterators" (N3644) - {} - - BOOST_CONTAINER_FORCEINLINE deque_iterator(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW - : m_cur(x.get_cur()), m_first(x.get_first()), m_last(x.get_last()), m_node(x.get_node()) - {} - - BOOST_CONTAINER_FORCEINLINE deque_iterator(const nonconst_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW - : m_cur(x.get_cur()), m_first(x.get_first()), m_last(x.get_last()), m_node(x.get_node()) - {} - - deque_iterator(Pointer cur, Pointer first, Pointer last, index_pointer node) BOOST_NOEXCEPT_OR_NOTHROW - : m_cur(cur), m_first(first), m_last(last), m_node(node) - {} - - BOOST_CONTAINER_FORCEINLINE deque_iterator& operator=(const deque_iterator& x) BOOST_NOEXCEPT_OR_NOTHROW - { m_cur = x.get_cur(); m_first = x.get_first(); m_last = x.get_last(); m_node = x.get_node(); return *this; } - - BOOST_CONTAINER_FORCEINLINE deque_iterator<Pointer, false> unconst() const BOOST_NOEXCEPT_OR_NOTHROW - { - return deque_iterator<Pointer, false>(this->get_cur(), this->get_first(), this->get_last(), this->get_node()); - } - - reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW - { return *this->m_cur; } - - pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->m_cur; } - - difference_type operator-(const deque_iterator& x) const BOOST_NOEXCEPT_OR_NOTHROW - { - if(!this->m_cur && !x.m_cur){ - return 0; - } - return difference_type(this->s_buffer_size()) * (this->m_node - x.m_node - 1) + - (this->m_cur - this->m_first) + (x.m_last - x.m_cur); - } - - deque_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW - { - ++this->m_cur; - if (this->m_cur == this->m_last) { - this->priv_set_node(this->m_node + 1); - this->m_cur = this->m_first; - } - return *this; - } - - deque_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW - { - deque_iterator tmp(*this); - ++*this; - return tmp; - } - - deque_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW - { - if (this->m_cur == this->m_first) { - this->priv_set_node(this->m_node - 1); - this->m_cur = this->m_last; - } - --this->m_cur; - return *this; - } - - deque_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW - { - deque_iterator tmp(*this); - --*this; - return tmp; - } - - deque_iterator& operator+=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - difference_type offset = n + (this->m_cur - this->m_first); - if (offset >= 0 && offset < difference_type(this->s_buffer_size())) - this->m_cur += n; - else { - difference_type node_offset = - offset > 0 ? offset / difference_type(this->s_buffer_size()) - : -difference_type((-offset - 1) / this->s_buffer_size()) - 1; - this->priv_set_node(this->m_node + node_offset); - this->m_cur = this->m_first + - (offset - node_offset * difference_type(this->s_buffer_size())); - } - return *this; - } - - deque_iterator operator+(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { deque_iterator tmp(*this); return tmp += n; } - - deque_iterator& operator-=(difference_type n) BOOST_NOEXCEPT_OR_NOTHROW - { return *this += -n; } - - deque_iterator operator-(difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { deque_iterator tmp(*this); return tmp -= n; } - - reference operator[](difference_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { return *(*this + n); } - - friend bool operator==(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_cur == r.m_cur; } - - friend bool operator!=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_cur != r.m_cur; } - - friend bool operator<(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return (l.m_node == r.m_node) ? (l.m_cur < r.m_cur) : (l.m_node < r.m_node); } - - friend bool operator>(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return r < l; } - - friend bool operator<=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return !(r < l); } - - friend bool operator>=(const deque_iterator& l, const deque_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return !(l < r); } - - void priv_set_node(index_pointer new_node) BOOST_NOEXCEPT_OR_NOTHROW - { - this->m_node = new_node; - this->m_first = *new_node; - this->m_last = this->m_first + this->s_buffer_size(); - } - - friend deque_iterator operator+(difference_type n, deque_iterator x) BOOST_NOEXCEPT_OR_NOTHROW - { return x += n; } -}; - -} //namespace dtl { - -// Deque base class. It has two purposes. First, its constructor -// and destructor allocate (but don't initialize) storage. This makes -// exception safety easier. -template <class Allocator> -class deque_base -{ - BOOST_COPYABLE_AND_MOVABLE(deque_base) - public: - typedef allocator_traits<Allocator> val_alloc_traits_type; - typedef typename val_alloc_traits_type::value_type val_alloc_val; - typedef typename val_alloc_traits_type::pointer val_alloc_ptr; - typedef typename val_alloc_traits_type::const_pointer val_alloc_cptr; - typedef typename val_alloc_traits_type::reference val_alloc_ref; - typedef typename val_alloc_traits_type::const_reference val_alloc_cref; - typedef typename val_alloc_traits_type::difference_type val_alloc_diff; - typedef typename val_alloc_traits_type::size_type val_alloc_size; - typedef typename val_alloc_traits_type::template - portable_rebind_alloc<val_alloc_ptr>::type ptr_alloc_t; - typedef allocator_traits<ptr_alloc_t> ptr_alloc_traits_type; - typedef typename ptr_alloc_traits_type::value_type ptr_alloc_val; - typedef typename ptr_alloc_traits_type::pointer ptr_alloc_ptr; - typedef typename ptr_alloc_traits_type::const_pointer ptr_alloc_cptr; - typedef typename ptr_alloc_traits_type::reference ptr_alloc_ref; - typedef typename ptr_alloc_traits_type::const_reference ptr_alloc_cref; - typedef Allocator allocator_type; - typedef allocator_type stored_allocator_type; - typedef val_alloc_size size_type; - - protected: - - typedef deque_value_traits<val_alloc_val> traits_t; - typedef ptr_alloc_t map_allocator_type; - - static size_type s_buffer_size() BOOST_NOEXCEPT_OR_NOTHROW - { return deque_buf_size<val_alloc_val>::value; } - - val_alloc_ptr priv_allocate_node() - { return this->alloc().allocate(s_buffer_size()); } - - void priv_deallocate_node(val_alloc_ptr p) BOOST_NOEXCEPT_OR_NOTHROW - { this->alloc().deallocate(p, s_buffer_size()); } - - ptr_alloc_ptr priv_allocate_map(size_type n) - { return this->ptr_alloc().allocate(n); } - - void priv_deallocate_map(ptr_alloc_ptr p, size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { this->ptr_alloc().deallocate(p, n); } - - typedef dtl::deque_iterator<val_alloc_ptr, false> iterator; - typedef dtl::deque_iterator<val_alloc_ptr, true > const_iterator; - - deque_base(size_type num_elements, const allocator_type& a) - : members_(a) - { this->priv_initialize_map(num_elements); } - - explicit deque_base(const allocator_type& a) - : members_(a) - {} - - deque_base() - : members_() - {} - - explicit deque_base(BOOST_RV_REF(deque_base) x) - : members_( boost::move(x.ptr_alloc()) - , boost::move(x.alloc()) ) - {} - - ~deque_base() - { - if (this->members_.m_map) { - this->priv_destroy_nodes(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1); - this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); - } - } - - private: - deque_base(const deque_base&); - - protected: - - void swap_members(deque_base &x) BOOST_NOEXCEPT_OR_NOTHROW - { - ::boost::adl_move_swap(this->members_.m_start, x.members_.m_start); - ::boost::adl_move_swap(this->members_.m_finish, x.members_.m_finish); - ::boost::adl_move_swap(this->members_.m_map, x.members_.m_map); - ::boost::adl_move_swap(this->members_.m_map_size, x.members_.m_map_size); - } - - void priv_initialize_map(size_type num_elements) - { -// if(num_elements){ - size_type num_nodes = num_elements / s_buffer_size() + 1; - - this->members_.m_map_size = dtl::max_value((size_type) InitialMapSize, num_nodes + 2); - this->members_.m_map = this->priv_allocate_map(this->members_.m_map_size); - - ptr_alloc_ptr nstart = this->members_.m_map + (this->members_.m_map_size - num_nodes) / 2; - ptr_alloc_ptr nfinish = nstart + num_nodes; - - BOOST_TRY { - this->priv_create_nodes(nstart, nfinish); - } - BOOST_CATCH(...){ - this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); - this->members_.m_map = 0; - this->members_.m_map_size = 0; - BOOST_RETHROW - } - BOOST_CATCH_END - - this->members_.m_start.priv_set_node(nstart); - this->members_.m_finish.priv_set_node(nfinish - 1); - this->members_.m_start.m_cur = this->members_.m_start.m_first; - this->members_.m_finish.m_cur = this->members_.m_finish.m_first + - num_elements % s_buffer_size(); -// } - } - - void priv_create_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) - { - ptr_alloc_ptr cur = nstart; - BOOST_TRY { - for (; cur < nfinish; ++cur) - *cur = this->priv_allocate_node(); - } - BOOST_CATCH(...){ - this->priv_destroy_nodes(nstart, cur); - BOOST_RETHROW - } - BOOST_CATCH_END - } - - void priv_destroy_nodes(ptr_alloc_ptr nstart, ptr_alloc_ptr nfinish) BOOST_NOEXCEPT_OR_NOTHROW - { - for (ptr_alloc_ptr n = nstart; n < nfinish; ++n) - this->priv_deallocate_node(*n); - } - - void priv_clear_map() BOOST_NOEXCEPT_OR_NOTHROW - { - if (this->members_.m_map) { - this->priv_destroy_nodes(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1); - this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); - this->members_.m_map = 0; - this->members_.m_map_size = 0; - this->members_.m_start = iterator(); - this->members_.m_finish = this->members_.m_start; - } - } - - enum { InitialMapSize = 8 }; - - protected: - struct members_holder - : public ptr_alloc_t - , public allocator_type - { - members_holder() - : map_allocator_type(), allocator_type() - , m_map(0), m_map_size(0) - , m_start(), m_finish(m_start) - {} - - explicit members_holder(const allocator_type &a) - : map_allocator_type(a), allocator_type(a) - , m_map(0), m_map_size(0) - , m_start(), m_finish(m_start) - {} - - template<class ValAllocConvertible, class PtrAllocConvertible> - members_holder(BOOST_FWD_REF(PtrAllocConvertible) pa, BOOST_FWD_REF(ValAllocConvertible) va) - : map_allocator_type(boost::forward<PtrAllocConvertible>(pa)) - , allocator_type (boost::forward<ValAllocConvertible>(va)) - , m_map(0), m_map_size(0) - , m_start(), m_finish(m_start) - {} - - ptr_alloc_ptr m_map; - val_alloc_size m_map_size; - iterator m_start; - iterator m_finish; - } members_; - - ptr_alloc_t &ptr_alloc() BOOST_NOEXCEPT_OR_NOTHROW - { return members_; } - - const ptr_alloc_t &ptr_alloc() const BOOST_NOEXCEPT_OR_NOTHROW - { return members_; } - - allocator_type &alloc() BOOST_NOEXCEPT_OR_NOTHROW - { return members_; } - - const allocator_type &alloc() const BOOST_NOEXCEPT_OR_NOTHROW - { return members_; } -}; -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -//! A double-ended queue is a sequence that supports random access to elements, constant time insertion -//! and removal of elements at the end of the sequence, and linear time insertion and removal of elements in the middle. -//! -//! \tparam T The type of object that is stored in the deque -//! \tparam Allocator The allocator used for all internal memory management -template <class T, class Allocator = new_allocator<T> > -#else -template <class T, class Allocator> -#endif -class deque : protected deque_base<Allocator> -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - typedef deque_base<Allocator> Base; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - - typedef T value_type; - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::reference reference; - typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference; - typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type; - typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type; - typedef Allocator allocator_type; - typedef BOOST_CONTAINER_IMPDEF(allocator_type) stored_allocator_type; - typedef BOOST_CONTAINER_IMPDEF(typename Base::iterator) iterator; - typedef BOOST_CONTAINER_IMPDEF(typename Base::const_iterator) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - private: // Internal typedefs - BOOST_COPYABLE_AND_MOVABLE(deque) - typedef typename Base::ptr_alloc_ptr index_pointer; - static size_type s_buffer_size() - { return Base::s_buffer_size(); } - typedef allocator_traits<Allocator> allocator_traits_type; - - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Default constructors a deque. - //! - //! <b>Throws</b>: If allocator_type's default constructor throws. - //! - //! <b>Complexity</b>: Constant. - deque() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value) - : Base() - {} - - //! <b>Effects</b>: Constructs a deque taking the allocator as parameter. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - explicit deque(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW - : Base(a) - {} - - //! <b>Effects</b>: Constructs a deque - //! and inserts n value initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's value initialization throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit deque(size_type n) - : Base(n, allocator_type()) - { - dtl::insert_value_initialized_n_proxy<Allocator, iterator> proxy; - proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n); - //deque_base will deallocate in case of exception... - } - - //! <b>Effects</b>: Constructs a deque - //! and inserts n default initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default initialization or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - //! - //! <b>Note</b>: Non-standard extension - deque(size_type n, default_init_t) - : Base(n, allocator_type()) - { - dtl::insert_default_initialized_n_proxy<Allocator, iterator> proxy; - proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n); - //deque_base will deallocate in case of exception... - } - - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts n value initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's value initialization throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit deque(size_type n, const allocator_type &a) - : Base(n, a) - { - dtl::insert_value_initialized_n_proxy<Allocator, iterator> proxy; - proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n); - //deque_base will deallocate in case of exception... - } - - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts n default initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default initialization or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - //! - //! <b>Note</b>: Non-standard extension - deque(size_type n, default_init_t, const allocator_type &a) - : Base(n, a) - { - dtl::insert_default_initialized_n_proxy<Allocator, iterator> proxy; - proxy.uninitialized_copy_n_and_update(this->alloc(), this->begin(), n); - //deque_base will deallocate in case of exception... - } - - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - deque(size_type n, const value_type& value) - : Base(n, allocator_type()) - { this->priv_fill_initialize(value); } - - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - deque(size_type n, const value_type& value, const allocator_type& a) - : Base(n, a) - { this->priv_fill_initialize(value); } - - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts a copy of the range [first, last) in the deque. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced InIt throws. - //! - //! <b>Complexity</b>: Linear to the range [first, last). - template <class InIt> - deque(InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_convertible - <InIt, size_type>::type * = 0 - #endif - ) - : Base(allocator_type()) - { - this->priv_range_initialize(first, last); - } - - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts a copy of the range [first, last) in the deque. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced InIt throws. - //! - //! <b>Complexity</b>: Linear to the range [first, last). - template <class InIt> - deque(InIt first, InIt last, const allocator_type& a - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_convertible - <InIt, size_type>::type * = 0 - #endif - ) - : Base(a) - { - this->priv_range_initialize(first, last); - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs a deque that will use a copy of allocator a - //! and inserts a copy of the range [il.begin(), il.end()) in the deque. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()). - deque(std::initializer_list<value_type> il, const allocator_type& a = allocator_type()) - : Base(a) - { - this->priv_range_initialize(il.begin(), il.end()); - } -#endif - - //! <b>Effects</b>: Copy constructs a deque. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Complexity</b>: Linear to the elements x contains. - deque(const deque& x) - : Base(allocator_traits_type::select_on_container_copy_construction(x.alloc())) - { - if(x.size()){ - this->priv_initialize_map(x.size()); - boost::container::uninitialized_copy_alloc - (this->alloc(), x.begin(), x.end(), this->members_.m_start); - } - } - - //! <b>Effects</b>: Move constructor. Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocator_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - deque(BOOST_RV_REF(deque) x) BOOST_NOEXCEPT_OR_NOTHROW - : Base(BOOST_MOVE_BASE(Base, x)) - { this->swap_members(x); } - - //! <b>Effects</b>: Copy constructs a vector using the specified allocator. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Throws</b>: If allocation - //! throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the elements x contains. - deque(const deque& x, const allocator_type &a) - : Base(a) - { - if(x.size()){ - this->priv_initialize_map(x.size()); - boost::container::uninitialized_copy_alloc - (this->alloc(), x.begin(), x.end(), this->members_.m_start); - } - } - - //! <b>Effects</b>: Move constructor using the specified allocator. - //! Moves x's resources to *this if a == allocator_type(). - //! Otherwise copies values from x to *this. - //! - //! <b>Throws</b>: If allocation or T's copy constructor throws. - //! - //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise. - deque(BOOST_RV_REF(deque) x, const allocator_type &a) - : Base(a) - { - if(x.alloc() == a){ - this->swap_members(x); - } - else{ - if(x.size()){ - this->priv_initialize_map(x.size()); - boost::container::uninitialized_copy_alloc - ( this->alloc(), boost::make_move_iterator(x.begin()) - , boost::make_move_iterator(x.end()), this->members_.m_start); - } - } - } - - //! <b>Effects</b>: Destroys the deque. All stored values are destroyed - //! and used memory is deallocated. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements. - ~deque() BOOST_NOEXCEPT_OR_NOTHROW - { - this->priv_destroy_range(this->members_.m_start, this->members_.m_finish); - } - - //! <b>Effects</b>: Makes *this contain the same elements as x. - //! - //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the number of elements in x. - deque& operator= (BOOST_COPY_ASSIGN_REF(deque) x) - { - if (&x != this){ - allocator_type &this_alloc = this->alloc(); - const allocator_type &x_alloc = x.alloc(); - dtl::bool_<allocator_traits_type:: - propagate_on_container_copy_assignment::value> flag; - if(flag && this_alloc != x_alloc){ - this->clear(); - this->shrink_to_fit(); - } - dtl::assign_alloc(this->alloc(), x.alloc(), flag); - dtl::assign_alloc(this->ptr_alloc(), x.ptr_alloc(), flag); - this->assign(x.cbegin(), x.cend()); - } - return *this; - } - - //! <b>Effects</b>: Move assignment. All x's values are transferred to *this. - //! - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or value_type's move constructor throws) - //! - //! <b>Complexity</b>: Constant if allocator_traits_type:: - //! propagate_on_container_move_assignment is true or - //! this->get>allocator() == x.get_allocator(). Linear otherwise. - deque& operator= (BOOST_RV_REF(deque) x) - BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value - || allocator_traits_type::is_always_equal::value) - { - BOOST_ASSERT(this != &x); - allocator_type &this_alloc = this->alloc(); - allocator_type &x_alloc = x.alloc(); - const bool propagate_alloc = allocator_traits_type:: - propagate_on_container_move_assignment::value; - dtl::bool_<propagate_alloc> flag; - const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(propagate_alloc || allocators_equal){ - //Destroy objects but retain memory in case x reuses it in the future - this->clear(); - //Move allocator if needed - dtl::move_alloc(this_alloc, x_alloc, flag); - dtl::move_alloc(this->ptr_alloc(), x.ptr_alloc(), flag); - //Nothrow swap - this->swap_members(x); - } - //Else do a one by one move - else{ - this->assign( boost::make_move_iterator(x.begin()) - , boost::make_move_iterator(x.end())); - } - return *this; - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Makes *this contain the same elements as il. - //! - //! <b>Postcondition</b>: this->size() == il.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the number of elements in il. - deque& operator=(std::initializer_list<value_type> il) - { - this->assign(il.begin(), il.end()); - return *this; - } -#endif - - //! <b>Effects</b>: Assigns the n copies of val to *this. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - void assign(size_type n, const T& val) - { - typedef constant_iterator<value_type, difference_type> c_it; - this->assign(c_it(val, n), c_it()); - } - - //! <b>Effects</b>: Assigns the the range [first, last) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing InIt throws. - //! - //! <b>Complexity</b>: Linear to n. - template <class InIt> - void assign(InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_or - < void - , dtl::is_convertible<InIt, size_type> - , dtl::is_not_input_iterator<InIt> - >::type * = 0 - #endif - ) - { - iterator cur = this->begin(); - for ( ; first != last && cur != end(); ++cur, ++first){ - *cur = *first; - } - if (first == last){ - this->erase(cur, this->cend()); - } - else{ - this->insert(this->cend(), first, last); - } - } - - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - template <class FwdIt> - void assign(FwdIt first, FwdIt last - , typename dtl::disable_if_or - < void - , dtl::is_convertible<FwdIt, size_type> - , dtl::is_input_iterator<FwdIt> - >::type * = 0 - ) - { - const size_type len = boost::container::iterator_distance(first, last); - if (len > size()) { - FwdIt mid = first; - boost::container::iterator_advance(mid, this->size()); - boost::container::copy(first, mid, begin()); - this->insert(this->cend(), mid, last); - } - else{ - this->erase(boost::container::copy(first, last, this->begin()), cend()); - } - } - #endif - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Assigns the the range [il.begin(), il.end()) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to il.size(). - void assign(std::initializer_list<value_type> il) - { this->assign(il.begin(), il.end()); } -#endif - - //! <b>Effects</b>: Returns a copy of the internal allocator. - //! - //! <b>Throws</b>: If allocator's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return Base::alloc(); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return Base::alloc(); } - - ////////////////////////////////////////////// - // - // iterators - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { return Base::alloc(); } - - //! <b>Effects</b>: Returns an iterator to the first element contained in the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_start; } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_start; } - - //! <b>Effects</b>: Returns an iterator to the end of the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_finish; } - - //! <b>Effects</b>: Returns a const_iterator to the end of the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_finish; } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning - //! of the reversed deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return reverse_iterator(this->members_.m_finish); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->members_.m_finish); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the end - //! of the reversed deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return reverse_iterator(this->members_.m_start); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->members_.m_start); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_start; } - - //! <b>Effects</b>: Returns a const_iterator to the end of the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_finish; } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->members_.m_finish); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->members_.m_start); } - - ////////////////////////////////////////////// - // - // capacity - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns true if the deque contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_finish == this->members_.m_start; } - - //! <b>Effects</b>: Returns the number of the elements contained in the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->members_.m_finish - this->members_.m_start; } - - //! <b>Effects</b>: Returns the largest possible size of the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return allocator_traits_type::max_size(this->alloc()); } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are value initialized. - //! - //! <b>Throws</b>: If memory allocation throws, or T's constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type new_size) - { - const size_type len = size(); - if (new_size < len) - this->priv_erase_last_n(len - new_size); - else{ - const size_type n = new_size - this->size(); - dtl::insert_value_initialized_n_proxy<Allocator, iterator> proxy; - priv_insert_back_aux_impl(n, proxy); - } - } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are default initialized. - //! - //! <b>Throws</b>: If memory allocation throws, or T's constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - //! - //! <b>Note</b>: Non-standard extension - void resize(size_type new_size, default_init_t) - { - const size_type len = size(); - if (new_size < len) - this->priv_erase_last_n(len - new_size); - else{ - const size_type n = new_size - this->size(); - dtl::insert_default_initialized_n_proxy<Allocator, iterator> proxy; - priv_insert_back_aux_impl(n, proxy); - } - } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are copy constructed from x. - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type new_size, const value_type& x) - { - const size_type len = size(); - if (new_size < len) - this->erase(this->members_.m_start + new_size, this->members_.m_finish); - else - this->insert(this->members_.m_finish, new_size - len, x); - } - - //! <b>Effects</b>: Tries to deallocate the excess of memory created - //! with previous allocations. The size of the deque is unchanged - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Constant. - void shrink_to_fit() - { - //This deque implementation already - //deallocates excess nodes when erasing - //so there is nothing to do except for - //empty deque - if(this->empty()){ - this->priv_clear_map(); - } - } - - ////////////////////////////////////////////// - // - // element access - // - ////////////////////////////////////////////// - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the first - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *this->members_.m_start; - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *this->members_.m_start; - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the last - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *(end()-1); - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the last - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *(cend()-1); - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() > n); - return this->members_.m_start[difference_type(n)]; - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a const reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() > n); - return this->members_.m_start[difference_type(n)]; - } - - //! <b>Requires</b>: size() >= n. - //! - //! <b>Effects</b>: Returns an iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() >= n); - return iterator(this->begin()+n); - } - - //! <b>Requires</b>: size() >= n. - //! - //! <b>Effects</b>: Returns a const_iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() >= n); - return const_iterator(this->cbegin()+n); - } - - //! <b>Requires</b>: begin() <= p <= end(). - //! - //! <b>Effects</b>: Returns the index of the element pointed by p - //! and size() if p == end(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { - //Range checked priv_index_of - return this->priv_index_of(p); - } - - //! <b>Requires</b>: begin() <= p <= end(). - //! - //! <b>Effects</b>: Returns the index of the element pointed by p - //! and size() if p == end(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { - //Range checked priv_index_of - return this->priv_index_of(p); - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: std::range_error if n >= size() - //! - //! <b>Complexity</b>: Constant. - reference at(size_type n) - { - this->priv_throw_if_out_of_range(n); - return (*this)[n]; - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a const reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: std::range_error if n >= size() - //! - //! <b>Complexity</b>: Constant. - const_reference at(size_type n) const - { - this->priv_throw_if_out_of_range(n); - return (*this)[n]; - } - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the beginning of the deque. - //! - //! <b>Returns</b>: A reference to the created object. - //! - //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time - template <class... Args> - reference emplace_front(BOOST_FWD_REF(Args)... args) - { - if(this->priv_push_front_simple_available()){ - reference r = *this->priv_push_front_simple_pos(); - allocator_traits_type::construct - ( this->alloc() - , this->priv_push_front_simple_pos() - , boost::forward<Args>(args)...); - this->priv_push_front_simple_commit(); - return r; - } - else{ - typedef dtl::insert_nonmovable_emplace_proxy<Allocator, iterator, Args...> type; - return *this->priv_insert_front_aux_impl(1, type(boost::forward<Args>(args)...)); - } - } - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the end of the deque. - //! - //! <b>Returns</b>: A reference to the created object. - //! - //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time - template <class... Args> - reference emplace_back(BOOST_FWD_REF(Args)... args) - { - if(this->priv_push_back_simple_available()){ - reference r = *this->priv_push_back_simple_pos(); - allocator_traits_type::construct - ( this->alloc() - , this->priv_push_back_simple_pos() - , boost::forward<Args>(args)...); - this->priv_push_back_simple_commit(); - return r; - } - else{ - typedef dtl::insert_nonmovable_emplace_proxy<Allocator, iterator, Args...> type; - return *this->priv_insert_back_aux_impl(1, type(boost::forward<Args>(args)...)); - } - } - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... before p - //! - //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws. - //! - //! <b>Complexity</b>: If p is end(), amortized constant time - //! Linear time otherwise. - template <class... Args> - iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - if(p == this->cbegin()){ - this->emplace_front(boost::forward<Args>(args)...); - return this->begin(); - } - else if(p == this->cend()){ - this->emplace_back(boost::forward<Args>(args)...); - return (this->end()-1); - } - else{ - typedef dtl::insert_emplace_proxy<Allocator, iterator, Args...> type; - return this->priv_insert_aux_impl(p, 1, type(boost::forward<Args>(args)...)); - } - } - - #else //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_DEQUE_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ - reference emplace_front(BOOST_MOVE_UREF##N)\ - {\ - if(priv_push_front_simple_available()){\ - reference r = *this->priv_push_front_simple_pos();\ - allocator_traits_type::construct\ - ( this->alloc(), this->priv_push_front_simple_pos() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - priv_push_front_simple_commit();\ - return r;\ - }\ - else{\ - typedef dtl::insert_nonmovable_emplace_proxy##N\ - <Allocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\ - return *priv_insert_front_aux_impl(1, type(BOOST_MOVE_FWD##N));\ - }\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ - reference emplace_back(BOOST_MOVE_UREF##N)\ - {\ - if(priv_push_back_simple_available()){\ - reference r = *this->priv_push_back_simple_pos();\ - allocator_traits_type::construct\ - ( this->alloc(), this->priv_push_back_simple_pos() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - priv_push_back_simple_commit();\ - return r;\ - }\ - else{\ - typedef dtl::insert_nonmovable_emplace_proxy##N\ - <Allocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\ - return *priv_insert_back_aux_impl(1, type(BOOST_MOVE_FWD##N));\ - }\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N\ - iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - BOOST_ASSERT(this->priv_in_range_or_end(p));\ - if(p == this->cbegin()){\ - this->emplace_front(BOOST_MOVE_FWD##N);\ - return this->begin();\ - }\ - else if(p == cend()){\ - this->emplace_back(BOOST_MOVE_FWD##N);\ - return (--this->end());\ - }\ - else{\ - typedef dtl::insert_emplace_proxy_arg##N\ - <Allocator, iterator BOOST_MOVE_I##N BOOST_MOVE_TARG##N> type;\ - return this->priv_insert_aux_impl(p, 1, type(BOOST_MOVE_FWD##N));\ - }\ - } - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_DEQUE_EMPLACE_CODE) - #undef BOOST_CONTAINER_DEQUE_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x at the front of the deque. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_front(const T &x); - - //! <b>Effects</b>: Constructs a new element in the front of the deque - //! and moves the resources of x to this new element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_front(T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x at the end of the deque. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_back(const T &x); - - //! <b>Effects</b>: Constructs a new element in the end of the deque - //! and moves the resources of x to this new element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_back(T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of x before p. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws. - //! - //! <b>Complexity</b>: If p is end(), amortized constant time - //! Linear time otherwise. - iterator insert(const_iterator p, const T &x); - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a new element before p with x's resources. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: If p is end(), amortized constant time - //! Linear time otherwise. - iterator insert(const_iterator p, T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: pos must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert n copies of x before pos. - //! - //! <b>Returns</b>: an iterator to the first inserted element or pos if n is 0. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - iterator insert(const_iterator pos, size_type n, const value_type& x) - { - //Range check of p is done by insert() - typedef constant_iterator<value_type, difference_type> c_it; - return this->insert(pos, c_it(x, n), c_it()); - } - - //! <b>Requires</b>: pos must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [first, last) range before pos. - //! - //! <b>Returns</b>: an iterator to the first inserted element or pos if first == last. - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced InIt throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to distance [first, last). - template <class InIt> - iterator insert(const_iterator pos, InIt first, InIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_or - < void - , dtl::is_convertible<InIt, size_type> - , dtl::is_not_input_iterator<InIt> - >::type * = 0 - #endif - ) - { - BOOST_ASSERT(this->priv_in_range_or_end(pos)); - size_type n = 0; - iterator it(pos.unconst()); - for(;first != last; ++first, ++n){ - it = this->emplace(it, *first); - ++it; - } - it -= n; - return it; - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Requires</b>: pos must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before pos. - //! - //! <b>Returns</b>: an iterator to the first inserted element or pos if il.begin() == il.end(). - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced std::initializer_list throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to distance [il.begin(), il.end()). - iterator insert(const_iterator pos, std::initializer_list<value_type> il) - { - //Range check os pos is done in insert() - return insert(pos, il.begin(), il.end()); - } -#endif - - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - template <class FwdIt> - iterator insert(const_iterator p, FwdIt first, FwdIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_or - < void - , dtl::is_convertible<FwdIt, size_type> - , dtl::is_input_iterator<FwdIt> - >::type * = 0 - #endif - ) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - dtl::insert_range_proxy<Allocator, FwdIt, iterator> proxy(first); - return priv_insert_aux_impl(p, boost::container::iterator_distance(first, last), proxy); - } - #endif - - //! <b>Effects</b>: Removes the first element from the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant time. - void pop_front() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - if (this->members_.m_start.m_cur != this->members_.m_start.m_last - 1) { - allocator_traits_type::destroy - ( this->alloc() - , boost::movelib::to_raw_pointer(this->members_.m_start.m_cur) - ); - ++this->members_.m_start.m_cur; - } - else - this->priv_pop_front_aux(); - } - - //! <b>Effects</b>: Removes the last element from the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant time. - void pop_back() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - if (this->members_.m_finish.m_cur != this->members_.m_finish.m_first) { - --this->members_.m_finish.m_cur; - allocator_traits_type::destroy - ( this->alloc() - , boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur) - ); - } - else - this->priv_pop_back_aux(); - } - - //! <b>Effects</b>: Erases the element at p. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the elements between pos and the - //! last element (if pos is near the end) or the first element - //! if(pos is near the beginning). - //! Constant if pos is the first or the last element. - iterator erase(const_iterator pos) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->priv_in_range(pos)); - iterator next = pos.unconst(); - ++next; - size_type index = pos - this->members_.m_start; - if (index < (this->size()/2)) { - boost::container::move_backward(this->begin(), pos.unconst(), next); - pop_front(); - } - else { - boost::container::move(next, this->end(), pos.unconst()); - pop_back(); - } - return this->members_.m_start + index; - } - - //! <b>Effects</b>: Erases the elements pointed by [first, last). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the distance between first and - //! last plus the elements between pos and the - //! last element (if pos is near the end) or the first element - //! if(pos is near the beginning). - iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(first == last || - (first < last && this->priv_in_range(first) && this->priv_in_range_or_end(last))); - if (first == this->members_.m_start && last == this->members_.m_finish) { - this->clear(); - return this->members_.m_finish; - } - else { - const size_type n = static_cast<size_type>(last - first); - const size_type elems_before = static_cast<size_type>(first - this->members_.m_start); - if (elems_before < (this->size() - n) - elems_before) { - boost::container::move_backward(begin(), first.unconst(), last.unconst()); - iterator new_start = this->members_.m_start + n; - this->priv_destroy_range(this->members_.m_start, new_start); - this->priv_destroy_nodes(this->members_.m_start.m_node, new_start.m_node); - this->members_.m_start = new_start; - } - else { - boost::container::move(last.unconst(), end(), first.unconst()); - iterator new_finish = this->members_.m_finish - n; - this->priv_destroy_range(new_finish, this->members_.m_finish); - this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1); - this->members_.m_finish = new_finish; - } - return this->members_.m_start + elems_before; - } - } - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - void swap(deque &x) - BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_swap::value - || allocator_traits_type::is_always_equal::value) - { - this->swap_members(x); - dtl::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; - dtl::swap_alloc(this->alloc(), x.alloc(), flag); - dtl::swap_alloc(this->ptr_alloc(), x.ptr_alloc(), flag); - } - - //! <b>Effects</b>: Erases all the elements of the deque. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements in the deque. - void clear() BOOST_NOEXCEPT_OR_NOTHROW - { - for (index_pointer node = this->members_.m_start.m_node + 1; - node < this->members_.m_finish.m_node; - ++node) { - this->priv_destroy_range(*node, *node + this->s_buffer_size()); - this->priv_deallocate_node(*node); - } - - if (this->members_.m_start.m_node != this->members_.m_finish.m_node) { - this->priv_destroy_range(this->members_.m_start.m_cur, this->members_.m_start.m_last); - this->priv_destroy_range(this->members_.m_finish.m_first, this->members_.m_finish.m_cur); - this->priv_deallocate_node(this->members_.m_finish.m_first); - } - else - this->priv_destroy_range(this->members_.m_start.m_cur, this->members_.m_finish.m_cur); - - this->members_.m_finish = this->members_.m_start; - } - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator==(const deque& x, const deque& y) - { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator!=(const deque& x, const deque& y) - { return !(x == y); } - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<(const deque& x, const deque& y) - { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>(const deque& x, const deque& y) - { return y < x; } - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<=(const deque& x, const deque& y) - { return !(y < x); } - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>=(const deque& x, const deque& y) - { return !(x < y); } - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - friend void swap(deque& x, deque& y) - { x.swap(y); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - - size_type priv_index_of(const_iterator p) const - { - BOOST_ASSERT(this->cbegin() <= p); - BOOST_ASSERT(p <= this->cend()); - return static_cast<size_type>(p - this->cbegin()); - } - - void priv_erase_last_n(size_type n) - { - if(n == this->size()) { - this->clear(); - } - else { - iterator new_finish = this->members_.m_finish - n; - this->priv_destroy_range(new_finish, this->members_.m_finish); - this->priv_destroy_nodes(new_finish.m_node + 1, this->members_.m_finish.m_node + 1); - this->members_.m_finish = new_finish; - } - } - - void priv_throw_if_out_of_range(size_type n) const - { - if (n >= this->size()) - throw_out_of_range("deque::at out of range"); - } - - bool priv_in_range(const_iterator pos) const - { - return (this->begin() <= pos) && (pos < this->end()); - } - - bool priv_in_range_or_end(const_iterator pos) const - { - return (this->begin() <= pos) && (pos <= this->end()); - } - - template <class U> - iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - if (p == cbegin()){ - this->push_front(::boost::forward<U>(x)); - return begin(); - } - else if (p == cend()){ - this->push_back(::boost::forward<U>(x)); - return --end(); - } - else { - return priv_insert_aux_impl - ( p, (size_type)1 - , dtl::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x))); - } - } - - template <class U> - void priv_push_front(BOOST_FWD_REF(U) x) - { - if(this->priv_push_front_simple_available()){ - allocator_traits_type::construct - ( this->alloc(), this->priv_push_front_simple_pos(), ::boost::forward<U>(x)); - this->priv_push_front_simple_commit(); - } - else{ - priv_insert_aux_impl - ( this->cbegin(), (size_type)1 - , dtl::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x))); - } - } - - template <class U> - void priv_push_back(BOOST_FWD_REF(U) x) - { - if(this->priv_push_back_simple_available()){ - allocator_traits_type::construct - ( this->alloc(), this->priv_push_back_simple_pos(), ::boost::forward<U>(x)); - this->priv_push_back_simple_commit(); - } - else{ - priv_insert_aux_impl - ( this->cend(), (size_type)1 - , dtl::get_insert_value_proxy<iterator, Allocator>(::boost::forward<U>(x))); - } - } - - bool priv_push_back_simple_available() const - { - return this->members_.m_map && - (this->members_.m_finish.m_cur != (this->members_.m_finish.m_last - 1)); - } - - T *priv_push_back_simple_pos() const - { - return boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur); - } - - void priv_push_back_simple_commit() - { - ++this->members_.m_finish.m_cur; - } - - bool priv_push_front_simple_available() const - { - return this->members_.m_map && - (this->members_.m_start.m_cur != this->members_.m_start.m_first); - } - - T *priv_push_front_simple_pos() const - { return boost::movelib::to_raw_pointer(this->members_.m_start.m_cur) - 1; } - - void priv_push_front_simple_commit() - { --this->members_.m_start.m_cur; } - - void priv_destroy_range(iterator p, iterator p2) - { - if(!Base::traits_t::trivial_dctr){ - for(;p != p2; ++p){ - allocator_traits_type::destroy(this->alloc(), boost::movelib::iterator_to_raw_pointer(p)); - } - } - } - - void priv_destroy_range(pointer p, pointer p2) - { - if(!Base::traits_t::trivial_dctr){ - for(;p != p2; ++p){ - allocator_traits_type::destroy(this->alloc(), boost::movelib::iterator_to_raw_pointer(p)); - } - } - } - - template<class InsertProxy> - iterator priv_insert_aux_impl(const_iterator p, size_type n, InsertProxy proxy) - { - iterator pos(p.unconst()); - const size_type pos_n = p - this->cbegin(); - if(!this->members_.m_map){ - this->priv_initialize_map(0); - pos = this->begin(); - } - - const size_type elemsbefore = static_cast<size_type>(pos - this->members_.m_start); - const size_type length = this->size(); - if (elemsbefore < length / 2) { - const iterator new_start = this->priv_reserve_elements_at_front(n); - const iterator old_start = this->members_.m_start; - if(!elemsbefore){ - proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n); - this->members_.m_start = new_start; - } - else{ - pos = this->members_.m_start + elemsbefore; - if (elemsbefore >= n) { - const iterator start_n = this->members_.m_start + n; - ::boost::container::uninitialized_move_alloc - (this->alloc(), this->members_.m_start, start_n, new_start); - this->members_.m_start = new_start; - boost::container::move(start_n, pos, old_start); - proxy.copy_n_and_update(this->alloc(), pos - n, n); - } - else { - const size_type mid_count = n - elemsbefore; - const iterator mid_start = old_start - mid_count; - proxy.uninitialized_copy_n_and_update(this->alloc(), mid_start, mid_count); - this->members_.m_start = mid_start; - ::boost::container::uninitialized_move_alloc - (this->alloc(), old_start, pos, new_start); - this->members_.m_start = new_start; - proxy.copy_n_and_update(this->alloc(), old_start, elemsbefore); - } - } - } - else { - const iterator new_finish = this->priv_reserve_elements_at_back(n); - const iterator old_finish = this->members_.m_finish; - const size_type elemsafter = length - elemsbefore; - if(!elemsafter){ - proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, n); - this->members_.m_finish = new_finish; - } - else{ - pos = old_finish - elemsafter; - if (elemsafter >= n) { - iterator finish_n = old_finish - difference_type(n); - ::boost::container::uninitialized_move_alloc - (this->alloc(), finish_n, old_finish, old_finish); - this->members_.m_finish = new_finish; - boost::container::move_backward(pos, finish_n, old_finish); - proxy.copy_n_and_update(this->alloc(), pos, n); - } - else { - const size_type raw_gap = n - elemsafter; - ::boost::container::uninitialized_move_alloc - (this->alloc(), pos, old_finish, old_finish + raw_gap); - BOOST_TRY{ - proxy.copy_n_and_update(this->alloc(), pos, elemsafter); - proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, raw_gap); - } - BOOST_CATCH(...){ - this->priv_destroy_range(old_finish, old_finish + elemsafter); - BOOST_RETHROW - } - BOOST_CATCH_END - this->members_.m_finish = new_finish; - } - } - } - return this->begin() + pos_n; - } - - template <class InsertProxy> - iterator priv_insert_back_aux_impl(size_type n, InsertProxy proxy) - { - if(!this->members_.m_map){ - this->priv_initialize_map(0); - } - - iterator new_finish = this->priv_reserve_elements_at_back(n); - iterator old_finish = this->members_.m_finish; - proxy.uninitialized_copy_n_and_update(this->alloc(), old_finish, n); - this->members_.m_finish = new_finish; - return iterator(this->members_.m_finish - n); - } - - template <class InsertProxy> - iterator priv_insert_front_aux_impl(size_type n, InsertProxy proxy) - { - if(!this->members_.m_map){ - this->priv_initialize_map(0); - } - - iterator new_start = this->priv_reserve_elements_at_front(n); - proxy.uninitialized_copy_n_and_update(this->alloc(), new_start, n); - this->members_.m_start = new_start; - return new_start; - } - - iterator priv_fill_insert(const_iterator pos, size_type n, const value_type& x) - { - typedef constant_iterator<value_type, difference_type> c_it; - return this->insert(pos, c_it(x, n), c_it()); - } - - // Precondition: this->members_.m_start and this->members_.m_finish have already been initialized, - // but none of the deque's elements have yet been constructed. - void priv_fill_initialize(const value_type& value) - { - index_pointer cur = this->members_.m_start.m_node; - BOOST_TRY { - for ( ; cur < this->members_.m_finish.m_node; ++cur){ - boost::container::uninitialized_fill_alloc - (this->alloc(), *cur, *cur + this->s_buffer_size(), value); - } - boost::container::uninitialized_fill_alloc - (this->alloc(), this->members_.m_finish.m_first, this->members_.m_finish.m_cur, value); - } - BOOST_CATCH(...){ - this->priv_destroy_range(this->members_.m_start, iterator(*cur, cur)); - BOOST_RETHROW - } - BOOST_CATCH_END - } - - template <class InIt> - void priv_range_initialize(InIt first, InIt last, typename iterator_enable_if_tag<InIt, std::input_iterator_tag>::type* =0) - { - this->priv_initialize_map(0); - BOOST_TRY { - for ( ; first != last; ++first) - this->emplace_back(*first); - } - BOOST_CATCH(...){ - this->clear(); - BOOST_RETHROW - } - BOOST_CATCH_END - } - - template <class FwdIt> - void priv_range_initialize(FwdIt first, FwdIt last, typename iterator_disable_if_tag<FwdIt, std::input_iterator_tag>::type* =0) - { - size_type n = 0; - n = boost::container::iterator_distance(first, last); - this->priv_initialize_map(n); - - index_pointer cur_node = this->members_.m_start.m_node; - BOOST_TRY { - for (; cur_node < this->members_.m_finish.m_node; ++cur_node) { - FwdIt mid = first; - boost::container::iterator_advance(mid, this->s_buffer_size()); - ::boost::container::uninitialized_copy_alloc(this->alloc(), first, mid, *cur_node); - first = mid; - } - ::boost::container::uninitialized_copy_alloc(this->alloc(), first, last, this->members_.m_finish.m_first); - } - BOOST_CATCH(...){ - this->priv_destroy_range(this->members_.m_start, iterator(*cur_node, cur_node)); - BOOST_RETHROW - } - BOOST_CATCH_END - } - - // Called only if this->members_.m_finish.m_cur == this->members_.m_finish.m_first. - void priv_pop_back_aux() BOOST_NOEXCEPT_OR_NOTHROW - { - this->priv_deallocate_node(this->members_.m_finish.m_first); - this->members_.m_finish.priv_set_node(this->members_.m_finish.m_node - 1); - this->members_.m_finish.m_cur = this->members_.m_finish.m_last - 1; - allocator_traits_type::destroy - ( this->alloc() - , boost::movelib::to_raw_pointer(this->members_.m_finish.m_cur) - ); - } - - // Called only if this->members_.m_start.m_cur == this->members_.m_start.m_last - 1. Note that - // if the deque has at least one element (a precondition for this member - // function), and if this->members_.m_start.m_cur == this->members_.m_start.m_last, then the deque - // must have at least two nodes. - void priv_pop_front_aux() BOOST_NOEXCEPT_OR_NOTHROW - { - allocator_traits_type::destroy - ( this->alloc() - , boost::movelib::to_raw_pointer(this->members_.m_start.m_cur) - ); - this->priv_deallocate_node(this->members_.m_start.m_first); - this->members_.m_start.priv_set_node(this->members_.m_start.m_node + 1); - this->members_.m_start.m_cur = this->members_.m_start.m_first; - } - - iterator priv_reserve_elements_at_front(size_type n) - { - size_type vacancies = this->members_.m_start.m_cur - this->members_.m_start.m_first; - if (n > vacancies){ - size_type new_elems = n-vacancies; - size_type new_nodes = (new_elems + this->s_buffer_size() - 1) / - this->s_buffer_size(); - size_type s = (size_type)(this->members_.m_start.m_node - this->members_.m_map); - if (new_nodes > s){ - this->priv_reallocate_map(new_nodes, true); - } - size_type i = 1; - BOOST_TRY { - for (; i <= new_nodes; ++i) - *(this->members_.m_start.m_node - i) = this->priv_allocate_node(); - } - BOOST_CATCH(...) { - for (size_type j = 1; j < i; ++j) - this->priv_deallocate_node(*(this->members_.m_start.m_node - j)); - BOOST_RETHROW - } - BOOST_CATCH_END - } - return this->members_.m_start - difference_type(n); - } - - iterator priv_reserve_elements_at_back(size_type n) - { - size_type vacancies = (this->members_.m_finish.m_last - this->members_.m_finish.m_cur) - 1; - if (n > vacancies){ - size_type new_elems = n - vacancies; - size_type new_nodes = (new_elems + this->s_buffer_size() - 1)/s_buffer_size(); - size_type s = (size_type)(this->members_.m_map_size - (this->members_.m_finish.m_node - this->members_.m_map)); - if (new_nodes + 1 > s){ - this->priv_reallocate_map(new_nodes, false); - } - size_type i = 1; - BOOST_TRY { - for (; i <= new_nodes; ++i) - *(this->members_.m_finish.m_node + i) = this->priv_allocate_node(); - } - BOOST_CATCH(...) { - for (size_type j = 1; j < i; ++j) - this->priv_deallocate_node(*(this->members_.m_finish.m_node + j)); - BOOST_RETHROW - } - BOOST_CATCH_END - } - return this->members_.m_finish + difference_type(n); - } - - void priv_reallocate_map(size_type nodes_to_add, bool add_at_front) - { - size_type old_num_nodes = this->members_.m_finish.m_node - this->members_.m_start.m_node + 1; - size_type new_num_nodes = old_num_nodes + nodes_to_add; - - index_pointer new_nstart; - if (this->members_.m_map_size > 2 * new_num_nodes) { - new_nstart = this->members_.m_map + (this->members_.m_map_size - new_num_nodes) / 2 - + (add_at_front ? nodes_to_add : 0); - if (new_nstart < this->members_.m_start.m_node) - boost::container::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart); - else - boost::container::move_backward - (this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart + old_num_nodes); - } - else { - size_type new_map_size = - this->members_.m_map_size + dtl::max_value(this->members_.m_map_size, nodes_to_add) + 2; - - index_pointer new_map = this->priv_allocate_map(new_map_size); - new_nstart = new_map + (new_map_size - new_num_nodes) / 2 - + (add_at_front ? nodes_to_add : 0); - boost::container::move(this->members_.m_start.m_node, this->members_.m_finish.m_node + 1, new_nstart); - this->priv_deallocate_map(this->members_.m_map, this->members_.m_map_size); - - this->members_.m_map = new_map; - this->members_.m_map_size = new_map_size; - } - - this->members_.m_start.priv_set_node(new_nstart); - this->members_.m_finish.priv_set_node(new_nstart + old_num_nodes - 1); - } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -}; - -}} - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace boost { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class T, class Allocator> -struct has_trivial_destructor_after_move<boost::container::deque<T, Allocator> > -{ - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value; -}; - -} - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -#include <boost/container/detail/config_end.hpp> - -#endif // #ifndef BOOST_CONTAINER_DEQUE_HPP diff --git a/contrib/restricted/boost/boost/container/detail/adaptive_node_pool.hpp b/contrib/restricted/boost/boost/container/detail/adaptive_node_pool.hpp deleted file mode 100644 index 33bfcc98a7..0000000000 --- a/contrib/restricted/boost/boost/container/detail/adaptive_node_pool.hpp +++ /dev/null @@ -1,166 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_ADAPTIVE_NODE_POOL_HPP -#define BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -#include <boost/intrusive/set.hpp> -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/container/detail/pool_common_alloc.hpp> -#include <boost/container/detail/mutex.hpp> -#include <boost/container/detail/adaptive_node_pool_impl.hpp> -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/container/detail/type_traits.hpp> - -#include <cstddef> -#include <cmath> -#include <cassert> - - -namespace boost { -namespace container { -namespace dtl { - -template<bool AlignOnly> -struct select_private_adaptive_node_pool_impl -{ - typedef boost::container::dtl:: - private_adaptive_node_pool_impl - < fake_segment_manager - , unsigned(AlignOnly)*::boost::container::adaptive_pool_flag::align_only - | ::boost::container::adaptive_pool_flag::size_ordered | ::boost::container::adaptive_pool_flag::address_ordered - > type; -}; - -//!Pooled memory allocator using an smart adaptive pool. Includes -//!a reference count but the class does not delete itself, this is -//!responsibility of user classes. Node size (NodeSize) and the number of -//!nodes allocated per block (NodesPerBlock) are known at compile time. -template< std::size_t NodeSize - , std::size_t NodesPerBlock - , std::size_t MaxFreeBlocks - , std::size_t OverheadPercent - > -class private_adaptive_node_pool - : public select_private_adaptive_node_pool_impl<(OverheadPercent == 0)>::type -{ - typedef typename select_private_adaptive_node_pool_impl<OverheadPercent == 0>::type base_t; - //Non-copyable - private_adaptive_node_pool(const private_adaptive_node_pool &); - private_adaptive_node_pool &operator=(const private_adaptive_node_pool &); - - public: - typedef typename base_t::multiallocation_chain multiallocation_chain; - static const std::size_t nodes_per_block = NodesPerBlock; - - //!Constructor. Never throws - private_adaptive_node_pool() - : base_t(0 - , NodeSize - , NodesPerBlock - , MaxFreeBlocks - , (unsigned char)OverheadPercent) - {} -}; - -//!Pooled memory allocator using adaptive pool. Includes -//!a reference count but the class does not delete itself, this is -//!responsibility of user classes. Node size (NodeSize) and the number of -//!nodes allocated per block (NodesPerBlock) are known at compile time -template< std::size_t NodeSize - , std::size_t NodesPerBlock - , std::size_t MaxFreeBlocks - , std::size_t OverheadPercent - > -class shared_adaptive_node_pool - : public private_adaptive_node_pool - <NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> -{ - private: - typedef private_adaptive_node_pool - <NodeSize, NodesPerBlock, MaxFreeBlocks, OverheadPercent> private_node_allocator_t; - public: - typedef typename private_node_allocator_t::multiallocation_chain multiallocation_chain; - - //!Constructor. Never throws - shared_adaptive_node_pool() - : private_node_allocator_t(){} - - //!Destructor. Deallocates all allocated blocks. Never throws - ~shared_adaptive_node_pool() - {} - - //!Allocates array of count elements. Can throw std::bad_alloc - void *allocate_node() - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - return private_node_allocator_t::allocate_node(); - } - - //!Deallocates an array pointed by ptr. Never throws - void deallocate_node(void *ptr) - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::deallocate_node(ptr); - } - - //!Allocates a singly linked list of n nodes ending in null pointer. - //!can throw std::bad_alloc - void allocate_nodes(const std::size_t n, multiallocation_chain &chain) - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - return private_node_allocator_t::allocate_nodes(n, chain); - } - - void deallocate_nodes(multiallocation_chain &chain) - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::deallocate_nodes(chain); - } - - //!Deallocates all the free blocks of memory. Never throws - void deallocate_free_blocks() - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::deallocate_free_blocks(); - } - - private: - default_mutex mutex_; -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_HPP diff --git a/contrib/restricted/boost/boost/container/detail/adaptive_node_pool_impl.hpp b/contrib/restricted/boost/boost/container/detail/adaptive_node_pool_impl.hpp deleted file mode 100644 index 9ff4ec5371..0000000000 --- a/contrib/restricted/boost/boost/container/detail/adaptive_node_pool_impl.hpp +++ /dev/null @@ -1,885 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_ADAPTIVE_NODE_POOL_IMPL_HPP -#define BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// container -#include <boost/container/container_fwd.hpp> -#include <boost/container/throw_exception.hpp> -// container/detail -#include <boost/container/detail/pool_common.hpp> -#include <boost/container/detail/iterator.hpp> -#include <boost/move/detail/iterator_to_raw_pointer.hpp> -#include <boost/container/detail/math_functions.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/move/detail/to_raw_pointer.hpp> -#include <boost/container/detail/type_traits.hpp> -// intrusive -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/intrusive/set.hpp> -#include <boost/intrusive/list.hpp> -#include <boost/intrusive/slist.hpp> -// other -#include <boost/assert.hpp> -#include <boost/core/no_exceptions_support.hpp> -#include <cstddef> - -namespace boost { -namespace container { - -namespace adaptive_pool_flag { - -static const unsigned int none = 0u; -static const unsigned int align_only = 1u << 0u; -static const unsigned int size_ordered = 1u << 1u; -static const unsigned int address_ordered = 1u << 2u; - -} //namespace adaptive_pool_flag{ - -namespace dtl { - -template<class size_type> -struct hdr_offset_holder_t -{ - hdr_offset_holder_t(size_type offset = 0) - : hdr_offset(offset) - {} - size_type hdr_offset; -}; - -template<class SizeType, unsigned int Flags> -struct less_func; - -template<class SizeType> -struct less_func<SizeType, adaptive_pool_flag::none> -{ - static bool less(SizeType, SizeType, const void *, const void *) - { return true; } -}; - -template<class SizeType> -struct less_func<SizeType, adaptive_pool_flag::size_ordered> -{ - static bool less(SizeType ls, SizeType rs, const void *, const void *) - { return ls < rs; } -}; - -template<class SizeType> -struct less_func<SizeType, adaptive_pool_flag::address_ordered> -{ - static bool less(SizeType, SizeType, const void *la, const void *ra) - { return &la < &ra; } -}; - -template<class SizeType> -struct less_func<SizeType, adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered> -{ - static bool less(SizeType ls, SizeType rs, const void *la, const void *ra) - { return (ls < rs) || ((ls == rs) && (la < ra)); } -}; - -template<class VoidPointer, class SizeType, bool ordered> -struct block_container_traits -{ - typedef typename bi::make_set_base_hook - < bi::void_pointer<VoidPointer> - , bi::optimize_size<true> - , bi::link_mode<bi::normal_link> >::type hook_t; - - template<class T> - struct container - { - typedef typename bi::make_multiset - <T, bi::base_hook<hook_t>, bi::size_type<SizeType> >::type type; - }; - - template<class Container> - static void reinsert_was_used(Container &container, typename Container::reference v, bool) - { - typedef typename Container::const_iterator const_block_iterator; - const const_block_iterator this_block - (Container::s_iterator_to(const_cast<typename Container::const_reference>(v))); - const_block_iterator next_block(this_block); - if(++next_block != container.cend()){ - if(this_block->free_nodes.size() > next_block->free_nodes.size()){ - container.erase(this_block); - container.insert(v); - } - } - } - - template<class Container> - static void insert_was_empty(Container &container, typename Container::value_type &v, bool) - { - container.insert(v); - } - - template<class Container> - static void erase_first(Container &container) - { - container.erase(container.cbegin()); - } - - template<class Container> - static void erase_last(Container &container) - { - container.erase(--container.cend()); - } -}; - -template<class VoidPointer, class SizeType> -struct block_container_traits<VoidPointer, SizeType, false> -{ - typedef typename bi::make_list_base_hook - < bi::void_pointer<VoidPointer> - , bi::link_mode<bi::normal_link> >::type hook_t; - - template<class T> - struct container - { - typedef typename bi::make_list - <T, bi::base_hook<hook_t>, bi::size_type<SizeType>, bi::constant_time_size<false> >::type type; - }; - - template<class Container> - static void reinsert_was_used(Container &container, typename Container::value_type &v, bool is_full) - { - if(is_full){ - container.erase(Container::s_iterator_to(v)); - container.push_back(v); - } - } - - template<class Container> - static void insert_was_empty(Container &container, typename Container::value_type &v, bool is_full) - { - if(is_full){ - container.push_back(v); - } - else{ - container.push_front(v); - } - } - - template<class Container> - static void erase_first(Container &container) - { - container.pop_front(); - } - - template<class Container> - static void erase_last(Container &container) - { - container.pop_back(); - } -}; - -template<class MultiallocationChain, class VoidPointer, class SizeType, unsigned int Flags> -struct adaptive_pool_types -{ - typedef VoidPointer void_pointer; - static const bool ordered = (Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered)) != 0; - typedef block_container_traits<VoidPointer, SizeType, ordered> block_container_traits_t; - typedef typename block_container_traits_t::hook_t hook_t; - typedef hdr_offset_holder_t<SizeType> hdr_offset_holder; - static const unsigned int order_flags = Flags & (adaptive_pool_flag::size_ordered | adaptive_pool_flag::address_ordered); - typedef MultiallocationChain free_nodes_t; - - struct block_info_t - : public hdr_offset_holder, - public hook_t - { - //An intrusive list of free node from this block - free_nodes_t free_nodes; - friend bool operator <(const block_info_t &l, const block_info_t &r) - { - return less_func<SizeType, order_flags>:: - less(l.free_nodes.size(), r.free_nodes.size(), &l , &r); - } - - friend bool operator ==(const block_info_t &l, const block_info_t &r) - { return &l == &r; } - }; - typedef typename block_container_traits_t:: template container<block_info_t>::type block_container_t; -}; - -template<class size_type> -inline size_type calculate_alignment - ( size_type overhead_percent, size_type real_node_size - , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation) -{ - //to-do: handle real_node_size != node_size - const size_type divisor = overhead_percent*real_node_size; - const size_type dividend = hdr_offset_size*100; - size_type elements_per_subblock = (dividend - 1)/divisor + 1; - size_type candidate_power_of_2 = - upper_power_of_2(elements_per_subblock*real_node_size + hdr_offset_size); - bool overhead_satisfied = false; - //Now calculate the wors-case overhead for a subblock - const size_type max_subblock_overhead = hdr_size + payload_per_allocation; - while(!overhead_satisfied){ - elements_per_subblock = (candidate_power_of_2 - max_subblock_overhead)/real_node_size; - const size_type overhead_size = candidate_power_of_2 - elements_per_subblock*real_node_size; - if(overhead_size*100/candidate_power_of_2 < overhead_percent){ - overhead_satisfied = true; - } - else{ - candidate_power_of_2 <<= 1; - } - } - return candidate_power_of_2; -} - -template<class size_type> -inline void calculate_num_subblocks - (size_type alignment, size_type real_node_size, size_type elements_per_block - , size_type &num_subblocks, size_type &real_num_node, size_type overhead_percent - , size_type hdr_size, size_type hdr_offset_size, size_type payload_per_allocation) -{ - const size_type hdr_subblock_elements = (alignment - hdr_size - payload_per_allocation)/real_node_size; - size_type elements_per_subblock = (alignment - hdr_offset_size)/real_node_size; - size_type possible_num_subblock = (elements_per_block - 1)/elements_per_subblock + 1; - while(((possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements) < elements_per_block){ - ++possible_num_subblock; - } - elements_per_subblock = (alignment - hdr_offset_size)/real_node_size; - bool overhead_satisfied = false; - while(!overhead_satisfied){ - const size_type total_data = (elements_per_subblock*(possible_num_subblock-1) + hdr_subblock_elements)*real_node_size; - const size_type total_size = alignment*possible_num_subblock; - if((total_size - total_data)*100/total_size < overhead_percent){ - overhead_satisfied = true; - } - else{ - ++possible_num_subblock; - } - } - num_subblocks = possible_num_subblock; - real_num_node = (possible_num_subblock-1)*elements_per_subblock + hdr_subblock_elements; -} - -template<class SegmentManagerBase, unsigned int Flags> -class private_adaptive_node_pool_impl -{ - //Non-copyable - private_adaptive_node_pool_impl(); - private_adaptive_node_pool_impl(const private_adaptive_node_pool_impl &); - private_adaptive_node_pool_impl &operator=(const private_adaptive_node_pool_impl &); - typedef private_adaptive_node_pool_impl this_type; - - typedef typename SegmentManagerBase::void_pointer void_pointer; - static const typename SegmentManagerBase:: - size_type PayloadPerAllocation = SegmentManagerBase::PayloadPerAllocation; - //Flags - //align_only - static const bool AlignOnly = (Flags & adaptive_pool_flag::align_only) != 0; - typedef bool_<AlignOnly> IsAlignOnly; - typedef true_ AlignOnlyTrue; - typedef false_ AlignOnlyFalse; - //size_ordered - static const bool SizeOrdered = (Flags & adaptive_pool_flag::size_ordered) != 0; - typedef bool_<SizeOrdered> IsSizeOrdered; - typedef true_ SizeOrderedTrue; - typedef false_ SizeOrderedFalse; - //address_ordered - static const bool AddressOrdered = (Flags & adaptive_pool_flag::address_ordered) != 0; - typedef bool_<AddressOrdered> IsAddressOrdered; - typedef true_ AddressOrderedTrue; - typedef false_ AddressOrderedFalse; - - public: - typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain; - typedef typename SegmentManagerBase::size_type size_type; - - private: - typedef adaptive_pool_types - <multiallocation_chain, void_pointer, size_type, Flags> adaptive_pool_types_t; - typedef typename adaptive_pool_types_t::free_nodes_t free_nodes_t; - typedef typename adaptive_pool_types_t::block_info_t block_info_t; - typedef typename adaptive_pool_types_t::block_container_t block_container_t; - typedef typename adaptive_pool_types_t::block_container_traits_t block_container_traits_t; - typedef typename block_container_t::iterator block_iterator; - typedef typename block_container_t::const_iterator const_block_iterator; - typedef typename adaptive_pool_types_t::hdr_offset_holder hdr_offset_holder; - - static const size_type MaxAlign = alignment_of<void_pointer>::value; - static const size_type HdrSize = ((sizeof(block_info_t)-1)/MaxAlign+1)*MaxAlign; - static const size_type HdrOffsetSize = ((sizeof(hdr_offset_holder)-1)/MaxAlign+1)*MaxAlign; - - public: - //!Segment manager typedef - typedef SegmentManagerBase segment_manager_base_type; - - //!Constructor from a segment manager. Never throws - private_adaptive_node_pool_impl - ( segment_manager_base_type *segment_mngr_base - , size_type node_size - , size_type nodes_per_block - , size_type max_free_blocks - , unsigned char overhead_percent - ) - : m_max_free_blocks(max_free_blocks) - , m_real_node_size(lcm(node_size, size_type(alignment_of<void_pointer>::value))) - //Round the size to a power of two value. - //This is the total memory size (including payload) that we want to - //allocate from the general-purpose allocator - , m_real_block_alignment - (AlignOnly ? - upper_power_of_2(HdrSize + m_real_node_size*nodes_per_block) : - calculate_alignment( (size_type)overhead_percent, m_real_node_size - , HdrSize, HdrOffsetSize, PayloadPerAllocation)) - //This is the real number of nodes per block - , m_num_subblocks(0) - , m_real_num_node(AlignOnly ? (m_real_block_alignment - PayloadPerAllocation - HdrSize)/m_real_node_size : 0) - //General purpose allocator - , mp_segment_mngr_base(segment_mngr_base) - , m_block_container() - , m_totally_free_blocks(0) - { - if(!AlignOnly){ - calculate_num_subblocks - ( m_real_block_alignment - , m_real_node_size - , nodes_per_block - , m_num_subblocks - , m_real_num_node - , (size_type)overhead_percent - , HdrSize - , HdrOffsetSize - , PayloadPerAllocation); - } - } - - //!Destructor. Deallocates all allocated blocks. Never throws - ~private_adaptive_node_pool_impl() - { this->priv_clear(); } - - size_type get_real_num_node() const - { return m_real_num_node; } - - //!Returns the segment manager. Never throws - segment_manager_base_type* get_segment_manager_base()const - { return boost::movelib::to_raw_pointer(mp_segment_mngr_base); } - - //!Allocates array of count elements. Can throw - void *allocate_node() - { - this->priv_invariants(); - //If there are no free nodes we allocate a new block - if(!m_block_container.empty()){ - //We take the first free node the multiset can't be empty - free_nodes_t &free_nodes = m_block_container.begin()->free_nodes; - BOOST_ASSERT(!free_nodes.empty()); - const size_type free_nodes_count = free_nodes.size(); - void *first_node = boost::movelib::to_raw_pointer(free_nodes.pop_front()); - if(free_nodes.empty()){ - block_container_traits_t::erase_first(m_block_container); - } - m_totally_free_blocks -= static_cast<size_type>(free_nodes_count == m_real_num_node); - this->priv_invariants(); - return first_node; - } - else{ - multiallocation_chain chain; - this->priv_append_from_new_blocks(1, chain, IsAlignOnly()); - return boost::movelib::to_raw_pointer(chain.pop_front()); - } - } - - //!Deallocates an array pointed by ptr. Never throws - void deallocate_node(void *pElem) - { - this->priv_invariants(); - block_info_t &block_info = *this->priv_block_from_node(pElem); - BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node); - - //We put the node at the beginning of the free node list - block_info.free_nodes.push_back(void_pointer(pElem)); - - //The loop reinserts all blocks except the last one - this->priv_reinsert_block(block_info, block_info.free_nodes.size() == 1); - this->priv_deallocate_free_blocks(m_max_free_blocks); - this->priv_invariants(); - } - - //!Allocates n nodes. - //!Can throw - void allocate_nodes(const size_type n, multiallocation_chain &chain) - { - size_type i = 0; - BOOST_TRY{ - this->priv_invariants(); - while(i != n){ - //If there are no free nodes we allocate all needed blocks - if (m_block_container.empty()){ - this->priv_append_from_new_blocks(n - i, chain, IsAlignOnly()); - BOOST_ASSERT(m_block_container.empty() || (++m_block_container.cbegin() == m_block_container.cend())); - BOOST_ASSERT(chain.size() == n); - break; - } - free_nodes_t &free_nodes = m_block_container.begin()->free_nodes; - const size_type free_nodes_count_before = free_nodes.size(); - m_totally_free_blocks -= static_cast<size_type>(free_nodes_count_before == m_real_num_node); - const size_type num_left = n-i; - const size_type num_elems = (num_left < free_nodes_count_before) ? num_left : free_nodes_count_before; - typedef typename free_nodes_t::iterator free_nodes_iterator; - - if(num_left < free_nodes_count_before){ - const free_nodes_iterator it_bbeg(free_nodes.before_begin()); - free_nodes_iterator it_bend(it_bbeg); - for(size_type j = 0; j != num_elems; ++j){ - ++it_bend; - } - free_nodes_iterator it_end = it_bend; ++it_end; - free_nodes_iterator it_beg = it_bbeg; ++it_beg; - free_nodes.erase_after(it_bbeg, it_end, num_elems); - chain.incorporate_after(chain.last(), &*it_beg, &*it_bend, num_elems); - //chain.splice_after(chain.last(), free_nodes, it_bbeg, it_bend, num_elems); - BOOST_ASSERT(!free_nodes.empty()); - } - else{ - const free_nodes_iterator it_beg(free_nodes.begin()), it_bend(free_nodes.last()); - free_nodes.clear(); - chain.incorporate_after(chain.last(), &*it_beg, &*it_bend, num_elems); - block_container_traits_t::erase_first(m_block_container); - } - i += num_elems; - } - } - BOOST_CATCH(...){ - this->deallocate_nodes(chain); - BOOST_RETHROW - } - BOOST_CATCH_END - this->priv_invariants(); - } - - //!Deallocates a linked list of nodes. Never throws - void deallocate_nodes(multiallocation_chain &nodes) - { - this->priv_invariants(); - //To take advantage of node locality, wait until two - //nodes belong to different blocks. Only then reinsert - //the block of the first node in the block tree. - //Cache of the previous block - block_info_t *prev_block_info = 0; - - //If block was empty before this call, it's not already - //inserted in the block tree. - bool prev_block_was_empty = false; - typedef typename free_nodes_t::iterator free_nodes_iterator; - { - const free_nodes_iterator itbb(nodes.before_begin()), ite(nodes.end()); - free_nodes_iterator itf(nodes.begin()), itbf(itbb); - size_type splice_node_count = size_type(-1); - while(itf != ite){ - void *pElem = boost::movelib::to_raw_pointer(boost::movelib::iterator_to_raw_pointer(itf)); - block_info_t &block_info = *this->priv_block_from_node(pElem); - BOOST_ASSERT(block_info.free_nodes.size() < m_real_num_node); - ++splice_node_count; - - //If block change is detected calculate the cached block position in the tree - if(&block_info != prev_block_info){ - if(prev_block_info){ //Make sure we skip the initial "dummy" cache - free_nodes_iterator it(itbb); ++it; - nodes.erase_after(itbb, itf, splice_node_count); - prev_block_info->free_nodes.incorporate_after(prev_block_info->free_nodes.last(), &*it, &*itbf, splice_node_count); - this->priv_reinsert_block(*prev_block_info, prev_block_was_empty); - splice_node_count = 0; - } - //Update cache with new data - prev_block_was_empty = block_info.free_nodes.empty(); - prev_block_info = &block_info; - } - itbf = itf; - ++itf; - } - } - if(prev_block_info){ - //The loop reinserts all blocks except the last one - const free_nodes_iterator itfirst(nodes.begin()), itlast(nodes.last()); - const size_type splice_node_count = nodes.size(); - nodes.clear(); - prev_block_info->free_nodes.incorporate_after(prev_block_info->free_nodes.last(), &*itfirst, &*itlast, splice_node_count); - this->priv_reinsert_block(*prev_block_info, prev_block_was_empty); - this->priv_invariants(); - this->priv_deallocate_free_blocks(m_max_free_blocks); - } - } - - void deallocate_free_blocks() - { this->priv_deallocate_free_blocks(0); } - - size_type num_free_nodes() - { - typedef typename block_container_t::const_iterator citerator; - size_type count = 0; - citerator it (m_block_container.begin()), itend(m_block_container.end()); - for(; it != itend; ++it){ - count += it->free_nodes.size(); - } - return count; - } - - void swap(private_adaptive_node_pool_impl &other) - { - BOOST_ASSERT(m_max_free_blocks == other.m_max_free_blocks); - BOOST_ASSERT(m_real_node_size == other.m_real_node_size); - BOOST_ASSERT(m_real_block_alignment == other.m_real_block_alignment); - BOOST_ASSERT(m_real_num_node == other.m_real_num_node); - std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base); - std::swap(m_totally_free_blocks, other.m_totally_free_blocks); - m_block_container.swap(other.m_block_container); - } - - //Deprecated, use deallocate_free_blocks - void deallocate_free_chunks() - { this->priv_deallocate_free_blocks(0); } - - private: - - void priv_deallocate_free_blocks(size_type max_free_blocks) - { //Trampoline function to ease inlining - if(m_totally_free_blocks > max_free_blocks){ - this->priv_deallocate_free_blocks_impl(max_free_blocks); - } - } - - void priv_deallocate_free_blocks_impl(size_type max_free_blocks) - { - this->priv_invariants(); - //Now check if we've reached the free nodes limit - //and check if we have free blocks. If so, deallocate as much - //as we can to stay below the limit - multiallocation_chain chain; - { - const const_block_iterator itend = m_block_container.cend(); - const_block_iterator it = itend; - --it; - size_type totally_free_blocks = m_totally_free_blocks; - - for( ; totally_free_blocks > max_free_blocks; --totally_free_blocks){ - BOOST_ASSERT(it->free_nodes.size() == m_real_num_node); - void *addr = priv_first_subblock_from_block(const_cast<block_info_t*>(&*it)); - --it; - block_container_traits_t::erase_last(m_block_container); - chain.push_front(void_pointer(addr)); - } - BOOST_ASSERT((m_totally_free_blocks - max_free_blocks) == chain.size()); - m_totally_free_blocks = max_free_blocks; - } - this->mp_segment_mngr_base->deallocate_many(chain); - } - - void priv_reinsert_block(block_info_t &prev_block_info, const bool prev_block_was_empty) - { - //Cache the free nodes from the block - const size_type this_block_free_nodes = prev_block_info.free_nodes.size(); - const bool is_full = this_block_free_nodes == m_real_num_node; - - //Update free block count - m_totally_free_blocks += static_cast<size_type>(is_full); - if(prev_block_was_empty){ - block_container_traits_t::insert_was_empty(m_block_container, prev_block_info, is_full); - } - else{ - block_container_traits_t::reinsert_was_used(m_block_container, prev_block_info, is_full); - } - } - - class block_destroyer; - friend class block_destroyer; - - class block_destroyer - { - public: - block_destroyer(const this_type *impl, multiallocation_chain &chain) - : mp_impl(impl), m_chain(chain) - {} - - void operator()(typename block_container_t::pointer to_deallocate) - { return this->do_destroy(to_deallocate, IsAlignOnly()); } - - private: - void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyTrue) - { - BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node); - m_chain.push_back(to_deallocate); - } - - void do_destroy(typename block_container_t::pointer to_deallocate, AlignOnlyFalse) - { - BOOST_ASSERT(to_deallocate->free_nodes.size() == mp_impl->m_real_num_node); - BOOST_ASSERT(0 == to_deallocate->hdr_offset); - hdr_offset_holder *hdr_off_holder = - mp_impl->priv_first_subblock_from_block(boost::movelib::to_raw_pointer(to_deallocate)); - m_chain.push_back(hdr_off_holder); - } - - const this_type *mp_impl; - multiallocation_chain &m_chain; - }; - - //This macro will activate invariant checking. Slow, but helpful for debugging the code. - //#define BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS - void priv_invariants() - #ifdef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS - #undef BOOST_CONTAINER_ADAPTIVE_NODE_POOL_CHECK_INVARIANTS - { - const const_block_iterator itend(m_block_container.end()); - - { //We iterate through the block tree to free the memory - const_block_iterator it(m_block_container.begin()); - - if(it != itend){ - for(++it; it != itend; ++it){ - const_block_iterator prev(it); - --prev; - BOOST_ASSERT(*prev < *it); - (void)prev; (void)it; - } - } - } - { //Check that the total free nodes are correct - const_block_iterator it(m_block_container.cbegin()); - size_type total_free_nodes = 0; - for(; it != itend; ++it){ - total_free_nodes += it->free_nodes.size(); - } - BOOST_ASSERT(total_free_nodes >= m_totally_free_blocks*m_real_num_node); - } - { //Check that the total totally free blocks are correct - BOOST_ASSERT(m_block_container.size() >= m_totally_free_blocks); - const_block_iterator it = m_block_container.cend(); - size_type total_free_blocks = m_totally_free_blocks; - while(total_free_blocks--){ - BOOST_ASSERT((--it)->free_nodes.size() == m_real_num_node); - } - } - - if(!AlignOnly){ - //Check that header offsets are correct - const_block_iterator it = m_block_container.begin(); - for(; it != itend; ++it){ - hdr_offset_holder *hdr_off_holder = this->priv_first_subblock_from_block(const_cast<block_info_t *>(&*it)); - for(size_type i = 0, max = m_num_subblocks; i < max; ++i){ - const size_type offset = reinterpret_cast<char*>(const_cast<block_info_t *>(&*it)) - reinterpret_cast<char*>(hdr_off_holder); - BOOST_ASSERT(hdr_off_holder->hdr_offset == offset); - BOOST_ASSERT(0 == ((size_type)hdr_off_holder & (m_real_block_alignment - 1))); - BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); - hdr_off_holder = reinterpret_cast<hdr_offset_holder *>(reinterpret_cast<char*>(hdr_off_holder) + m_real_block_alignment); - } - } - } - } - #else - {} //empty - #endif - - //!Deallocates all used memory. Never throws - void priv_clear() - { - #ifndef NDEBUG - block_iterator it = m_block_container.begin(); - block_iterator itend = m_block_container.end(); - size_type n_free_nodes = 0; - for(; it != itend; ++it){ - //Check for memory leak - BOOST_ASSERT(it->free_nodes.size() == m_real_num_node); - ++n_free_nodes; - } - BOOST_ASSERT(n_free_nodes == m_totally_free_blocks); - #endif - //Check for memory leaks - this->priv_invariants(); - multiallocation_chain chain; - m_block_container.clear_and_dispose(block_destroyer(this, chain)); - this->mp_segment_mngr_base->deallocate_many(chain); - m_totally_free_blocks = 0; - } - - block_info_t *priv_block_from_node(void *node, AlignOnlyFalse) const - { - hdr_offset_holder *hdr_off_holder = - reinterpret_cast<hdr_offset_holder*>((std::size_t)node & size_type(~(m_real_block_alignment - 1))); - BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); - BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); - block_info_t *block = reinterpret_cast<block_info_t *> - (reinterpret_cast<char*>(hdr_off_holder) + hdr_off_holder->hdr_offset); - BOOST_ASSERT(block->hdr_offset == 0); - return block; - } - - block_info_t *priv_block_from_node(void *node, AlignOnlyTrue) const - { - return (block_info_t *)((std::size_t)node & std::size_t(~(m_real_block_alignment - 1))); - } - - block_info_t *priv_block_from_node(void *node) const - { return this->priv_block_from_node(node, IsAlignOnly()); } - - hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block) const - { return this->priv_first_subblock_from_block(block, IsAlignOnly()); } - - hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, AlignOnlyFalse) const - { - hdr_offset_holder *const hdr_off_holder = reinterpret_cast<hdr_offset_holder*> - (reinterpret_cast<char*>(block) - (m_num_subblocks-1)*m_real_block_alignment); - BOOST_ASSERT(hdr_off_holder->hdr_offset == size_type(reinterpret_cast<char*>(block) - reinterpret_cast<char*>(hdr_off_holder))); - BOOST_ASSERT(0 == ((std::size_t)hdr_off_holder & (m_real_block_alignment - 1))); - BOOST_ASSERT(0 == (hdr_off_holder->hdr_offset & (m_real_block_alignment - 1))); - return hdr_off_holder; - } - - hdr_offset_holder *priv_first_subblock_from_block(block_info_t *block, AlignOnlyTrue) const - { - return reinterpret_cast<hdr_offset_holder*>(block); - } - - void priv_dispatch_block_chain_or_free - ( multiallocation_chain &chain, block_info_t &c_info, size_type num_node - , char *mem_address, size_type total_elements, bool insert_block_if_free) - { - BOOST_ASSERT(chain.size() <= total_elements); - //First add all possible nodes to the chain - const size_type left = total_elements - chain.size(); - const size_type max_chain = (num_node < left) ? num_node : left; - mem_address = static_cast<char *>(boost::movelib::to_raw_pointer - (chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, max_chain))); - //Now store remaining nodes in the free list - if(const size_type max_free = num_node - max_chain){ - free_nodes_t & free_nodes = c_info.free_nodes; - free_nodes.incorporate_after(free_nodes.last(), void_pointer(mem_address), m_real_node_size, max_free); - if(insert_block_if_free){ - m_block_container.push_front(c_info); - } - } - } - - //!Allocates a several blocks of nodes. Can throw - void priv_append_from_new_blocks(size_type min_elements, multiallocation_chain &chain, AlignOnlyTrue) - { - BOOST_ASSERT(m_block_container.empty()); - BOOST_ASSERT(min_elements > 0); - const size_type n = (min_elements - 1)/m_real_num_node + 1; - const size_type real_block_size = m_real_block_alignment - PayloadPerAllocation; - const size_type total_elements = chain.size() + min_elements; - for(size_type i = 0; i != n; ++i){ - //We allocate a new NodeBlock and put it the last - //element of the tree - char *mem_address = static_cast<char*> - (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment)); - if(!mem_address){ - //In case of error, free memory deallocating all nodes (the new ones allocated - //in this function plus previously stored nodes in chain). - this->deallocate_nodes(chain); - throw_bad_alloc(); - } - block_info_t &c_info = *new(mem_address)block_info_t(); - mem_address += HdrSize; - if(i != (n-1)){ - chain.incorporate_after(chain.last(), void_pointer(mem_address), m_real_node_size, m_real_num_node); - } - else{ - this->priv_dispatch_block_chain_or_free(chain, c_info, m_real_num_node, mem_address, total_elements, true); - } - } - } - - void priv_append_from_new_blocks(size_type min_elements, multiallocation_chain &chain, AlignOnlyFalse) - { - BOOST_ASSERT(m_block_container.empty()); - BOOST_ASSERT(min_elements > 0); - const size_type n = (min_elements - 1)/m_real_num_node + 1; - const size_type real_block_size = m_real_block_alignment*m_num_subblocks - PayloadPerAllocation; - const size_type elements_per_subblock = (m_real_block_alignment - HdrOffsetSize)/m_real_node_size; - const size_type hdr_subblock_elements = (m_real_block_alignment - HdrSize - PayloadPerAllocation)/m_real_node_size; - const size_type total_elements = chain.size() + min_elements; - - for(size_type i = 0; i != n; ++i){ - //We allocate a new NodeBlock and put it the last - //element of the tree - char *mem_address = static_cast<char*> - (mp_segment_mngr_base->allocate_aligned(real_block_size, m_real_block_alignment)); - if(!mem_address){ - //In case of error, free memory deallocating all nodes (the new ones allocated - //in this function plus previously stored nodes in chain). - this->deallocate_nodes(chain); - throw_bad_alloc(); - } - //First initialize header information on the last subblock - char *hdr_addr = mem_address + m_real_block_alignment*(m_num_subblocks-1); - block_info_t &c_info = *new(hdr_addr)block_info_t(); - //Some structural checks - BOOST_ASSERT(static_cast<void*>(&static_cast<hdr_offset_holder&>(c_info).hdr_offset) == - static_cast<void*>(&c_info)); (void)c_info; - if(i != (n-1)){ - for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1 - ; subblock < maxsubblock - ; ++subblock, mem_address += m_real_block_alignment){ - //Initialize header offset mark - new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address)); - chain.incorporate_after - (chain.last(), void_pointer(mem_address + HdrOffsetSize), m_real_node_size, elements_per_subblock); - } - chain.incorporate_after(chain.last(), void_pointer(hdr_addr + HdrSize), m_real_node_size, hdr_subblock_elements); - } - else{ - for( size_type subblock = 0, maxsubblock = m_num_subblocks - 1 - ; subblock < maxsubblock - ; ++subblock, mem_address += m_real_block_alignment){ - //Initialize header offset mark - new(mem_address) hdr_offset_holder(size_type(hdr_addr - mem_address)); - this->priv_dispatch_block_chain_or_free - (chain, c_info, elements_per_subblock, mem_address + HdrOffsetSize, total_elements, false); - } - this->priv_dispatch_block_chain_or_free - (chain, c_info, hdr_subblock_elements, hdr_addr + HdrSize, total_elements, true); - } - } - } - - private: - typedef typename boost::intrusive::pointer_traits - <void_pointer>::template rebind_pointer<segment_manager_base_type>::type segment_mngr_base_ptr_t; - const size_type m_max_free_blocks; - const size_type m_real_node_size; - //Round the size to a power of two value. - //This is the total memory size (including payload) that we want to - //allocate from the general-purpose allocator - const size_type m_real_block_alignment; - size_type m_num_subblocks; - //This is the real number of nodes per block - //const - size_type m_real_num_node; - segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager - block_container_t m_block_container; //Intrusive block list - size_type m_totally_free_blocks; //Free blocks -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP diff --git a/contrib/restricted/boost/boost/container/detail/container_or_allocator_rebind.hpp b/contrib/restricted/boost/boost/container/detail/container_or_allocator_rebind.hpp deleted file mode 100644 index d74df6c966..0000000000 --- a/contrib/restricted/boost/boost/container/detail/container_or_allocator_rebind.hpp +++ /dev/null @@ -1,49 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP -#define BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/allocator_traits.hpp> -#include <boost/container/detail/container_rebind.hpp> -#include <boost/container/detail/is_container.hpp> - -namespace boost { -namespace container { -namespace dtl { - -template<class AllocatorOrContainer, class ToType, bool = is_container<AllocatorOrContainer>::value> -struct container_or_allocator_rebind_impl - : container_rebind<AllocatorOrContainer, ToType> -{}; - -template<class AllocatorOrContainer, class ToType> -struct container_or_allocator_rebind_impl<AllocatorOrContainer, ToType, false> - : allocator_traits<AllocatorOrContainer>::template portable_rebind_alloc<ToType> - -{}; - -template<class AllocatorOrContainer, class ToType> -struct container_or_allocator_rebind - : container_or_allocator_rebind_impl<AllocatorOrContainer, ToType> -{}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_OR_ALLOCATOR_REBIND_HPP diff --git a/contrib/restricted/boost/boost/container/detail/container_rebind.hpp b/contrib/restricted/boost/boost/container/detail/container_rebind.hpp deleted file mode 100644 index 0ebb4789e4..0000000000 --- a/contrib/restricted/boost/boost/container/detail/container_rebind.hpp +++ /dev/null @@ -1,258 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP -#define BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/allocator_traits.hpp> - - -namespace boost { -namespace container { -namespace dtl { - - template <class Cont, class U> - struct container_rebind; - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template <template <class, class, class...> class Cont, typename V, typename A, class... An, class U> - struct container_rebind<Cont<V, A, An...>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, An...> type; - }; - - //Needed for non-conforming compilers like GCC 4.3 - template <template <class, class> class Cont, typename V, typename A, class U> - struct container_rebind<Cont<V, A>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type; - }; - - template <template <class> class Cont, typename V, class U> - struct container_rebind<Cont<V>, U> - { - typedef Cont<U> type; - }; - - //for small_vector,static_vector - - template <template <class, std::size_t, class, class...> class Cont, typename V, std::size_t N, typename A, class... An, class U> - struct container_rebind<Cont<V, N, A, An...>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, An...> type; - }; - - //Needed for non-conforming compilers like GCC 4.3 - template <template <class, std::size_t, class> class Cont, typename V, std::size_t N, typename A, class U> - struct container_rebind<Cont<V, N, A>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type; - }; - - template <template <class, std::size_t> class Cont, typename V, std::size_t N, class U> - struct container_rebind<Cont<V, N>, U> - { - typedef Cont<U, N> type; - }; - -#else //C++03 compilers - - template <template <class> class Cont //0arg - , typename V - , class U> - struct container_rebind<Cont<V>, U> - { - typedef Cont<U> type; - }; - - template <template <class, class> class Cont //0arg - , typename V, typename A - , class U> - struct container_rebind<Cont<V, A>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type; - }; - - template <template <class, class, class> class Cont //1arg - , typename V, typename A, class P0 - , class U> - struct container_rebind<Cont<V, A, P0>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0> type; - }; - - template <template <class, class, class, class> class Cont //2arg - , typename V, typename A, class P0, class P1 - , class U> - struct container_rebind<Cont<V, A, P0, P1>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1> type; - }; - - template <template <class, class, class, class, class> class Cont //3arg - , typename V, typename A, class P0, class P1, class P2 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2> type; - }; - - template <template <class, class, class, class, class, class> class Cont //4arg - , typename V, typename A, class P0, class P1, class P2, class P3 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2, P3>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type; - }; - - template <template <class, class, class, class, class, class, class> class Cont //5arg - , typename V, typename A, class P0, class P1, class P2, class P3, class P4 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type; - }; - - template <template <class, class, class, class, class, class, class, class> class Cont //6arg - , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type; - }; - - template <template <class, class, class, class, class, class, class, class, class> class Cont //7arg - , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type; - }; - - template <template <class, class, class, class, class, class, class, class, class, class> class Cont //8arg - , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type; - }; - - template <template <class, class, class, class, class, class, class, class, class, class, class> class Cont //9arg - , typename V, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8 - , class U> - struct container_rebind<Cont<V, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U> - { - typedef Cont<U, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type; - }; - - //For small_vector/static_vector - template <template <class, std::size_t> class Cont //0arg - , typename V, std::size_t N - , class U> - struct container_rebind<Cont<V, N>, U> - { - typedef Cont<U, N> type; - }; - - template <template <class, std::size_t, class> class Cont //0arg - , typename V, std::size_t N, typename A - , class U> - struct container_rebind<Cont<V, N, A>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type> type; - }; - - template <template <class, std::size_t, class, class> class Cont //1arg - , typename V, std::size_t N, typename A, class P0 - , class U> - struct container_rebind<Cont<V, N, A, P0>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0> type; - }; - - template <template <class, std::size_t, class, class, class> class Cont //2arg - , typename V, std::size_t N, typename A, class P0, class P1 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1> type; - }; - - template <template <class, std::size_t, class, class, class, class> class Cont //3arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2> type; - }; - - template <template <class, std::size_t, class, class, class, class, class> class Cont //4arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2, P3>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3> type; - }; - - template <template <class, std::size_t, class, class, class, class, class, class> class Cont //5arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4> type; - }; - - template <template <class, std::size_t, class, class, class, class, class, class, class> class Cont //6arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5> type; - }; - - template <template <class, std::size_t, class, class, class, class, class, class, class, class> class Cont //7arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6> type; - }; - - template <template <class, std::size_t, class, class, class, class, class, class, class, class, class> class Cont //8arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6, P7>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7> type; - }; - - template <template <class, std::size_t, class, class, class, class, class, class, class, class, class, class> class Cont //9arg - , typename V, std::size_t N, typename A, class P0, class P1, class P2, class P3, class P4, class P5, class P6, class P7, class P8 - , class U> - struct container_rebind<Cont<V, N, A, P0, P1, P2, P3, P4, P5, P6, P7, P8>, U> - { - typedef Cont<U, N, typename allocator_traits<A>::template portable_rebind_alloc<U>::type, P0, P1, P2, P3, P4, P5, P6, P7, P8> type; - }; - -#endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_CONTAINER_REBIND_HPP diff --git a/contrib/restricted/boost/boost/container/detail/flat_tree.hpp b/contrib/restricted/boost/boost/container/detail/flat_tree.hpp deleted file mode 100644 index 5f212e3fc8..0000000000 --- a/contrib/restricted/boost/boost/container/detail/flat_tree.hpp +++ /dev/null @@ -1,1539 +0,0 @@ -//////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -//////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_FLAT_TREE_HPP -#define BOOST_CONTAINER_FLAT_TREE_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -#include <boost/container/container_fwd.hpp> - -#include <boost/move/utility_core.hpp> - -#include <boost/container/detail/pair.hpp> -#include <boost/container/vector.hpp> -#include <boost/container/allocator_traits.hpp> - -#include <boost/container/detail/value_init.hpp> -#include <boost/container/detail/destroyers.hpp> -#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare -#include <boost/container/detail/iterator.hpp> -#include <boost/container/detail/is_sorted.hpp> -#include <boost/container/detail/type_traits.hpp> -#include <boost/container/detail/iterators.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/is_contiguous_container.hpp> -#include <boost/container/detail/is_container.hpp> - -#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair - -#include <boost/move/make_unique.hpp> -#include <boost/move/iterator.hpp> -#include <boost/move/adl_move_swap.hpp> -#include <boost/move/algo/adaptive_sort.hpp> -#include <boost/move/algo/detail/pdqsort.hpp> - -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -#include <boost/move/detail/fwd_macros.hpp> -#endif - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//merge_unique -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge_unique -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -//merge_equal -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME merge -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 3 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 3 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -//index_of -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME index_of -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -//nth -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME nth -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -//reserve -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME reserve -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 1 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 1 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -//capacity -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME capacity -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace dtl { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace boost { -namespace container { -namespace dtl { - -/////////////////////////////////////// -// -// Helper functions to merge elements -// -/////////////////////////////////////// - -BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(stored_allocator_type) - -/////////////////////////////////////// -// -// flat_tree_container_inplace_merge -// -/////////////////////////////////////// -template<class SequenceContainer, class Compare> -void flat_tree_container_inplace_merge //is_contiguous_container == true - (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp , dtl::true_) -{ - typedef typename SequenceContainer::value_type value_type; - value_type *const braw = boost::movelib::iterator_to_raw_pointer(dest.begin()); - value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); - value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); - boost::movelib::adaptive_merge(braw, iraw, eraw, comp, eraw, dest.capacity()- dest.size()); -} - -template<class SequenceContainer, class Compare> -void flat_tree_container_inplace_merge //is_contiguous_container == false - (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp, dtl::false_) -{ - boost::movelib::adaptive_merge(dest.begin(), it, dest.end(), comp); -} - -/////////////////////////////////////// -// -// flat_tree_container_inplace_sort_ending -// -/////////////////////////////////////// -template<class SequenceContainer, class Compare> -void flat_tree_container_inplace_sort_ending //is_contiguous_container == true - (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp, dtl::true_) -{ - typedef typename SequenceContainer::value_type value_type; - value_type *const iraw = boost::movelib::iterator_to_raw_pointer(it); - value_type *const eraw = boost::movelib::iterator_to_raw_pointer(dest.end()); - boost::movelib::adaptive_sort(iraw, eraw, comp, eraw, dest.capacity()- dest.size()); -} - -template<class SequenceContainer, class Compare> -void flat_tree_container_inplace_sort_ending //is_contiguous_container == false - (SequenceContainer& dest, typename SequenceContainer::iterator it, Compare comp , dtl::false_) -{ - boost::movelib::adaptive_sort(it, dest.end(), comp); -} - -/////////////////////////////////////// -// -// flat_tree_merge -// -/////////////////////////////////////// -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::true_) -{ - dest.merge(first, last, comp); -} - -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_equal //has_merge_unique == false - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_) -{ - typedef typename SequenceContainer::iterator iterator; - iterator const it = dest.insert( dest.end(), first, last ); - dtl::bool_<is_contiguous_container<SequenceContainer>::value> contiguous_tag; - (flat_tree_container_inplace_merge)(dest, it, comp, contiguous_tag); -} - -/////////////////////////////////////// -// -// flat_tree_merge_unique -// -/////////////////////////////////////// -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == true - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::true_) -{ - dest.merge_unique(first, last, comp); -} - -template<class SequenceContainer, class Iterator, class Compare> -BOOST_CONTAINER_FORCEINLINE void flat_tree_merge_unique //has_merge_unique == false - (SequenceContainer& dest, Iterator first, Iterator last, Compare comp, dtl::false_) -{ - typedef typename SequenceContainer::iterator iterator; - typedef typename SequenceContainer::size_type size_type; - - size_type const old_sz = dest.size(); - iterator const first_new = dest.insert(dest.cend(), first, last ); - iterator e = boost::movelib::inplace_set_difference(first_new, dest.end(), dest.begin(), first_new, comp); - dest.erase(e, dest.end()); - dtl::bool_<is_contiguous_container<SequenceContainer>::value> contiguous_tag; - (flat_tree_container_inplace_merge)(dest, dest.begin()+old_sz, comp, contiguous_tag); -} - -/////////////////////////////////////// -// -// flat_tree_index_of -// -/////////////////////////////////////// -template<class SequenceContainer, class Iterator> -BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_index_of // has_index_of == true - (SequenceContainer& cont, Iterator p, dtl::true_) -{ - return cont.index_of(p); -} - -template<class SequenceContainer, class Iterator> -BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_index_of // has_index_of == false - (SequenceContainer& cont, Iterator p, dtl::false_) -{ - typedef typename SequenceContainer::size_type size_type; - return static_cast<size_type>(p - cont.begin()); -} - -/////////////////////////////////////// -// -// flat_tree_nth -// -/////////////////////////////////////// -template<class Iterator, class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE Iterator - flat_tree_nth // has_nth == true - (SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::true_) -{ - return cont.nth(n); -} - -template<class Iterator, class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE Iterator - flat_tree_nth // has_nth == false - (SequenceContainer& cont, typename SequenceContainer::size_type n, dtl::false_) -{ - return cont.begin()+ n; -} - -/////////////////////////////////////// -// -// flat_tree_get_stored_allocator -// -/////////////////////////////////////// -template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::stored_allocator_type & - flat_tree_get_stored_allocator // has_get_stored_allocator == true - (SequenceContainer& cont, dtl::true_) -{ - return cont.get_stored_allocator(); -} - -template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE const typename SequenceContainer::stored_allocator_type & - flat_tree_get_stored_allocator // has_get_stored_allocator == true - (const SequenceContainer& cont, dtl::true_) -{ - return cont.get_stored_allocator(); -} - -template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::allocator_type - flat_tree_get_stored_allocator // has_get_stored_allocator == false - (SequenceContainer& cont, dtl::false_) -{ - return cont.get_allocator(); -} - -/////////////////////////////////////// -// -// flat_tree_adopt_sequence_equal -// -/////////////////////////////////////// -template<class SequenceContainer, class Compare> -void flat_tree_sort_contiguous_to_adopt // is_contiguous_container == true - (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp) -{ - if(tseq.capacity() >= (seq.capacity() - seq.size())) { - tseq.clear(); - boost::movelib::adaptive_sort - (boost::movelib::iterator_to_raw_pointer(seq.begin()) - , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp - , boost::movelib::iterator_to_raw_pointer(tseq.begin()) - , tseq.capacity()); - } - else{ - boost::movelib::adaptive_sort - (boost::movelib::iterator_to_raw_pointer(seq.begin()) - , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp - , boost::movelib::iterator_to_raw_pointer(seq.end()) - , seq.capacity() - seq.size()); - } -} - -template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_equal // is_contiguous_container == true - (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::true_) -{ - flat_tree_sort_contiguous_to_adopt(tseq, boost::move(seq), comp); - tseq = boost::move(seq); -} - -template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_equal // is_contiguous_container == false - (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::false_) -{ - boost::movelib::adaptive_sort(seq.begin(), seq.end(), comp); - tseq = boost::move(seq); -} - -/////////////////////////////////////// -// -// flat_tree_adopt_sequence_unique -// -/////////////////////////////////////// -template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_unique// is_contiguous_container == true - (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::true_) -{ - boost::movelib::pdqsort - ( boost::movelib::iterator_to_raw_pointer(seq.begin()) - , boost::movelib::iterator_to_raw_pointer(seq.end()) - , comp); - seq.erase(boost::movelib::unique - (seq.begin(), seq.end(), boost::movelib::negate<Compare>(comp)), seq.cend()); - tseq = boost::move(seq); -} - -template<class SequenceContainer, class Compare> -void flat_tree_adopt_sequence_unique// is_contiguous_container == false - (SequenceContainer &tseq, BOOST_RV_REF(SequenceContainer) seq, Compare comp, dtl::false_) -{ - boost::movelib::pdqsort(seq.begin(), seq.end(), comp); - seq.erase(boost::movelib::unique - (seq.begin(), seq.end(), boost::movelib::negate<Compare>(comp)), seq.cend()); - tseq = boost::move(seq); -} - -/////////////////////////////////////// -// -// flat_tree_reserve -// -/////////////////////////////////////// -template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE void // has_reserve == true - flat_tree_reserve(SequenceContainer &tseq, typename SequenceContainer::size_type cap, dtl::true_) -{ - tseq.reserve(cap); -} - -template<class SequenceContainer> -BOOST_CONTAINER_FORCEINLINE void // has_reserve == false - flat_tree_reserve(SequenceContainer &, typename SequenceContainer::size_type, dtl::false_) -{ -} - -/////////////////////////////////////// -// -// flat_tree_capacity -// -/////////////////////////////////////// -template<class SequenceContainer> // has_capacity == true -BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_capacity(const SequenceContainer &tseq, dtl::true_) -{ - return tseq.capacity(); -} - -template<class SequenceContainer> // has_capacity == false -BOOST_CONTAINER_FORCEINLINE typename SequenceContainer::size_type - flat_tree_capacity(const SequenceContainer &tseq, dtl::false_) -{ - return tseq.size(); -} - -/////////////////////////////////////// -// -// flat_tree_value_compare -// -/////////////////////////////////////// - -template<class Compare, class Value, class KeyOfValue> -class flat_tree_value_compare - : private Compare -{ - typedef Value first_argument_type; - typedef Value second_argument_type; - typedef bool return_type; - public: - flat_tree_value_compare() - : Compare() - {} - - flat_tree_value_compare(const Compare &pred) - : Compare(pred) - {} - - bool operator()(const Value& lhs, const Value& rhs) const - { - KeyOfValue key_extract; - return Compare::operator()(key_extract(lhs), key_extract(rhs)); - } - - const Compare &get_comp() const - { return *this; } - - Compare &get_comp() - { return *this; } -}; - -/////////////////////////////////////// -// -// select_container_type -// -/////////////////////////////////////// -template < class Value, class AllocatorOrContainer - , bool = boost::container::dtl::is_container<AllocatorOrContainer>::value > -struct select_container_type -{ - typedef AllocatorOrContainer type; -}; - -template <class Value, class AllocatorOrContainer> -struct select_container_type<Value, AllocatorOrContainer, false> -{ - typedef boost::container::vector<Value, AllocatorOrContainer> type; -}; - - -/////////////////////////////////////// -// -// flat_tree -// -/////////////////////////////////////// -template <class Value, class KeyOfValue, - class Compare, class AllocatorOrContainer> -class flat_tree -{ - public: - typedef typename select_container_type<Value, AllocatorOrContainer>::type container_type; - typedef container_type sequence_type; //For backwards compatibility - - private: - typedef typename container_type::allocator_type allocator_t; - typedef allocator_traits<allocator_t> allocator_traits_type; - - public: - typedef flat_tree_value_compare<Compare, Value, KeyOfValue> value_compare; - - private: - - struct Data - //Inherit from value_compare to do EBO - : public value_compare - { - BOOST_COPYABLE_AND_MOVABLE(Data) - - public: - Data() - : value_compare(), m_seq() - {} - - explicit Data(const allocator_t &alloc) - : value_compare(), m_seq(alloc) - {} - - explicit Data(const Compare &comp) - : value_compare(comp), m_seq() - {} - - Data(const Compare &comp, const allocator_t &alloc) - : value_compare(comp), m_seq(alloc) - {} - - explicit Data(const Data &d) - : value_compare(static_cast<const value_compare&>(d)), m_seq(d.m_seq) - {} - - Data(BOOST_RV_REF(Data) d) - : value_compare(boost::move(static_cast<value_compare&>(d))), m_seq(boost::move(d.m_seq)) - {} - - Data(const Data &d, const allocator_t &a) - : value_compare(static_cast<const value_compare&>(d)), m_seq(d.m_seq, a) - {} - - Data(BOOST_RV_REF(Data) d, const allocator_t &a) - : value_compare(boost::move(static_cast<value_compare&>(d))), m_seq(boost::move(d.m_seq), a) - {} - - Data& operator=(BOOST_COPY_ASSIGN_REF(Data) d) - { - this->value_compare::operator=(d); - m_seq = d.m_seq; - return *this; - } - - Data& operator=(BOOST_RV_REF(Data) d) - { - this->value_compare::operator=(boost::move(static_cast<value_compare &>(d))); - m_seq = boost::move(d.m_seq); - return *this; - } - - void swap(Data &d) - { - value_compare& mycomp = *this, & othercomp = d; - boost::adl_move_swap(mycomp, othercomp); - this->m_seq.swap(d.m_seq); - } - - container_type m_seq; - }; - - Data m_data; - BOOST_COPYABLE_AND_MOVABLE(flat_tree) - - public: - - typedef typename container_type::value_type value_type; - typedef typename container_type::pointer pointer; - typedef typename container_type::const_pointer const_pointer; - typedef typename container_type::reference reference; - typedef typename container_type::const_reference const_reference; - typedef typename KeyOfValue::type key_type; - typedef Compare key_compare; - typedef typename container_type::allocator_type allocator_type; - typedef typename container_type::size_type size_type; - typedef typename container_type::difference_type difference_type; - typedef typename container_type::iterator iterator; - typedef typename container_type::const_iterator const_iterator; - typedef typename container_type::reverse_iterator reverse_iterator; - typedef typename container_type::const_reverse_iterator const_reverse_iterator; - - //!Standard extension - typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT - (boost::container::dtl::, container_type - ,stored_allocator_type, allocator_type) stored_allocator_type; - - static const bool has_stored_allocator_type = - BOOST_INTRUSIVE_HAS_TYPE(boost::container::dtl::, container_type, stored_allocator_type); - - private: - typedef allocator_traits<stored_allocator_type> stored_allocator_traits; - - public: - typedef typename dtl::if_c - <has_stored_allocator_type, const stored_allocator_type &, allocator_type>::type get_stored_allocator_const_return_t; - - typedef typename dtl::if_c - <has_stored_allocator_type, stored_allocator_type &, allocator_type>::type get_stored_allocator_noconst_return_t; - - BOOST_CONTAINER_FORCEINLINE flat_tree() - : m_data() - { } - - BOOST_CONTAINER_FORCEINLINE explicit flat_tree(const Compare& comp) - : m_data(comp) - { } - - BOOST_CONTAINER_FORCEINLINE explicit flat_tree(const allocator_type& a) - : m_data(a) - { } - - BOOST_CONTAINER_FORCEINLINE flat_tree(const Compare& comp, const allocator_type& a) - : m_data(comp, a) - { } - - BOOST_CONTAINER_FORCEINLINE flat_tree(const flat_tree& x) - : m_data(x.m_data) - { } - - BOOST_CONTAINER_FORCEINLINE flat_tree(BOOST_RV_REF(flat_tree) x) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) - : m_data(boost::move(x.m_data)) - { } - - BOOST_CONTAINER_FORCEINLINE flat_tree(const flat_tree& x, const allocator_type &a) - : m_data(x.m_data, a) - { } - - BOOST_CONTAINER_FORCEINLINE flat_tree(BOOST_RV_REF(flat_tree) x, const allocator_type &a) - : m_data(boost::move(x.m_data), a) - { } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( ordered_range_t, InputIterator first, InputIterator last) - : m_data() - { - this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); - BOOST_ASSERT((is_sorted)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( ordered_range_t, InputIterator first, InputIterator last, const Compare& comp) - : m_data(comp) - { - this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); - BOOST_ASSERT((is_sorted)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_data(comp, a) - { - this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); - BOOST_ASSERT((is_sorted)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last) - : m_data() - { - this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); - BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp) - : m_data(comp) - { - this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); - BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_data(comp, a) - { - this->m_data.m_seq.insert(this->m_data.m_seq.end(), first, last); - BOOST_ASSERT((is_sorted_and_unique)(this->m_data.m_seq.cbegin(), this->m_data.m_seq.cend(), this->priv_value_comp())); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( bool unique_insertion, InputIterator first, InputIterator last) - : m_data() - { - this->priv_range_insertion_construct(unique_insertion, first, last); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( bool unique_insertion, InputIterator first, InputIterator last - , const Compare& comp) - : m_data(comp) - { - this->priv_range_insertion_construct(unique_insertion, first, last); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( bool unique_insertion, InputIterator first, InputIterator last - , const allocator_type& a) - : m_data(a) - { - this->priv_range_insertion_construct(unique_insertion, first, last); - } - - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_tree( bool unique_insertion, InputIterator first, InputIterator last - , const Compare& comp, const allocator_type& a) - : m_data(comp, a) - { - this->priv_range_insertion_construct(unique_insertion, first, last); - } - - BOOST_CONTAINER_FORCEINLINE ~flat_tree() - {} - - BOOST_CONTAINER_FORCEINLINE flat_tree& operator=(BOOST_COPY_ASSIGN_REF(flat_tree) x) - { m_data = x.m_data; return *this; } - - BOOST_CONTAINER_FORCEINLINE flat_tree& operator=(BOOST_RV_REF(flat_tree) x) - BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || - allocator_traits_type::is_always_equal::value) && - boost::container::dtl::is_nothrow_move_assignable<Compare>::value) - { m_data = boost::move(x.m_data); return *this; } - - BOOST_CONTAINER_FORCEINLINE const value_compare &priv_value_comp() const - { return static_cast<const value_compare &>(this->m_data); } - - BOOST_CONTAINER_FORCEINLINE value_compare &priv_value_comp() - { return static_cast<value_compare &>(this->m_data); } - - BOOST_CONTAINER_FORCEINLINE const key_compare &priv_key_comp() const - { return this->priv_value_comp().get_comp(); } - - BOOST_CONTAINER_FORCEINLINE key_compare &priv_key_comp() - { return this->priv_value_comp().get_comp(); } - - struct insert_commit_data - { - const_iterator position; - }; - - public: - // accessors: - BOOST_CONTAINER_FORCEINLINE Compare key_comp() const - { return this->m_data.get_comp(); } - - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const - { return this->m_data; } - - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const - { return this->m_data.m_seq.get_allocator(); } - - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const - { - return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_<has_stored_allocator_type>()); - } - - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() - { - return flat_tree_get_stored_allocator(this->m_data.m_seq, dtl::bool_<has_stored_allocator_type>()); - } - - BOOST_CONTAINER_FORCEINLINE iterator begin() - { return this->m_data.m_seq.begin(); } - - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const - { return this->cbegin(); } - - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const - { return this->m_data.m_seq.begin(); } - - BOOST_CONTAINER_FORCEINLINE iterator end() - { return this->m_data.m_seq.end(); } - - BOOST_CONTAINER_FORCEINLINE const_iterator end() const - { return this->cend(); } - - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const - { return this->m_data.m_seq.end(); } - - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() - { return reverse_iterator(this->end()); } - - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const - { return this->crbegin(); } - - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const - { return const_reverse_iterator(this->cend()); } - - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() - { return reverse_iterator(this->begin()); } - - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const - { return this->crend(); } - - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const - { return const_reverse_iterator(this->cbegin()); } - - BOOST_CONTAINER_FORCEINLINE bool empty() const - { return this->m_data.m_seq.empty(); } - - BOOST_CONTAINER_FORCEINLINE size_type size() const - { return this->m_data.m_seq.size(); } - - BOOST_CONTAINER_FORCEINLINE size_type max_size() const - { return this->m_data.m_seq.max_size(); } - - BOOST_CONTAINER_FORCEINLINE void swap(flat_tree& other) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::dtl::is_nothrow_swappable<Compare>::value ) - { this->m_data.swap(other.m_data); } - - public: - // insert/erase - std::pair<iterator,bool> insert_unique(const value_type& val) - { - std::pair<iterator,bool> ret; - insert_commit_data data; - ret.second = this->priv_insert_unique_prepare(KeyOfValue()(val), data); - ret.first = ret.second ? this->priv_insert_commit(data, val) - : this->begin() + (data.position - this->cbegin()); - //: iterator(vector_iterator_get_ptr(data.position)); - return ret; - } - - std::pair<iterator,bool> insert_unique(BOOST_RV_REF(value_type) val) - { - std::pair<iterator,bool> ret; - insert_commit_data data; - ret.second = this->priv_insert_unique_prepare(KeyOfValue()(val), data); - ret.first = ret.second ? this->priv_insert_commit(data, boost::move(val)) - : this->begin() + (data.position - this->cbegin()); - //: iterator(vector_iterator_get_ptr(data.position)); - return ret; - } - - iterator insert_equal(const value_type& val) - { - iterator i = this->upper_bound(KeyOfValue()(val)); - i = this->m_data.m_seq.insert(i, val); - return i; - } - - iterator insert_equal(BOOST_RV_REF(value_type) mval) - { - iterator i = this->upper_bound(KeyOfValue()(mval)); - i = this->m_data.m_seq.insert(i, boost::move(mval)); - return i; - } - - iterator insert_unique(const_iterator hint, const value_type& val) - { - BOOST_ASSERT(this->priv_in_range_or_end(hint)); - insert_commit_data data; - return this->priv_insert_unique_prepare(hint, KeyOfValue()(val), data) - ? this->priv_insert_commit(data, val) - : this->begin() + (data.position - this->cbegin()); - //: iterator(vector_iterator_get_ptr(data.position)); - } - - iterator insert_unique(const_iterator hint, BOOST_RV_REF(value_type) val) - { - BOOST_ASSERT(this->priv_in_range_or_end(hint)); - insert_commit_data data; - return this->priv_insert_unique_prepare(hint, KeyOfValue()(val), data) - ? this->priv_insert_commit(data, boost::move(val)) - : this->begin() + (data.position - this->cbegin()); - //: iterator(vector_iterator_get_ptr(data.position)); - } - - iterator insert_equal(const_iterator hint, const value_type& val) - { - BOOST_ASSERT(this->priv_in_range_or_end(hint)); - insert_commit_data data; - this->priv_insert_equal_prepare(hint, val, data); - return this->priv_insert_commit(data, val); - } - - iterator insert_equal(const_iterator hint, BOOST_RV_REF(value_type) mval) - { - BOOST_ASSERT(this->priv_in_range_or_end(hint)); - insert_commit_data data; - this->priv_insert_equal_prepare(hint, mval, data); - return this->priv_insert_commit(data, boost::move(mval)); - } - - template <class InIt> - void insert_unique(InIt first, InIt last) - { - dtl::bool_<is_contiguous_container<container_type>::value> contiguous_tag; - container_type &seq = this->m_data.m_seq; - value_compare &val_cmp = this->priv_value_comp(); - - //Step 1: put new elements in the back - typename container_type::iterator const it = seq.insert(seq.cend(), first, last); - - //Step 2: sort them - boost::movelib::pdqsort(it, seq.end(), val_cmp); - - //Step 3: only left unique values from the back not already present in the original range - typename container_type::iterator const e = boost::movelib::inplace_set_unique_difference - (it, seq.end(), seq.begin(), it, val_cmp); - seq.erase(e, seq.cend()); - - //Step 4: merge both ranges - (flat_tree_container_inplace_merge)(seq, it, this->priv_value_comp(), contiguous_tag); - } - - template <class InIt> - void insert_equal(InIt first, InIt last) - { - dtl::bool_<is_contiguous_container<container_type>::value> contiguous_tag; - container_type &seq = this->m_data.m_seq; - typename container_type::iterator const it = seq.insert(seq.cend(), first, last); - (flat_tree_container_inplace_sort_ending)(seq, it, this->priv_value_comp(), contiguous_tag); - (flat_tree_container_inplace_merge) (seq, it, this->priv_value_comp(), contiguous_tag); - } - - //Ordered - - template <class InIt> - void insert_equal(ordered_range_t, InIt first, InIt last) - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_merge_unique<container_type, InIt, InIt, value_compare>::value; - (flat_tree_merge_equal)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_<value>()); - } - - template <class InIt> - void insert_unique(ordered_unique_range_t, InIt first, InIt last) - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_merge_unique<container_type, InIt, InIt, value_compare>::value; - (flat_tree_merge_unique)(this->m_data.m_seq, first, last, this->priv_value_comp(), dtl::bool_<value>()); - } - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template <class... Args> - std::pair<iterator, bool> emplace_unique(BOOST_FWD_REF(Args)... args) - { - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); - get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); - stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); - value_destructor<stored_allocator_type, value_type> d(a, val); - return this->insert_unique(::boost::move(val)); - } - - template <class... Args> - iterator emplace_hint_unique(const_iterator hint, BOOST_FWD_REF(Args)... args) - { - //hint checked in insert_unique - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); - get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); - stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); - value_destructor<stored_allocator_type, value_type> d(a, val); - return this->insert_unique(hint, ::boost::move(val)); - } - - template <class... Args> - iterator emplace_equal(BOOST_FWD_REF(Args)... args) - { - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); - get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); - stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); - value_destructor<stored_allocator_type, value_type> d(a, val); - return this->insert_equal(::boost::move(val)); - } - - template <class... Args> - iterator emplace_hint_equal(const_iterator hint, BOOST_FWD_REF(Args)... args) - { - //hint checked in insert_equal - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v; - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data)); - get_stored_allocator_noconst_return_t a = this->get_stored_allocator(); - stored_allocator_traits::construct(a, &val, ::boost::forward<Args>(args)... ); - value_destructor<stored_allocator_type, value_type> d(a, val); - return this->insert_equal(hint, ::boost::move(val)); - } - - template <class KeyType, class... Args> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace - (const_iterator hint, BOOST_FWD_REF(KeyType) key, BOOST_FWD_REF(Args)... args) - { - std::pair<iterator,bool> ret; - insert_commit_data data; - const key_type & k = key; - ret.second = hint == const_iterator() - ? this->priv_insert_unique_prepare(k, data) - : this->priv_insert_unique_prepare(hint, k, data); - - if(!ret.second){ - ret.first = this->nth(data.position - this->cbegin()); - } - else{ - typedef typename emplace_functor_type<try_emplace_t, KeyType, Args...>::type func_t; - typedef emplace_iterator<value_type, func_t, difference_type> it_t; - func_t func(try_emplace_t(), ::boost::forward<KeyType>(key), ::boost::forward<Args>(args)...); - ret.first = this->m_data.m_seq.insert(data.position, it_t(func), it_t()); - } - return ret; - } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - std::pair<iterator, bool> emplace_unique(BOOST_MOVE_UREF##N)\ - {\ - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ - get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ - stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - value_destructor<stored_allocator_type, value_type> d(a, val);\ - return this->insert_unique(::boost::move(val));\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace_hint_unique(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ - get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ - stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - value_destructor<stored_allocator_type, value_type> d(a, val);\ - return this->insert_unique(hint, ::boost::move(val));\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace_equal(BOOST_MOVE_UREF##N)\ - {\ - typename aligned_storage<sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ - get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ - stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - value_destructor<stored_allocator_type, value_type> d(a, val);\ - return this->insert_equal(::boost::move(val));\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace_hint_equal(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - typename aligned_storage <sizeof(value_type), alignment_of<value_type>::value>::type v;\ - value_type &val = *static_cast<value_type *>(static_cast<void *>(v.data));\ - get_stored_allocator_noconst_return_t a = this->get_stored_allocator();\ - stored_allocator_traits::construct(a, &val BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - value_destructor<stored_allocator_type, value_type> d(a, val);\ - return this->insert_equal(hint, ::boost::move(val));\ - }\ - template <class KeyType BOOST_MOVE_I##N BOOST_MOVE_CLASS##N>\ - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool>\ - try_emplace(const_iterator hint, BOOST_FWD_REF(KeyType) key BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - std::pair<iterator,bool> ret;\ - insert_commit_data data;\ - const key_type & k = key;\ - ret.second = hint == const_iterator()\ - ? this->priv_insert_unique_prepare(k, data)\ - : this->priv_insert_unique_prepare(hint, k, data);\ - \ - if(!ret.second){\ - ret.first = this->nth(data.position - this->cbegin());\ - }\ - else{\ - typedef typename emplace_functor_type<try_emplace_t, KeyType BOOST_MOVE_I##N BOOST_MOVE_TARG##N>::type func_t;\ - typedef emplace_iterator<value_type, func_t, difference_type> it_t;\ - func_t func(try_emplace_t(), ::boost::forward<KeyType>(key) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - ret.first = this->m_data.m_seq.insert(data.position, it_t(func), it_t());\ - }\ - return ret;\ - }\ - // - BOOST_MOVE_ITERATE_0TO7(BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE) - #undef BOOST_CONTAINER_FLAT_TREE_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - template<class KeyType, class M> - std::pair<iterator, bool> insert_or_assign(const_iterator hint, BOOST_FWD_REF(KeyType) key, BOOST_FWD_REF(M) obj) - { - const key_type& k = key; - std::pair<iterator,bool> ret; - insert_commit_data data; - ret.second = hint == const_iterator() - ? this->priv_insert_unique_prepare(k, data) - : this->priv_insert_unique_prepare(hint, k, data); - if(!ret.second){ - ret.first = this->nth(data.position - this->cbegin()); - ret.first->second = boost::forward<M>(obj); - } - else{ - typedef typename emplace_functor_type<KeyType, M>::type func_t; - typedef emplace_iterator<value_type, func_t, difference_type> it_t; - func_t func(boost::forward<KeyType>(key), boost::forward<M>(obj)); - ret.first = this->m_data.m_seq.insert(data.position, it_t(func), it_t()); - } - return ret; - } - - BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator position) - { return this->m_data.m_seq.erase(position); } - - size_type erase(const key_type& k) - { - std::pair<iterator,iterator > itp = this->equal_range(k); - size_type ret = static_cast<size_type>(itp.second-itp.first); - if (ret){ - this->m_data.m_seq.erase(itp.first, itp.second); - } - return ret; - } - - BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator first, const_iterator last) - { return this->m_data.m_seq.erase(first, last); } - - BOOST_CONTAINER_FORCEINLINE void clear() - { this->m_data.m_seq.clear(); } - - //! <b>Effects</b>: Tries to deallocate the excess of memory created - // with previous allocations. The size of the vector is unchanged - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to size(). - BOOST_CONTAINER_FORCEINLINE void shrink_to_fit() - { this->m_data.m_seq.shrink_to_fit(); } - - BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_nth<container_type, size_type>::value; - return flat_tree_nth<iterator>(this->m_data.m_seq, n, dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_nth<container_type, size_type>::value; - return flat_tree_nth<const_iterator>(this->m_data.m_seq, n, dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_index_of<container_type, iterator>::value; - return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_index_of<container_type, const_iterator>::value; - return flat_tree_index_of(this->m_data.m_seq, p, dtl::bool_<value>()); - } - - // set operations: - iterator find(const key_type& k) - { - iterator i = this->lower_bound(k); - iterator end_it = this->end(); - if (i != end_it && this->m_data.get_comp()(k, KeyOfValue()(*i))){ - i = end_it; - } - return i; - } - - const_iterator find(const key_type& k) const - { - const_iterator i = this->lower_bound(k); - - const_iterator end_it = this->cend(); - if (i != end_it && this->m_data.get_comp()(k, KeyOfValue()(*i))){ - i = end_it; - } - return i; - } - - // set operations: - size_type count(const key_type& k) const - { - std::pair<const_iterator, const_iterator> p = this->equal_range(k); - size_type n = p.second - p.first; - return n; - } - - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge_unique(flat_tree<Value, KeyOfValue, C2, AllocatorOrContainer>& source) - { - this->insert( boost::make_move_iterator(source.begin()) - , boost::make_move_iterator(source.end())); - } - - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge_equal(flat_tree<Value, KeyOfValue, C2, AllocatorOrContainer>& source) - { - this->insert( boost::make_move_iterator(source.begin()) - , boost::make_move_iterator(source.end())); - } - - BOOST_CONTAINER_FORCEINLINE void merge_unique(flat_tree& source) - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_merge_unique<container_type, iterator, iterator, value_compare>::value; - (flat_tree_merge_unique) - ( this->m_data.m_seq - , boost::make_move_iterator(source.m_data.m_seq.begin()) - , boost::make_move_iterator(source.m_data.m_seq.end()) - , this->priv_value_comp() - , dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE void merge_equal(flat_tree& source) - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_merge<container_type, iterator, iterator, value_compare>::value; - (flat_tree_merge_equal) - ( this->m_data.m_seq - , boost::make_move_iterator(source.m_data.m_seq.begin()) - , boost::make_move_iterator(source.m_data.m_seq.end()) - , this->priv_value_comp() - , dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& k) - { return this->priv_lower_bound(this->begin(), this->end(), k); } - - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& k) const - { return this->priv_lower_bound(this->cbegin(), this->cend(), k); } - - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& k) - { return this->priv_upper_bound(this->begin(), this->end(), k); } - - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& k) const - { return this->priv_upper_bound(this->cbegin(), this->cend(), k); } - - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& k) - { return this->priv_equal_range(this->begin(), this->end(), k); } - - BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& k) const - { return this->priv_equal_range(this->cbegin(), this->cend(), k); } - - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, iterator> lower_bound_range(const key_type& k) - { return this->priv_lower_bound_range(this->begin(), this->end(), k); } - - BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> lower_bound_range(const key_type& k) const - { return this->priv_lower_bound_range(this->cbegin(), this->cend(), k); } - - BOOST_CONTAINER_FORCEINLINE size_type capacity() const - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_capacity<container_type>::value; - return (flat_tree_capacity)(this->m_data.m_seq, dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE void reserve(size_type cnt) - { - const bool value = boost::container::dtl:: - has_member_function_callable_with_reserve<container_type, size_type>::value; - (flat_tree_reserve)(this->m_data.m_seq, cnt, dtl::bool_<value>()); - } - - BOOST_CONTAINER_FORCEINLINE container_type extract_sequence() - { - return boost::move(m_data.m_seq); - } - - BOOST_CONTAINER_FORCEINLINE container_type &get_sequence_ref() - { - return m_data.m_seq; - } - - BOOST_CONTAINER_FORCEINLINE void adopt_sequence_equal(BOOST_RV_REF(container_type) seq) - { - (flat_tree_adopt_sequence_equal)( m_data.m_seq, boost::move(seq), this->priv_value_comp() - , dtl::bool_<is_contiguous_container<container_type>::value>()); - } - - BOOST_CONTAINER_FORCEINLINE void adopt_sequence_unique(BOOST_RV_REF(container_type) seq) - { - (flat_tree_adopt_sequence_unique)(m_data.m_seq, boost::move(seq), this->priv_value_comp() - , dtl::bool_<is_contiguous_container<container_type>::value>()); - } - - void adopt_sequence_equal(ordered_range_t, BOOST_RV_REF(container_type) seq) - { - BOOST_ASSERT((is_sorted)(seq.cbegin(), seq.cend(), this->priv_value_comp())); - m_data.m_seq = boost::move(seq); - } - - void adopt_sequence_unique(ordered_unique_range_t, BOOST_RV_REF(container_type) seq) - { - BOOST_ASSERT((is_sorted_and_unique)(seq.cbegin(), seq.cend(), this->priv_value_comp())); - m_data.m_seq = boost::move(seq); - } - - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_tree& x, const flat_tree& y) - { - return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); - } - - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_tree& x, const flat_tree& y) - { - return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); - } - - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_tree& x, const flat_tree& y) - { return !(x == y); } - - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_tree& x, const flat_tree& y) - { return y < x; } - - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_tree& x, const flat_tree& y) - { return !(y < x); } - - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_tree& x, const flat_tree& y) - { return !(x < y); } - - BOOST_CONTAINER_FORCEINLINE friend void swap(flat_tree& x, flat_tree& y) - { x.swap(y); } - - private: - - template <class InputIterator> - void priv_range_insertion_construct( bool unique_insertion, InputIterator first, InputIterator last) - { - //Use cend() as hint to achieve linear time for - //ordered ranges as required by the standard - //for the constructor - //Call end() every iteration as reallocation might have invalidated iterators - if(unique_insertion){ - this->insert_unique(first, last); - } - else{ - this->insert_equal (first, last); - } - } - - BOOST_CONTAINER_FORCEINLINE bool priv_in_range_or_end(const_iterator pos) const - { - return (this->begin() <= pos) && (pos <= this->end()); - } - - // insert/erase - void priv_insert_equal_prepare - (const_iterator pos, const value_type& val, insert_commit_data &data) - { - // N1780 - // To insert val at pos: - // if pos == end || val <= *pos - // if pos == begin || val >= *(pos-1) - // insert val before pos - // else - // insert val before upper_bound(val) - // else - // insert val before lower_bound(val) - const value_compare &val_cmp = this->m_data; - - if(pos == this->cend() || !val_cmp(*pos, val)){ - if (pos == this->cbegin() || !val_cmp(val, pos[-1])){ - data.position = pos; - } - else{ - data.position = - this->priv_upper_bound(this->cbegin(), pos, KeyOfValue()(val)); - } - } - else{ - data.position = - this->priv_lower_bound(pos, this->cend(), KeyOfValue()(val)); - } - } - - bool priv_insert_unique_prepare - (const_iterator b, const_iterator e, const key_type& k, insert_commit_data &commit_data) - { - const key_compare &key_cmp = this->priv_key_comp(); - commit_data.position = this->priv_lower_bound(b, e, k); - return commit_data.position == e || key_cmp(k, KeyOfValue()(*commit_data.position)); - } - - BOOST_CONTAINER_FORCEINLINE bool priv_insert_unique_prepare - (const key_type& k, insert_commit_data &commit_data) - { return this->priv_insert_unique_prepare(this->cbegin(), this->cend(), k, commit_data); } - - bool priv_insert_unique_prepare - (const_iterator pos, const key_type& k, insert_commit_data &commit_data) - { - //N1780. Props to Howard Hinnant! - //To insert k at pos: - //if pos == end || k <= *pos - // if pos == begin || k >= *(pos-1) - // insert k before pos - // else - // insert k before upper_bound(k) - //else if pos+1 == end || k <= *(pos+1) - // insert k after pos - //else - // insert k before lower_bound(k) - const key_compare &key_cmp = this->priv_key_comp(); - const const_iterator cend_it = this->cend(); - if(pos == cend_it || key_cmp(k, KeyOfValue()(*pos))){ //Check if k should go before end - const const_iterator cbeg = this->cbegin(); - commit_data.position = pos; - if(pos == cbeg){ //If container is empty then insert it in the beginning - return true; - } - const_iterator prev(pos); - --prev; - if(key_cmp(KeyOfValue()(*prev), k)){ //If previous element was less, then it should go between prev and pos - return true; - } - else if(!key_cmp(k, KeyOfValue()(*prev))){ //If previous was equal then insertion should fail - commit_data.position = prev; - return false; - } - else{ //Previous was bigger so insertion hint was pointless, dispatch to hintless insertion - //but reduce the search between beg and prev as prev is bigger than k - return this->priv_insert_unique_prepare(cbeg, prev, k, commit_data); - } - } - else{ - //The hint is before the insertion position, so insert it - //in the remaining range [pos, end) - return this->priv_insert_unique_prepare(pos, cend_it, k, commit_data); - } - } - - template<class Convertible> - BOOST_CONTAINER_FORCEINLINE iterator priv_insert_commit - (insert_commit_data &commit_data, BOOST_FWD_REF(Convertible) convertible) - { - return this->m_data.m_seq.insert - ( commit_data.position - , boost::forward<Convertible>(convertible)); - } - - template <class RanIt> - RanIt priv_lower_bound(RanIt first, const RanIt last, - const key_type & key) const - { - const Compare &key_cmp = this->m_data.get_comp(); - KeyOfValue key_extract; - size_type len = static_cast<size_type>(last - first); - RanIt middle; - - while (len) { - size_type step = len >> 1; - middle = first; - middle += step; - - if (key_cmp(key_extract(*middle), key)) { - first = ++middle; - len -= step + 1; - } - else{ - len = step; - } - } - return first; - } - - template <class RanIt> - RanIt priv_upper_bound - (RanIt first, const RanIt last,const key_type & key) const - { - const Compare &key_cmp = this->m_data.get_comp(); - KeyOfValue key_extract; - size_type len = static_cast<size_type>(last - first); - RanIt middle; - - while (len) { - size_type step = len >> 1; - middle = first; - middle += step; - - if (key_cmp(key, key_extract(*middle))) { - len = step; - } - else{ - first = ++middle; - len -= step + 1; - } - } - return first; - } - - template <class RanIt> - std::pair<RanIt, RanIt> - priv_equal_range(RanIt first, RanIt last, const key_type& key) const - { - const Compare &key_cmp = this->m_data.get_comp(); - KeyOfValue key_extract; - size_type len = static_cast<size_type>(last - first); - RanIt middle; - - while (len) { - size_type step = len >> 1; - middle = first; - middle += step; - - if (key_cmp(key_extract(*middle), key)){ - first = ++middle; - len -= step + 1; - } - else if (key_cmp(key, key_extract(*middle))){ - len = step; - } - else { - //Middle is equal to key - last = first; - last += len; - RanIt const first_ret = this->priv_lower_bound(first, middle, key); - return std::pair<RanIt, RanIt> - ( first_ret, this->priv_upper_bound(++middle, last, key)); - } - } - return std::pair<RanIt, RanIt>(first, first); - } - - template<class RanIt> - std::pair<RanIt, RanIt> priv_lower_bound_range(RanIt first, RanIt last, const key_type& k) const - { - const Compare &key_cmp = this->m_data.get_comp(); - KeyOfValue key_extract; - RanIt lb(this->priv_lower_bound(first, last, k)), ub(lb); - if(lb != last && static_cast<difference_type>(!key_cmp(k, key_extract(*lb)))){ - ++ub; - } - return std::pair<RanIt, RanIt>(lb, ub); - } -}; - -} //namespace dtl { - -} //namespace container { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class T, class KeyOfValue, -class Compare, class AllocatorOrContainer> -struct has_trivial_destructor_after_move<boost::container::dtl::flat_tree<T, KeyOfValue, Compare, AllocatorOrContainer> > -{ - typedef typename boost::container::dtl::select_container_type<T, AllocatorOrContainer>::type container_type; - typedef typename container_type::allocator_type allocator_t; - typedef typename ::boost::container::allocator_traits<allocator_t>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<allocator_t>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value; -}; - -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif // BOOST_CONTAINER_FLAT_TREE_HPP diff --git a/contrib/restricted/boost/boost/container/detail/function_detector.hpp b/contrib/restricted/boost/boost/container/detail/function_detector.hpp deleted file mode 100644 index 00caced5ba..0000000000 --- a/contrib/restricted/boost/boost/container/detail/function_detector.hpp +++ /dev/null @@ -1,96 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2009-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 was modified from the code posted by Alexandre Courpron in his -// article "Interface Detection" in The Code Project: -// http://www.codeproject.com/KB/architecture/Detector.aspx -/////////////////////////////////////////////////////////////////////////////// -// Copyright 2007 Alexandre Courpron -// -// Permission to use, copy, modify, redistribute and sell this software, -// provided that this copyright notice appears on all copies of the software. -/////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP -#define BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> - -namespace boost { -namespace container { -namespace function_detector { - - typedef char NotFoundType; - struct StaticFunctionType { NotFoundType x [2]; }; - struct NonStaticFunctionType { NotFoundType x [3]; }; - - enum - { NotFound = 0, - StaticFunction = sizeof( StaticFunctionType ) - sizeof( NotFoundType ), - NonStaticFunction = sizeof( NonStaticFunctionType ) - sizeof( NotFoundType ) - }; - -} //namespace boost { -} //namespace container { -} //namespace function_detector { - -#define BOOST_CONTAINER_CREATE_FUNCTION_DETECTOR(Identifier, InstantiationKey) \ - namespace boost { \ - namespace container { \ - namespace function_detector { \ - template < class T, \ - class NonStaticType, \ - class NonStaticConstType, \ - class StaticType > \ - class DetectMember_##InstantiationKey_##Identifier { \ - template < NonStaticType > \ - struct TestNonStaticNonConst ; \ - \ - template < NonStaticConstType > \ - struct TestNonStaticConst ; \ - \ - template < StaticType > \ - struct TestStatic ; \ - \ - template <class U > \ - static NonStaticFunctionType Test( TestNonStaticNonConst<&U::Identifier>*, int ); \ - \ - template <class U > \ - static NonStaticFunctionType Test( TestNonStaticConst<&U::Identifier>*, int ); \ - \ - template <class U> \ - static StaticFunctionType Test( TestStatic<&U::Identifier>*, int ); \ - \ - template <class U> \ - static NotFoundType Test( ... ); \ - public : \ - static const int check = NotFound + (sizeof(Test<T>(0, 0)) - sizeof(NotFoundType));\ - };\ -}}} //namespace boost::container::function_detector { - -#define BOOST_CONTAINER_DETECT_FUNCTION(Class, InstantiationKey, ReturnType, Identifier, Params) \ - ::boost::container::function_detector::DetectMember_##InstantiationKey_##Identifier< Class,\ - ReturnType (Class::*)Params,\ - ReturnType (Class::*)Params const,\ - ReturnType (*)Params \ - >::check - -#include <boost/container/detail/config_end.hpp> - -#endif //@ifndef BOOST_CONTAINER_DETAIL_FUNCTION_DETECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/detail/is_container.hpp b/contrib/restricted/boost/boost/container/detail/is_container.hpp deleted file mode 100644 index feab702e9e..0000000000 --- a/contrib/restricted/boost/boost/container/detail/is_container.hpp +++ /dev/null @@ -1,55 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_IS_CONTAINER_HPP -#define BOOST_CONTAINER_DETAIL_IS_CONTAINER_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -//empty -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME empty -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_container_detail { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -//size -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME size -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_container_detail { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -namespace boost { -namespace container { -namespace dtl { - -template <class Container> -struct is_container -{ - static const bool value = - boost::container::is_container_detail:: - has_member_function_callable_with_size <const Container>::value && - boost::container::is_container_detail:: - has_member_function_callable_with_empty<const Container>::value; -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_IS_CONTAINER_HPP diff --git a/contrib/restricted/boost/boost/container/detail/is_contiguous_container.hpp b/contrib/restricted/boost/boost/container/detail/is_contiguous_container.hpp deleted file mode 100644 index 528aeee133..0000000000 --- a/contrib/restricted/boost/boost/container/detail/is_contiguous_container.hpp +++ /dev/null @@ -1,47 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2017-2017. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_IS_CONTIGUOUS_CONTAINER_HPP -#define BOOST_CONTAINER_DETAIL_IS_CONTIGUOUS_CONTAINER_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -//data -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME data -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEG namespace boost { namespace container { namespace is_contiguous_container_detail { -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MIN 0 -#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_MAX 0 -#include <boost/intrusive/detail/has_member_function_callable_with.hpp> - -namespace boost { -namespace container { -namespace dtl { - -template <class Container> -struct is_contiguous_container -{ - static const bool value = - boost::container::is_contiguous_container_detail:: - has_member_function_callable_with_data<Container>::value && - boost::container::is_contiguous_container_detail:: - has_member_function_callable_with_data<const Container>::value; -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_IS_CONTIGUOUS_CONTAINER_HPP diff --git a/contrib/restricted/boost/boost/container/detail/is_sorted.hpp b/contrib/restricted/boost/boost/container/detail/is_sorted.hpp deleted file mode 100644 index 315bab54d7..0000000000 --- a/contrib/restricted/boost/boost/container/detail/is_sorted.hpp +++ /dev/null @@ -1,57 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2016-2016. 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_IS_SORTED_HPP -#define BOOST_CONTAINER_DETAIL_IS_SORTED_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -namespace boost { -namespace container { -namespace dtl { - -template <class ForwardIterator, class Pred> -bool is_sorted (ForwardIterator first, ForwardIterator last, Pred pred) -{ - if(first != last){ - ForwardIterator next = first; - while (++next != last){ - if(pred(*next, *first)) - return false; - ++first; - } - } - return true; -} - -template <class ForwardIterator, class Pred> -bool is_sorted_and_unique (ForwardIterator first, ForwardIterator last, Pred pred) -{ - if(first != last){ - ForwardIterator next = first; - while (++next != last){ - if(!pred(*first, *next)) - return false; - ++first; - } - } - return true; -} - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_IS_SORTED_HPP diff --git a/contrib/restricted/boost/boost/container/detail/iterator_to_raw_pointer.hpp b/contrib/restricted/boost/boost/container/detail/iterator_to_raw_pointer.hpp deleted file mode 100644 index 49f1d43bab..0000000000 --- a/contrib/restricted/boost/boost/container/detail/iterator_to_raw_pointer.hpp +++ /dev/null @@ -1,33 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2014-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_DETAIL_ITERATOR_TO_RAW_POINTER_HPP -#define BOOST_CONTAINER_DETAIL_ITERATOR_TO_RAW_POINTER_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/move/detail/iterator_to_raw_pointer.hpp> - -namespace boost { -namespace container { -namespace dtl { - -using ::boost::movelib::iterator_to_raw_pointer; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ITERATOR_TO_RAW_POINTER_HPP diff --git a/contrib/restricted/boost/boost/container/detail/math_functions.hpp b/contrib/restricted/boost/boost/container/detail/math_functions.hpp deleted file mode 100644 index f1519315a3..0000000000 --- a/contrib/restricted/boost/boost/container/detail/math_functions.hpp +++ /dev/null @@ -1,123 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Stephen Cleary 2000. -// (C) Copyright Ion Gaztanaga 2007-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 file is a slightly modified file from Boost.Pool -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP -#define BOOST_CONTAINER_DETAIL_MATH_FUNCTIONS_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -#include <climits> -#include <boost/static_assert.hpp> - -namespace boost { -namespace container { -namespace dtl { - -// Greatest common divisor and least common multiple - -// -// gcd is an algorithm that calculates the greatest common divisor of two -// integers, using Euclid's algorithm. -// -// Pre: A > 0 && B > 0 -// Recommended: A > B -template <typename Integer> -inline Integer gcd(Integer A, Integer B) -{ - do - { - const Integer tmp(B); - B = A % B; - A = tmp; - } while (B != 0); - - return A; -} - -// -// lcm is an algorithm that calculates the least common multiple of two -// integers. -// -// Pre: A > 0 && B > 0 -// Recommended: A > B -template <typename Integer> -inline Integer lcm(const Integer & A, const Integer & B) -{ - Integer ret = A; - ret /= gcd(A, B); - ret *= B; - return ret; -} - -template <typename Integer> -inline Integer log2_ceil(const Integer & A) -{ - Integer i = 0; - Integer power_of_2 = 1; - - while(power_of_2 < A){ - power_of_2 <<= 1; - ++i; - } - return i; -} - -template <typename Integer> -inline Integer upper_power_of_2(const Integer & A) -{ - Integer power_of_2 = 1; - - while(power_of_2 < A){ - power_of_2 <<= 1; - } - return power_of_2; -} - -//This function uses binary search to discover the -//highest set bit of the integer -inline std::size_t floor_log2 (std::size_t x) -{ - const std::size_t Bits = sizeof(std::size_t)*CHAR_BIT; - const bool Size_t_Bits_Power_2= !(Bits & (Bits-1)); - BOOST_STATIC_ASSERT(((Size_t_Bits_Power_2)== true)); - - std::size_t n = x; - std::size_t log2 = 0; - - for(std::size_t shift = Bits >> 1; shift; shift >>= 1){ - std::size_t tmp = n >> shift; - if (tmp) - log2 += shift, n = tmp; - } - - return log2; -} - -} // namespace dtl -} // namespace container -} // namespace boost - -#include <boost/container/detail/config_end.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/container/detail/mutex.hpp b/contrib/restricted/boost/boost/container/detail/mutex.hpp deleted file mode 100644 index 56e72a81d0..0000000000 --- a/contrib/restricted/boost/boost/container/detail/mutex.hpp +++ /dev/null @@ -1,283 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Stephen Cleary 2000 -// (C) Copyright Ion Gaztanaga 2015-2017. -// -// Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_MUTEX_HPP -#define BOOST_CONTAINER_MUTEX_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -//#define BOOST_CONTAINER_NO_MT -//#define BOOST_CONTAINER_NO_SPINLOCKS - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// Extremely Light-Weight wrapper classes for OS thread synchronization - -#define BOOST_MUTEX_HELPER_NONE 0 -#define BOOST_MUTEX_HELPER_WIN32 1 -#define BOOST_MUTEX_HELPER_PTHREAD 2 -#define BOOST_MUTEX_HELPER_SPINLOCKS 3 - -#if !defined(BOOST_HAS_THREADS) && !defined(BOOST_NO_MT) -# define BOOST_NO_MT -#endif - -#if defined(BOOST_NO_MT) || defined(BOOST_CONTAINER_NO_MT) - // No multithreading -> make locks into no-ops - #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_NONE -#else - //Taken from dlmalloc - #if !defined(BOOST_CONTAINER_NO_SPINLOCKS) && \ - ((defined(__GNUC__) && \ - ((__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) || \ - defined(__i386__) || defined(__x86_64__))) || \ - (defined(_MSC_VER) && _MSC_VER>=1310)) - #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_SPINLOCKS - #endif - - #if defined(BOOST_WINDOWS) - #include <windows.h> - #ifndef BOOST_MUTEX_HELPER - #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_WIN32 - #endif - #elif defined(BOOST_HAS_UNISTD_H) - #include <unistd.h> - #if !defined(BOOST_MUTEX_HELPER) && (defined(_POSIX_THREADS) || defined(BOOST_HAS_PTHREADS)) - #define BOOST_MUTEX_HELPER BOOST_MUTEX_HELPER_PTHREAD - #endif - #endif -#endif - -#ifndef BOOST_MUTEX_HELPER - #error Unable to determine platform mutex type; #define BOOST_NO_MT to assume single-threaded -#endif - -#if BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_NONE - //... -#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_SPINLOCKS - #if defined(_MSC_VER) - #ifndef _M_AMD64 - /* These are already defined on AMD64 builds */ - #ifdef __cplusplus - extern "C" { - #endif /* __cplusplus */ - long __cdecl _InterlockedCompareExchange(long volatile *Dest, long Exchange, long Comp); - long __cdecl _InterlockedExchange(long volatile *Target, long Value); - #ifdef __cplusplus - } - #endif /* __cplusplus */ - #endif /* _M_AMD64 */ - #pragma intrinsic (_InterlockedCompareExchange) - #pragma intrinsic (_InterlockedExchange) - #define interlockedcompareexchange _InterlockedCompareExchange - #define interlockedexchange _InterlockedExchange - #elif defined(WIN32) && defined(__GNUC__) - #define interlockedcompareexchange(a, b, c) __sync_val_compare_and_swap(a, c, b) - #define interlockedexchange __sync_lock_test_and_set - #endif /* Win32 */ - - /* First, define CAS_LOCK and CLEAR_LOCK on ints */ - /* Note CAS_LOCK defined to return 0 on success */ - - #if defined(__GNUC__)&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) - #define BOOST_CONTAINER_CAS_LOCK(sl) __sync_lock_test_and_set(sl, 1) - #define BOOST_CONTAINER_CLEAR_LOCK(sl) __sync_lock_release(sl) - - #elif (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) - /* Custom spin locks for older gcc on x86 */ - static inline int boost_container_x86_cas_lock(int *sl) { - int ret; - int val = 1; - int cmp = 0; - __asm__ __volatile__ ("lock; cmpxchgl %1, %2" - : "=a" (ret) - : "r" (val), "m" (*(sl)), "0"(cmp) - : "memory", "cc"); - return ret; - } - - static inline void boost_container_x86_clear_lock(int* sl) { - assert(*sl != 0); - int prev = 0; - int ret; - __asm__ __volatile__ ("lock; xchgl %0, %1" - : "=r" (ret) - : "m" (*(sl)), "0"(prev) - : "memory"); - } - - #define BOOST_CONTAINER_CAS_LOCK(sl) boost_container_x86_cas_lock(sl) - #define BOOST_CONTAINER_CLEAR_LOCK(sl) boost_container_x86_clear_lock(sl) - - #else /* Win32 MSC */ - #define BOOST_CONTAINER_CAS_LOCK(sl) interlockedexchange((long volatile*)sl, (long)1) - #define BOOST_CONTAINER_CLEAR_LOCK(sl) interlockedexchange((long volatile*)sl, (long)0) - #endif - - /* How to yield for a spin lock */ - #define SPINS_PER_YIELD 63 - #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) - #define SLEEP_EX_DURATION 50 /* delay for yield/sleep */ - #define SPIN_LOCK_YIELD SleepEx(SLEEP_EX_DURATION, FALSE) - #elif defined (__SVR4) && defined (__sun) /* solaris */ - #include <thread.h> - #define SPIN_LOCK_YIELD thr_yield(); - #elif !defined(LACKS_SCHED_H) - #include <sched.h> - #define SPIN_LOCK_YIELD sched_yield(); - #else - #define SPIN_LOCK_YIELD - #endif /* ... yield ... */ - - #define BOOST_CONTAINER_SPINS_PER_YIELD 63 - inline int boost_interprocess_spin_acquire_lock(int *sl) { - int spins = 0; - while (*(volatile int *)sl != 0 || - BOOST_CONTAINER_CAS_LOCK(sl)) { - if ((++spins & BOOST_CONTAINER_SPINS_PER_YIELD) == 0) { - SPIN_LOCK_YIELD; - } - } - return 0; - } - #define BOOST_CONTAINER_MLOCK_T int - #define BOOST_CONTAINER_TRY_LOCK(sl) !BOOST_CONTAINER_CAS_LOCK(sl) - #define BOOST_CONTAINER_RELEASE_LOCK(sl) BOOST_CONTAINER_CLEAR_LOCK(sl) - #define BOOST_CONTAINER_ACQUIRE_LOCK(sl) (BOOST_CONTAINER_CAS_LOCK(sl)? boost_interprocess_spin_acquire_lock(sl) : 0) - #define BOOST_MOVE_INITIAL_LOCK(sl) (*sl = 0) - #define BOOST_CONTAINER_DESTROY_LOCK(sl) (0) -#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_WIN32 - // -#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_PTHREAD - #include <pthread.h> -#endif - -namespace boost { -namespace container { -namespace dtl { - -#if BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_NONE - class null_mutex - { - private: - null_mutex(const null_mutex &); - void operator=(const null_mutex &); - - public: - null_mutex() { } - - static void lock() { } - static void unlock() { } - }; - - typedef null_mutex default_mutex; -#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_SPINLOCKS - - class spin_mutex - { - private: - BOOST_CONTAINER_MLOCK_T sl; - spin_mutex(const spin_mutex &); - void operator=(const spin_mutex &); - - public: - spin_mutex() { BOOST_MOVE_INITIAL_LOCK(&sl); } - - void lock() { BOOST_CONTAINER_ACQUIRE_LOCK(&sl); } - void unlock() { BOOST_CONTAINER_RELEASE_LOCK(&sl); } - }; - typedef spin_mutex default_mutex; -#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_WIN32 - class mutex - { - private: - CRITICAL_SECTION mtx; - - mutex(const mutex &); - void operator=(const mutex &); - - public: - mutex() - { InitializeCriticalSection(&mtx); } - - ~mutex() - { DeleteCriticalSection(&mtx); } - - void lock() - { EnterCriticalSection(&mtx); } - - void unlock() - { LeaveCriticalSection(&mtx); } - }; - - typedef mutex default_mutex; -#elif BOOST_MUTEX_HELPER == BOOST_MUTEX_HELPER_PTHREAD - class mutex - { - private: - pthread_mutex_t mtx; - - mutex(const mutex &); - void operator=(const mutex &); - - public: - mutex() - { pthread_mutex_init(&mtx, 0); } - - ~mutex() - { pthread_mutex_destroy(&mtx); } - - void lock() - { pthread_mutex_lock(&mtx); } - - void unlock() - { pthread_mutex_unlock(&mtx); } - }; - - typedef mutex default_mutex; -#endif - -template<class Mutex> -class scoped_lock -{ - public: - scoped_lock(Mutex &m) - : m_(m) - { m_.lock(); } - ~scoped_lock() - { m_.unlock(); } - - private: - Mutex &m_; -}; - -} // namespace dtl -} // namespace container -} // namespace boost - -#undef BOOST_MUTEX_HELPER_WIN32 -#undef BOOST_MUTEX_HELPER_PTHREAD -#undef BOOST_MUTEX_HELPER_NONE -#undef BOOST_MUTEX_HELPER -#undef BOOST_MUTEX_HELPER_SPINLOCKS - -#include <boost/container/detail/config_end.hpp> - -#endif diff --git a/contrib/restricted/boost/boost/container/detail/node_pool.hpp b/contrib/restricted/boost/boost/container/detail/node_pool.hpp deleted file mode 100644 index e43956b643..0000000000 --- a/contrib/restricted/boost/boost/container/detail/node_pool.hpp +++ /dev/null @@ -1,157 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_NODE_POOL_HPP -#define BOOST_CONTAINER_DETAIL_NODE_POOL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -#include <boost/container/detail/mutex.hpp> -#include <boost/container/detail/pool_common_alloc.hpp> -#include <boost/container/detail/node_pool_impl.hpp> -#include <boost/container/detail/mutex.hpp> -#include <boost/move/utility_core.hpp> -#include <cstddef> -#include <cassert> - -namespace boost { -namespace container { -namespace dtl { - -//!Pooled memory allocator using single segregated storage. Includes -//!a reference count but the class does not delete itself, this is -//!responsibility of user classes. Node size (NodeSize) and the number of -//!nodes allocated per block (NodesPerBlock) are known at compile time -template< std::size_t NodeSize, std::size_t NodesPerBlock > -class private_node_pool - //Inherit from the implementation to avoid template bloat - : public boost::container::dtl:: - private_node_pool_impl<fake_segment_manager> -{ - typedef boost::container::dtl:: - private_node_pool_impl<fake_segment_manager> base_t; - //Non-copyable - private_node_pool(const private_node_pool &); - private_node_pool &operator=(const private_node_pool &); - - public: - typedef typename base_t::multiallocation_chain multiallocation_chain; - static const std::size_t nodes_per_block = NodesPerBlock; - - //!Constructor from a segment manager. Never throws - private_node_pool() - : base_t(0, NodeSize, NodesPerBlock) - {} - -}; - -template< std::size_t NodeSize - , std::size_t NodesPerBlock - > -class shared_node_pool - : public private_node_pool<NodeSize, NodesPerBlock> -{ - private: - typedef private_node_pool<NodeSize, NodesPerBlock> private_node_allocator_t; - - public: - typedef typename private_node_allocator_t::free_nodes_t free_nodes_t; - typedef typename private_node_allocator_t::multiallocation_chain multiallocation_chain; - - //!Constructor from a segment manager. Never throws - shared_node_pool() - : private_node_allocator_t(){} - - //!Destructor. Deallocates all allocated blocks. Never throws - ~shared_node_pool() - {} - - //!Allocates array of count elements. Can throw std::bad_alloc - void *allocate_node() - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - return private_node_allocator_t::allocate_node(); - } - - //!Deallocates an array pointed by ptr. Never throws - void deallocate_node(void *ptr) - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::deallocate_node(ptr); - } - - //!Allocates a singly linked list of n nodes ending in null pointer. - //!can throw std::bad_alloc - void allocate_nodes(const std::size_t n, multiallocation_chain &chain) - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - return private_node_allocator_t::allocate_nodes(n, chain); - } - - void deallocate_nodes(multiallocation_chain &chain) - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::deallocate_nodes(chain); - } - - //!Deallocates all the free blocks of memory. Never throws - void deallocate_free_blocks() - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::deallocate_free_blocks(); - } - - //!Deallocates all blocks. Never throws - void purge_blocks() - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - private_node_allocator_t::purge_blocks(); - } - - std::size_t num_free_nodes() - { - //----------------------- - scoped_lock<default_mutex> guard(mutex_); - //----------------------- - return private_node_allocator_t::num_free_nodes(); - } - - private: - default_mutex mutex_; -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_DETAIL_NODE_POOL_HPP diff --git a/contrib/restricted/boost/boost/container/detail/node_pool_impl.hpp b/contrib/restricted/boost/boost/container/detail/node_pool_impl.hpp deleted file mode 100644 index 97f555bc75..0000000000 --- a/contrib/restricted/boost/boost/container/detail/node_pool_impl.hpp +++ /dev/null @@ -1,375 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_NODE_POOL_IMPL_HPP -#define BOOST_CONTAINER_DETAIL_NODE_POOL_IMPL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/container_fwd.hpp> - -#include <boost/container/detail/math_functions.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/pool_common.hpp> -#include <boost/move/detail/to_raw_pointer.hpp> -#include <boost/container/detail/type_traits.hpp> - -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/intrusive/set.hpp> -#include <boost/intrusive/slist.hpp> - -#include <boost/core/no_exceptions_support.hpp> -#include <boost/assert.hpp> -#include <cstddef> - -namespace boost { -namespace container { -namespace dtl { - -template<class SegmentManagerBase> -class private_node_pool_impl -{ - //Non-copyable - private_node_pool_impl(); - private_node_pool_impl(const private_node_pool_impl &); - private_node_pool_impl &operator=(const private_node_pool_impl &); - - //A node object will hold node_t when it's not allocated - public: - typedef typename SegmentManagerBase::void_pointer void_pointer; - typedef typename node_slist<void_pointer>::slist_hook_t slist_hook_t; - typedef typename node_slist<void_pointer>::node_t node_t; - typedef typename node_slist<void_pointer>::node_slist_t free_nodes_t; - typedef typename SegmentManagerBase::multiallocation_chain multiallocation_chain; - typedef typename SegmentManagerBase::size_type size_type; - - private: - typedef typename bi::make_slist - < node_t, bi::base_hook<slist_hook_t> - , bi::linear<true> - , bi::constant_time_size<false> >::type blockslist_t; - - static size_type get_rounded_size(size_type orig_size, size_type round_to) - { return ((orig_size-1)/round_to+1)*round_to; } - - public: - - //!Segment manager typedef - typedef SegmentManagerBase segment_manager_base_type; - - //!Constructor from a segment manager. Never throws - private_node_pool_impl(segment_manager_base_type *segment_mngr_base, size_type node_size, size_type nodes_per_block) - : m_nodes_per_block(nodes_per_block) - , m_real_node_size(lcm(node_size, size_type(alignment_of<node_t>::value))) - //General purpose allocator - , mp_segment_mngr_base(segment_mngr_base) - , m_blocklist() - , m_freelist() - //Debug node count - , m_allocated(0) - {} - - //!Destructor. Deallocates all allocated blocks. Never throws - ~private_node_pool_impl() - { this->purge_blocks(); } - - size_type get_real_num_node() const - { return m_nodes_per_block; } - - //!Returns the segment manager. Never throws - segment_manager_base_type* get_segment_manager_base()const - { return boost::movelib::to_raw_pointer(mp_segment_mngr_base); } - - void *allocate_node() - { return this->priv_alloc_node(); } - - //!Deallocates an array pointed by ptr. Never throws - void deallocate_node(void *ptr) - { this->priv_dealloc_node(ptr); } - - //!Allocates a singly linked list of n nodes ending in null pointer. - void allocate_nodes(const size_type n, multiallocation_chain &chain) - { - //Preallocate all needed blocks to fulfill the request - size_type cur_nodes = m_freelist.size(); - if(cur_nodes < n){ - this->priv_alloc_block(((n - cur_nodes) - 1)/m_nodes_per_block + 1); - } - - //We just iterate the needed nodes to get the last we'll erase - typedef typename free_nodes_t::iterator free_iterator; - free_iterator before_last_new_it = m_freelist.before_begin(); - for(size_type j = 0; j != n; ++j){ - ++before_last_new_it; - } - - //Cache the first node of the allocated range before erasing - free_iterator first_node(m_freelist.begin()); - free_iterator last_node (before_last_new_it); - - //Erase the range. Since we already have the distance, this is O(1) - m_freelist.erase_after( m_freelist.before_begin() - , ++free_iterator(before_last_new_it) - , n); - - //Now take the last erased node and just splice it in the end - //of the intrusive list that will be traversed by the multialloc iterator. - chain.incorporate_after(chain.before_begin(), &*first_node, &*last_node, n); - m_allocated += n; - } - - void deallocate_nodes(multiallocation_chain &chain) - { - typedef typename multiallocation_chain::iterator iterator; - iterator it(chain.begin()), itend(chain.end()); - while(it != itend){ - void *pElem = &*it; - ++it; - this->priv_dealloc_node(pElem); - } - } - - //!Deallocates all the free blocks of memory. Never throws - void deallocate_free_blocks() - { - typedef typename free_nodes_t::iterator nodelist_iterator; - typename blockslist_t::iterator bit(m_blocklist.before_begin()), - it(m_blocklist.begin()), - itend(m_blocklist.end()); - free_nodes_t backup_list; - nodelist_iterator backup_list_last = backup_list.before_begin(); - - //Execute the algorithm and get an iterator to the last value - size_type blocksize = (get_rounded_size) - (m_real_node_size*m_nodes_per_block, (size_type) alignment_of<node_t>::value); - - while(it != itend){ - //Collect all the nodes from the block pointed by it - //and push them in the list - free_nodes_t free_nodes; - nodelist_iterator last_it = free_nodes.before_begin(); - const void *addr = get_block_from_hook(&*it, blocksize); - - m_freelist.remove_and_dispose_if - (is_between(addr, blocksize), push_in_list(free_nodes, last_it)); - - //If the number of nodes is equal to m_nodes_per_block - //this means that the block can be deallocated - if(free_nodes.size() == m_nodes_per_block){ - //Unlink the nodes - free_nodes.clear(); - it = m_blocklist.erase_after(bit); - mp_segment_mngr_base->deallocate((void*)addr); - } - //Otherwise, insert them in the backup list, since the - //next "remove_if" does not need to check them again. - else{ - //Assign the iterator to the last value if necessary - if(backup_list.empty() && !m_freelist.empty()){ - backup_list_last = last_it; - } - //Transfer nodes. This is constant time. - backup_list.splice_after - ( backup_list.before_begin() - , free_nodes - , free_nodes.before_begin() - , last_it - , free_nodes.size()); - bit = it; - ++it; - } - } - //We should have removed all the nodes from the free list - BOOST_ASSERT(m_freelist.empty()); - - //Now pass all the node to the free list again - m_freelist.splice_after - ( m_freelist.before_begin() - , backup_list - , backup_list.before_begin() - , backup_list_last - , backup_list.size()); - } - - size_type num_free_nodes() - { return m_freelist.size(); } - - //!Deallocates all used memory. Precondition: all nodes allocated from this pool should - //!already be deallocated. Otherwise, undefined behaviour. Never throws - void purge_blocks() - { - //check for memory leaks - BOOST_ASSERT(m_allocated==0); - size_type blocksize = (get_rounded_size) - (m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); - - //We iterate though the NodeBlock list to free the memory - while(!m_blocklist.empty()){ - void *addr = get_block_from_hook(&m_blocklist.front(), blocksize); - m_blocklist.pop_front(); - mp_segment_mngr_base->deallocate((void*)addr); - } - //Just clear free node list - m_freelist.clear(); - } - - void swap(private_node_pool_impl &other) - { - BOOST_ASSERT(m_nodes_per_block == other.m_nodes_per_block); - BOOST_ASSERT(m_real_node_size == other.m_real_node_size); - std::swap(mp_segment_mngr_base, other.mp_segment_mngr_base); - m_blocklist.swap(other.m_blocklist); - m_freelist.swap(other.m_freelist); - std::swap(m_allocated, other.m_allocated); - } - - private: - - struct push_in_list - { - push_in_list(free_nodes_t &l, typename free_nodes_t::iterator &it) - : slist_(l), last_it_(it) - {} - - void operator()(typename free_nodes_t::pointer p) const - { - slist_.push_front(*p); - if(slist_.size() == 1){ //Cache last element - ++last_it_ = slist_.begin(); - } - } - - private: - free_nodes_t &slist_; - typename free_nodes_t::iterator &last_it_; - }; - - struct is_between - { - typedef typename free_nodes_t::value_type argument_type; - typedef bool result_type; - - is_between(const void *addr, std::size_t size) - : beg_(static_cast<const char *>(addr)), end_(beg_+size) - {} - - bool operator()(typename free_nodes_t::const_reference v) const - { - return (beg_ <= reinterpret_cast<const char *>(&v) && - end_ > reinterpret_cast<const char *>(&v)); - } - private: - const char * beg_; - const char * end_; - }; - - //!Allocates one node, using single segregated storage algorithm. - //!Never throws - node_t *priv_alloc_node() - { - //If there are no free nodes we allocate a new block - if (m_freelist.empty()) - this->priv_alloc_block(1); - //We take the first free node - node_t *n = (node_t*)&m_freelist.front(); - m_freelist.pop_front(); - ++m_allocated; - return n; - } - - //!Deallocates one node, using single segregated storage algorithm. - //!Never throws - void priv_dealloc_node(void *pElem) - { - //We put the node at the beginning of the free node list - node_t * to_deallocate = static_cast<node_t*>(pElem); - m_freelist.push_front(*to_deallocate); - BOOST_ASSERT(m_allocated>0); - --m_allocated; - } - - //!Allocates several blocks of nodes. Can throw - void priv_alloc_block(size_type num_blocks) - { - BOOST_ASSERT(num_blocks > 0); - size_type blocksize = - (get_rounded_size)(m_real_node_size*m_nodes_per_block, (size_type)alignment_of<node_t>::value); - - BOOST_TRY{ - for(size_type i = 0; i != num_blocks; ++i){ - //We allocate a new NodeBlock and put it as first - //element in the free Node list - char *pNode = reinterpret_cast<char*> - (mp_segment_mngr_base->allocate(blocksize + sizeof(node_t))); - char *pBlock = pNode; - m_blocklist.push_front(get_block_hook(pBlock, blocksize)); - - //We initialize all Nodes in Node Block to insert - //them in the free Node list - for(size_type j = 0; j < m_nodes_per_block; ++j, pNode += m_real_node_size){ - m_freelist.push_front(*new (pNode) node_t); - } - } - } - BOOST_CATCH(...){ - //to-do: if possible, an efficient way to deallocate allocated blocks - BOOST_RETHROW - } - BOOST_CATCH_END - } - - //!Deprecated, use deallocate_free_blocks - void deallocate_free_chunks() - { this->deallocate_free_blocks(); } - - //!Deprecated, use purge_blocks - void purge_chunks() - { this->purge_blocks(); } - - private: - //!Returns a reference to the block hook placed in the end of the block - static node_t & get_block_hook (void *block, size_type blocksize) - { - return *reinterpret_cast<node_t*>(reinterpret_cast<char*>(block) + blocksize); - } - - //!Returns the starting address of the block reference to the block hook placed in the end of the block - void *get_block_from_hook (node_t *hook, size_type blocksize) - { - return (reinterpret_cast<char*>(hook) - blocksize); - } - - private: - typedef typename boost::intrusive::pointer_traits - <void_pointer>::template rebind_pointer<segment_manager_base_type>::type segment_mngr_base_ptr_t; - - const size_type m_nodes_per_block; - const size_type m_real_node_size; - segment_mngr_base_ptr_t mp_segment_mngr_base; //Segment manager - blockslist_t m_blocklist; //Intrusive container of blocks - free_nodes_t m_freelist; //Intrusive container of free nods - size_type m_allocated; //Used nodes for debugging -}; - - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP diff --git a/contrib/restricted/boost/boost/container/detail/pool_common.hpp b/contrib/restricted/boost/boost/container/detail/pool_common.hpp deleted file mode 100644 index f42c1dd4d2..0000000000 --- a/contrib/restricted/boost/boost/container/detail/pool_common.hpp +++ /dev/null @@ -1,57 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_POOL_COMMON_HPP -#define BOOST_CONTAINER_DETAIL_POOL_COMMON_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -#include <boost/intrusive/slist.hpp> - -namespace boost { -namespace container { -namespace dtl { - -template<class VoidPointer> -struct node_slist -{ - //This hook will be used to chain the individual nodes - typedef typename bi::make_slist_base_hook - <bi::void_pointer<VoidPointer>, bi::link_mode<bi::normal_link> >::type slist_hook_t; - - //A node object will hold node_t when it's not allocated - typedef slist_hook_t node_t; - - typedef typename bi::make_slist - <node_t, bi::linear<true>, bi::cache_last<true>, bi::base_hook<slist_hook_t> >::type node_slist_t; -}; - -template<class T> -struct is_stateless_segment_manager -{ - static const bool value = false; -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_DETAIL_ADAPTIVE_NODE_POOL_IMPL_HPP diff --git a/contrib/restricted/boost/boost/container/detail/pool_common_alloc.hpp b/contrib/restricted/boost/boost/container/detail/pool_common_alloc.hpp deleted file mode 100644 index bfb82f5561..0000000000 --- a/contrib/restricted/boost/boost/container/detail/pool_common_alloc.hpp +++ /dev/null @@ -1,102 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_POOL_COMMON_ALLOC_HPP -#define BOOST_CONTAINER_DETAIL_POOL_COMMON_ALLOC_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/throw_exception.hpp> - -#include <boost/intrusive/slist.hpp> -#include <boost/container/detail/pool_common.hpp> -#include <boost/container/detail/dlmalloc.hpp> -#include <cstddef> - -namespace boost{ -namespace container{ -namespace dtl{ - -struct node_slist_helper - : public boost::container::dtl::node_slist<void*> -{}; - -struct fake_segment_manager -{ - typedef void * void_pointer; - static const std::size_t PayloadPerAllocation = BOOST_CONTAINER_ALLOCATION_PAYLOAD; - - typedef boost::container::dtl:: - basic_multiallocation_chain<void*> multiallocation_chain; - static void deallocate(void_pointer p) - { dlmalloc_free(p); } - - static void deallocate_many(multiallocation_chain &chain) - { - std::size_t size = chain.size(); - std::pair<void*, void*> ptrs = chain.extract_data(); - dlmalloc_memchain dlchain; - BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&dlchain, ptrs.first, ptrs.second, size); - dlmalloc_multidealloc(&dlchain); - } - - typedef std::ptrdiff_t difference_type; - typedef std::size_t size_type; - - static void *allocate_aligned(std::size_t nbytes, std::size_t alignment) - { - void *ret = dlmalloc_memalign(nbytes, alignment); - if(!ret) - boost::container::throw_bad_alloc(); - return ret; - } - - static void *allocate(std::size_t nbytes) - { - void *ret = dlmalloc_malloc(nbytes); - if(!ret) - boost::container::throw_bad_alloc(); - return ret; - } -}; - -} //namespace boost{ -} //namespace container{ -} //namespace dtl{ - -namespace boost { -namespace container { -namespace dtl { - -template<class T> -struct is_stateless_segment_manager; - -template<> -struct is_stateless_segment_manager - <boost::container::dtl::fake_segment_manager> -{ - static const bool value = true; -}; - -} //namespace dtl { -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //BOOST_CONTAINER_DETAIL_POOL_COMMON_ALLOC_HPP diff --git a/contrib/restricted/boost/boost/container/detail/singleton.hpp b/contrib/restricted/boost/boost/container/detail/singleton.hpp deleted file mode 100644 index 7601c3ca8c..0000000000 --- a/contrib/restricted/boost/boost/container/detail/singleton.hpp +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (C) 2000 Stephen Cleary -// Copyright (C) 2008 Ion Gaztanaga -// -// Distributed under the Boost Software License, Version 1.0. (See -// accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org for updates, documentation, and revision history. -// -// This file is a modified file from Boost.Pool - -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2007-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_SINGLETON_DETAIL_HPP -#define BOOST_CONTAINER_DETAIL_SINGLETON_DETAIL_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// -// The following helper classes are placeholders for a generic "singleton" -// class. The classes below support usage of singletons, including use in -// program startup/shutdown code, AS LONG AS there is only one thread -// running before main() begins, and only one thread running after main() -// exits. -// -// This class is also limited in that it can only provide singleton usage for -// classes with default constructors. -// - -// The design of this class is somewhat twisted, but can be followed by the -// calling inheritance. Let us assume that there is some user code that -// calls "singleton_default<T>::instance()". The following (convoluted) -// sequence ensures that the same function will be called before main(): -// instance() contains a call to create_object.do_nothing() -// Thus, object_creator is implicitly instantiated, and create_object -// must exist. -// Since create_object is a static member, its constructor must be -// called before main(). -// The constructor contains a call to instance(), thus ensuring that -// instance() will be called before main(). -// The first time instance() is called (i.e., before main()) is the -// latest point in program execution where the object of type T -// can be created. -// Thus, any call to instance() will auto-magically result in a call to -// instance() before main(), unless already present. -// Furthermore, since the instance() function contains the object, instead -// of the singleton_default class containing a static instance of the -// object, that object is guaranteed to be constructed (at the latest) in -// the first call to instance(). This permits calls to instance() from -// static code, even if that code is called before the file-scope objects -// in this file have been initialized. - -namespace boost { -namespace container { -namespace dtl { - -// T must be: no-throw default constructible and no-throw destructible -template <typename T> -struct singleton_default -{ - private: - struct object_creator - { - // This constructor does nothing more than ensure that instance() - // is called before main() begins, thus creating the static - // T object before multithreading race issues can come up. - object_creator() { singleton_default<T>::instance(); } - inline void do_nothing() const { } - }; - static object_creator create_object; - - singleton_default(); - - public: - typedef T object_type; - - // If, at any point (in user code), singleton_default<T>::instance() - // is called, then the following function is instantiated. - static object_type & instance() - { - // This is the object that we return a reference to. - // It is guaranteed to be created before main() begins because of - // the next line. - static object_type obj; - - // The following line does nothing else than force the instantiation - // of singleton_default<T>::create_object, whose constructor is - // called before main() begins. - create_object.do_nothing(); - - return obj; - } -}; -template <typename T> -typename singleton_default<T>::object_creator -singleton_default<T>::create_object; - -} // namespace dtl -} // namespace container -} // namespace boost - -#include <boost/container/detail/config_end.hpp> - -#endif //BOOST_CONTAINER_DETAIL_SINGLETON_DETAIL_HPP diff --git a/contrib/restricted/boost/boost/container/flat_map.hpp b/contrib/restricted/boost/boost/container/flat_map.hpp deleted file mode 100644 index ffd0d058ab..0000000000 --- a/contrib/restricted/boost/boost/container/flat_map.hpp +++ /dev/null @@ -1,2590 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_FLAT_MAP_HPP -#define BOOST_CONTAINER_FLAT_MAP_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -// container -#include <boost/container/allocator_traits.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/new_allocator.hpp> //new_allocator -#include <boost/container/throw_exception.hpp> -// container/detail -#include <boost/container/detail/flat_tree.hpp> -#include <boost/container/detail/type_traits.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/algorithm.hpp> //equal() -#include <boost/container/detail/container_or_allocator_rebind.hpp> -// move -#include <boost/move/utility_core.hpp> -#include <boost/move/traits.hpp> -// move/detail -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -#include <boost/move/detail/fwd_macros.hpp> -#endif -#include <boost/move/detail/move_helpers.hpp> -// intrusive -#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair -#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal -//others -#include <boost/core/no_exceptions_support.hpp> - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -namespace boost { -namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -template <class Key, class T, class Compare, class AllocatorOrContainer> -class flat_multimap; - -namespace dtl{ - -template<class D, class S> -BOOST_CONTAINER_FORCEINLINE static D &force(S &s) -{ return *reinterpret_cast<D*>(&s); } - -template<class D, class S> -BOOST_CONTAINER_FORCEINLINE static D force_copy(const S &s) -{ - const D *const vp = reinterpret_cast<const D *>(&s); - D ret_val(*vp); - return ret_val; -} - -} //namespace dtl{ - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! A flat_map is a kind of associative container that supports unique keys (contains at -//! most one of each key value) and provides for fast retrieval of values of another -//! type T based on the keys. -//! -//! A flat_map satisfies all of the requirements of a container, a reversible -//! container and an associative container. A flat_map also provides -//! most operations described for unique keys. For a -//! flat_map<Key,T> the key_type is Key and the value_type is std::pair<Key,T> -//! (unlike std::map<Key, T> which value_type is std::pair<<b>const</b> Key, T>). -//! -//! flat_map is similar to std::map but it's implemented by as an ordered sequence container. -//! The underlying sequence container is by default <i>vector</i> but it can also work -//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>). -//! -//! Using vector-like sequence containers means that inserting a new element into a flat_map might invalidate -//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar -//! container that offers stable pointers and references). Similarly, erasing an element might invalidate -//! iterators and references pointing to elements that come after (their keys are bigger) the erased element. -//! -//! This container provides random-access iterators. -//! -//! \tparam Key is the key_type of the map -//! \tparam Value is the <code>mapped_type</code> -//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>). -//! \tparam AllocatorOrContainer is either: -//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>). -//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>) -//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like -//! sequence container with random-access iterators.. -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class Key, class T, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator< std::pair< Key, T> > > -#else -template <class Key, class T, class Compare, class AllocatorOrContainer> -#endif -class flat_map -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - BOOST_COPYABLE_AND_MOVABLE(flat_map) - //This is the tree that we should store if pair was movable - typedef dtl::flat_tree< - std::pair<Key, T>, - dtl::select1st<Key>, - Compare, - AllocatorOrContainer> tree_t; - - //This is the real tree stored here. It's based on a movable pair - typedef dtl::flat_tree< - dtl::pair<Key, T>, - dtl::select1st<Key>, - Compare, - typename dtl::container_or_allocator_rebind<AllocatorOrContainer, dtl::pair<Key, T> >::type - > impl_tree_t; - impl_tree_t m_flat_tree; // flat tree representing flat_map - - typedef typename impl_tree_t::value_type impl_value_type; - typedef typename impl_tree_t::const_iterator impl_const_iterator; - typedef typename impl_tree_t::iterator impl_iterator; - typedef typename impl_tree_t::allocator_type impl_allocator_type; - #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - typedef std::initializer_list<impl_value_type> impl_initializer_list; - #endif - - typedef dtl::flat_tree_value_compare - < Compare - , dtl::select1st<Key> - , std::pair<Key, T> > value_compare_t; - typedef typename tree_t::iterator iterator_t; - typedef typename tree_t::const_iterator const_iterator_t; - typedef typename tree_t::reverse_iterator reverse_iterator_t; - typedef typename tree_t::const_reverse_iterator const_reverse_iterator_t; - - public: - typedef typename impl_tree_t::stored_allocator_type impl_stored_allocator_type; - typedef typename impl_tree_t::sequence_type impl_sequence_type; - - BOOST_CONTAINER_FORCEINLINE impl_tree_t &tree() - { return m_flat_tree; } - - BOOST_CONTAINER_FORCEINLINE const impl_tree_t &tree() const - { return m_flat_tree; } - - private: - typedef typename tree_t::get_stored_allocator_const_return_t get_stored_allocator_const_return_t; - typedef typename tree_t::get_stored_allocator_noconst_return_t get_stored_allocator_noconst_return_t; - typedef typename impl_tree_t::get_stored_allocator_const_return_t impl_get_stored_allocator_const_return_t; - typedef typename impl_tree_t::get_stored_allocator_noconst_return_t impl_get_stored_allocator_noconst_return_t; - - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - typedef Key key_type; - typedef T mapped_type; - typedef Compare key_compare; - typedef std::pair<Key, T> value_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type; - typedef typename sequence_type::allocator_type allocator_type; - typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type; - typedef typename sequence_type::pointer pointer; - typedef typename sequence_type::const_pointer const_pointer; - typedef typename sequence_type::reference reference; - typedef typename sequence_type::const_reference const_reference; - typedef typename sequence_type::size_type size_type; - typedef typename sequence_type::difference_type difference_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare; - - typedef typename sequence_type::iterator iterator; - typedef typename sequence_type::const_iterator const_iterator; - typedef typename sequence_type::reverse_iterator reverse_iterator; - typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type; - - //AllocatorOrContainer::value_type must be std::pair<Key, T> - BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, typename allocator_type::value_type>::value)); - - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Default constructs an empty flat_map. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE flat_map() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value && - dtl::is_nothrow_default_constructible<Compare>::value) - : m_flat_tree() - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified allocator. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE explicit flat_map(const allocator_type& a) - : m_flat_tree(dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified - //! comparison object. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE explicit flat_map(const Compare& comp) - : m_flat_tree(comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified - //! comparison object and allocator. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE flat_map(const Compare& comp, const allocator_type& a) - : m_flat_tree(comp, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map and - //! and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_map(InputIterator first, InputIterator last) - : m_flat_tree(true, first, last) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified - //! allocator, and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_map(InputIterator first, InputIterator last, const allocator_type& a) - : m_flat_tree(true, first, last, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_map(InputIterator first, InputIterator last, const Compare& comp) - : m_flat_tree(true, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! allocator, and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_map(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(true, first, last, comp, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map - //! and inserts elements from the ordered range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_map(ordered_unique_range_t, InputIterator first, InputIterator last) - : m_flat_tree(ordered_range, first, last) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! inserts elements from the ordered range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_map(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp) - : m_flat_tree(ordered_range, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! allocator, and inserts elements from the ordered range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_map(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(ordered_range, first, last, comp, dtl::force<const impl_allocator_type>(a)) - {} - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs an empty flat_map and - //! inserts elements from the range [il.begin() ,il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list<value_type> il) - : m_flat_tree( true - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified - //! allocator, and inserts elements from the range [il.begin() ,il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list<value_type> il, const allocator_type& a) - : m_flat_tree( true - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! inserts elements from the range [il.begin() ,il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list<value_type> il, const Compare& comp) - : m_flat_tree(true - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! allocator, and inserts elements from the range [il.begin() ,il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE flat_map(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : m_flat_tree(true - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , comp - , dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using and - //! inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, std::initializer_list<value_type> il) - : m_flat_tree(ordered_unique_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp) - : m_flat_tree(ordered_unique_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_map(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : m_flat_tree( ordered_unique_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , comp - , dtl::force<const impl_allocator_type>(a)) - {} -#endif - - //! <b>Effects</b>: Copy constructs a flat_map. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE flat_map(const flat_map& x) - : m_flat_tree(x.m_flat_tree) - {} - - //! <b>Effects</b>: Move constructs a flat_map. - //! Constructs *this using x's resources. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Postcondition</b>: x is emptied. - BOOST_CONTAINER_FORCEINLINE flat_map(BOOST_RV_REF(flat_map) x) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) - : m_flat_tree(boost::move(x.m_flat_tree)) - {} - - //! <b>Effects</b>: Copy constructs a flat_map using the specified allocator. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE flat_map(const flat_map& x, const allocator_type &a) - : m_flat_tree(x.m_flat_tree, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Move constructs a flat_map using the specified allocator. - //! Constructs *this using x's resources. - //! - //! <b>Complexity</b>: Constant if x.get_allocator() == a, linear otherwise. - BOOST_CONTAINER_FORCEINLINE flat_map(BOOST_RV_REF(flat_map) x, const allocator_type &a) - : m_flat_tree(boost::move(x.m_flat_tree), dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Makes *this a copy of x. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE flat_map& operator=(BOOST_COPY_ASSIGN_REF(flat_map) x) - { m_flat_tree = x.m_flat_tree; return *this; } - - //! <b>Effects</b>: Move constructs a flat_map. - //! Constructs *this using x's resources. - //! - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or value_type's move constructor throws) - //! - //! <b>Complexity</b>: Constant if allocator_traits_type:: - //! propagate_on_container_move_assignment is true or - //! this->get>allocator() == x.get_allocator(). Linear otherwise. - BOOST_CONTAINER_FORCEINLINE flat_map& operator=(BOOST_RV_REF(flat_map) x) - BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || - allocator_traits_type::is_always_equal::value) && - boost::container::dtl::is_nothrow_move_assignable<Compare>::value) - { m_flat_tree = boost::move(x.m_flat_tree); return *this; } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Assign elements from il to *this - flat_map& operator=(std::initializer_list<value_type> il) - { - this->clear(); - this->insert(il.begin(), il.end()); - return *this; - } -#endif - - //! <b>Effects</b>: Returns a copy of the allocator that - //! was passed to the object's constructor. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<allocator_type>(m_flat_tree.get_allocator()); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_noconst_return_t get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { - impl_get_stored_allocator_noconst_return_t r = m_flat_tree.get_stored_allocator(); - return dtl::force<stored_allocator_type>(r); - } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE get_stored_allocator_const_return_t get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { - impl_get_stored_allocator_const_return_t r = m_flat_tree.get_stored_allocator(); - return dtl::force<const stored_allocator_type>(r); - } - - ////////////////////////////////////////////// - // - // iterators - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns an iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.begin()); } - - //! <b>Effects</b>: Returns an iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.end()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.end()); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<reverse_iterator>(m_flat_tree.rbegin()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rbegin()); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<reverse_iterator>(m_flat_tree.rend()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rend()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.cbegin()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.cend()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crbegin()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crend()); } - - ////////////////////////////////////////////// - // - // capacity - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns true if the container contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE bool empty() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.empty(); } - - //! <b>Effects</b>: Returns the number of the elements contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE size_type size() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.size(); } - - //! <b>Effects</b>: Returns the largest possible size of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.max_size(); } - - //! <b>Effects</b>: Number of elements for which memory has been allocated. - //! capacity() is always greater than or equal to size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.capacity(); } - - //! <b>Effects</b>: If n is less than or equal to capacity(), or the - //! underlying container has no `reserve` member, this call has no - //! effect. Otherwise, it is a request for allocation of additional memory. - //! If the request is successful, then capacity() is greater than or equal to - //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged. - //! - //! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws. - //! - //! <b>Note</b>: If capacity() is less than "cnt", iterators and references to - //! to values might be invalidated. - BOOST_CONTAINER_FORCEINLINE void reserve(size_type cnt) - { m_flat_tree.reserve(cnt); } - - //! <b>Effects</b>: Tries to deallocate the excess of memory created - // with previous allocations. The size of the vector is unchanged - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to size(). - BOOST_CONTAINER_FORCEINLINE void shrink_to_fit() - { m_flat_tree.shrink_to_fit(); } - - ////////////////////////////////////////////// - // - // element access - // - ////////////////////////////////////////////// - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! Effects: If there is no key equivalent to x in the flat_map, inserts - //! value_type(x, T()) into the flat_map. - //! - //! Returns: A reference to the mapped_type corresponding to x in *this. - //! - //! Complexity: Logarithmic. - mapped_type &operator[](const key_type& k); - - //! Effects: If there is no key equivalent to x in the flat_map, inserts - //! value_type(move(x), T()) into the flat_map (the key is move-constructed) - //! - //! Returns: A reference to the mapped_type corresponding to x in *this. - //! - //! Complexity: Logarithmic. - mapped_type &operator[](key_type &&k) ; - #elif defined(BOOST_MOVE_HELPERS_RETURN_SFINAE_BROKEN) - //in compilers like GCC 3.4, we can't catch temporaries - BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](const key_type &k) { return this->priv_subscript(k); } - BOOST_CONTAINER_FORCEINLINE mapped_type& operator[](BOOST_RV_REF(key_type) k) { return this->priv_subscript(::boost::move(k)); } - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH( operator[] , key_type, mapped_type&, this->priv_subscript) - #endif - - //! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj) - //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value - //! as if by insert, constructing it from value_type(k, forward<M>(obj)). - //! - //! No iterators or references are invalidated. If the insertion is successful, pointers and references - //! to the element obtained while it is held in the node handle are invalidated, and pointers and - //! references obtained to that element before it was extracted become valid. - //! - //! Returns: The bool component is true if the insertion took place and false if the assignment - //! took place. The iterator component is pointing at the element that was inserted or updated. - //! - //! Complexity: Logarithmic in the size of the container. - template <class M> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(const key_type& k, BOOST_FWD_REF(M) obj) - { - return dtl::force_copy< std::pair<iterator, bool> > - (this->m_flat_tree.insert_or_assign - ( impl_const_iterator(), k, ::boost::forward<M>(obj)) - ); - } - - //! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj) - //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value - //! as if by insert, constructing it from value_type(k, move(obj)). - //! - //! No iterators or references are invalidated. If the insertion is successful, pointers and references - //! to the element obtained while it is held in the node handle are invalidated, and pointers and - //! references obtained to that element before it was extracted become valid. - //! - //! Returns: The bool component is true if the insertion took place and false if the assignment - //! took place. The iterator component is pointing at the element that was inserted or updated. - //! - //! Complexity: Logarithmic in the size of the container. - template <class M> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> insert_or_assign(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) - { - return dtl::force_copy< std::pair<iterator, bool> > - (this->m_flat_tree.insert_or_assign - ( impl_const_iterator(), ::boost::move(k), ::boost::forward<M>(obj)) - ); - } - - //! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj) - //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value - //! as if by insert, constructing it from value_type(k, forward<M>(obj)) and the new element - //! to the container as close as possible to the position just before hint. - //! - //! No iterators or references are invalidated. If the insertion is successful, pointers and references - //! to the element obtained while it is held in the node handle are invalidated, and pointers and - //! references obtained to that element before it was extracted become valid. - //! - //! Returns: The bool component is true if the insertion took place and false if the assignment - //! took place. The iterator component is pointing at the element that was inserted or updated. - //! - //! Complexity: Logarithmic in the size of the container in general, but amortized constant if - //! the new element is inserted just before hint. - template <class M> - BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, const key_type& k, BOOST_FWD_REF(M) obj) - { - return dtl::force_copy< std::pair<iterator, bool> > - (this->m_flat_tree.insert_or_assign - ( dtl::force_copy<impl_const_iterator>(hint) - , k, ::boost::forward<M>(obj)) - ); - } - - //! Effects: If a key equivalent to k already exists in the container, assigns forward<M>(obj) - //! to the mapped_type corresponding to the key k. If the key does not exist, inserts the new value - //! as if by insert, constructing it from value_type(k, move(obj)) and the new element - //! to the container as close as possible to the position just before hint. - //! - //! No iterators or references are invalidated. If the insertion is successful, pointers and references - //! to the element obtained while it is held in the node handle are invalidated, and pointers and - //! references obtained to that element before it was extracted become valid. - //! - //! Returns: The bool component is true if the insertion took place and false if the assignment - //! took place. The iterator component is pointing at the element that was inserted or updated. - //! - //! Complexity: Logarithmic in the size of the container in general, but amortized constant if - //! the new element is inserted just before hint. - template <class M> - BOOST_CONTAINER_FORCEINLINE iterator insert_or_assign(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(M) obj) - { - return dtl::force_copy< std::pair<iterator, bool> > - (this->m_flat_tree.insert_or_assign - ( dtl::force_copy<impl_const_iterator>(hint) - , ::boost::move(k), ::boost::forward<M>(obj)) - ); - } - - //! @copydoc ::boost::container::flat_set::nth(size_type) - BOOST_CONTAINER_FORCEINLINE iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.nth(n)); } - - //! @copydoc ::boost::container::flat_set::nth(size_type) const - BOOST_CONTAINER_FORCEINLINE const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.nth(n)); } - - //! @copydoc ::boost::container::flat_set::index_of(iterator) - BOOST_CONTAINER_FORCEINLINE size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(dtl::force_copy<impl_iterator>(p)); } - - //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const - BOOST_CONTAINER_FORCEINLINE size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(dtl::force_copy<impl_const_iterator>(p)); } - - //! Returns: A reference to the element whose key is equivalent to x. - //! - //! Throws: An exception object of type out_of_range if no such element is present. - //! - //! Complexity: logarithmic. - T& at(const key_type& k) - { - iterator i = this->find(k); - if(i == this->end()){ - throw_out_of_range("flat_map::at key not found"); - } - return i->second; - } - - //! Returns: A reference to the element whose key is equivalent to x. - //! - //! Throws: An exception object of type out_of_range if no such element is present. - //! - //! Complexity: logarithmic. - const T& at(const key_type& k) const - { - const_iterator i = this->find(k); - if(i == this->end()){ - throw_out_of_range("flat_map::at key not found"); - } - return i->second; - } - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object x of type T constructed with - //! std::forward<Args>(args)... if and only if there is no element in the container - //! with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args) - { return dtl::force_copy< std::pair<iterator, bool> >(m_flat_tree.emplace_unique(boost::forward<Args>(args)...)); } - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the container if and only if there is - //! no element in the container with key equivalent to the key of x. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args) - { - return dtl::force_copy<iterator> - (m_flat_tree.emplace_hint_unique( dtl::force_copy<impl_const_iterator>(hint) - , boost::forward<Args>(args)...)); - } - - //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct, - //! forward_as_tuple(k), forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise - //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k), - //! forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only if the - //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. - //! - //! <b>Complexity</b>: Logarithmic. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(const key_type& k, BOOST_FWD_REF(Args)... args) - { - return dtl::force_copy< std::pair<iterator, bool> >( - m_flat_tree.try_emplace(impl_const_iterator(), k, boost::forward<Args>(args)...)); - } - - //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct, - //! forward_as_tuple(k), forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise - //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(k), - //! forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Returns</b>: The returned iterator points to the map element whose key is equivalent to k. - //! - //! <b>Complexity</b>: Logarithmic in general, but amortized constant if value - //! is inserted right before p. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k, BOOST_FWD_REF(Args)... args) - { - return dtl::force_copy<iterator>(m_flat_tree.try_emplace - (dtl::force_copy<impl_const_iterator>(hint), k, boost::forward<Args>(args)...).first); - } - - //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct, - //! forward_as_tuple(move(k)), forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise - //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)), - //! forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only if the - //! insertion took place. The returned iterator points to the map element whose key is equivalent to k. - //! - //! <b>Complexity</b>: Logarithmic. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) - { - return dtl::force_copy< std::pair<iterator, bool> > - (m_flat_tree.try_emplace(impl_const_iterator(), boost::move(k), boost::forward<Args>(args)...)); - } - - //! <b>Requires</b>: value_type shall be EmplaceConstructible into map from piecewise_construct, - //! forward_as_tuple(move(k)), forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Effects</b>: If the map already contains an element whose key is equivalent to k, there is no effect. Otherwise - //! inserts an object of type value_type constructed with piecewise_construct, forward_as_tuple(move(k)), - //! forward_as_tuple(forward<Args>(args)...). - //! - //! <b>Returns</b>: The returned iterator points to the map element whose key is equivalent to k. - //! - //! <b>Complexity</b>: Logarithmic in general, but amortized constant if value - //! is inserted right before p. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k, BOOST_FWD_REF(Args)... args) - { - return dtl::force_copy<iterator> - (m_flat_tree.try_emplace(dtl::force_copy - <impl_const_iterator>(hint), boost::move(k), boost::forward<Args>(args)...).first); - } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\ - {\ - return dtl::force_copy< std::pair<iterator, bool> >\ - (m_flat_tree.emplace_unique(BOOST_MOVE_FWD##N));\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - return dtl::force_copy<iterator>(m_flat_tree.emplace_hint_unique\ - (dtl::force_copy<impl_const_iterator>(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ - }\ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(const key_type& k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - return dtl::force_copy< std::pair<iterator, bool> >\ - (m_flat_tree.try_emplace(impl_const_iterator(), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, const key_type &k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { return dtl::force_copy<iterator>(m_flat_tree.try_emplace\ - (dtl::force_copy<impl_const_iterator>(hint), k BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> try_emplace(BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - return dtl::force_copy< std::pair<iterator, bool> >\ - (m_flat_tree.try_emplace(impl_const_iterator(), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator try_emplace(const_iterator hint, BOOST_RV_REF(key_type) k BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { return dtl::force_copy<iterator>(m_flat_tree.try_emplace\ - (dtl::force_copy<impl_const_iterator>(hint), boost::move(k) BOOST_MOVE_I##N BOOST_MOVE_FWD##N).first); }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE) - #undef BOOST_CONTAINER_FLAT_MAP_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - //! <b>Effects</b>: Inserts x if and only if there is no element in the container - //! with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(const value_type& x) - { return dtl::force_copy<std::pair<iterator,bool> >( - m_flat_tree.insert_unique(dtl::force<const impl_value_type>(x))); } - - //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and - //! only if there is no element in the container with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(value_type) x) - { return dtl::force_copy<std::pair<iterator,bool> >( - m_flat_tree.insert_unique(boost::move(dtl::force<impl_value_type>(x)))); } - - //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and - //! only if there is no element in the container with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> insert(BOOST_RV_REF(movable_value_type) x) - { - return dtl::force_copy<std::pair<iterator,bool> > - (m_flat_tree.insert_unique(boost::move(x))); - } - - //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is - //! no element in the container with key equivalent to the key of x. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x) - { - return dtl::force_copy<iterator>( - m_flat_tree.insert_unique( dtl::force_copy<impl_const_iterator>(p) - , dtl::force<const impl_value_type>(x))); - } - - //! <b>Effects</b>: Inserts an element move constructed from x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) - { - return dtl::force_copy<iterator> - (m_flat_tree.insert_unique( dtl::force_copy<impl_const_iterator>(p) - , boost::move(dtl::force<impl_value_type>(x)))); - } - - //! <b>Effects</b>: Inserts an element move constructed from x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(movable_value_type) x) - { - return dtl::force_copy<iterator>( - m_flat_tree.insert_unique(dtl::force_copy<impl_const_iterator>(p), boost::move(x))); - } - - //! <b>Requires</b>: first, last are not iterators into *this. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) if and only - //! if there is no element with key equivalent to the key of that element. - //! - //! <b>Complexity</b>: N log(size()+N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) - { m_flat_tree.insert_unique(first, last); } - - //! <b>Requires</b>: first, last are not iterators into *this. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) if and only - //! if there is no element with key equivalent to the key of that element. This - //! function is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last) - { m_flat_tree.insert_unique(ordered_unique_range, first, last); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only - //! if there is no element with key equivalent to the key of that element. - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il) - { - m_flat_tree.insert_unique( dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()); - } - - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only - //! if there is no element with key equivalent to the key of that element. This - //! function is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il) - { - m_flat_tree.insert_unique(ordered_unique_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()); - } -#endif - - //! <b>Requires</b>: this->get_allocator() == source.get_allocator(). - //! - //! <b>Effects</b>: Attempts to extract each element in source and insert it into a using - //! the comparison object of *this. If there is an element in a with key equivalent to the - //! key of an element from source, then that element is not extracted from source. - //! - //! <b>Postcondition</b>: Pointers and references to the transferred elements of source refer - //! to those same elements but as members of *this. Iterators referring to the transferred - //! elements will continue to refer to their elements, but they now behave as iterators into *this, - //! not into source. - //! - //! <b>Throws</b>: Nothing unless the comparison object throws. - //! - //! <b>Complexity</b>: N log(a.size() + N) (N has the value source.size()) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_map<Key, T, C2, AllocatorOrContainer>& source) - { m_flat_tree.merge_unique(source.tree()); } - - //! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_map<Key, T, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_map<Key, T, C2, AllocatorOrContainer>&>(source)); } - - //! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_multimap<Key, T, C2, AllocatorOrContainer>& source) - { m_flat_tree.merge_unique(source.tree()); } - - //! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multimap<Key, T, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_multimap<Key, T, C2, AllocatorOrContainer>&>(source)); } - - //! <b>Effects</b>: Erases the element pointed to by p. - //! - //! <b>Returns</b>: Returns an iterator pointing to the element immediately - //! following q prior to the element being erased. If no such element exists, - //! returns end(). - //! - //! <b>Complexity</b>: Linear to the elements with keys bigger than p - //! - //! <b>Note</b>: Invalidates elements with keys - //! not less than the erased element. - BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p) - { - return dtl::force_copy<iterator> - (m_flat_tree.erase(dtl::force_copy<impl_const_iterator>(p))); - } - - //! <b>Effects</b>: Erases all elements in the container with key equivalent to x. - //! - //! <b>Returns</b>: Returns the number of erased elements. - //! - //! <b>Complexity</b>: Logarithmic search time plus erasure time - //! linear to the elements with bigger keys. - BOOST_CONTAINER_FORCEINLINE size_type erase(const key_type& x) - { return m_flat_tree.erase(x); } - - //! <b>Effects</b>: Erases all the elements in the range [first, last). - //! - //! <b>Returns</b>: Returns last. - //! - //! <b>Complexity</b>: size()*N where N is the distance from first to last. - //! - //! <b>Complexity</b>: Logarithmic search time plus erasure time - //! linear to the elements with bigger keys. - BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator first, const_iterator last) - { - return dtl::force_copy<iterator>( - m_flat_tree.erase( dtl::force_copy<impl_const_iterator>(first) - , dtl::force_copy<impl_const_iterator>(last))); - } - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE void swap(flat_map& x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::dtl::is_nothrow_swappable<Compare>::value ) - { m_flat_tree.swap(x.m_flat_tree); } - - //! <b>Effects</b>: erase(a.begin(),a.end()). - //! - //! <b>Postcondition</b>: size() == 0. - //! - //! <b>Complexity</b>: linear in size(). - BOOST_CONTAINER_FORCEINLINE void clear() BOOST_NOEXCEPT_OR_NOTHROW - { m_flat_tree.clear(); } - - ////////////////////////////////////////////// - // - // observers - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns the comparison object out - //! of which a was constructed. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const - { return dtl::force_copy<key_compare>(m_flat_tree.key_comp()); } - - //! <b>Effects</b>: Returns an object of value_compare constructed out - //! of the comparison object. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const - { return value_compare(dtl::force_copy<key_compare>(m_flat_tree.key_comp())); } - - ////////////////////////////////////////////// - // - // map operations - // - ////////////////////////////////////////////// - - //! <b>Returns</b>: An iterator pointing to an element with the key - //! equivalent to x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x) - { return dtl::force_copy<iterator>(m_flat_tree.find(x)); } - - //! <b>Returns</b>: A const_iterator pointing to an element with the key - //! equivalent to x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const - { return dtl::force_copy<const_iterator>(m_flat_tree.find(x)); } - - //! <b>Returns</b>: The number of elements with key equivalent to x. - //! - //! <b>Complexity</b>: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const - { return static_cast<size_type>(m_flat_tree.find(x) != m_flat_tree.end()); } - - //! <b>Returns</b>: An iterator pointing to the first element with key not less - //! than k, or a.end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x) - { return dtl::force_copy<iterator>(m_flat_tree.lower_bound(x)); } - - //! <b>Returns</b>: A const iterator pointing to the first element with key not - //! less than k, or a.end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const - { return dtl::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); } - - //! <b>Returns</b>: An iterator pointing to the first element with key not less - //! than x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x) - { return dtl::force_copy<iterator>(m_flat_tree.upper_bound(x)); } - - //! <b>Returns</b>: A const iterator pointing to the first element with key not - //! less than x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const - { return dtl::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); } - - //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x) - { return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.lower_bound_range(x)); } - - //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const - { return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.lower_bound_range(x)); } - - //! <b>Effects</b>: Extracts the internal sequence container. - //! - //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant. - //! - //! <b>Postcondition</b>: this->empty() - //! - //! <b>Throws</b>: If secuence_type's move constructor throws - BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() - { - return boost::move(dtl::force<sequence_type>(m_flat_tree.get_sequence_ref())); - } - - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. Erases non-unique elements. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() - //! - //! <b>Throws</b>: If the comparison or the move constructor throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_unique(boost::move(dtl::force<impl_sequence_type>(seq))); } - - //! <b>Requires</b>: seq shall be ordered according to this->compare() - //! and shall contain unique elements. - //! - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(1) - //! - //! <b>Throws</b>: If the move assignment throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_unique(ordered_unique_range_t(), boost::move(dtl::force<impl_sequence_type>(seq))); } - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_map& x, const flat_map& y) - { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_map& x, const flat_map& y) - { return !(x == y); } - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_map& x, const flat_map& y) - { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_map& x, const flat_map& y) - { return y < x; } - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_map& x, const flat_map& y) - { return !(y < x); } - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_map& x, const flat_map& y) - { return !(x < y); } - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE friend void swap(flat_map& x, flat_map& y) - { x.swap(y); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - mapped_type &priv_subscript(const key_type& k) - { - iterator i = lower_bound(k); - // i->first is greater than or equivalent to k. - if (i == end() || key_comp()(k, (*i).first)){ - dtl::value_init<mapped_type> m; - i = insert(i, impl_value_type(k, ::boost::move(m.m_t))); - } - return (*i).second; - } - mapped_type &priv_subscript(BOOST_RV_REF(key_type) mk) - { - key_type &k = mk; - iterator i = lower_bound(k); - // i->first is greater than or equivalent to k. - if (i == end() || key_comp()(k, (*i).first)){ - dtl::value_init<mapped_type> m; - i = insert(i, impl_value_type(boost::move(k), ::boost::move(m.m_t))); - } - return (*i).second; - } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -}; - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -} //namespace container { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class Key, class T, class Compare, class AllocatorOrContainer> -struct has_trivial_destructor_after_move<boost::container::flat_map<Key, T, Compare, AllocatorOrContainer> > -{ - typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value && - ::boost::has_trivial_destructor_after_move<Compare>::value; -}; - -namespace container { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! A flat_multimap is a kind of associative container that supports equivalent keys -//! (possibly containing multiple copies of the same key value) and provides for -//! fast retrieval of values of another type T based on the keys. -//! -//! A flat_multimap satisfies all of the requirements of a container and of a reversible -//! container and of an associative container. For a -//! flat_multimap<Key,T> the key_type is Key and the value_type is std::pair<Key,T> -//! (unlike std::multimap<Key, T> which value_type is std::pair<<b>const</b> Key, T>). -//! -//! flat_multimap is similar to std::multimap but it's implemented by as an ordered sequence container. -//! The underlying sequence container is by default <i>vector</i> but it can also work -//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>). -//! -//! Using vector-like sequence containers means that inserting a new element into a flat_multimap might invalidate -//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar -//! container that offers stable pointers and references). Similarly, erasing an element might invalidate -//! iterators and references pointing to elements that come after (their keys are bigger) the erased element. -//! -//! This container provides random-access iterators. -//! -//! \tparam Key is the key_type of the map -//! \tparam Value is the <code>mapped_type</code> -//! \tparam Compare is the ordering function for Keys (e.g. <i>std::less<Key></i>). -//! \tparam AllocatorOrContainer is either: -//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>). -//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>) -//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like -//! sequence container with random-access iterators. -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class Key, class T, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator< std::pair< Key, T> > > -#else -template <class Key, class T, class Compare, class AllocatorOrContainer> -#endif -class flat_multimap -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - BOOST_COPYABLE_AND_MOVABLE(flat_multimap) - typedef dtl::flat_tree< - std::pair<Key, T>, - dtl::select1st<Key>, - Compare, - AllocatorOrContainer> tree_t; - //This is the real tree stored here. It's based on a movable pair - typedef dtl::flat_tree< - dtl::pair<Key, T>, - dtl::select1st<Key>, - Compare, - typename dtl::container_or_allocator_rebind<AllocatorOrContainer, dtl::pair<Key, T> >::type - > impl_tree_t; - impl_tree_t m_flat_tree; // flat tree representing flat_map - - typedef typename impl_tree_t::value_type impl_value_type; - typedef typename impl_tree_t::const_iterator impl_const_iterator; - typedef typename impl_tree_t::iterator impl_iterator; - typedef typename impl_tree_t::allocator_type impl_allocator_type; - #if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - typedef std::initializer_list<impl_value_type> impl_initializer_list; - #endif - - typedef dtl::flat_tree_value_compare - < Compare - , dtl::select1st<Key> - , std::pair<Key, T> > value_compare_t; - typedef typename tree_t::iterator iterator_t; - typedef typename tree_t::const_iterator const_iterator_t; - typedef typename tree_t::reverse_iterator reverse_iterator_t; - typedef typename tree_t::const_reverse_iterator const_reverse_iterator_t; - - public: - typedef typename impl_tree_t::stored_allocator_type impl_stored_allocator_type; - typedef typename impl_tree_t::sequence_type impl_sequence_type; - - BOOST_CONTAINER_FORCEINLINE impl_tree_t &tree() - { return m_flat_tree; } - - BOOST_CONTAINER_FORCEINLINE const impl_tree_t &tree() const - { return m_flat_tree; } - - private: - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - typedef Key key_type; - typedef T mapped_type; - typedef Compare key_compare; - typedef std::pair<Key, T> value_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type; - typedef typename sequence_type::allocator_type allocator_type; - typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type; - typedef typename sequence_type::pointer pointer; - typedef typename sequence_type::const_pointer const_pointer; - typedef typename sequence_type::reference reference; - typedef typename sequence_type::const_reference const_reference; - typedef typename sequence_type::size_type size_type; - typedef typename sequence_type::difference_type difference_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare; - - typedef typename sequence_type::iterator iterator; - typedef typename sequence_type::const_iterator const_iterator; - typedef typename sequence_type::reverse_iterator reverse_iterator; - typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(impl_value_type) movable_value_type; - - //AllocatorOrContainer::value_type must be std::pair<Key, T> - BOOST_STATIC_ASSERT((dtl::is_same<std::pair<Key, T>, typename AllocatorOrContainer::value_type>::value)); - - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Default constructs an empty flat_map. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE flat_multimap() - BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value && - dtl::is_nothrow_default_constructible<Compare>::value) - : m_flat_tree() - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified allocator. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE explicit flat_multimap(const allocator_type& a) - : m_flat_tree(dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison - //! object . - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE explicit flat_multimap(const Compare& comp) - : m_flat_tree(comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison - //! object and allocator. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(const Compare& comp, const allocator_type& a) - : m_flat_tree(comp, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap - //! and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(InputIterator first, InputIterator last) - : m_flat_tree(false, first, last) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified - //! allocator, and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(InputIterator first, InputIterator last, const allocator_type& a) - : m_flat_tree(false, first, last, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object - //! and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(InputIterator first, InputIterator last, const Compare& comp) - : m_flat_tree(false, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object - //! and allocator, and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(false, first, last, comp, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap - //! and inserts elements from the ordered range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(ordered_range_t, InputIterator first, InputIterator last) - : m_flat_tree(ordered_range, first, last) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and - //! inserts elements from the ordered range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp) - : m_flat_tree(ordered_range, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and - //! allocator, and inserts elements from the ordered range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_multimap(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : m_flat_tree(ordered_range, first, last, comp, a) - {} - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs an empty flat_map and - //! inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(std::initializer_list<value_type> il) - : m_flat_tree( false - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified - //! allocator, and inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(std::initializer_list<value_type> il, const allocator_type& a) - : m_flat_tree(false - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(std::initializer_list<value_type> il, const Compare& comp) - : m_flat_tree(false - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end(), comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_map using the specified comparison object and - //! allocator, and inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! the predicate and otherwise N logN, where N is last - first. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : m_flat_tree( false - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , comp, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap and - //! inserts elements from the ordered range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(ordered_range_t, std::initializer_list<value_type> il) - : m_flat_tree( ordered_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and - //! inserts elements from the ordered range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp) - : m_flat_tree( ordered_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end(), comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_multimap using the specified comparison object and - //! allocator, and inserts elements from the ordered range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : m_flat_tree( ordered_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end() - , comp, dtl::force<const impl_allocator_type>(a)) - {} -#endif - - //! <b>Effects</b>: Copy constructs a flat_multimap. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE - flat_multimap(const flat_multimap& x) - : m_flat_tree(x.m_flat_tree) - {} - - //! <b>Effects</b>: Move constructs a flat_multimap. Constructs *this using x's resources. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Postcondition</b>: x is emptied. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(BOOST_RV_REF(flat_multimap) x) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) - : m_flat_tree(boost::move(x.m_flat_tree)) - {} - - //! <b>Effects</b>: Copy constructs a flat_multimap using the specified allocator. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE - flat_multimap(const flat_multimap& x, const allocator_type &a) - : m_flat_tree(x.m_flat_tree, dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Move constructs a flat_multimap using the specified allocator. - //! Constructs *this using x's resources. - //! - //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise. - BOOST_CONTAINER_FORCEINLINE - flat_multimap(BOOST_RV_REF(flat_multimap) x, const allocator_type &a) - : m_flat_tree(boost::move(x.m_flat_tree), dtl::force<const impl_allocator_type>(a)) - {} - - //! <b>Effects</b>: Makes *this a copy of x. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE - flat_multimap& operator=(BOOST_COPY_ASSIGN_REF(flat_multimap) x) - { m_flat_tree = x.m_flat_tree; return *this; } - - //! <b>Effects</b>: this->swap(x.get()). - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - flat_multimap& operator=(BOOST_RV_REF(flat_multimap) x) - BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || - allocator_traits_type::is_always_equal::value) && - boost::container::dtl::is_nothrow_move_assignable<Compare>::value) - { m_flat_tree = boost::move(x.m_flat_tree); return *this; } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Assign content of il to *this - //! - //! <b>Complexity</b>: Linear in il.size(). - BOOST_CONTAINER_FORCEINLINE - flat_multimap& operator=(std::initializer_list<value_type> il) - { - this->clear(); - this->insert(il.begin(), il.end()); - return *this; - } -#endif - - //! <b>Effects</b>: Returns a copy of the allocator that - //! was passed to the object's constructor. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<allocator_type>(m_flat_tree.get_allocator()); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force<stored_allocator_type>(m_flat_tree.get_stored_allocator()); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force<const stored_allocator_type>(m_flat_tree.get_stored_allocator()); } - - ////////////////////////////////////////////// - // - // iterators - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns an iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.begin()); } - - //! <b>Effects</b>: Returns an iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.end()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.end()); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<reverse_iterator>(m_flat_tree.rbegin()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rbegin()); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<reverse_iterator>(m_flat_tree.rend()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.rend()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.cbegin()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_iterator>(m_flat_tree.cend()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crbegin()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<const_reverse_iterator>(m_flat_tree.crend()); } - - ////////////////////////////////////////////// - // - // capacity - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns true if the container contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.empty(); } - - //! <b>Effects</b>: Returns the number of the elements contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.size(); } - - //! <b>Effects</b>: Returns the largest possible size of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.max_size(); } - - //! <b>Effects</b>: Number of elements for which memory has been allocated. - //! capacity() is always greater than or equal to size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.capacity(); } - - //! <b>Effects</b>: If n is less than or equal to capacity(), or the - //! underlying container has no `reserve` member, this call has no - //! effect. Otherwise, it is a request for allocation of additional memory. - //! If the request is successful, then capacity() is greater than or equal to - //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged. - //! - //! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws. - //! - //! <b>Note</b>: If capacity() is less than "cnt", iterators and references to - //! to values might be invalidated. - BOOST_CONTAINER_FORCEINLINE - void reserve(size_type cnt) - { m_flat_tree.reserve(cnt); } - - //! <b>Effects</b>: Tries to deallocate the excess of memory created - // with previous allocations. The size of the vector is unchanged - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to size(). - BOOST_CONTAINER_FORCEINLINE - void shrink_to_fit() - { m_flat_tree.shrink_to_fit(); } - - //! @copydoc ::boost::container::flat_set::nth(size_type) - BOOST_CONTAINER_FORCEINLINE - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.nth(n)); } - - //! @copydoc ::boost::container::flat_set::nth(size_type) const - BOOST_CONTAINER_FORCEINLINE - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { return dtl::force_copy<iterator>(m_flat_tree.nth(n)); } - - //! @copydoc ::boost::container::flat_set::index_of(iterator) - BOOST_CONTAINER_FORCEINLINE - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(dtl::force_copy<impl_iterator>(p)); } - - //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const - BOOST_CONTAINER_FORCEINLINE - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { return m_flat_tree.index_of(dtl::force_copy<impl_const_iterator>(p)); } - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... and returns the iterator pointing to the - //! newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE - iterator emplace(BOOST_FWD_REF(Args)... args) - { return dtl::force_copy<iterator>(m_flat_tree.emplace_equal(boost::forward<Args>(args)...)); } - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant time if the value - //! is to be inserted before p) plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE - iterator emplace_hint(const_iterator hint, BOOST_FWD_REF(Args)... args) - { - return dtl::force_copy<iterator>(m_flat_tree.emplace_hint_equal - (dtl::force_copy<impl_const_iterator>(hint), boost::forward<Args>(args)...)); - } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_FLAT_MULTIMAP_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\ - { return dtl::force_copy<iterator>(m_flat_tree.emplace_equal(BOOST_MOVE_FWD##N)); }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - return dtl::force_copy<iterator>(m_flat_tree.emplace_hint_equal\ - (dtl::force_copy<impl_const_iterator>(hint) BOOST_MOVE_I##N BOOST_MOVE_FWD##N));\ - }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTIMAP_EMPLACE_CODE) - #undef BOOST_CONTAINER_FLAT_MULTIMAP_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - //! <b>Effects</b>: Inserts x and returns the iterator pointing to the - //! newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const value_type& x) - { - return dtl::force_copy<iterator>( - m_flat_tree.insert_equal(dtl::force<const impl_value_type>(x))); - } - - //! <b>Effects</b>: Inserts a new value move-constructed from x and returns - //! the iterator pointing to the newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(value_type) x) - { return dtl::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); } - - //! <b>Effects</b>: Inserts a new value move-constructed from x and returns - //! the iterator pointing to the newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(BOOST_RV_REF(impl_value_type) x) - { return dtl::force_copy<iterator>(m_flat_tree.insert_equal(boost::move(x))); } - - //! <b>Effects</b>: Inserts a copy of x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant time if the value - //! is to be inserted before p) plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, const value_type& x) - { - return dtl::force_copy<iterator> - (m_flat_tree.insert_equal( dtl::force_copy<impl_const_iterator>(p) - , dtl::force<const impl_value_type>(x))); - } - - //! <b>Effects</b>: Inserts a value move constructed from x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant time if the value - //! is to be inserted before p) plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(value_type) x) - { - return dtl::force_copy<iterator> - (m_flat_tree.insert_equal(dtl::force_copy<impl_const_iterator>(p) - , boost::move(x))); - } - - //! <b>Effects</b>: Inserts a value move constructed from x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant time if the value - //! is to be inserted before p) plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE iterator insert(const_iterator p, BOOST_RV_REF(impl_value_type) x) - { - return dtl::force_copy<iterator>( - m_flat_tree.insert_equal(dtl::force_copy<impl_const_iterator>(p), boost::move(x))); - } - - //! <b>Requires</b>: first, last are not iterators into *this. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) . - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) - { m_flat_tree.insert_equal(first, last); } - - //! <b>Requires</b>: first, last are not iterators into *this. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) if and only - //! if there is no element with key equivalent to the key of that element. This - //! function is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last) - { m_flat_tree.insert_equal(ordered_range, first, last); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) . - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il) - { - m_flat_tree.insert_equal( dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()); - } - - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only - //! if there is no element with key equivalent to the key of that element. This - //! function is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il) - { - m_flat_tree.insert_equal( ordered_range - , dtl::force<impl_initializer_list>(il).begin() - , dtl::force<impl_initializer_list>(il).end()); - } -#endif - - //! <b>Requires</b>: this->get_allocator() == source.get_allocator(). - //! - //! <b>Effects</b>: Extracts each element in source and insert it into a using - //! the comparison object of *this. - //! - //! <b>Postcondition</b>: Pointers and references to the transferred elements of source refer - //! to those same elements but as members of *this. Iterators referring to the transferred - //! elements will continue to refer to their elements, but they now behave as iterators into *this, - //! not into source. - //! - //! <b>Throws</b>: Nothing unless the comparison object throws. - //! - //! <b>Complexity</b>: N log(a.size() + N) (N has the value source.size()) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_multimap<Key, T, C2, AllocatorOrContainer>& source) - { m_flat_tree.merge_equal(source.tree()); } - - //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multimap<Key, T, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_multimap<Key, T, C2, AllocatorOrContainer>&>(source)); } - - //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_map<Key, T, C2, AllocatorOrContainer>& source) - { m_flat_tree.merge_equal(source.tree()); } - - //! @copydoc ::boost::container::flat_multimap::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_map<Key, T, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_map<Key, T, C2, AllocatorOrContainer>&>(source)); } - - //! <b>Effects</b>: Erases the element pointed to by p. - //! - //! <b>Returns</b>: Returns an iterator pointing to the element immediately - //! following q prior to the element being erased. If no such element exists, - //! returns end(). - //! - //! <b>Complexity</b>: Linear to the elements with keys bigger than p - //! - //! <b>Note</b>: Invalidates elements with keys - //! not less than the erased element. - BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator p) - { - return dtl::force_copy<iterator>( - m_flat_tree.erase(dtl::force_copy<impl_const_iterator>(p))); - } - - //! <b>Effects</b>: Erases all elements in the container with key equivalent to x. - //! - //! <b>Returns</b>: Returns the number of erased elements. - //! - //! <b>Complexity</b>: Logarithmic search time plus erasure time - //! linear to the elements with bigger keys. - BOOST_CONTAINER_FORCEINLINE size_type erase(const key_type& x) - { return m_flat_tree.erase(x); } - - //! <b>Effects</b>: Erases all the elements in the range [first, last). - //! - //! <b>Returns</b>: Returns last. - //! - //! <b>Complexity</b>: size()*N where N is the distance from first to last. - //! - //! <b>Complexity</b>: Logarithmic search time plus erasure time - //! linear to the elements with bigger keys. - BOOST_CONTAINER_FORCEINLINE iterator erase(const_iterator first, const_iterator last) - { - return dtl::force_copy<iterator> - (m_flat_tree.erase( dtl::force_copy<impl_const_iterator>(first) - , dtl::force_copy<impl_const_iterator>(last))); - } - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE void swap(flat_multimap& x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::dtl::is_nothrow_swappable<Compare>::value ) - { m_flat_tree.swap(x.m_flat_tree); } - - //! <b>Effects</b>: erase(a.begin(),a.end()). - //! - //! <b>Postcondition</b>: size() == 0. - //! - //! <b>Complexity</b>: linear in size(). - BOOST_CONTAINER_FORCEINLINE void clear() BOOST_NOEXCEPT_OR_NOTHROW - { m_flat_tree.clear(); } - - ////////////////////////////////////////////// - // - // observers - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns the comparison object out - //! of which a was constructed. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE key_compare key_comp() const - { return dtl::force_copy<key_compare>(m_flat_tree.key_comp()); } - - //! <b>Effects</b>: Returns an object of value_compare constructed out - //! of the comparison object. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE value_compare value_comp() const - { return value_compare(dtl::force_copy<key_compare>(m_flat_tree.key_comp())); } - - ////////////////////////////////////////////// - // - // map operations - // - ////////////////////////////////////////////// - - //! <b>Returns</b>: An iterator pointing to an element with the key - //! equivalent to x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE iterator find(const key_type& x) - { return dtl::force_copy<iterator>(m_flat_tree.find(x)); } - - //! <b>Returns</b>: An const_iterator pointing to an element with the key - //! equivalent to x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - BOOST_CONTAINER_FORCEINLINE const_iterator find(const key_type& x) const - { return dtl::force_copy<const_iterator>(m_flat_tree.find(x)); } - - //! <b>Returns</b>: The number of elements with key equivalent to x. - //! - //! <b>Complexity</b>: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const - { return m_flat_tree.count(x); } - - //! <b>Returns</b>: An iterator pointing to the first element with key not less - //! than k, or a.end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE iterator lower_bound(const key_type& x) - { return dtl::force_copy<iterator>(m_flat_tree.lower_bound(x)); } - - //! <b>Returns</b>: A const iterator pointing to the first element with key - //! not less than k, or a.end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE const_iterator lower_bound(const key_type& x) const - { return dtl::force_copy<const_iterator>(m_flat_tree.lower_bound(x)); } - - //! <b>Returns</b>: An iterator pointing to the first element with key not less - //! than x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE iterator upper_bound(const key_type& x) - {return dtl::force_copy<iterator>(m_flat_tree.upper_bound(x)); } - - //! <b>Returns</b>: A const iterator pointing to the first element with key - //! not less than x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE const_iterator upper_bound(const key_type& x) const - { return dtl::force_copy<const_iterator>(m_flat_tree.upper_bound(x)); } - - //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x) - { return dtl::force_copy<std::pair<iterator,iterator> >(m_flat_tree.equal_range(x)); } - - //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const - { return dtl::force_copy<std::pair<const_iterator,const_iterator> >(m_flat_tree.equal_range(x)); } - - //! <b>Effects</b>: Extracts the internal sequence container. - //! - //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant. - //! - //! <b>Postcondition</b>: this->empty() - //! - //! <b>Throws</b>: If secuence_type's move constructor throws - BOOST_CONTAINER_FORCEINLINE sequence_type extract_sequence() - { - return boost::move(dtl::force<sequence_type>(m_flat_tree.get_sequence_ref())); - } - - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() - //! - //! <b>Throws</b>: If the comparison or the move constructor throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_equal(boost::move(dtl::force<impl_sequence_type>(seq))); } - - //! <b>Requires</b>: seq shall be ordered according to this->compare(). - //! - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(1) - //! - //! <b>Throws</b>: If the move assignment throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq) - { this->m_flat_tree.adopt_sequence_equal(ordered_range_t(), boost::move(dtl::force<impl_sequence_type>(seq))); } - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const flat_multimap& x, const flat_multimap& y) - { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const flat_multimap& x, const flat_multimap& y) - { return !(x == y); } - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<(const flat_multimap& x, const flat_multimap& y) - { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>(const flat_multimap& x, const flat_multimap& y) - { return y < x; } - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator<=(const flat_multimap& x, const flat_multimap& y) - { return !(y < x); } - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - BOOST_CONTAINER_FORCEINLINE friend bool operator>=(const flat_multimap& x, const flat_multimap& y) - { return !(x < y); } - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE friend void swap(flat_multimap& x, flat_multimap& y) - { x.swap(y); } -}; - -}} - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace boost { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class Key, class T, class Compare, class AllocatorOrContainer> -struct has_trivial_destructor_after_move< boost::container::flat_multimap<Key, T, Compare, AllocatorOrContainer> > -{ - typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value && - ::boost::has_trivial_destructor_after_move<Compare>::value; -}; - -} //namespace boost { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -#include <boost/container/detail/config_end.hpp> - -#endif // BOOST_CONTAINER_FLAT_MAP_HPP diff --git a/contrib/restricted/boost/boost/container/flat_set.hpp b/contrib/restricted/boost/boost/container/flat_set.hpp deleted file mode 100644 index 59ab57361f..0000000000 --- a/contrib/restricted/boost/boost/container/flat_set.hpp +++ /dev/null @@ -1,1681 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_FLAT_SET_HPP -#define BOOST_CONTAINER_FLAT_SET_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// container -#include <boost/container/allocator_traits.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/new_allocator.hpp> //new_allocator -// container/detail -#include <boost/container/detail/flat_tree.hpp> -#include <boost/container/detail/mpl.hpp> -// move -#include <boost/move/traits.hpp> -#include <boost/move/utility_core.hpp> -// move/detail -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -#include <boost/move/detail/fwd_macros.hpp> -#endif -#include <boost/move/detail/move_helpers.hpp> -// intrusive/detail -#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair -#include <boost/intrusive/detail/minimal_less_equal_header.hpp>//less, equal -// std -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -namespace boost { -namespace container { - -#if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) -template <class Key, class Compare, class AllocatorOrContainer> -class flat_multiset; -#endif - -//! flat_set is a Sorted Associative Container that stores objects of type Key. -//! It is also a Unique Associative Container, meaning that no two elements are the same. -//! -//! flat_set is similar to std::set but it's implemented by as an ordered sequence container. -//! The underlying sequence container is by default <i>vector</i> but it can also work -//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>). -//! -//! Using vector-like sequence containers means that inserting a new element into a flat_set might invalidate -//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar -//! container that offers stable pointers and references). Similarly, erasing an element might invalidate -//! iterators and references pointing to elements that come after (their keys are bigger) the erased element. -//! -//! This container provides random-access iterators. -//! -//! \tparam Key is the type to be inserted in the set, which is also the key_type -//! \tparam Compare is the comparison functor used to order keys -//! \tparam AllocatorOrContainer is either: -//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>). -//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>) -//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like -//! sequence container with random-access iterators. -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> > -#else -template <class Key, class Compare, class AllocatorOrContainer> -#endif -class flat_set - ///@cond - : public dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> - ///@endcond -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - BOOST_COPYABLE_AND_MOVABLE(flat_set) - typedef dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> tree_t; - - public: - tree_t &tree() - { return *this; } - - const tree_t &tree() const - { return *this; } - - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - typedef Key key_type; - typedef Compare key_compare; - typedef Key value_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type; - typedef typename sequence_type::allocator_type allocator_type; - typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type; - typedef typename sequence_type::pointer pointer; - typedef typename sequence_type::const_pointer const_pointer; - typedef typename sequence_type::reference reference; - typedef typename sequence_type::const_reference const_reference; - typedef typename sequence_type::size_type size_type; - typedef typename sequence_type::difference_type difference_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare; - - typedef typename sequence_type::iterator iterator; - typedef typename sequence_type::const_iterator const_iterator; - typedef typename sequence_type::reverse_iterator reverse_iterator; - typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; - - public: - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Default constructs an empty container. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - flat_set() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value && - dtl::is_nothrow_default_constructible<Compare>::value) - : tree_t() - {} - - //! <b>Effects</b>: Constructs an empty container using the specified - //! comparison object. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - explicit flat_set(const Compare& comp) - : tree_t(comp) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified allocator. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - explicit flat_set(const allocator_type& a) - : tree_t(a) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified - //! comparison object and allocator. - //! - //! <b>Complexity</b>: Constant. - BOOST_CONTAINER_FORCEINLINE - flat_set(const Compare& comp, const allocator_type& a) - : tree_t(comp, a) - {} - - //! <b>Effects</b>: Constructs an empty container and - //! inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! comp and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(InputIterator first, InputIterator last) - : tree_t(true, first, last) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified - //! allocator, and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! comp and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(InputIterator first, InputIterator last, const allocator_type& a) - : tree_t(true, first, last, a) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! comp and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(InputIterator first, InputIterator last, const Compare& comp) - : tree_t(true, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! allocator, and inserts elements from the range [first ,last ). - //! - //! <b>Complexity</b>: Linear in N if the range [first ,last ) is already sorted using - //! comp and otherwise N logN, where N is last - first. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : tree_t(true, first, last, comp, a) - {} - - //! <b>Effects</b>: Constructs an empty container and - //! inserts elements from the ordered unique range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(ordered_unique_range_t, InputIterator first, InputIterator last) - : tree_t(ordered_unique_range, first, last) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! inserts elements from the ordered unique range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp) - : tree_t(ordered_unique_range, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! allocator, and inserts elements from the ordered unique range [first ,last). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE - flat_set(ordered_unique_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : tree_t(ordered_unique_range, first, last, comp, a) - {} - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs an empty container and - //! inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! comp and otherwise N logN, where N is il.begin() - il.end(). - BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il) - : tree_t(true, il.begin(), il.end()) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified - //! allocator, and inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! comp and otherwise N logN, where N is il.begin() - il.end(). - BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const allocator_type& a) - : tree_t(true, il.begin(), il.end(), a) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! comp and otherwise N logN, where N is il.begin() - il.end(). - BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp) - : tree_t(true, il.begin(), il.end(), comp) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! allocator, and inserts elements from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: Linear in N if the range [il.begin(), il.end()) is already sorted using - //! comp and otherwise N logN, where N is il.begin() - il.end(). - BOOST_CONTAINER_FORCEINLINE flat_set(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : tree_t(true, il.begin(), il.end(), comp, a) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il) - : tree_t(ordered_unique_range, il.begin(), il.end()) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp) - : tree_t(ordered_unique_range, il.begin(), il.end(), comp) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_set(ordered_unique_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : tree_t(ordered_unique_range, il.begin(), il.end(), comp, a) - {} -#endif - - //! <b>Effects</b>: Copy constructs the container. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x) - : tree_t(static_cast<const tree_t&>(x)) - {} - - //! <b>Effects</b>: Move constructs thecontainer. Constructs *this using x's resources. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Postcondition</b>: x is emptied. - BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) - : tree_t(BOOST_MOVE_BASE(tree_t, x)) - {} - - //! <b>Effects</b>: Copy constructs a container using the specified allocator. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE flat_set(const flat_set& x, const allocator_type &a) - : tree_t(static_cast<const tree_t&>(x), a) - {} - - //! <b>Effects</b>: Move constructs a container using the specified allocator. - //! Constructs *this using x's resources. - //! - //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise - BOOST_CONTAINER_FORCEINLINE flat_set(BOOST_RV_REF(flat_set) x, const allocator_type &a) - : tree_t(BOOST_MOVE_BASE(tree_t, x), a) - {} - - //! <b>Effects</b>: Makes *this a copy of x. - //! - //! <b>Complexity</b>: Linear in x.size(). - BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_COPY_ASSIGN_REF(flat_set) x) - { return static_cast<flat_set&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); } - - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or value_type's move constructor throws) - //! - //! <b>Complexity</b>: Constant if allocator_traits_type:: - //! propagate_on_container_move_assignment is true or - //! this->get>allocator() == x.get_allocator(). Linear otherwise. - BOOST_CONTAINER_FORCEINLINE flat_set& operator=(BOOST_RV_REF(flat_set) x) - BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || - allocator_traits_type::is_always_equal::value) && - boost::container::dtl::is_nothrow_move_assignable<Compare>::value) - { return static_cast<flat_set&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Copy all elements from il to *this. - //! - //! <b>Complexity</b>: Linear in il.size(). - flat_set& operator=(std::initializer_list<value_type> il) - { - this->clear(); - this->insert(il.begin(), il.end()); - return *this; - } -#endif - - #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - //! <b>Effects</b>: Returns a copy of the allocator that - //! was passed to the object's constructor. - //! - //! <b>Complexity</b>: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns an iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns an iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_iterator to the end of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns true if the container contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns the number of the elements contained in the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns the largest possible size of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Number of elements for which memory has been allocated. - //! capacity() is always greater than or equal to size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: If n is less than or equal to capacity(), or the - //! underlying container has no `reserve` member, this call has no - //! effect. Otherwise, it is a request for allocation of additional memory. - //! If the request is successful, then capacity() is greater than or equal to - //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged. - //! - //! <b>Throws</b>: If memory allocation allocation throws or T's copy constructor throws. - //! - //! <b>Note</b>: If capacity() is less than "cnt", iterators and references to - //! to values might be invalidated. - void reserve(size_type cnt); - - //! <b>Effects</b>: Tries to deallocate the excess of memory created - // with previous allocations. The size of the vector is unchanged - //! - //! <b>Throws</b>: If memory allocation throws, or Key's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to size(). - void shrink_to_fit(); - - #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object x of type Key constructed with - //! std::forward<Args>(args)... if and only if there is no element in the container - //! with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_FWD_REF(Args)... args) - { return this->tree_t::emplace_unique(boost::forward<Args>(args)...); } - - //! <b>Effects</b>: Inserts an object of type Key constructed with - //! std::forward<Args>(args)... in the container if and only if there is - //! no element in the container with key equivalent to the key of x. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) - { return this->tree_t::emplace_hint_unique(p, boost::forward<Args>(args)...); } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,bool> emplace(BOOST_MOVE_UREF##N)\ - { return this->tree_t::emplace_unique(BOOST_MOVE_FWD##N); }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { return this->tree_t::emplace_hint_unique(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE) - #undef BOOST_CONTAINER_FLAT_SET_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts x if and only if there is no element in the container - //! with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - std::pair<iterator, bool> insert(const value_type &x); - - //! <b>Effects</b>: Inserts a new value_type move constructed from the pair if and - //! only if there is no element in the container with key equivalent to the key of x. - //! - //! <b>Returns</b>: The bool component of the returned pair is true if and only - //! if the insertion takes place, and the iterator component of the pair - //! points to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - std::pair<iterator, bool> insert(value_type &&x); - #else - private: - typedef std::pair<iterator, bool> insert_return_pair; - public: - BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, insert_return_pair, this->priv_insert) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x in the container if and only if there is - //! no element in the container with key equivalent to the key of x. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - iterator insert(const_iterator p, const value_type &x); - - //! <b>Effects</b>: Inserts an element move constructed from x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - iterator insert(const_iterator p, value_type &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: first, last are not iterators into *this. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) if and only - //! if there is no element with key equivalent to the key of that element. - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) - { this->tree_t::insert_unique(first, last); } - - //! <b>Requires</b>: first, last are not iterators into *this and - //! must be ordered according to the predicate and must be - //! unique values. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) .This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, InputIterator first, InputIterator last) - { this->tree_t::insert_unique(ordered_unique_range, first, last); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) if and only - //! if there is no element with key equivalent to the key of that element. - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il) - { this->tree_t::insert_unique(il.begin(), il.end()); } - - //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate - //! and must be unique values. - //! - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()) .This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE void insert(ordered_unique_range_t, std::initializer_list<value_type> il) - { this->tree_t::insert_unique(ordered_unique_range, il.begin(), il.end()); } -#endif - - //! @copydoc ::boost::container::flat_map::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source) - { this->tree_t::merge_unique(source.tree()); } - - //! @copydoc ::boost::container::flat_set::merge(flat_set<Key, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); } - - //! @copydoc ::boost::container::flat_map::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source) - { this->tree_t::merge_unique(source.tree()); } - - //! @copydoc ::boost::container::flat_set::merge(flat_multiset<Key, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); } - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Erases the element pointed to by p. - //! - //! <b>Returns</b>: Returns an iterator pointing to the element immediately - //! following q prior to the element being erased. If no such element exists, - //! returns end(). - //! - //! <b>Complexity</b>: Linear to the elements with keys bigger than p - //! - //! <b>Note</b>: Invalidates elements with keys - //! not less than the erased element. - iterator erase(const_iterator p); - - //! <b>Effects</b>: Erases all elements in the container with key equivalent to x. - //! - //! <b>Returns</b>: Returns the number of erased elements. - //! - //! <b>Complexity</b>: Logarithmic search time plus erasure time - //! linear to the elements with bigger keys. - size_type erase(const key_type& x); - - //! <b>Effects</b>: Erases all the elements in the range [first, last). - //! - //! <b>Returns</b>: Returns last. - //! - //! <b>Complexity</b>: size()*N where N is the distance from first to last. - //! - //! <b>Complexity</b>: Logarithmic search time plus erasure time - //! linear to the elements with bigger keys. - iterator erase(const_iterator first, const_iterator last); - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - void swap(flat_set& x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::dtl::is_nothrow_swappable<Compare>::value ); - - //! <b>Effects</b>: erase(a.begin(),a.end()). - //! - //! <b>Postcondition</b>: size() == 0. - //! - //! <b>Complexity</b>: linear in size(). - void clear() BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Effects</b>: Returns the comparison object out - //! of which a was constructed. - //! - //! <b>Complexity</b>: Constant. - key_compare key_comp() const; - - //! <b>Effects</b>: Returns an object of value_compare constructed out - //! of the comparison object. - //! - //! <b>Complexity</b>: Constant. - value_compare value_comp() const; - - //! <b>Returns</b>: An iterator pointing to an element with the key - //! equivalent to x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - iterator find(const key_type& x); - - //! <b>Returns</b>: A const_iterator pointing to an element with the key - //! equivalent to x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic. - const_iterator find(const key_type& x) const; - - //! <b>Requires</b>: size() >= n. - //! - //! <b>Effects</b>: Returns an iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Requires</b>: size() >= n. - //! - //! <b>Effects</b>: Returns a const_iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Requires</b>: begin() <= p <= end(). - //! - //! <b>Effects</b>: Returns the index of the element pointed by p - //! and size() if p == end(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW; - - //! <b>Requires</b>: begin() <= p <= end(). - //! - //! <b>Effects</b>: Returns the index of the element pointed by p - //! and size() if p == end(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW; - - #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Returns</b>: The number of elements with key equivalent to x. - //! - //! <b>Complexity</b>: log(size())+count(k) - BOOST_CONTAINER_FORCEINLINE size_type count(const key_type& x) const - { return static_cast<size_type>(this->tree_t::find(x) != this->tree_t::cend()); } - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Returns</b>: An iterator pointing to the first element with key not less - //! than k, or a.end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - iterator lower_bound(const key_type& x); - - //! <b>Returns</b>: A const iterator pointing to the first element with key not - //! less than k, or a.end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - const_iterator lower_bound(const key_type& x) const; - - //! <b>Returns</b>: An iterator pointing to the first element with key not less - //! than x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - iterator upper_bound(const key_type& x); - - //! <b>Returns</b>: A const iterator pointing to the first element with key not - //! less than x, or end() if such an element is not found. - //! - //! <b>Complexity</b>: Logarithmic - const_iterator upper_bound(const key_type& x) const; - - #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const - { return this->tree_t::lower_bound_range(x); } - - //! <b>Effects</b>: Equivalent to std::make_pair(this->lower_bound(k), this->upper_bound(k)). - //! - //! <b>Complexity</b>: Logarithmic - BOOST_CONTAINER_FORCEINLINE std::pair<iterator,iterator> equal_range(const key_type& x) - { return this->tree_t::lower_bound_range(x); } - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator==(const flat_set& x, const flat_set& y); - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator!=(const flat_set& x, const flat_set& y); - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<(const flat_set& x, const flat_set& y); - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>(const flat_set& x, const flat_set& y); - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<=(const flat_set& x, const flat_set& y); - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>=(const flat_set& x, const flat_set& y); - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - friend void swap(flat_set& x, flat_set& y); - - //! <b>Effects</b>: Extracts the internal sequence container. - //! - //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant. - //! - //! <b>Postcondition</b>: this->empty() - //! - //! <b>Throws</b>: If secuence_type's move constructor throws - sequence_type extract_sequence(); - - #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. Erases non-unique elements. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() - //! - //! <b>Throws</b>: If the comparison or the move constructor throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) - { this->tree_t::adopt_sequence_unique(boost::move(seq)); } - - //! <b>Requires</b>: seq shall be ordered according to this->compare() - //! and shall contain unique elements. - //! - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(1) - //! - //! <b>Throws</b>: If the move assignment throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_unique_range_t, BOOST_RV_REF(sequence_type) seq) - { this->tree_t::adopt_sequence_unique(ordered_unique_range_t(), boost::move(seq)); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - template<class KeyType> - BOOST_CONTAINER_FORCEINLINE std::pair<iterator, bool> priv_insert(BOOST_FWD_REF(KeyType) x) - { return this->tree_t::insert_unique(::boost::forward<KeyType>(x)); } - - template<class KeyType> - BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) - { return this->tree_t::insert_unique(p, ::boost::forward<KeyType>(x)); } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -}; - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -} //namespace container { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class Key, class Compare, class AllocatorOrContainer> -struct has_trivial_destructor_after_move<boost::container::flat_set<Key, Compare, AllocatorOrContainer> > -{ - typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value && - ::boost::has_trivial_destructor_after_move<Compare>::value; -}; - -namespace container { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! flat_multiset is a Sorted Associative Container that stores objects of type Key and -//! can store multiple copies of the same key value. -//! -//! flat_multiset is similar to std::multiset but it's implemented by as an ordered sequence container. -//! The underlying sequence container is by default <i>vector</i> but it can also work -//! user-provided vector-like SequenceContainers (like <i>static_vector</i> or <i>small_vector</i>). -//! -//! Using vector-like sequence containers means that inserting a new element into a flat_multiset might invalidate -//! previous iterators and references (unless that sequence container is <i>stable_vector</i> or a similar -//! container that offers stable pointers and references). Similarly, erasing an element might invalidate -//! iterators and references pointing to elements that come after (their keys are bigger) the erased element. -//! -//! This container provides random-access iterators. -//! -//! \tparam Key is the type to be inserted in the multiset, which is also the key_type -//! \tparam Compare is the comparison functor used to order keys -//! \tparam AllocatorOrContainer is either: -//! - The allocator to allocate <code>value_type</code>s (e.g. <i>allocator< std::pair<Key, T> > </i>). -//! (in this case <i>sequence_type</i> will be vector<value_type, AllocatorOrContainer>) -//! - The SequenceContainer to be used as the underlying <i>sequence_type</i>. It must be a vector-like -//! sequence container with random-access iterators. -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class Key, class Compare = std::less<Key>, class AllocatorOrContainer = new_allocator<Key> > -#else -template <class Key, class Compare, class AllocatorOrContainer> -#endif -class flat_multiset - ///@cond - : public dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> - ///@endcond -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - BOOST_COPYABLE_AND_MOVABLE(flat_multiset) - typedef dtl::flat_tree<Key, dtl::identity<Key>, Compare, AllocatorOrContainer> tree_t; - - public: - tree_t &tree() - { return *this; } - - const tree_t &tree() const - { return *this; } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - typedef Key key_type; - typedef Compare key_compare; - typedef Key value_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::sequence_type) sequence_type; - typedef typename sequence_type::allocator_type allocator_type; - typedef ::boost::container::allocator_traits<allocator_type> allocator_traits_type; - typedef typename sequence_type::pointer pointer; - typedef typename sequence_type::const_pointer const_pointer; - typedef typename sequence_type::reference reference; - typedef typename sequence_type::const_reference const_reference; - typedef typename sequence_type::size_type size_type; - typedef typename sequence_type::difference_type difference_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::stored_allocator_type) stored_allocator_type; - typedef typename BOOST_CONTAINER_IMPDEF(tree_t::value_compare) value_compare; - - typedef typename sequence_type::iterator iterator; - typedef typename sequence_type::const_iterator const_iterator; - typedef typename sequence_type::reverse_iterator reverse_iterator; - typedef typename sequence_type::const_reverse_iterator const_reverse_iterator; - - //! @copydoc ::boost::container::flat_set::flat_set() - BOOST_CONTAINER_FORCEINLINE flat_multiset() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<AllocatorOrContainer>::value && - dtl::is_nothrow_default_constructible<Compare>::value) - : tree_t() - {} - - //! @copydoc ::boost::container::flat_set::flat_set(const Compare&) - BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const Compare& comp) - : tree_t(comp) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(const allocator_type&) - BOOST_CONTAINER_FORCEINLINE explicit flat_multiset(const allocator_type& a) - : tree_t(a) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(const Compare&, const allocator_type&) - BOOST_CONTAINER_FORCEINLINE flat_multiset(const Compare& comp, const allocator_type& a) - : tree_t(comp, a) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator) - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last) - : tree_t(false, first, last) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const allocator_type&) - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const allocator_type& a) - : tree_t(false, first, last, a) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp) - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp) - : tree_t(false, first, last, comp) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(InputIterator, InputIterator, const Compare& comp, const allocator_type&) - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : tree_t(false, first, last, comp, a) - {} - - //! <b>Effects</b>: Constructs an empty flat_multiset and - //! inserts elements from the ordered range [first ,last ). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last) - : tree_t(ordered_range, first, last) - {} - - //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and - //! inserts elements from the ordered range [first ,last ). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp) - : tree_t(ordered_range, first, last, comp) - {} - - //! <b>Effects</b>: Constructs an empty flat_multiset using the specified comparison object and - //! allocator, and inserts elements from the ordered range [first, last ). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [first ,last) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, InputIterator first, InputIterator last, const Compare& comp, const allocator_type& a) - : tree_t(ordered_range, first, last, comp, a) - {} - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type) - BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il) - : tree_t(false, il.begin(), il.end()) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const allocator_type&) - BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const allocator_type& a) - : tree_t(false, il.begin(), il.end(), a) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp) - BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp) - : tree_t(false, il.begin(), il.end(), comp) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(std::initializer_list<value_type>, const Compare& comp, const allocator_type&) - BOOST_CONTAINER_FORCEINLINE flat_multiset(std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : tree_t(false, il.begin(), il.end(), comp, a) - {} - - //! <b>Effects</b>: Constructs an empty containerand - //! inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il) - : tree_t(ordered_range, il.begin(), il.end()) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp) - : tree_t(ordered_range, il.begin(), il.end(), comp) - {} - - //! <b>Effects</b>: Constructs an empty container using the specified comparison object and - //! allocator, and inserts elements from the ordered unique range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Requires</b>: [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Complexity</b>: Linear in N. - //! - //! <b>Note</b>: Non-standard extension. - BOOST_CONTAINER_FORCEINLINE flat_multiset(ordered_range_t, std::initializer_list<value_type> il, const Compare& comp, const allocator_type& a) - : tree_t(ordered_range, il.begin(), il.end(), comp, a) - {} -#endif - - //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &) - BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x) - : tree_t(static_cast<const tree_t&>(x)) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&) - BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<Compare>::value) - : tree_t(boost::move(static_cast<tree_t&>(x))) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(const flat_set &, const allocator_type &) - BOOST_CONTAINER_FORCEINLINE flat_multiset(const flat_multiset& x, const allocator_type &a) - : tree_t(static_cast<const tree_t&>(x), a) - {} - - //! @copydoc ::boost::container::flat_set::flat_set(flat_set &&, const allocator_type &) - BOOST_CONTAINER_FORCEINLINE flat_multiset(BOOST_RV_REF(flat_multiset) x, const allocator_type &a) - : tree_t(BOOST_MOVE_BASE(tree_t, x), a) - {} - - //! @copydoc ::boost::container::flat_set::operator=(const flat_set &) - BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_COPY_ASSIGN_REF(flat_multiset) x) - { return static_cast<flat_multiset&>(this->tree_t::operator=(static_cast<const tree_t&>(x))); } - - //! @copydoc ::boost::container::flat_set::operator=(flat_set &&) - BOOST_CONTAINER_FORCEINLINE flat_multiset& operator=(BOOST_RV_REF(flat_multiset) x) - BOOST_NOEXCEPT_IF( (allocator_traits_type::propagate_on_container_move_assignment::value || - allocator_traits_type::is_always_equal::value) && - boost::container::dtl::is_nothrow_move_assignable<Compare>::value) - { return static_cast<flat_multiset&>(this->tree_t::operator=(BOOST_MOVE_BASE(tree_t, x))); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! @copydoc ::boost::container::flat_set::operator=(std::initializer_list<value_type>) - flat_multiset& operator=(std::initializer_list<value_type> il) - { - this->clear(); - this->insert(il.begin(), il.end()); - return *this; - } -#endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! @copydoc ::boost::container::flat_set::get_allocator() - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::get_stored_allocator() - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::get_stored_allocator() const - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::begin() - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::begin() const - const_iterator begin() const; - - //! @copydoc ::boost::container::flat_set::cbegin() const - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::end() - iterator end() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::end() const - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::cend() const - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::rbegin() - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::rbegin() const - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::crbegin() const - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::rend() - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::rend() const - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::crend() const - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::empty() const - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::size() const - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::max_size() const - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::capacity() const - size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::reserve(size_type) - void reserve(size_type cnt); - - //! @copydoc ::boost::container::flat_set::shrink_to_fit() - void shrink_to_fit(); - - #endif // #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type Key constructed with - //! std::forward<Args>(args)... and returns the iterator pointing to the - //! newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_FWD_REF(Args)... args) - { return this->tree_t::emplace_equal(boost::forward<Args>(args)...); } - - //! <b>Effects</b>: Inserts an object of type Key constructed with - //! std::forward<Args>(args)... in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class... Args> - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator p, BOOST_FWD_REF(Args)... args) - { return this->tree_t::emplace_hint_equal(p, boost::forward<Args>(args)...); } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace(BOOST_MOVE_UREF##N)\ - { return this->tree_t::emplace_equal(BOOST_MOVE_FWD##N); }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - BOOST_CONTAINER_FORCEINLINE iterator emplace_hint(const_iterator hint BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - { return this->tree_t::emplace_hint_equal(hint BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE) - #undef BOOST_CONTAINER_FLAT_MULTISET_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts x and returns the iterator pointing to the - //! newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - iterator insert(const value_type &x); - - //! <b>Effects</b>: Inserts a new value_type move constructed from x - //! and returns the iterator pointing to the newly inserted element. - //! - //! <b>Complexity</b>: Logarithmic search time plus linear insertion - //! to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - iterator insert(value_type &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(insert, value_type, iterator, this->priv_insert) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - iterator insert(const_iterator p, const value_type &x); - - //! <b>Effects</b>: Inserts a new value move constructed from x in the container. - //! p is a hint pointing to where the insert should start to search. - //! - //! <b>Returns</b>: An iterator pointing to the element with key equivalent - //! to the key of x. - //! - //! <b>Complexity</b>: Logarithmic search time (constant if x is inserted - //! right before p) plus insertion linear to the elements with bigger keys than x. - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - iterator insert(const_iterator p, value_type &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, value_type, iterator, this->priv_insert, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: first, last are not iterators into *this. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) . - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(InputIterator first, InputIterator last) - { this->tree_t::insert_equal(first, last); } - - //! <b>Requires</b>: first, last are not iterators into *this and - //! must be ordered according to the predicate. - //! - //! <b>Effects</b>: inserts each element from the range [first,last) .This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. - template <class InputIterator> - BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, InputIterator first, InputIterator last) - { this->tree_t::insert_equal(ordered_range, first, last); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). - //! - //! <b>Complexity</b>: N log(N). - //! - //! <b>Note</b>: If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE void insert(std::initializer_list<value_type> il) - { this->tree_t::insert_equal(il.begin(), il.end()); } - - //! <b>Requires</b>: Range [il.begin(), il.end()) must be ordered according to the predicate. - //! - //! <b>Effects</b>: inserts each element from the range [il.begin(), il.end()). This function - //! is more efficient than the normal range creation for ordered ranges. - //! - //! <b>Complexity</b>: Linear. - //! - //! <b>Note</b>: Non-standard extension. If an element is inserted it might invalidate elements. - BOOST_CONTAINER_FORCEINLINE void insert(ordered_range_t, std::initializer_list<value_type> il) - { this->tree_t::insert_equal(ordered_range, il.begin(), il.end()); } -#endif - - //! @copydoc ::boost::container::flat_multimap::merge(flat_multimap<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_multiset<Key, C2, AllocatorOrContainer>& source) - { this->tree_t::merge_equal(source.tree()); } - - //! @copydoc ::boost::container::flat_multiset::merge(flat_multiset<Key, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_multiset<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_multiset<Key, C2, AllocatorOrContainer>&>(source)); } - - //! @copydoc ::boost::container::flat_multimap::merge(flat_map<Key, T, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(flat_set<Key, C2, AllocatorOrContainer>& source) - { this->tree_t::merge_equal(source.tree()); } - - //! @copydoc ::boost::container::flat_multiset::merge(flat_set<Key, C2, AllocatorOrContainer>&) - template<class C2> - BOOST_CONTAINER_FORCEINLINE void merge(BOOST_RV_REF_BEG flat_set<Key, C2, AllocatorOrContainer> BOOST_RV_REF_END source) - { return this->merge(static_cast<flat_set<Key, C2, AllocatorOrContainer>&>(source)); } - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! @copydoc ::boost::container::flat_set::erase(const_iterator) - iterator erase(const_iterator p); - - //! @copydoc ::boost::container::flat_set::erase(const key_type&) - size_type erase(const key_type& x); - - //! @copydoc ::boost::container::flat_set::erase(const_iterator,const_iterator) - iterator erase(const_iterator first, const_iterator last); - - //! @copydoc ::boost::container::flat_set::swap - void swap(flat_multiset& x) - BOOST_NOEXCEPT_IF( allocator_traits_type::is_always_equal::value - && boost::container::dtl::is_nothrow_swappable<Compare>::value ); - - //! @copydoc ::boost::container::flat_set::clear - void clear() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::key_comp - key_compare key_comp() const; - - //! @copydoc ::boost::container::flat_set::value_comp - value_compare value_comp() const; - - //! @copydoc ::boost::container::flat_set::find(const key_type& ) - iterator find(const key_type& x); - - //! @copydoc ::boost::container::flat_set::find(const key_type& ) const - const_iterator find(const key_type& x) const; - - //! @copydoc ::boost::container::flat_set::nth(size_type) - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::nth(size_type) const - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::index_of(iterator) - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::index_of(const_iterator) const - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @copydoc ::boost::container::flat_set::count(const key_type& ) const - size_type count(const key_type& x) const; - - //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& ) - iterator lower_bound(const key_type& x); - - //! @copydoc ::boost::container::flat_set::lower_bound(const key_type& ) const - const_iterator lower_bound(const key_type& x) const; - - //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& ) - iterator upper_bound(const key_type& x); - - //! @copydoc ::boost::container::flat_set::upper_bound(const key_type& ) const - const_iterator upper_bound(const key_type& x) const; - - //! @copydoc ::boost::container::flat_set::equal_range(const key_type& ) const - std::pair<const_iterator, const_iterator> equal_range(const key_type& x) const; - - //! @copydoc ::boost::container::flat_set::equal_range(const key_type& ) - std::pair<iterator,iterator> equal_range(const key_type& x); - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator==(const flat_multiset& x, const flat_multiset& y); - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator!=(const flat_multiset& x, const flat_multiset& y); - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<(const flat_multiset& x, const flat_multiset& y); - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>(const flat_multiset& x, const flat_multiset& y); - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<=(const flat_multiset& x, const flat_multiset& y); - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>=(const flat_multiset& x, const flat_multiset& y); - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - friend void swap(flat_multiset& x, flat_multiset& y); - - //! <b>Effects</b>: Extracts the internal sequence container. - //! - //! <b>Complexity</b>: Same as the move constructor of sequence_type, usually constant. - //! - //! <b>Postcondition</b>: this->empty() - //! - //! <b>Throws</b>: If secuence_type's move constructor throws - sequence_type extract_sequence(); - - #endif //#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(NlogN) with N = seq.size() - //! - //! <b>Throws</b>: If the comparison or the move constructor throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(BOOST_RV_REF(sequence_type) seq) - { this->tree_t::adopt_sequence_equal(boost::move(seq)); } - - //! <b>Requires</b>: seq shall be ordered according to this->compare() - //! - //! <b>Effects</b>: Discards the internally hold sequence container and adopts the - //! one passed externally using the move assignment. - //! - //! <b>Complexity</b>: Assuming O(1) move assignment, O(1) - //! - //! <b>Throws</b>: If the move assignment throws - BOOST_CONTAINER_FORCEINLINE void adopt_sequence(ordered_range_t, BOOST_RV_REF(sequence_type) seq) - { this->tree_t::adopt_sequence_equal(ordered_range_t(), boost::move(seq)); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - template <class KeyType> - BOOST_CONTAINER_FORCEINLINE iterator priv_insert(BOOST_FWD_REF(KeyType) x) - { return this->tree_t::insert_equal(::boost::forward<KeyType>(x)); } - - template <class KeyType> - BOOST_CONTAINER_FORCEINLINE iterator priv_insert(const_iterator p, BOOST_FWD_REF(KeyType) x) - { return this->tree_t::insert_equal(p, ::boost::forward<KeyType>(x)); } - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -}; - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -} //namespace container { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class Key, class Compare, class AllocatorOrContainer> -struct has_trivial_destructor_after_move<boost::container::flat_multiset<Key, Compare, AllocatorOrContainer> > -{ - typedef typename ::boost::container::allocator_traits<AllocatorOrContainer>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<AllocatorOrContainer>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value && - ::boost::has_trivial_destructor_after_move<Compare>::value; -}; - -namespace container { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -}} - -#include <boost/container/detail/config_end.hpp> - -#endif // BOOST_CONTAINER_FLAT_SET_HPP diff --git a/contrib/restricted/boost/boost/container/list.hpp b/contrib/restricted/boost/boost/container/list.hpp deleted file mode 100644 index c74372f858..0000000000 --- a/contrib/restricted/boost/boost/container/list.hpp +++ /dev/null @@ -1,1489 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2005-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -#ifndef BOOST_CONTAINER_LIST_HPP -#define BOOST_CONTAINER_LIST_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// container -#include <boost/container/container_fwd.hpp> -#include <boost/container/new_allocator.hpp> //new_allocator -#include <boost/container/throw_exception.hpp> -// container/detail -#include <boost/container/detail/algorithm.hpp> -#include <boost/container/detail/compare_functors.hpp> -#include <boost/container/detail/iterator.hpp> -#include <boost/container/detail/iterators.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/node_alloc_holder.hpp> -#include <boost/container/detail/version_type.hpp> -#include <boost/container/detail/value_functors.hpp> -// move -#include <boost/move/utility_core.hpp> -#include <boost/move/iterator.hpp> -#include <boost/move/traits.hpp> -// move/detail -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -# include <boost/move/detail/fwd_macros.hpp> -#endif -#include <boost/move/detail/move_helpers.hpp> - -// intrusive -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/intrusive/list.hpp> -// other -#include <boost/assert.hpp> -// std -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -namespace boost { -namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -namespace dtl { - -template<class VoidPointer> -struct list_hook -{ - typedef typename dtl::bi::make_list_base_hook - <dtl::bi::void_pointer<VoidPointer>, dtl::bi::link_mode<dtl::bi::normal_link> >::type type; -}; - -template <class T, class VoidPointer> -struct list_node - : public list_hook<VoidPointer>::type -{ - private: - list_node(); - - public: - typedef T value_type; - typedef typename list_hook<VoidPointer>::type hook_type; - - T m_data; - - T &get_data() - { return this->m_data; } - - const T &get_data() const - { return this->m_data; } -}; - -template <class T, class VoidPointer> -struct iiterator_node_value_type< list_node<T,VoidPointer> > { - typedef T type; -}; - -template<class Allocator> -struct intrusive_list_type -{ - typedef boost::container::allocator_traits<Allocator> allocator_traits_type; - typedef typename allocator_traits_type::value_type value_type; - typedef typename boost::intrusive::pointer_traits - <typename allocator_traits_type::pointer>::template - rebind_pointer<void>::type - void_pointer; - typedef typename dtl::list_node - <value_type, void_pointer> node_type; - typedef typename dtl::bi::make_list - < node_type - , dtl::bi::base_hook<typename list_hook<void_pointer>::type> - , dtl::bi::constant_time_size<true> - , dtl::bi::size_type - <typename allocator_traits_type::size_type> - >::type container_type; - typedef container_type type ; -}; - -} //namespace dtl { -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! A list is a doubly linked list. That is, it is a Sequence that supports both -//! forward and backward traversal, and (amortized) constant time insertion and -//! removal of elements at the beginning or the end, or in the middle. Lists have -//! the important property that insertion and splicing do not invalidate iterators -//! to list elements, and that even removal invalidates only the iterators that point -//! to the elements that are removed. The ordering of iterators may be changed -//! (that is, list<T>::iterator might have a different predecessor or successor -//! after a list operation than it did before), but the iterators themselves will -//! not be invalidated or made to point to different elements unless that invalidation -//! or mutation is explicit. -//! -//! \tparam T The type of object that is stored in the list -//! \tparam Allocator The allocator used for all internal memory management -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class T, class Allocator = new_allocator<T> > -#else -template <class T, class Allocator> -#endif -class list - : protected dtl::node_alloc_holder - <Allocator, typename dtl::intrusive_list_type<Allocator>::type> -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef typename - dtl::intrusive_list_type<Allocator>::type Icont; - typedef dtl::node_alloc_holder<Allocator, Icont> AllocHolder; - typedef typename AllocHolder::NodePtr NodePtr; - typedef typename AllocHolder::NodeAlloc NodeAlloc; - typedef typename AllocHolder::ValAlloc ValAlloc; - typedef typename AllocHolder::Node Node; - typedef dtl::allocator_destroyer<NodeAlloc> Destroyer; - typedef typename AllocHolder::alloc_version alloc_version; - typedef boost::container::allocator_traits<Allocator> allocator_traits_type; - typedef boost::container::equal_to_value<Allocator> equal_to_value_type; - - BOOST_COPYABLE_AND_MOVABLE(list) - - typedef dtl::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl; - typedef dtl::iterator_from_iiterator<typename Icont::iterator, true> const_iterator_impl; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - - typedef T value_type; - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::reference reference; - typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference; - typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type; - typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type; - typedef Allocator allocator_type; - typedef BOOST_CONTAINER_IMPDEF(NodeAlloc) stored_allocator_type; - typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; - typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator; - - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Default constructs a list. - //! - //! <b>Throws</b>: If allocator_type's default constructor throws. - //! - //! <b>Complexity</b>: Constant. - list() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value) - : AllocHolder() - {} - - //! <b>Effects</b>: Constructs a list taking the allocator as parameter. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - explicit list(const allocator_type &a) BOOST_NOEXCEPT_OR_NOTHROW - : AllocHolder(a) - {} - - //! <b>Effects</b>: Constructs a list - //! and inserts n value-initialized value_types. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit list(size_type n) - : AllocHolder(Allocator()) - { this->resize(n); } - - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - list(size_type n, const allocator_type &a) - : AllocHolder(a) - { this->resize(n); } - - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - list(size_type n, const T& value, const Allocator& a = Allocator()) - : AllocHolder(a) - { this->insert(this->cbegin(), n, value); } - - //! <b>Effects</b>: Copy constructs a list. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Throws</b>: If allocator_type's default constructor throws. - //! - //! <b>Complexity</b>: Linear to the elements x contains. - list(const list& x) - : AllocHolder(x) - { this->insert(this->cbegin(), x.begin(), x.end()); } - - //! <b>Effects</b>: Move constructor. Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocator_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - list(BOOST_RV_REF(list) x) BOOST_NOEXCEPT_OR_NOTHROW - : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x)) - {} - - //! <b>Effects</b>: Copy constructs a list using the specified allocator. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Throws</b>: If allocator_type's default constructor or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the elements x contains. - list(const list& x, const allocator_type &a) - : AllocHolder(a) - { this->insert(this->cbegin(), x.begin(), x.end()); } - - //! <b>Effects</b>: Move constructor sing the specified allocator. - //! Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocation or value_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise. - list(BOOST_RV_REF(list) x, const allocator_type &a) - : AllocHolder(a) - { - if(this->node_alloc() == x.node_alloc()){ - this->icont().swap(x.icont()); - } - else{ - this->insert(this->cbegin(), boost::make_move_iterator(x.begin()), boost::make_move_iterator(x.end())); - } - } - - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts a copy of the range [first, last) in the list. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced InIt throws. - //! - //! <b>Complexity</b>: Linear to the range [first, last). - template <class InpIt> - list(InpIt first, InpIt last, const Allocator &a = Allocator()) - : AllocHolder(a) - { this->insert(this->cbegin(), first, last); } - - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts a copy of the range [il.begin(), il.end()) in the list. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced - //! std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()). - list(std::initializer_list<value_type> il, const Allocator &a = Allocator()) - : AllocHolder(a) - { this->insert(this->cbegin(), il.begin(), il.end()); } -#endif - - //! <b>Effects</b>: Destroys the list. All stored values are destroyed - //! and used memory is deallocated. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements. - ~list() BOOST_NOEXCEPT_OR_NOTHROW - {} //AllocHolder clears the list - - //! <b>Effects</b>: Makes *this contain the same elements as x. - //! - //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the number of elements in x. - list& operator=(BOOST_COPY_ASSIGN_REF(list) x) - { - if (&x != this){ - NodeAlloc &this_alloc = this->node_alloc(); - const NodeAlloc &x_alloc = x.node_alloc(); - dtl::bool_<allocator_traits_type:: - propagate_on_container_copy_assignment::value> flag; - if(flag && this_alloc != x_alloc){ - this->clear(); - } - this->AllocHolder::copy_assign_alloc(x); - this->assign(x.begin(), x.end()); - } - return *this; - } - - //! <b>Effects</b>: Move assignment. All x's values are transferred to *this. - //! - //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had - //! before the function. - //! - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or value_type's move constructor throws) - //! - //! <b>Complexity</b>: Constant if allocator_traits_type:: - //! propagate_on_container_move_assignment is true or - //! this->get>allocator() == x.get_allocator(). Linear otherwise. - list& operator=(BOOST_RV_REF(list) x) - BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value - || allocator_traits_type::is_always_equal::value) - { - BOOST_ASSERT(this != &x); - NodeAlloc &this_alloc = this->node_alloc(); - NodeAlloc &x_alloc = x.node_alloc(); - const bool propagate_alloc = allocator_traits_type:: - propagate_on_container_move_assignment::value; - const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(propagate_alloc || allocators_equal){ - //Destroy - this->clear(); - //Move allocator if needed - this->AllocHolder::move_assign_alloc(x); - //Obtain resources - this->icont() = boost::move(x.icont()); - } - //Else do a one by one move - else{ - this->assign( boost::make_move_iterator(x.begin()) - , boost::make_move_iterator(x.end())); - } - return *this; - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Makes *this contain the same elements as il. - //! - //! <b>Postcondition</b>: this->size() == il.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the number of elements in x. - list& operator=(std::initializer_list<value_type> il) - { - assign(il.begin(), il.end()); - return *this; - } -#endif - - //! <b>Effects</b>: Assigns the n copies of val to *this. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - void assign(size_type n, const T& val) - { - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - return this->assign(cvalue_iterator(val, n), cvalue_iterator()); - } - - //! <b>Effects</b>: Assigns the range [first, last) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing InpIt throws. - //! - //! <b>Complexity</b>: Linear to n. - template <class InpIt> - void assign(InpIt first, InpIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_convertible<InpIt, size_type>::type * = 0 - #endif - ) - { - iterator first1 = this->begin(); - const iterator last1 = this->end(); - for ( ; first1 != last1 && first != last; ++first1, ++first) - *first1 = *first; - if (first == last) - this->erase(first1, last1); - else{ - this->insert(last1, first, last); - } - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Assigns the range [il.begin(), il.end()) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to n. - void assign(std::initializer_list<value_type> il) - { assign(il.begin(), il.end()); } -#endif - - //! <b>Effects</b>: Returns a copy of the internal allocator. - //! - //! <b>Throws</b>: If allocator's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return allocator_type(this->node_alloc()); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { return this->node_alloc(); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->node_alloc(); } - - ////////////////////////////////////////////// - // - // iterators - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns an iterator to the first element contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->icont().begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->cbegin(); } - - //! <b>Effects</b>: Returns an iterator to the end of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->icont().end()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->cend(); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning - //! of the reversed list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return reverse_iterator(end()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->crbegin(); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the end - //! of the reversed list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return reverse_iterator(begin()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->crend(); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_iterator(this->non_const_icont().begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_iterator(this->non_const_icont().end()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->cend()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->cbegin()); } - - ////////////////////////////////////////////// - // - // capacity - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns true if the list contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW - { return !this->size(); } - - //! <b>Effects</b>: Returns the number of the elements contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->icont().size(); } - - //! <b>Effects</b>: Returns the largest possible size of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return AllocHolder::max_size(); } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are value initialized. - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type new_size) - { - if(!priv_try_shrink(new_size)){ - typedef value_init_construct_iterator<value_type, difference_type> value_init_iterator; - this->insert(this->cend(), value_init_iterator(new_size - this->size()), value_init_iterator()); - } - } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are copy constructed from x. - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type new_size, const T& x) - { - if(!priv_try_shrink(new_size)){ - this->insert(this->cend(), new_size - this->size(), x); - } - } - - ////////////////////////////////////////////// - // - // element access - // - ////////////////////////////////////////////// - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *this->begin(); - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *this->begin(); - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *(--this->end()); - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return *(--this->end()); - } - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the end of the list. - //! - //! <b>Returns</b>: A reference to the created object. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's in-place constructor throws. - //! - //! <b>Complexity</b>: Constant - template <class... Args> - reference emplace_back(BOOST_FWD_REF(Args)... args) - { return *this->emplace(this->cend(), boost::forward<Args>(args)...); } - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the beginning of the list. - //! - //! <b>Returns</b>: A reference to the created object. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's in-place constructor throws. - //! - //! <b>Complexity</b>: Constant - template <class... Args> - reference emplace_front(BOOST_FWD_REF(Args)... args) - { return *this->emplace(this->cbegin(), boost::forward<Args>(args)...); } - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... before p. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's in-place constructor throws. - //! - //! <b>Complexity</b>: Constant - template <class... Args> - iterator emplace(const_iterator position, BOOST_FWD_REF(Args)... args) - { - BOOST_ASSERT((priv_is_linked)(position)); - NodePtr pnode(AllocHolder::create_node(boost::forward<Args>(args)...)); - return iterator(this->icont().insert(position.get(), *pnode)); - } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_LIST_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - reference emplace_back(BOOST_MOVE_UREF##N)\ - { return *this->emplace(this->cend() BOOST_MOVE_I##N BOOST_MOVE_FWD##N); }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - reference emplace_front(BOOST_MOVE_UREF##N)\ - { return *this->emplace(this->cbegin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace(const_iterator position BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - BOOST_ASSERT(position == this->cend() || (--(++position) == position) );\ - NodePtr pnode (AllocHolder::create_node(BOOST_MOVE_FWD##N));\ - return iterator(this->icont().insert(position.get(), *pnode));\ - }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_LIST_EMPLACE_CODE) - #undef BOOST_CONTAINER_LIST_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x at the beginning of the list. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_front(const T &x); - - //! <b>Effects</b>: Constructs a new element in the beginning of the list - //! and moves the resources of x to this new element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_front(T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x at the end of the list. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_back(const T &x); - - //! <b>Effects</b>: Constructs a new element in the end of the list - //! and moves the resources of x to this new element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_back(T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of x before p. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - iterator insert(const_iterator p, const T &x); - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a new element before p with x's resources. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - iterator insert(const_iterator p, T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts n copies of x before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if n is 0. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - iterator insert(const_iterator position, size_type n, const T& x) - { - //range check is done by insert - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - return this->insert(position, cvalue_iterator(x, n), cvalue_iterator()); - } - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [first, last) range before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if first == last. - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced InpIt throws. - //! - //! <b>Complexity</b>: Linear to distance [first, last). - template <class InpIt> - iterator insert(const_iterator p, InpIt first, InpIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::enable_if_c - < !dtl::is_convertible<InpIt, size_type>::value - && (dtl::is_input_iterator<InpIt>::value - || dtl::is_same<alloc_version, version_1>::value - ) - >::type * = 0 - #endif - ) - { - BOOST_ASSERT((priv_is_linked)(p)); - const typename Icont::iterator ipos(p.get()); - iterator ret_it(ipos); - if(first != last){ - ret_it = iterator(this->icont().insert(ipos, *this->create_node_from_it(first))); - ++first; - } - for (; first != last; ++first){ - this->icont().insert(ipos, *this->create_node_from_it(first)); - } - return ret_it; - } - - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - template <class FwdIt> - iterator insert(const_iterator position, FwdIt first, FwdIt last - , typename dtl::enable_if_c - < !dtl::is_convertible<FwdIt, size_type>::value - && !(dtl::is_input_iterator<FwdIt>::value - || dtl::is_same<alloc_version, version_1>::value - ) - >::type * = 0 - ) - { - BOOST_ASSERT((priv_is_linked)(position)); - //Optimized allocation and construction - insertion_functor func(this->icont(), position.get()); - iterator before_p(position.get()); - --before_p; - this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func); - return ++before_p; - } - #endif - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if if.begin() == il.end(). - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to distance [il.begin(), il.end()). - iterator insert(const_iterator p, std::initializer_list<value_type> il) - { - //position range check is done by insert() - return insert(p, il.begin(), il.end()); - } -#endif - - //! <b>Effects</b>: Removes the first element from the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Amortized constant time. - void pop_front() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - this->erase(this->cbegin()); - } - - //! <b>Effects</b>: Removes the last element from the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Amortized constant time. - void pop_back() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - const_iterator tmp = this->cend(); - this->erase(--tmp); - } - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Erases the element at p. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Amortized constant time. - iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(p != this->cend() && (priv_is_linked)(p)); - return iterator(this->icont().erase_and_dispose(p.get(), Destroyer(this->node_alloc()))); - } - - //! <b>Requires</b>: first and last must be valid iterator to elements in *this. - //! - //! <b>Effects</b>: Erases the elements pointed by [first, last). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the distance between first and last. - iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(first == last || (first != this->cend() && (priv_is_linked)(first))); - BOOST_ASSERT(first == last || (priv_is_linked)(last)); - return iterator(AllocHolder::erase_range(first.get(), last.get(), alloc_version())); - } - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - void swap(list& x) - BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_swap::value - || allocator_traits_type::is_always_equal::value) - { - BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || - allocator_traits_type::is_always_equal::value || - this->get_stored_allocator() == x.get_stored_allocator()); - AllocHolder::swap(x); - } - - //! <b>Effects</b>: Erases all the elements of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements in the list. - void clear() BOOST_NOEXCEPT_OR_NOTHROW - { AllocHolder::clear(alloc_version()); } - - ////////////////////////////////////////////// - // - // slist operations - // - ////////////////////////////////////////////// - - //! <b>Requires</b>: p must point to an element contained - //! by the list. x != *this. this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers all the elements of list x to this list, before the - //! the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of - //! this list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, list& x) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT((priv_is_linked)(p)); - BOOST_ASSERT(this != &x); - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice(p.get(), x.icont()); - } - - //! <b>Requires</b>: p must point to an element contained - //! by the list. x != *this. this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers all the elements of list x to this list, before the - //! the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of - //! this list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, BOOST_RV_REF(list) x) BOOST_NOEXCEPT_OR_NOTHROW - { - //Checks done in splice - this->splice(p, static_cast<list&>(x)); - } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. i must point to an element contained in list x. - //! this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! If p == i or p == ++i, this function is a null operation. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, list &x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT((priv_is_linked)(p)); - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice(p.get(), x.icont(), i.get()); - } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. i must point to an element contained in list x. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! If p == i or p == ++i, this function is a null operation. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this != &x); - //Additional checks done in splice() - this->splice(p, static_cast<list&>(x), i); - } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. first and last must point to elements contained in list x. - //! this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear to the number of elements transferred. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, list &x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT((priv_is_linked)(p)); - BOOST_ASSERT(first == last || (first != x.cend() && x.priv_is_linked(first))); - BOOST_ASSERT(first == last || x.priv_is_linked(last)); - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice(p.get(), x.icont(), first.get(), last.get()); - } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. first and last must point to elements contained in list x. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear to the number of elements transferred. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this != &x); - //Additional checks done in splice() - this->splice(p, static_cast<list&>(x), first, last); - } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. first and last must point to elements contained in list x. - //! n == distance(first, last). this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - //! - //! <b>Note</b>: Non-standard extension - void splice(const_iterator p, list &x, const_iterator first, const_iterator last, size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice(p.get(), x.icont(), first.get(), last.get(), n); - } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. first and last must point to elements contained in list x. - //! n == distance(first, last). this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - //! - //! <b>Note</b>: Non-standard extension - void splice(const_iterator p, BOOST_RV_REF(list) x, const_iterator first, const_iterator last, size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast<list&>(x), first, last, n); } - - //! <b>Effects</b>: Removes all the elements that compare equal to value. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality. - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - void remove(const T& value) - { this->remove_if(equal_to_value_type(value)); } - - //! <b>Effects</b>: Removes all the elements for which a specified - //! predicate is satisfied. - //! - //! <b>Throws</b>: If pred throws. - //! - //! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate. - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - template <class Pred> - void remove_if(Pred pred) - { - typedef value_to_node_compare<Node, Pred> value_to_node_compare_type; - this->icont().remove_and_dispose_if(value_to_node_compare_type(pred), Destroyer(this->node_alloc())); - } - - //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent - //! elements that are equal from the list. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons). - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - void unique() - { this->unique(value_equal_t()); } - - //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent - //! elements that satisfy some binary predicate from the list. - //! - //! <b>Throws</b>: If pred throws. - //! - //! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()). - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - template <class BinaryPredicate> - void unique(BinaryPredicate binary_pred) - { - typedef value_to_node_compare<Node, BinaryPredicate> value_to_node_compare_type; - this->icont().unique_and_dispose(value_to_node_compare_type(binary_pred), Destroyer(this->node_alloc())); - } - - //! <b>Requires</b>: The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this according to std::less<value_type>. The merge is stable; - //! that is, if an element from *this is equivalent to one from x, then the element - //! from *this will precede the one from x. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - void merge(list &x) - { this->merge(x, value_less_t()); } - - //! <b>Requires</b>: The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this according to std::less<value_type>. The merge is stable; - //! that is, if an element from *this is equivalent to one from x, then the element - //! from *this will precede the one from x. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - void merge(BOOST_RV_REF(list) x) - { this->merge(static_cast<list&>(x)); } - - //! <b>Requires</b>: p must be a comparison function that induces a strict weak - //! ordering and both *this and x must be sorted according to that ordering - //! The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this. The merge is stable; that is, if an element from *this is - //! equivalent to one from x, then the element from *this will precede the one from x. - //! - //! <b>Throws</b>: If comp throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - //! - //! <b>Note</b>: Iterators and references to *this are not invalidated. - template <class StrictWeakOrdering> - void merge(list &x, const StrictWeakOrdering &comp) - { - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type; - this->icont().merge(x.icont(), value_to_node_compare_type(comp)); - } - - //! <b>Requires</b>: p must be a comparison function that induces a strict weak - //! ordering and both *this and x must be sorted according to that ordering - //! The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this. The merge is stable; that is, if an element from *this is - //! equivalent to one from x, then the element from *this will precede the one from x. - //! - //! <b>Throws</b>: If comp throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - //! - //! <b>Note</b>: Iterators and references to *this are not invalidated. - template <class StrictWeakOrdering> - void merge(BOOST_RV_REF(list) x, StrictWeakOrdering comp) - { this->merge(static_cast<list&>(x), comp); } - - //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>. - //! The sort is stable, that is, the relative order of equivalent elements is preserved. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Notes</b>: Iterators and references are not invalidated. - //! - //! <b>Complexity</b>: The number of comparisons is approximately N log N, where N - //! is the list's size. - void sort() - { this->sort(value_less_t()); } - - //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>. - //! The sort is stable, that is, the relative order of equivalent elements is preserved. - //! - //! <b>Throws</b>: If comp throws. - //! - //! <b>Notes</b>: Iterators and references are not invalidated. - //! - //! <b>Complexity</b>: The number of comparisons is approximately N log N, where N - //! is the list's size. - template <class StrictWeakOrdering> - void sort(StrictWeakOrdering comp) - { - // nothing if the list has length 0 or 1. - if (this->size() < 2) - return; - typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type; - this->icont().sort(value_to_node_compare_type(comp)); - } - - //! <b>Effects</b>: Reverses the order of elements in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: This function is linear time. - //! - //! <b>Note</b>: Iterators and references are not invalidated - void reverse() BOOST_NOEXCEPT_OR_NOTHROW - { this->icont().reverse(); } - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator==(const list& x, const list& y) - { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator!=(const list& x, const list& y) - { return !(x == y); } - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<(const list& x, const list& y) - { return boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>(const list& x, const list& y) - { return y < x; } - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<=(const list& x, const list& y) - { return !(y < x); } - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>=(const list& x, const list& y) - { return !(x < y); } - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - friend void swap(list& x, list& y) - { x.swap(y); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - - static bool priv_is_linked(const_iterator const position) - { - const_iterator cur(position); - //This list is circular including end nodes - return (--(++cur)) == position && (++(--cur)) == position; - } - - bool priv_try_shrink(size_type new_size) - { - const size_type len = this->size(); - if(len > new_size){ - const const_iterator iend = this->cend(); - size_type to_erase = len - new_size; - const_iterator ifirst; - if(to_erase < len/2u){ - ifirst = iend; - while(to_erase--){ - --ifirst; - } - } - else{ - ifirst = this->cbegin(); - size_type to_skip = len - to_erase; - while(to_skip--){ - ++ifirst; - } - } - this->erase(ifirst, iend); - return true; - } - else{ - return false; - } - } - - iterator priv_insert(const_iterator p, const T &x) - { - BOOST_ASSERT((priv_is_linked)(p)); - NodePtr tmp = AllocHolder::create_node(x); - return iterator(this->icont().insert(p.get(), *tmp)); - } - - iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) - { - BOOST_ASSERT((priv_is_linked)(p)); - NodePtr tmp = AllocHolder::create_node(boost::move(x)); - return iterator(this->icont().insert(p.get(), *tmp)); - } - - void priv_push_back (const T &x) - { this->insert(this->cend(), x); } - - void priv_push_back (BOOST_RV_REF(T) x) - { this->insert(this->cend(), boost::move(x)); } - - void priv_push_front (const T &x) - { this->insert(this->cbegin(), x); } - - void priv_push_front (BOOST_RV_REF(T) x) - { this->insert(this->cbegin(), boost::move(x)); } - - class insertion_functor; - friend class insertion_functor; - - class insertion_functor - { - Icont &icont_; - typedef typename Icont::const_iterator iconst_iterator; - const iconst_iterator pos_; - - public: - insertion_functor(Icont &icont, typename Icont::const_iterator pos) - : icont_(icont), pos_(pos) - {} - - void operator()(Node &n) - { - this->icont_.insert(pos_, n); - } - }; - - typedef value_less<value_type> value_less_t; - typedef value_equal<value_type> value_equal_t; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -}; - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -} //namespace container { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class T, class Allocator> -struct has_trivial_destructor_after_move<boost::container::list<T, Allocator> > -{ - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value; -}; - -namespace container { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -}} - -#include <boost/container/detail/config_end.hpp> - -#endif // BOOST_CONTAINER_LIST_HPP diff --git a/contrib/restricted/boost/boost/container/node_allocator.hpp b/contrib/restricted/boost/boost/container/node_allocator.hpp deleted file mode 100644 index b5c20a65d1..0000000000 --- a/contrib/restricted/boost/boost/container/node_allocator.hpp +++ /dev/null @@ -1,341 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (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_POOLED_NODE_ALLOCATOR_HPP -#define BOOST_CONTAINER_POOLED_NODE_ALLOCATOR_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/throw_exception.hpp> -#include <boost/container/detail/node_pool.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/multiallocation_chain.hpp> -#include <boost/container/detail/dlmalloc.hpp> -#include <boost/container/detail/singleton.hpp> - -#include <boost/assert.hpp> -#include <boost/static_assert.hpp> -#include <cstddef> - -namespace boost { -namespace container { - -//!An STL node allocator that uses a modified DlMalloc as memory -//!source. -//! -//!This node allocator shares a segregated storage between all instances -//!of node_allocator with equal sizeof(T). -//! -//!NodesPerBlock is the number of nodes allocated at once when the allocator -//!runs out of nodes -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template - < class T - , std::size_t NodesPerBlock = NodeAlloc_nodes_per_block> -#else -template - < class T - , std::size_t NodesPerBlock - , std::size_t Version> -#endif -class node_allocator -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - //! If Version is 1, the allocator is a STL conforming allocator. If Version is 2, - //! the allocator offers advanced expand in place and burst allocation capabilities. - public: - typedef unsigned int allocation_type; - typedef node_allocator<T, NodesPerBlock, Version> self_t; - - static const std::size_t nodes_per_block = NodesPerBlock; - - BOOST_STATIC_ASSERT((Version <=2)); - #endif - - public: - //------- - typedef T value_type; - typedef T * pointer; - typedef const T * const_pointer; - typedef typename ::boost::container:: - dtl::unvoid_ref<T>::type reference; - typedef typename ::boost::container:: - dtl::unvoid_ref<const T>::type const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - typedef boost::container::dtl:: - version_type<self_t, Version> version; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef boost::container::dtl:: - basic_multiallocation_chain<void*> multiallocation_chain_void; - typedef boost::container::dtl:: - transform_multiallocation_chain - <multiallocation_chain_void, T> multiallocation_chain; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - //!Obtains node_allocator from - //!node_allocator - template<class T2> - struct rebind - { - typedef node_allocator< T2, NodesPerBlock - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - , Version - #endif - > other; - }; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - //!Not assignable from related node_allocator - template<class T2, std::size_t N2> - node_allocator& operator= - (const node_allocator<T2, N2>&); - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - - //!Default constructor - node_allocator() BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Copy constructor from other node_allocator. - node_allocator(const node_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Copy constructor from related node_allocator. - template<class T2> - node_allocator - (const node_allocator<T2, NodesPerBlock - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - , Version - #endif - > &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Destructor - ~node_allocator() BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!Returns the number of elements that could be allocated. - //!Never throws - size_type max_size() const - { return size_type(-1)/sizeof(T); } - - //!Allocate memory for an array of count elements. - //!Throws std::bad_alloc if there is no enough memory - pointer allocate(size_type count, const void * = 0) - { - if(BOOST_UNLIKELY(count > this->max_size())) - boost::container::throw_bad_alloc(); - - if(Version == 1 && count == 1){ - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - return pointer(static_cast<T*>(singleton_t::instance().allocate_node())); - } - else{ - void *ret = dlmalloc_malloc(count*sizeof(T)); - if(BOOST_UNLIKELY(!ret)) - boost::container::throw_bad_alloc(); - return static_cast<pointer>(ret); - } - } - - //!Deallocate allocated memory. - //!Never throws - void deallocate(const pointer &ptr, size_type count) BOOST_NOEXCEPT_OR_NOTHROW - { - (void)count; - if(Version == 1 && count == 1){ - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().deallocate_node(ptr); - } - else{ - dlmalloc_free(ptr); - } - } - - //!Deallocates all free blocks of the pool - static void deallocate_free_blocks() BOOST_NOEXCEPT_OR_NOTHROW - { - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().deallocate_free_blocks(); - } - - pointer allocation_command - (allocation_type command, size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - pointer ret = this->priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); - if(BOOST_UNLIKELY(!ret && !(command & BOOST_CONTAINER_NOTHROW_ALLOCATION))) - boost::container::throw_bad_alloc(); - return ret; - } - - //!Returns maximum the number of objects the previously allocated memory - //!pointed by p can hold. - size_type size(pointer p) const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - return dlmalloc_size(p); - } - - //!Allocates just one object. Memory allocated with this function - //!must be deallocated only with deallocate_one(). - //!Throws bad_alloc if there is no enough memory - pointer allocate_one() - { - BOOST_STATIC_ASSERT(( Version > 1 )); - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - return (pointer)singleton_t::instance().allocate_node(); - } - - //!Allocates many elements of size == 1. - //!Elements must be individually deallocated with deallocate_one() - void allocate_individual(std::size_t num_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - typename shared_pool_t::multiallocation_chain ch; - singleton_t::instance().allocate_nodes(num_elements, ch); - chain.incorporate_after(chain.before_begin(), (T*)&*ch.begin(), (T*)&*ch.last(), ch.size()); - } - - //!Deallocates memory previously allocated with allocate_one(). - //!You should never use deallocate_one to deallocate memory allocated - //!with other functions different from allocate_one(). Never throws - void deallocate_one(pointer p) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - singleton_t::instance().deallocate_node(p); - } - - void deallocate_individual(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - typedef dtl::shared_node_pool - <sizeof(T), NodesPerBlock> shared_pool_t; - typedef dtl::singleton_default<shared_pool_t> singleton_t; - typename shared_pool_t::multiallocation_chain ch(&*chain.begin(), &*chain.last(), chain.size()); - singleton_t::instance().deallocate_nodes(ch); - } - - //!Allocates many elements of size elem_size. - //!Elements must be individually deallocated with deallocate() - void allocate_many(size_type elem_size, std::size_t n_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - dlmalloc_memchain ch; - BOOST_CONTAINER_MEMCHAIN_INIT(&ch); - if(BOOST_UNLIKELY(!dlmalloc_multialloc_nodes(n_elements, elem_size*sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch))){ - boost::container::throw_bad_alloc(); - } - chain.incorporate_after( chain.before_begin() - , (T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - , (T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - , BOOST_CONTAINER_MEMCHAIN_SIZE(&ch)); - } - - //!Allocates n_elements elements, each one of size elem_sizes[i] - //!Elements must be individually deallocated with deallocate() - void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain) - { - BOOST_STATIC_ASSERT(( Version > 1 )); - dlmalloc_memchain ch; - dlmalloc_multialloc_arrays(n_elements, elem_sizes, sizeof(T), DL_MULTIALLOC_DEFAULT_CONTIGUOUS, &ch); - if(BOOST_UNLIKELY(BOOST_CONTAINER_MEMCHAIN_EMPTY(&ch))){ - boost::container::throw_bad_alloc(); - } - chain.incorporate_after( chain.before_begin() - , (T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - , (T*)BOOST_CONTAINER_MEMCHAIN_LASTMEM(&ch) - , BOOST_CONTAINER_MEMCHAIN_SIZE(&ch)); - } - - void deallocate_many(multiallocation_chain &chain) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_STATIC_ASSERT(( Version > 1 )); - void *first = &*chain.begin(); - void *last = &*chain.last(); - size_t num = chain.size(); - dlmalloc_memchain ch; - BOOST_CONTAINER_MEMCHAIN_INIT_FROM(&ch, first, last, num); - dlmalloc_multidealloc(&ch); - } - - //!Swaps allocators. Does not throw. If each allocator is placed in a - //!different memory segment, the result is undefined. - friend void swap(self_t &, self_t &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - //!An allocator always compares to true, as memory allocated with one - //!instance can be deallocated by another instance - friend bool operator==(const node_allocator &, const node_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return true; } - - //!An allocator always compares to false, as memory allocated with one - //!instance can be deallocated by another instance - friend bool operator!=(const node_allocator &, const node_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return false; } - - private: - pointer priv_allocation_command - (allocation_type command, std::size_t limit_size - ,size_type &prefer_in_recvd_out_size - ,pointer &reuse) - { - std::size_t const preferred_size = prefer_in_recvd_out_size; - dlmalloc_command_ret_t ret = {0 , 0}; - if((limit_size > this->max_size()) | (preferred_size > this->max_size())){ - return pointer(); - } - std::size_t l_size = limit_size*sizeof(T); - std::size_t p_size = preferred_size*sizeof(T); - std::size_t r_size; - { - void* reuse_ptr_void = reuse; - ret = dlmalloc_allocation_command(command, sizeof(T), l_size, p_size, &r_size, reuse_ptr_void); - reuse = static_cast<T*>(reuse_ptr_void); - } - prefer_in_recvd_out_size = r_size/sizeof(T); - return (pointer)ret.first; - } -}; - -} //namespace container { -} //namespace boost { - -#include <boost/container/detail/config_end.hpp> - -#endif //#ifndef BOOST_CONTAINER_POOLED_NODE_ALLOCATOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/deque.hpp b/contrib/restricted/boost/boost/container/pmr/deque.hpp deleted file mode 100644 index acb7da3d0d..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/deque.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_DEQUE_HPP -#define BOOST_CONTAINER_PMR_DEQUE_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/deque.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class T> -using deque = boost::container::deque<T, polymorphic_allocator<T>>; - -#endif - -//! A portable metafunction to obtain a deque -//! that uses a polymorphic allocator -template<class T> -struct deque_of -{ - typedef boost::container::deque - < T, polymorphic_allocator<T> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_DEQUE_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/flat_map.hpp b/contrib/restricted/boost/boost/container/pmr/flat_map.hpp deleted file mode 100644 index 76c697bac4..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/flat_map.hpp +++ /dev/null @@ -1,63 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_FLAT_MAP_HPP -#define BOOST_CONTAINER_PMR_FLAT_MAP_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/flat_map.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class Key - ,class T - ,class Compare = std::less<Key > > -using flat_map = boost::container::flat_map<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > >; - -template <class Key - ,class T - ,class Compare = std::less<Key> > -using flat_multimap = boost::container::flat_multimap<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > >; - -#endif - -//! A portable metafunction to obtain a flat_map -//! that uses a polymorphic allocator -template <class Key - ,class T - ,class Compare = std::less<Key> > -struct flat_map_of -{ - typedef boost::container::flat_map<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > > type; -}; - -//! A portable metafunction to obtain a flat_multimap -//! that uses a polymorphic allocator -template <class Key - ,class T - ,class Compare = std::less<Key> > -struct flat_multimap_of -{ - typedef boost::container::flat_multimap<Key, T, Compare, polymorphic_allocator<std::pair<Key, T> > > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_FLAT_MAP_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/flat_set.hpp b/contrib/restricted/boost/boost/container/pmr/flat_set.hpp deleted file mode 100644 index f072c95139..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/flat_set.hpp +++ /dev/null @@ -1,59 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_SET_HPP -#define BOOST_CONTAINER_PMR_SET_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/flat_set.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class Key - ,class Compare = std::less<Key> > -using flat_set = boost::container::flat_set<Key, Compare, polymorphic_allocator<Key> >; - -template <class Key - ,class Compare = std::less<Key> > -using flat_multiset = boost::container::flat_multiset<Key, Compare, polymorphic_allocator<Key> >; - -#endif - -//! A portable metafunction to obtain a flat_set -//! that uses a polymorphic allocator -template <class Key - ,class Compare = std::less<Key> > -struct flat_set_of -{ - typedef boost::container::flat_set<Key, Compare, polymorphic_allocator<Key> > type; -}; - -//! A portable metafunction to obtain a flat_multiset -//! that uses a polymorphic allocator -template <class Key - ,class Compare = std::less<Key> > -struct flat_multiset_of -{ - typedef boost::container::flat_multiset<Key, Compare, polymorphic_allocator<Key> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_SET_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/list.hpp b/contrib/restricted/boost/boost/container/pmr/list.hpp deleted file mode 100644 index f3676a3d17..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/list.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_LIST_HPP -#define BOOST_CONTAINER_PMR_LIST_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/list.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class T> -using list = boost::container::list<T, polymorphic_allocator<T>>; - -#endif - -//! A portable metafunction to obtain a list -//! that uses a polymorphic allocator -template<class T> -struct list_of -{ - typedef boost::container::list - < T, polymorphic_allocator<T> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_VECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/map.hpp b/contrib/restricted/boost/boost/container/pmr/map.hpp deleted file mode 100644 index 71821606ae..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/map.hpp +++ /dev/null @@ -1,67 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_MAP_HPP -#define BOOST_CONTAINER_PMR_MAP_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/map.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class Key - ,class T - ,class Compare = std::less<Key> - ,class Options = void > -using map = boost::container::map<Key, T, Compare, polymorphic_allocator<std::pair<const Key, T> >, Options>; - -template <class Key - ,class T - ,class Compare = std::less<Key> - ,class Options = void > -using multimap = boost::container::multimap<Key, T, Compare, polymorphic_allocator<std::pair<const Key, T> >, Options>; - -#endif - -//! A portable metafunction to obtain a map -//! that uses a polymorphic allocator -template <class Key - ,class T - ,class Compare = std::less<Key> - ,class Options = void > -struct map_of -{ - typedef boost::container::map<Key, T, Compare, polymorphic_allocator<std::pair<const Key, T> >, Options> type; -}; - -//! A portable metafunction to obtain a multimap -//! that uses a polymorphic allocator -template <class Key - ,class T - ,class Compare = std::less<Key> - ,class Options = void > -struct multimap_of -{ - typedef boost::container::multimap<Key, T, Compare, polymorphic_allocator<std::pair<const Key, T> >, Options> type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_MAP_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/polymorphic_allocator.hpp b/contrib/restricted/boost/boost/container/pmr/polymorphic_allocator.hpp deleted file mode 100644 index ef8b940c73..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/polymorphic_allocator.hpp +++ /dev/null @@ -1,177 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_HPP -#define BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/config.hpp> -#include <boost/move/detail/type_traits.hpp> -#include <boost/move/utility_core.hpp> -#include <boost/container/detail/dispatch_uses_allocator.hpp> -#include <boost/container/new_allocator.hpp> -#include <boost/container/pmr/memory_resource.hpp> -#include <boost/container/pmr/global_resource.hpp> - -#include <cstddef> - -namespace boost { -namespace container { -namespace pmr { - -//! A specialization of class template `polymorphic_allocator` conforms to the Allocator requirements. -//! Constructed with different memory resources, different instances of the same specialization of -//! `polymorphic_allocator` can exhibit entirely different allocation behavior. This runtime -//! polymorphism allows objects that use polymorphic_allocator to behave as if they used different -//! allocator types at run time even though they use the same static allocator type. -template <class T> -class polymorphic_allocator -{ - public: - typedef T value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef std::size_t size_type; - typedef std::ptrdiff_t difference_type; - - template <typename U> - struct rebind { - typedef ::boost::container::pmr::polymorphic_allocator<U> other; - }; - - //! <b>Effects</b>: Sets m_resource to - //! `get_default_resource()`. - polymorphic_allocator() BOOST_NOEXCEPT - : m_resource(::boost::container::pmr::get_default_resource()) - {} - - //! <b>Requires</b>: r is non-null. - //! - //! <b>Effects</b>: Sets m_resource to r. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Notes</b>: This constructor provides an implicit conversion from memory_resource*. - //! Non-standard extension: if r is null m_resource is set to get_default_resource(). - polymorphic_allocator(memory_resource* r) - : m_resource(r ? r : ::boost::container::pmr::get_default_resource()) - {} - - //! <b>Effects</b>: Sets m_resource to - //! other.resource(). - polymorphic_allocator(const polymorphic_allocator& other) - : m_resource(other.m_resource) - {} - - //! <b>Effects</b>: Sets m_resource to - //! other.resource(). - template <class U> - polymorphic_allocator(const polymorphic_allocator<U>& other) BOOST_NOEXCEPT - : m_resource(other.resource()) - {} - - //! <b>Effects</b>: Sets m_resource to - //! other.resource(). - polymorphic_allocator& operator=(const polymorphic_allocator& other) - { m_resource = other.m_resource; return *this; } - - //! <b>Returns</b>: Equivalent to - //! `static_cast<T*>(m_resource->allocate(n * sizeof(T), alignof(T)))`. - T* allocate(size_t n) - { return static_cast<T*>(m_resource->allocate(n*sizeof(T), ::boost::move_detail::alignment_of<T>::value)); } - - //! <b>Requires</b>: p was allocated from a memory resource, x, equal to *m_resource, - //! using `x.allocate(n * sizeof(T), alignof(T))`. - //! - //! <b>Effects</b>: Equivalent to m_resource->deallocate(p, n * sizeof(T), alignof(T)). - //! - //! <b>Throws</b>: Nothing. - void deallocate(T* p, size_t n) - { m_resource->deallocate(p, n*sizeof(T), ::boost::move_detail::alignment_of<T>::value); } - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Requires</b>: Uses-allocator construction of T with allocator - //! `*this` and constructor arguments `std::forward<Args>(args)...` - //! is well-formed. [Note: uses-allocator construction is always well formed for - //! types that do not use allocators. - end note] - //! - //! <b>Effects</b>: Construct a T object at p by uses-allocator construction with allocator - //! `*this` and constructor arguments `std::forward<Args>(args)...`. - //! - //! <b>Throws</b>: Nothing unless the constructor for T throws. - template < typename U, class ...Args> - void construct(U* p, BOOST_FWD_REF(Args)...args) - { - new_allocator<U> na; - dtl::dispatch_uses_allocator - (na, *this, p, ::boost::forward<Args>(args)...); - } - - #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //Disable this overload if the first argument is pair as some compilers have - //overload selection problems when the first parameter is a pair. - #define BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_CONSTRUCT_CODE(N) \ - template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\ - void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\ - {\ - new_allocator<U> na;\ - dtl::dispatch_uses_allocator\ - (na, *this, p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\ - }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_CONSTRUCT_CODE) - #undef BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_CONSTRUCT_CODE - - #endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: - //! p->~U(). - template <class U> - void destroy(U* p) - { (void)p; p->~U(); } - - //! <b>Returns</b>: Equivalent to - //! `polymorphic_allocator()`. - polymorphic_allocator select_on_container_copy_construction() const - { return polymorphic_allocator(); } - - //! <b>Returns</b>: - //! m_resource. - memory_resource* resource() const - { return m_resource; } - - private: - memory_resource* m_resource; -}; - -//! <b>Returns</b>: -//! `*a.resource() == *b.resource()`. -template <class T1, class T2> -bool operator==(const polymorphic_allocator<T1>& a, const polymorphic_allocator<T2>& b) BOOST_NOEXCEPT -{ return *a.resource() == *b.resource(); } - - -//! <b>Returns</b>: -//! `! (a == b)`. -template <class T1, class T2> -bool operator!=(const polymorphic_allocator<T1>& a, const polymorphic_allocator<T2>& b) BOOST_NOEXCEPT -{ return *a.resource() != *b.resource(); } - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_POLYMORPHIC_ALLOCATOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/resource_adaptor.hpp b/contrib/restricted/boost/boost/container/pmr/resource_adaptor.hpp deleted file mode 100644 index f5ce5c8a18..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/resource_adaptor.hpp +++ /dev/null @@ -1,193 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_RESOURCE_ADAPTOR_HPP -#define BOOST_CONTAINER_PMR_RESOURCE_ADAPTOR_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/config.hpp> -#include <boost/container/pmr/memory_resource.hpp> -#include <boost/container/allocator_traits.hpp> -#include <boost/intrusive/detail/ebo_functor_holder.hpp> -#include <boost/move/utility_core.hpp> - -namespace boost { -namespace container { -namespace pmr { - -//! An instance of resource_adaptor<Allocator> is an adaptor that wraps a memory_resource interface -//! around Allocator. In order that resource_adaptor<X<T>> and resource_adaptor<X<U>> are the same -//! type for any allocator template X and types T and U, resource_adaptor<Allocator> is rendered as -//! an alias to this class template such that Allocator is rebound to a char value type in every -//! specialization of the class template. The requirements on this class template are defined below. -//! In addition to the Allocator requirements, the parameter to resource_adaptor shall meet -//! the following additional requirements: -//! -//! - `typename allocator_traits<Allocator>:: pointer` shall be identical to -//! `typename allocator_traits<Allocator>:: value_type*`. -//! -//! - `typename allocator_traits<Allocator>:: const_pointer` shall be identical to -//! `typename allocator_traits<Allocator>:: value_type const*`. -//! -//! - `typename allocator_traits<Allocator>:: void_pointer` shall be identical to `void*`. -//! -//! - `typename allocator_traits<Allocator>:: const_void_pointer` shall be identical to `void const*`. -template <class Allocator> -class resource_adaptor_imp - : public memory_resource - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - , private ::boost::intrusive::detail::ebo_functor_holder<Allocator> - #endif -{ - #ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - Allocator m_alloc; - #else - BOOST_COPYABLE_AND_MOVABLE(resource_adaptor_imp) - typedef ::boost::intrusive::detail::ebo_functor_holder<Allocator> ebo_alloc_t; - void static_assert_if_not_char_allocator() const - { - //This class can only be used with allocators type char - BOOST_STATIC_ASSERT((dtl::is_same<typename Allocator::value_type, char>::value)); - } - #endif - - public: - typedef Allocator allocator_type; - - //! <b>Effects</b>: Default constructs - //! m_alloc. - resource_adaptor_imp() - { this->static_assert_if_not_char_allocator(); } - - //! <b>Effects</b>: Copy constructs - //! m_alloc. - resource_adaptor_imp(const resource_adaptor_imp &other) - : ebo_alloc_t(other.ebo_alloc_t::get()) - {} - - //! <b>Effects</b>: Move constructs - //! m_alloc. - resource_adaptor_imp(BOOST_RV_REF(resource_adaptor_imp) other) - : ebo_alloc_t(::boost::move(other.get())) - {} - - //! <b>Effects</b>: Initializes m_alloc with - //! a2. - explicit resource_adaptor_imp(const Allocator& a2) - : ebo_alloc_t(a2) - { this->static_assert_if_not_char_allocator(); } - - //! <b>Effects</b>: Initializes m_alloc with - //! a2. - explicit resource_adaptor_imp(BOOST_RV_REF(Allocator) a2) - : ebo_alloc_t(::boost::move(a2)) - { this->static_assert_if_not_char_allocator(); } - - //! <b>Effects</b>: Copy assigns - //! m_alloc. - resource_adaptor_imp& operator=(BOOST_COPY_ASSIGN_REF(resource_adaptor_imp) other) - { this->ebo_alloc_t::get() = other.ebo_alloc_t::get(); return *this; } - - //! <b>Effects</b>: Move assigns - //! m_alloc. - resource_adaptor_imp& operator=(BOOST_RV_REF(resource_adaptor_imp) other) - { this->ebo_alloc_t::get() = ::boost::move(other.ebo_alloc_t::get()); return *this; } - - //! <b>Effects</b>: Returns m_alloc. - allocator_type &get_allocator() - { return this->ebo_alloc_t::get(); } - - //! <b>Effects</b>: Returns m_alloc. - const allocator_type &get_allocator() const - { return this->ebo_alloc_t::get(); } - - protected: - //! <b>Returns</b>: Allocated memory obtained by calling m_alloc.allocate. The size and alignment - //! of the allocated memory shall meet the requirements for a class derived from memory_resource. - virtual void* do_allocate(size_t bytes, size_t alignment) - { (void)alignment; return this->ebo_alloc_t::get().allocate(bytes); } - - //! <b>Requires</b>: p was previously allocated using A.allocate, where A == m_alloc, and not - //! subsequently deallocated. - //! - //! <b>Effects</b>: Returns memory to the allocator using m_alloc.deallocate(). - virtual void do_deallocate(void* p, size_t bytes, size_t alignment) - { (void)alignment; this->ebo_alloc_t::get().deallocate((char*)p, bytes); } - - //! Let p be dynamic_cast<const resource_adaptor_imp*>(&other). - //! - //! <b>Returns</b>: false if p is null, otherwise the value of m_alloc == p->m_alloc. - virtual bool do_is_equal(const memory_resource& other) const BOOST_NOEXCEPT - { - const resource_adaptor_imp* p = dynamic_cast<const resource_adaptor_imp*>(&other); - return p && p->ebo_alloc_t::get() == this->ebo_alloc_t::get(); - } -}; - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - -//! `resource_adaptor<Allocator>` is rendered as an alias to resource_adaptor_imp class template -//! such that Allocator is rebound to a char value type. -template <class Allocator> -using resource_adaptor = resource_adaptor_imp - <typename allocator_traits<Allocator>::template rebind_alloc<char> >; - -#else - -template <class Allocator> -class resource_adaptor - : public resource_adaptor_imp - <typename allocator_traits<Allocator>::template portable_rebind_alloc<char>::type> -{ - typedef resource_adaptor_imp - <typename allocator_traits<Allocator>::template portable_rebind_alloc<char>::type> base_t; - - BOOST_COPYABLE_AND_MOVABLE(resource_adaptor) - - public: - resource_adaptor() - : base_t() - {} - - resource_adaptor(const resource_adaptor &other) - : base_t(other) - {} - - resource_adaptor(BOOST_RV_REF(resource_adaptor) other) - : base_t(BOOST_MOVE_BASE(base_t, other)) - {} - - explicit resource_adaptor(const Allocator& a2) - : base_t(a2) - {} - - explicit resource_adaptor(BOOST_RV_REF(Allocator) a2) - : base_t(BOOST_MOVE_BASE(base_t, a2)) - {} - - resource_adaptor& operator=(BOOST_COPY_ASSIGN_REF(resource_adaptor) other) - { return static_cast<resource_adaptor&>(this->base_t::operator=(other)); } - - resource_adaptor& operator=(BOOST_RV_REF(resource_adaptor) other) - { return static_cast<resource_adaptor&>(this->base_t::operator=(BOOST_MOVE_BASE(base_t, other))); } - - //get_allocator and protected functions are properly inherited -}; - -#endif - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_RESOURCE_ADAPTOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/set.hpp b/contrib/restricted/boost/boost/container/pmr/set.hpp deleted file mode 100644 index 320169667f..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/set.hpp +++ /dev/null @@ -1,63 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_SET_HPP -#define BOOST_CONTAINER_PMR_SET_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/set.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class Key - ,class Compare = std::less<Key> - ,class Options = void > -using set = boost::container::set<Key, Compare, polymorphic_allocator<Key>, Options>; - -template <class Key - ,class Compare = std::less<Key> - ,class Options = void > -using multiset = boost::container::multiset<Key, Compare, polymorphic_allocator<Key>, Options>; - -#endif - -//! A portable metafunction to obtain a set -//! that uses a polymorphic allocator -template <class Key - ,class Compare = std::less<Key> - ,class Options = void > -struct set_of -{ - typedef boost::container::set<Key, Compare, polymorphic_allocator<Key>, Options> type; -}; - -//! A portable metafunction to obtain a multiset -//! that uses a polymorphic allocator -template <class Key - ,class Compare = std::less<Key> - ,class Options = void > -struct multiset_of -{ - typedef boost::container::multiset<Key, Compare, polymorphic_allocator<Key>, Options> type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_SET_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/slist.hpp b/contrib/restricted/boost/boost/container/pmr/slist.hpp deleted file mode 100644 index c90fd7d6cd..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/slist.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_SLIST_HPP -#define BOOST_CONTAINER_PMR_SLIST_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/slist.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class T> -using slist = boost::container::slist<T, polymorphic_allocator<T>>; - -#endif - -//! A portable metafunction to obtain a slist -//! that uses a polymorphic allocator -template<class T> -struct slist_of -{ - typedef boost::container::slist - < T, polymorphic_allocator<T> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_VECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/small_vector.hpp b/contrib/restricted/boost/boost/container/pmr/small_vector.hpp deleted file mode 100644 index 6eef149728..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/small_vector.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_SMALL_VECTOR_HPP -#define BOOST_CONTAINER_PMR_SMALL_VECTOR_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/small_vector.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class T, std::size_t N> -using small_vector = boost::container::small_vector<T, N, polymorphic_allocator<T>>; - -#endif - -//! A portable metafunction to obtain a small_vector -//! that uses a polymorphic allocator -template<class T, std::size_t N> -struct small_vector_of -{ - typedef boost::container::small_vector - < T, N, polymorphic_allocator<T> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_SMALL_VECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/stable_vector.hpp b/contrib/restricted/boost/boost/container/pmr/stable_vector.hpp deleted file mode 100644 index d11c426fc4..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/stable_vector.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_STABLE_VECTOR_HPP -#define BOOST_CONTAINER_PMR_STABLE_VECTOR_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/stable_vector.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class T> -using stable_vector = boost::container::stable_vector<T, polymorphic_allocator<T>>; - -#endif - -//! A portable metafunction to obtain a stable_vector -//! that uses a polymorphic allocator -template<class T> -struct stable_vector_of -{ - typedef boost::container::stable_vector - < T, polymorphic_allocator<T> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_STABLE_VECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/string.hpp b/contrib/restricted/boost/boost/container/pmr/string.hpp deleted file mode 100644 index c1eba67296..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/string.hpp +++ /dev/null @@ -1,50 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_STRING_HPP -#define BOOST_CONTAINER_PMR_STRING_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/string.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class CharT, class Traits = std::char_traits<CharT> > -using basic_string = - boost::container::basic_string<CharT, Traits, polymorphic_allocator<CharT> >; - -#endif - -//! A portable metafunction to obtain a basic_string -//! that uses a polymorphic allocator -template <class CharT, class Traits = std::char_traits<CharT> > -struct basic_string_of -{ - typedef boost::container::basic_string - <CharT, Traits, polymorphic_allocator<CharT> > type; -}; - -typedef basic_string_of<char>::type string; - -typedef basic_string_of<wchar_t>::type wstring; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_STRING_HPP diff --git a/contrib/restricted/boost/boost/container/pmr/vector.hpp b/contrib/restricted/boost/boost/container/pmr/vector.hpp deleted file mode 100644 index 2bd9c157e0..0000000000 --- a/contrib/restricted/boost/boost/container/pmr/vector.hpp +++ /dev/null @@ -1,45 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2015-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_PMR_VECTOR_HPP -#define BOOST_CONTAINER_PMR_VECTOR_HPP - -#if defined (_MSC_VER) -# pragma once -#endif - -#include <boost/container/vector.hpp> -#include <boost/container/pmr/polymorphic_allocator.hpp> - -namespace boost { -namespace container { -namespace pmr { - -#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) - -template <class T> -using vector = boost::container::vector<T, polymorphic_allocator<T>>; - -#endif - -//! A portable metafunction to obtain a vector -//! that uses a polymorphic allocator -template<class T> -struct vector_of -{ - typedef boost::container::vector - < T, polymorphic_allocator<T> > type; -}; - -} //namespace pmr { -} //namespace container { -} //namespace boost { - -#endif //BOOST_CONTAINER_PMR_VECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/slist.hpp b/contrib/restricted/boost/boost/container/slist.hpp deleted file mode 100644 index d721e4f71c..0000000000 --- a/contrib/restricted/boost/boost/container/slist.hpp +++ /dev/null @@ -1,1702 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2004-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_SLIST_HPP -#define BOOST_CONTAINER_SLIST_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// container -#include <boost/container/container_fwd.hpp> -#include <boost/container/new_allocator.hpp> //new_allocator -#include <boost/container/throw_exception.hpp> -// container/detail -#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare -#include <boost/container/detail/compare_functors.hpp> -#include <boost/container/detail/iterator.hpp> -#include <boost/container/detail/iterators.hpp> -#include <boost/container/detail/mpl.hpp> -#include <boost/container/detail/node_alloc_holder.hpp> -#include <boost/container/detail/type_traits.hpp> -#include <boost/container/detail/value_functors.hpp> -// intrusive -#include <boost/intrusive/pointer_traits.hpp> -#include <boost/intrusive/slist.hpp> -// move -#include <boost/move/iterator.hpp> -#include <boost/move/traits.hpp> -#include <boost/move/utility_core.hpp> -// move/detail -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -#include <boost/move/detail/fwd_macros.hpp> -#endif -#include <boost/move/detail/move_helpers.hpp> -// other -#include <boost/core/no_exceptions_support.hpp> -// std -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -namespace boost { -namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -template <class T, class Allocator> -class slist; - -namespace dtl { - -template<class VoidPointer> -struct slist_hook -{ - typedef typename dtl::bi::make_slist_base_hook - <dtl::bi::void_pointer<VoidPointer>, dtl::bi::link_mode<dtl::bi::normal_link> >::type type; -}; - -template <class T, class VoidPointer> -struct slist_node - : public slist_hook<VoidPointer>::type -{ - private: - slist_node(); - - public: - typedef T value_type; - typedef typename slist_hook<VoidPointer>::type hook_type; - - T m_data; - - T &get_data() - { return this->m_data; } - - const T &get_data() const - { return this->m_data; } -}; - -template <class T, class VoidPointer> -struct iiterator_node_value_type< slist_node<T,VoidPointer> > { - typedef T type; -}; - -template<class Allocator> -struct intrusive_slist_type -{ - typedef boost::container::allocator_traits<Allocator> allocator_traits_type; - typedef typename allocator_traits_type::value_type value_type; - typedef typename boost::intrusive::pointer_traits - <typename allocator_traits_type::pointer>::template - rebind_pointer<void>::type - void_pointer; - typedef typename dtl::slist_node - <value_type, void_pointer> node_type; - - typedef typename dtl::bi::make_slist - <node_type - ,dtl::bi::base_hook<typename slist_hook<void_pointer>::type> - ,dtl::bi::constant_time_size<true> - , dtl::bi::size_type - <typename allocator_traits_type::size_type> - >::type container_type; - typedef container_type type ; -}; - -} //namespace dtl { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! An slist is a singly linked list: a list where each element is linked to the next -//! element, but not to the previous element. That is, it is a Sequence that -//! supports forward but not backward traversal, and (amortized) constant time -//! insertion and removal of elements. Slists, like lists, have the important -//! property that insertion and splicing do not invalidate iterators to list elements, -//! and that even removal invalidates only the iterators that point to the elements -//! that are removed. The ordering of iterators may be changed (that is, -//! slist<T>::iterator might have a different predecessor or successor after a list -//! operation than it did before), but the iterators themselves will not be invalidated -//! or made to point to different elements unless that invalidation or mutation is explicit. -//! -//! The main difference between slist and list is that list's iterators are bidirectional -//! iterators, while slist's iterators are forward iterators. This means that slist is -//! less versatile than list; frequently, however, bidirectional iterators are -//! unnecessary. You should usually use slist unless you actually need the extra -//! functionality of list, because singly linked lists are smaller and faster than double -//! linked lists. -//! -//! Important performance note: like every other Sequence, slist defines the member -//! functions insert and erase. Using these member functions carelessly, however, can -//! result in disastrously slow programs. The problem is that insert's first argument is -//! an iterator p, and that it inserts the new element(s) before p. This means that -//! insert must find the iterator just before p; this is a constant-time operation -//! for list, since list has bidirectional iterators, but for slist it must find that -//! iterator by traversing the list from the beginning up to p. In other words: -//! insert and erase are slow operations anywhere but near the beginning of the slist. -//! -//! Slist provides the member functions insert_after and erase_after, which are constant -//! time operations: you should always use insert_after and erase_after whenever -//! possible. If you find that insert_after and erase_after aren't adequate for your -//! needs, and that you often need to use insert and erase in the middle of the list, -//! then you should probably use list instead of slist. -//! -//! \tparam T The type of object that is stored in the list -//! \tparam Allocator The allocator used for all internal memory management -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class T, class Allocator = new_allocator<T> > -#else -template <class T, class Allocator> -#endif -class slist - : protected dtl::node_alloc_holder - <Allocator, typename dtl::intrusive_slist_type<Allocator>::type> -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef typename - dtl::intrusive_slist_type<Allocator>::type Icont; - typedef dtl::node_alloc_holder<Allocator, Icont> AllocHolder; - typedef typename AllocHolder::NodePtr NodePtr; - typedef typename AllocHolder::NodeAlloc NodeAlloc; - typedef typename AllocHolder::ValAlloc ValAlloc; - typedef typename AllocHolder::Node Node; - typedef dtl::allocator_destroyer<NodeAlloc> Destroyer; - typedef typename AllocHolder::alloc_version alloc_version; - typedef boost::container:: - allocator_traits<Allocator> allocator_traits_type; - typedef boost::container::equal_to_value<Allocator> equal_to_value_type; - - BOOST_COPYABLE_AND_MOVABLE(slist) - typedef dtl::iterator_from_iiterator<typename Icont::iterator, false> iterator_impl; - typedef dtl::iterator_from_iiterator<typename Icont::iterator, true > const_iterator_impl; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - - typedef T value_type; - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::reference reference; - typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference; - typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type; - typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type; - typedef Allocator allocator_type; - typedef BOOST_CONTAINER_IMPDEF(NodeAlloc) stored_allocator_type; - typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; - typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; - - public: - - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Constructs a list taking the allocator as parameter. - //! - //! <b>Throws</b>: If allocator_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - slist() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value) - : AllocHolder() - {} - - //! <b>Effects</b>: Constructs a list taking the allocator as parameter. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - explicit slist(const allocator_type& a) BOOST_NOEXCEPT_OR_NOTHROW - : AllocHolder(a) - {} - - //! <b>Effects</b>: Constructs a list - //! and inserts n value-initialized value_types. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit slist(size_type n) - : AllocHolder(allocator_type()) - { this->resize(n); } - - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - slist(size_type n, const allocator_type &a) - : AllocHolder(a) - { this->resize(n); } - - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit slist(size_type n, const value_type& x, const allocator_type& a = allocator_type()) - : AllocHolder(a) - { this->insert_after(this->cbefore_begin(), n, x); } - - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts a copy of the range [first, last) in the list. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced InIt throws. - //! - //! <b>Complexity</b>: Linear to the range [first, last). - template <class InpIt> - slist(InpIt first, InpIt last, const allocator_type& a = allocator_type()) - : AllocHolder(a) - { this->insert_after(this->cbefore_begin(), first, last); } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs a list that will use a copy of allocator a - //! and inserts a copy of the range [il.begin(), il.end()) in the list. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()). - slist(std::initializer_list<value_type> il, const allocator_type& a = allocator_type()) - : AllocHolder(a) - { this->insert_after(this->cbefore_begin(), il.begin(), il.end()); } -#endif - - //! <b>Effects</b>: Copy constructs a list. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! - //! <b>Complexity</b>: Linear to the elements x contains. - slist(const slist& x) - : AllocHolder(x) - { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); } - - //! <b>Effects</b>: Move constructor. Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocator_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - slist(BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW - : AllocHolder(BOOST_MOVE_BASE(AllocHolder, x)) - {} - - //! <b>Effects</b>: Copy constructs a list using the specified allocator. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! - //! <b>Complexity</b>: Linear to the elements x contains. - slist(const slist& x, const allocator_type &a) - : AllocHolder(a) - { this->insert_after(this->cbefore_begin(), x.begin(), x.end()); } - - //! <b>Effects</b>: Move constructor using the specified allocator. - //! Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocation or value_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise. - slist(BOOST_RV_REF(slist) x, const allocator_type &a) - : AllocHolder(a) - { - if(this->node_alloc() == x.node_alloc()){ - this->icont().swap(x.icont()); - } - else{ - this->insert_after(this->cbefore_begin(), boost::make_move_iterator(x.begin()), boost::make_move_iterator(x.end())); - } - } - - //! <b>Effects</b>: Destroys the list. All stored values are destroyed - //! and used memory is deallocated. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements. - ~slist() BOOST_NOEXCEPT_OR_NOTHROW - {} //AllocHolder clears the slist - - //! <b>Effects</b>: Makes *this contain the same elements as x. - //! - //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the number of elements in x. - slist& operator= (BOOST_COPY_ASSIGN_REF(slist) x) - { - if (&x != this){ - NodeAlloc &this_alloc = this->node_alloc(); - const NodeAlloc &x_alloc = x.node_alloc(); - dtl::bool_<allocator_traits_type:: - propagate_on_container_copy_assignment::value> flag; - if(flag && this_alloc != x_alloc){ - this->clear(); - } - this->AllocHolder::copy_assign_alloc(x); - this->assign(x.begin(), x.end()); - } - return *this; - } - - //! <b>Effects</b>: Makes *this contain the same elements as x. - //! - //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or value_type's move constructor throws) - //! - //! <b>Complexity</b>: Constant if allocator_traits_type:: - //! propagate_on_container_move_assignment is true or - //! this->get>allocator() == x.get_allocator(). Linear otherwise. - slist& operator=(BOOST_RV_REF(slist) x) - BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value - || allocator_traits_type::is_always_equal::value) - { - BOOST_ASSERT(this != &x); - NodeAlloc &this_alloc = this->node_alloc(); - NodeAlloc &x_alloc = x.node_alloc(); - const bool propagate_alloc = allocator_traits_type:: - propagate_on_container_move_assignment::value; - const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(propagate_alloc || allocators_equal){ - //Destroy - this->clear(); - //Move allocator if needed - this->AllocHolder::move_assign_alloc(x); - //Obtain resources - this->icont() = boost::move(x.icont()); - } - //Else do a one by one move - else{ - this->assign( boost::make_move_iterator(x.begin()) - , boost::make_move_iterator(x.end())); - } - return *this; - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Makes *this contain the same elements as in il. - //! - //! <b>Postcondition</b>: this->size() == il.size(). *this contains a copy - //! of each of il's elements. - //! - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or value_type's move constructor throws) - slist& operator=(std::initializer_list<value_type> il) - { - assign(il.begin(), il.end()); - return *this; - } -#endif - - //! <b>Effects</b>: Assigns the n copies of val to *this. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - void assign(size_type n, const T& val) - { - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - return this->assign(cvalue_iterator(val, n), cvalue_iterator()); - } - - //! <b>Effects</b>: Assigns the range [first, last) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing InpIt throws. - //! - //! <b>Complexity</b>: Linear to n. - template <class InpIt> - void assign(InpIt first, InpIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::disable_if_convertible<InpIt, size_type>::type * = 0 - #endif - ) - { - iterator end_n(this->end()); - iterator prev(this->before_begin()); - iterator node(this->begin()); - while (node != end_n && first != last){ - *node = *first; - prev = node; - ++node; - ++first; - } - if (first != last) - this->insert_after(prev, first, last); - else - this->erase_after(prev, end_n); - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Assigns the range [il.begin(), il.end()) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to range [il.begin(), il.end()). - - void assign(std::initializer_list<value_type> il) - { - assign(il.begin(), il.end()); - } -#endif - //! <b>Effects</b>: Returns a copy of the internal allocator. - //! - //! <b>Throws</b>: If allocator's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - allocator_type get_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return allocator_type(this->node_alloc()); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { return this->node_alloc(); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->node_alloc(); } - - ////////////////////////////////////////////// - // - // iterators - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns a non-dereferenceable iterator that, - //! when incremented, yields begin(). This iterator may be used - //! as the argument to insert_after, erase_after, etc. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator before_begin() BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(end()); } - - //! <b>Effects</b>: Returns a non-dereferenceable const_iterator - //! that, when incremented, yields begin(). This iterator may be used - //! as the argument to insert_after, erase_after, etc. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator before_begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->cbefore_begin(); } - - //! <b>Effects</b>: Returns an iterator to the first element contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->icont().begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->cbegin(); } - - //! <b>Effects</b>: Returns an iterator to the end of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->icont().end()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->cend(); } - - //! <b>Effects</b>: Returns a non-dereferenceable const_iterator - //! that, when incremented, yields begin(). This iterator may be used - //! as the argument to insert_after, erase_after, etc. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cbefore_begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_iterator(end()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_iterator(this->non_const_icont().begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_iterator(this->non_const_icont().end()); } - - //! <b>Returns</b>: The iterator to the element before i in the sequence. - //! Returns the end-iterator, if either i is the begin-iterator or the - //! sequence is empty. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements before i. - //! - //! <b>Note</b>: Non-standard extension. - iterator previous(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->icont().previous(p.get())); } - - //! <b>Returns</b>: The const_iterator to the element before i in the sequence. - //! Returns the end-const_iterator, if either i is the begin-const_iterator or - //! the sequence is empty. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements before i. - //! - //! <b>Note</b>: Non-standard extension. - const_iterator previous(const_iterator p) - { return const_iterator(this->icont().previous(p.get())); } - - ////////////////////////////////////////////// - // - // capacity - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns true if the list contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - bool empty() const - { return !this->size(); } - - //! <b>Effects</b>: Returns the number of the elements contained in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type size() const - { return this->icont().size(); } - - //! <b>Effects</b>: Returns the largest possible size of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type max_size() const - { return AllocHolder::max_size(); } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are value initialized. - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type new_size) - { - const_iterator last_pos; - if(!priv_try_shrink(new_size, last_pos)){ - typedef value_init_construct_iterator<value_type, difference_type> value_init_iterator; - this->insert_after(last_pos, value_init_iterator(new_size - this->size()), value_init_iterator()); - } - } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are copy constructed from x. - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type new_size, const T& x) - { - const_iterator last_pos; - if(!priv_try_shrink(new_size, last_pos)){ - this->insert_after(last_pos, new_size, x); - } - } - - ////////////////////////////////////////////// - // - // element access - // - ////////////////////////////////////////////// - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference front() - { - BOOST_ASSERT(!this->empty()); - return *this->begin(); - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the first element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference front() const - { - BOOST_ASSERT(!this->empty()); - return *this->begin(); - } - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the front of the list - //! - //! <b>Returns</b>: A reference to the created object. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - template <class... Args> - reference emplace_front(BOOST_FWD_REF(Args)... args) - { return *this->emplace_after(this->cbefore_begin(), boost::forward<Args>(args)...); } - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... after prev - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's in-place constructor throws. - //! - //! <b>Complexity</b>: Constant - template <class... Args> - iterator emplace_after(const_iterator prev, BOOST_FWD_REF(Args)... args) - { - NodePtr pnode(AllocHolder::create_node(boost::forward<Args>(args)...)); - return iterator(this->icont().insert_after(prev.get(), *pnode)); - } - - #else // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #define BOOST_CONTAINER_SLIST_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - reference emplace_front(BOOST_MOVE_UREF##N)\ - { return *this->emplace_after(this->cbefore_begin() BOOST_MOVE_I##N BOOST_MOVE_FWD##N);}\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace_after(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - NodePtr pnode (AllocHolder::create_node(BOOST_MOVE_FWD##N));\ - return iterator(this->icont().insert_after(p.get(), *pnode));\ - }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SLIST_EMPLACE_CODE) - #undef BOOST_CONTAINER_SLIST_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x at the beginning of the list. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_front(const T &x); - - //! <b>Effects</b>: Constructs a new element in the beginning of the list - //! and moves the resources of x to this new element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_front(T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(push_front, T, void, priv_push_front) - #endif - - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts a copy of the value after prev_p. - //! - //! <b>Returns</b>: An iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - //! - //! <b>Note</b>: Does not affect the validity of iterators and references of - //! previous values. - iterator insert_after(const_iterator prev_p, const T &x); - - //! <b>Requires</b>: prev_p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts a move constructed copy object from the value after the - //! element pointed by prev_p. - //! - //! <b>Returns</b>: An iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - //! - //! <b>Note</b>: Does not affect the validity of iterators and references of - //! previous values. - iterator insert_after(const_iterator prev_p, T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert_after, T, iterator, priv_insert_after, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: prev_p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts n copies of x after prev_p. - //! - //! <b>Returns</b>: an iterator to the last inserted element or prev_p if n is 0. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! - //! <b>Complexity</b>: Linear to n. - //! - //! <b>Note</b>: Does not affect the validity of iterators and references of - //! previous values. - iterator insert_after(const_iterator prev_p, size_type n, const value_type& x) - { - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - return this->insert_after(prev_p, cvalue_iterator(x, n), cvalue_iterator()); - } - - //! <b>Requires</b>: prev_p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts the range pointed by [first, last) after prev_p. - //! - //! <b>Returns</b>: an iterator to the last inserted element or prev_p if first == last. - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced InpIt throws. - //! - //! <b>Complexity</b>: Linear to the number of elements inserted. - //! - //! <b>Note</b>: Does not affect the validity of iterators and references of - //! previous values. - template <class InpIt> - iterator insert_after(const_iterator prev_p, InpIt first, InpIt last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - , typename dtl::enable_if_c - < !dtl::is_convertible<InpIt, size_type>::value - && (dtl::is_input_iterator<InpIt>::value - || dtl::is_same<alloc_version, version_1>::value - ) - >::type * = 0 - #endif - ) - { - iterator ret_it(prev_p.get()); - for (; first != last; ++first){ - ret_it = iterator(this->icont().insert_after(ret_it.get(), *this->create_node_from_it(first))); - } - return ret_it; - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Requires</b>: prev_p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts the range pointed by [il.begin(), il.end()) after prev_p. - //! - //! <b>Returns</b>: an iterator to the last inserted element or prev_p if il.begin() == il.end(). - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to the number of elements inserted. - //! - //! <b>Note</b>: Does not affect the validity of iterators and references of - //! previous values. - iterator insert_after(const_iterator prev_p, std::initializer_list<value_type> il) - { - return insert_after(prev_p, il.begin(), il.end()); - } -#endif - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - template <class FwdIt> - iterator insert_after(const_iterator prev, FwdIt first, FwdIt last - , typename dtl::enable_if_c - < !dtl::is_convertible<FwdIt, size_type>::value - && !(dtl::is_input_iterator<FwdIt>::value - || dtl::is_same<alloc_version, version_1>::value - ) - >::type * = 0 - ) - { - //Optimized allocation and construction - insertion_functor func(this->icont(), prev.get()); - this->allocate_many_and_construct(first, boost::container::iterator_distance(first, last), func); - return iterator(func.inserted_first()); - } - #endif - - //! <b>Effects</b>: Removes the first element from the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Amortized constant time. - void pop_front() - { - BOOST_ASSERT(!this->empty()); - this->icont().pop_front_and_dispose(Destroyer(this->node_alloc())); - } - - //! <b>Effects</b>: Erases the element after the element pointed by prev_p - //! of the list. - //! - //! <b>Returns</b>: the first element remaining beyond the removed elements, - //! or end() if no such element exists. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Does not invalidate iterators or references to non erased elements. - iterator erase_after(const_iterator prev_p) - { - return iterator(this->icont().erase_after_and_dispose(prev_p.get(), Destroyer(this->node_alloc()))); - } - - //! <b>Effects</b>: Erases the range (before_first, last) from - //! the list. - //! - //! <b>Returns</b>: the first element remaining beyond the removed elements, - //! or end() if no such element exists. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of erased elements. - //! - //! <b>Note</b>: Does not invalidate iterators or references to non erased elements. - iterator erase_after(const_iterator before_first, const_iterator last) - { - return iterator(this->icont().erase_after_and_dispose(before_first.get(), last.get(), Destroyer(this->node_alloc()))); - } - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements on *this and x. - void swap(slist& x) - BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value - || allocator_traits_type::is_always_equal::value) - { - BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || - allocator_traits_type::is_always_equal::value || - this->get_stored_allocator() == x.get_stored_allocator()); - AllocHolder::swap(x); - } - - //! <b>Effects</b>: Erases all the elements of the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements in the list. - void clear() - { this->icont().clear_and_dispose(Destroyer(this->node_alloc())); } - - ////////////////////////////////////////////// - // - // slist operations - // - ////////////////////////////////////////////// - - //! <b>Requires</b>: p must point to an element contained - //! by the list. x != *this - //! - //! <b>Effects</b>: Transfers all the elements of list x to this list, after the - //! the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator - //! are not equal. - //! - //! <b>Complexity</b>: Linear to the elements in x. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of - //! this list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this != &x); - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice_after(prev_p.get(), x.icont()); - } - - //! <b>Requires</b>: p must point to an element contained - //! by the list. x != *this - //! - //! <b>Effects</b>: Transfers all the elements of list x to this list, after the - //! the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: std::runtime_error if this' allocator and x's allocator - //! are not equal. - //! - //! <b>Complexity</b>: Linear to the elements in x. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of - //! this list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(prev_p, static_cast<slist&>(x)); } - - //! <b>Requires</b>: prev_p must be a valid iterator of this. - //! i must point to an element contained in list x. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list, - //! after the element pointed by prev_p. - //! If prev_p == prev or prev_p == ++prev, this function is a null operation. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, slist& x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice_after(prev_p.get(), x.icont(), prev.get()); - } - - //! <b>Requires</b>: prev_p must be a valid iterator of this. - //! i must point to an element contained in list x. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list, - //! after the element pointed by prev_p. - //! If prev_p == prev or prev_p == ++prev, this function is a null operation. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, const_iterator prev) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(prev_p, static_cast<slist&>(x), prev); } - - //! <b>Requires</b>: prev_p must be a valid iterator of this. - //! before_first and before_last must be valid iterators of x. - //! prev_p must not be contained in [before_first, before_last) range. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_p. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear to the number of transferred elements. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, slist& x, - const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice_after - (prev_p.get(), x.icont(), before_first.get(), before_last.get()); - } - - //! <b>Requires</b>: prev_p must be a valid iterator of this. - //! before_first and before_last must be valid iterators of x. - //! prev_p must not be contained in [before_first, before_last) range. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_p. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear to the number of transferred elements. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, - const_iterator before_first, const_iterator before_last) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last); } - - //! <b>Requires</b>: prev_p must be a valid iterator of this. - //! before_first and before_last must be valid iterators of x. - //! prev_p must not be contained in [before_first, before_last) range. - //! n == distance(before_first, before_last). - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_p. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, slist& x, - const_iterator before_first, const_iterator before_last, - size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().splice_after - (prev_p.get(), x.icont(), before_first.get(), before_last.get(), n); - } - - //! <b>Requires</b>: prev_p must be a valid iterator of this. - //! before_first and before_last must be valid iterators of x. - //! prev_p must not be contained in [before_first, before_last) range. - //! n == distance(before_first, before_last). - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the range [before_first + 1, before_last + 1) - //! from list x to this list, after the element pointed by prev_p. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice_after(const_iterator prev_p, BOOST_RV_REF(slist) x, - const_iterator before_first, const_iterator before_last, - size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(prev_p, static_cast<slist&>(x), before_first, before_last, n); } - - //! <b>Effects</b>: Removes all the elements that compare equal to value. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear time. It performs exactly size() comparisons for equality. - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - void remove(const T& value) - { this->remove_if(equal_to_value_type(value)); } - - //! <b>Effects</b>: Removes all the elements for which a specified - //! predicate is satisfied. - //! - //! <b>Throws</b>: If pred throws. - //! - //! <b>Complexity</b>: Linear time. It performs exactly size() calls to the predicate. - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - template <class Pred> - void remove_if(Pred pred) - { - typedef value_to_node_compare<Node, Pred> value_to_node_compare_type; - this->icont().remove_and_dispose_if(value_to_node_compare_type(pred), Destroyer(this->node_alloc())); - } - - //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent - //! elements that are equal from the list. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: Linear time (size()-1 comparisons equality comparisons). - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - void unique() - { this->unique(value_equal_t()); } - - //! <b>Effects</b>: Removes adjacent duplicate elements or adjacent - //! elements that satisfy some binary predicate from the list. - //! - //! <b>Throws</b>: If pred throws. - //! - //! <b>Complexity</b>: Linear time (size()-1 comparisons calls to pred()). - //! - //! <b>Note</b>: The relative order of elements that are not removed is unchanged, - //! and iterators to elements that are not removed remain valid. - template <class Pred> - void unique(Pred pred) - { - typedef value_to_node_compare<Node, Pred> value_to_node_compare_type; - this->icont().unique_and_dispose(value_to_node_compare_type(pred), Destroyer(this->node_alloc())); - } - - //! <b>Requires</b>: The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this according to std::less<value_type>. The merge is stable; - //! that is, if an element from *this is equivalent to one from x, then the element - //! from *this will precede the one from x. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - void merge(slist & x) - { this->merge(x, value_less_t()); } - - //! <b>Requires</b>: The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this according to std::less<value_type>. The merge is stable; - //! that is, if an element from *this is equivalent to one from x, then the element - //! from *this will precede the one from x. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - void merge(BOOST_RV_REF(slist) x) - { this->merge(static_cast<slist&>(x)); } - - //! <b>Requires</b>: p must be a comparison function that induces a strict weak - //! ordering and both *this and x must be sorted according to that ordering - //! The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this. The merge is stable; that is, if an element from *this is - //! equivalent to one from x, then the element from *this will precede the one from x. - //! - //! <b>Throws</b>: If comp throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - //! - //! <b>Note</b>: Iterators and references to *this are not invalidated. - template <class StrictWeakOrdering> - void merge(slist& x, StrictWeakOrdering comp) - { - typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type; - BOOST_ASSERT(this->node_alloc() == x.node_alloc()); - this->icont().merge(x.icont(), value_to_node_compare_type(comp)); - } - - //! <b>Requires</b>: p must be a comparison function that induces a strict weak - //! ordering and both *this and x must be sorted according to that ordering - //! The lists x and *this must be distinct. - //! - //! <b>Effects</b>: This function removes all of x's elements and inserts them - //! in order into *this. The merge is stable; that is, if an element from *this is - //! equivalent to one from x, then the element from *this will precede the one from x. - //! - //! <b>Throws</b>: If comp throws. - //! - //! <b>Complexity</b>: This function is linear time: it performs at most - //! size() + x.size() - 1 comparisons. - //! - //! <b>Note</b>: Iterators and references to *this are not invalidated. - template <class StrictWeakOrdering> - void merge(BOOST_RV_REF(slist) x, StrictWeakOrdering comp) - { this->merge(static_cast<slist&>(x), comp); } - - //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>. - //! The sort is stable, that is, the relative order of equivalent elements is preserved. - //! - //! <b>Throws</b>: If comparison throws. - //! - //! <b>Notes</b>: Iterators and references are not invalidated. - //! - //! <b>Complexity</b>: The number of comparisons is approximately N log N, where N - //! is the list's size. - void sort() - { this->sort(value_less_t()); } - - //! <b>Effects</b>: This function sorts the list *this according to std::less<value_type>. - //! The sort is stable, that is, the relative order of equivalent elements is preserved. - //! - //! <b>Throws</b>: If comp throws. - //! - //! <b>Notes</b>: Iterators and references are not invalidated. - //! - //! <b>Complexity</b>: The number of comparisons is approximately N log N, where N - //! is the list's size. - template <class StrictWeakOrdering> - void sort(StrictWeakOrdering comp) - { - typedef value_to_node_compare<Node, StrictWeakOrdering> value_to_node_compare_type; - // nothing if the slist has length 0 or 1. - if (this->size() < 2) - return; - this->icont().sort(value_to_node_compare_type(comp)); - } - - //! <b>Effects</b>: Reverses the order of elements in the list. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: This function is linear time. - //! - //! <b>Note</b>: Iterators and references are not invalidated - void reverse() BOOST_NOEXCEPT_OR_NOTHROW - { this->icont().reverse(); } - - ////////////////////////////////////////////// - // - // list compatibility interface - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... before p - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's in-place constructor throws. - //! - //! <b>Complexity</b>: Linear to the elements before p - template <class... Args> - iterator emplace(const_iterator p, BOOST_FWD_REF(Args)... args) - { return this->emplace_after(this->previous(p), boost::forward<Args>(args)...); } - - #else - - #define BOOST_CONTAINER_SLIST_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - return this->emplace_after(this->previous(p) BOOST_MOVE_I##N BOOST_MOVE_FWD##N);\ - }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_SLIST_EMPLACE_CODE) - #undef BOOST_CONTAINER_SLIST_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of x before p. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the elements before p. - iterator insert(const_iterator p, const T &x); - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a new element before p with x's resources. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Linear to the elements before p. - iterator insert(const_iterator prev_p, T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts n copies of x before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if n == 0. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n plus linear to the elements before p. - iterator insert(const_iterator p, size_type n, const value_type& x) - { - const_iterator prev(this->previous(p)); - this->insert_after(prev, n, x); - return ++iterator(prev.get()); - } - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [first, last) range before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if first == last. - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced InpIt throws. - //! - //! <b>Complexity</b>: Linear to distance [first, last) plus - //! linear to the elements before p. - template <class InIter> - iterator insert(const_iterator p, InIter first, InIter last) - { - const_iterator prev(this->previous(p)); - this->insert_after(prev, first, last); - return ++iterator(prev.get()); - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if il.begin() == il.end(). - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced std::initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()) plus - //! linear to the elements before p. - iterator insert(const_iterator p, std::initializer_list<value_type> il) - { - return insert(p, il.begin(), il.end()); - } -#endif - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Erases the element at p. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements before p. - iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->erase_after(previous(p))); } - - //! <b>Requires</b>: first and last must be valid iterator to elements in *this. - //! - //! <b>Effects</b>: Erases the elements pointed by [first, last). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the distance between first and last plus - //! linear to the elements before first. - iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->erase_after(previous(first), last)); } - - //! <b>Requires</b>: p must point to an element contained - //! by the list. x != *this. this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers all the elements of list x to this list, before the - //! the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size(). - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of - //! this list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, slist& x) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(this->previous(p), x); } - - //! <b>Requires</b>: p must point to an element contained - //! by the list. x != *this. this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers all the elements of list x to this list, before the - //! the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear in distance(begin(), p), and linear in x.size(). - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of - //! this list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, BOOST_RV_REF(slist) x) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast<slist&>(x)); } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. i must point to an element contained in list x. - //! this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! If p == i or p == ++i, this function is a null operation. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i). - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, slist& x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(this->previous(p), x, x.previous(i)); } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. i must point to an element contained in list x. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Effects</b>: Transfers the value pointed by i, from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! If p == i or p == ++i, this function is a null operation. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear in distance(begin(), p), and in distance(x.begin(), i). - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator i) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast<slist&>(x), i); } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. first and last must point to elements contained in list x. - //! - //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! this' allocator and x's allocator shall compare equal. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first), - //! and in distance(first, last). - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, slist& x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice_after(this->previous(p), x, x.previous(first), x.previous(last)); } - - //! <b>Requires</b>: p must point to an element contained - //! by this list. first and last must point to elements contained in list x. - //! this' allocator and x's allocator shall compare equal - //! - //! <b>Effects</b>: Transfers the range pointed by first and last from list x to this list, - //! before the element pointed by p. No destructors or copy constructors are called. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Linear in distance(begin(), p), in distance(x.begin(), first), - //! and in distance(first, last). - //! - //! <b>Note</b>: Iterators of values obtained from list x now point to elements of this - //! list. Iterators of this list and all the references are not invalidated. - void splice(const_iterator p, BOOST_RV_REF(slist) x, const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { this->splice(p, static_cast<slist&>(x), first, last); } - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator==(const slist& x, const slist& y) - { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator!=(const slist& x, const slist& y) - { return !(x == y); } - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<(const slist& x, const slist& y) - { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>(const slist& x, const slist& y) - { return y < x; } - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<=(const slist& x, const slist& y) - { return !(y < x); } - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>=(const slist& x, const slist& y) - { return !(x < y); } - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - friend void swap(slist& x, slist& y) - { x.swap(y); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - - void priv_push_front (const T &x) - { this->insert_after(this->cbefore_begin(), x); } - - void priv_push_front (BOOST_RV_REF(T) x) - { this->insert_after(this->cbefore_begin(), ::boost::move(x)); } - - bool priv_try_shrink(size_type new_size, const_iterator &last_pos) - { - typename Icont::iterator end_n(this->icont().end()), cur(this->icont().before_begin()), cur_next; - while (++(cur_next = cur) != end_n && new_size > 0){ - --new_size; - cur = cur_next; - } - last_pos = const_iterator(cur); - if (cur_next != end_n){ - this->erase_after(last_pos, const_iterator(end_n)); - return true; - } - else{ - return false; - } - } - - template<class U> - iterator priv_insert(const_iterator p, BOOST_FWD_REF(U) x) - { return this->insert_after(previous(p), ::boost::forward<U>(x)); } - - template<class U> - iterator priv_insert_after(const_iterator prev_p, BOOST_FWD_REF(U) x) - { return iterator(this->icont().insert_after(prev_p.get(), *this->create_node(::boost::forward<U>(x)))); } - - class insertion_functor; - friend class insertion_functor; - - class insertion_functor - { - Icont &icont_; - typedef typename Icont::iterator iiterator; - typedef typename Icont::const_iterator iconst_iterator; - const iconst_iterator prev_; - iiterator ret_; - - public: - insertion_functor(Icont &icont, typename Icont::const_iterator prev) - : icont_(icont), prev_(prev), ret_(prev.unconst()) - {} - - void operator()(Node &n) - { - ret_ = this->icont_.insert_after(prev_, n); - } - - iiterator inserted_first() const - { return ret_; } - }; - - //Functors for member algorithm defaults - typedef value_less<value_type> value_less_t; - typedef value_equal<value_type> value_equal_t; - - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -}; - -}} - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace boost { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class T, class Allocator> -struct has_trivial_destructor_after_move<boost::container::slist<T, Allocator> > -{ - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value; -}; - -namespace container { - -}} //namespace boost{ namespace container { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -// Specialization of insert_iterator so that insertions will be constant -// time rather than linear time. - -#include <boost/move/detail/std_ns_begin.hpp> -BOOST_CONTAINER_DOC1ST(namespace std {, BOOST_MOVE_STD_NS_BEG) - -//! A specialization of insert_iterator -//! that works with slist -template <class T, class Allocator> -class insert_iterator<boost::container::slist<T, Allocator> > -{ - private: - typedef boost::container::slist<T, Allocator> Container; - Container* container; - typename Container::iterator iter; - - public: - typedef Container container_type; - typedef output_iterator_tag iterator_category; - typedef void value_type; - typedef void difference_type; - typedef void pointer; - typedef void reference; - - insert_iterator(Container& x, - typename Container::iterator i, - bool is_previous = false) - : container(&x), iter(is_previous ? i : x.previous(i)){ } - - insert_iterator<Container>& - operator=(const typename Container::value_type& value) - { - iter = container->insert_after(iter, value); - return *this; - } - insert_iterator<Container>& operator*(){ return *this; } - insert_iterator<Container>& operator++(){ return *this; } - insert_iterator<Container>& operator++(int){ return *this; } -}; - -BOOST_CONTAINER_DOC1ST( }, BOOST_MOVE_STD_NS_END) -#include <boost/move/detail/std_ns_end.hpp> - -#include <boost/container/detail/config_end.hpp> - -#endif // BOOST_CONTAINER_SLIST_HPP diff --git a/contrib/restricted/boost/boost/container/stable_vector.hpp b/contrib/restricted/boost/boost/container/stable_vector.hpp deleted file mode 100644 index 68bc261e84..0000000000 --- a/contrib/restricted/boost/boost/container/stable_vector.hpp +++ /dev/null @@ -1,2123 +0,0 @@ -////////////////////////////////////////////////////////////////////////////// -// -// (C) Copyright Ion Gaztanaga 2008-2015. Distributed under the Boost -// Software License, Version 1.0. (See accompanying file -// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// -// See http://www.boost.org/libs/container for documentation. -// -////////////////////////////////////////////////////////////////////////////// -// Stable vector. -// -// Copyright 2008 Joaquin M Lopez Munoz. -// Distributed under the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) -// -////////////////////////////////////////////////////////////////////////////// - -#ifndef BOOST_CONTAINER_STABLE_VECTOR_HPP -#define BOOST_CONTAINER_STABLE_VECTOR_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> - -// container -#include <boost/container/allocator_traits.hpp> -#include <boost/container/container_fwd.hpp> -#include <boost/container/new_allocator.hpp> //new_allocator -#include <boost/container/throw_exception.hpp> -// container/detail -#include <boost/container/detail/addressof.hpp> -#include <boost/container/detail/algorithm.hpp> //algo_equal(), algo_lexicographical_compare -#include <boost/container/detail/alloc_helpers.hpp> -#include <boost/container/detail/allocator_version_traits.hpp> -#include <boost/container/detail/construct_in_place.hpp> -#include <boost/container/detail/iterator.hpp> -#include <boost/container/detail/iterators.hpp> -#include <boost/container/detail/placement_new.hpp> -#include <boost/move/detail/to_raw_pointer.hpp> -#include <boost/container/detail/type_traits.hpp> -// intrusive -#include <boost/intrusive/pointer_traits.hpp> -// intrusive/detail -#include <boost/intrusive/detail/minimal_pair_header.hpp> //pair -// move -#include <boost/move/utility_core.hpp> -#include <boost/move/iterator.hpp> -#include <boost/move/adl_move_swap.hpp> -// move/detail -#include <boost/move/detail/move_helpers.hpp> -// other -#include <boost/assert.hpp> -#include <boost/core/no_exceptions_support.hpp> -// std -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - #include <boost/container/vector.hpp> - //#define STABLE_VECTOR_ENABLE_INVARIANT_CHECKING -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace boost { -namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace stable_vector_detail{ - -template <class C> -class clear_on_destroy -{ - public: - clear_on_destroy(C &c) - : c_(c), do_clear_(true) - {} - - void release() - { do_clear_ = false; } - - ~clear_on_destroy() - { - if(do_clear_){ - c_.clear(); - c_.priv_clear_pool(); - } - } - - private: - clear_on_destroy(const clear_on_destroy &); - clear_on_destroy &operator=(const clear_on_destroy &); - C &c_; - bool do_clear_; -}; - -template<typename Pointer> -struct node; - -template<class VoidPtr> -struct node_base -{ - private: - typedef typename boost::intrusive:: - pointer_traits<VoidPtr> void_ptr_traits; - typedef typename void_ptr_traits:: - template rebind_pointer - <node_base>::type node_base_ptr; - typedef typename void_ptr_traits:: - template rebind_pointer - <node_base_ptr>::type node_base_ptr_ptr; - - public: - node_base(const node_base_ptr_ptr &n) - : up(n) - {} - - node_base() - : up() - {} - - node_base_ptr_ptr up; -}; - -template<typename Pointer> -struct node - : public node_base - <typename ::boost::intrusive::pointer_traits<Pointer>::template - rebind_pointer<void>::type - > -{ - private: - node(); - - public: - typename ::boost::intrusive::pointer_traits<Pointer>::element_type value; -}; - -template<class VoidPtr, class VoidAllocator> -struct index_traits -{ - typedef boost::intrusive:: - pointer_traits - <VoidPtr> void_ptr_traits; - typedef stable_vector_detail:: - node_base<VoidPtr> node_base_type; - typedef typename void_ptr_traits::template - rebind_pointer<node_base_type>::type node_base_ptr; - typedef typename void_ptr_traits::template - rebind_pointer<node_base_ptr>::type node_base_ptr_ptr; - typedef boost::intrusive:: - pointer_traits<node_base_ptr> node_base_ptr_traits; - typedef boost::intrusive:: - pointer_traits<node_base_ptr_ptr> node_base_ptr_ptr_traits; - typedef typename allocator_traits<VoidAllocator>:: - template portable_rebind_alloc - <node_base_ptr>::type node_base_ptr_allocator; - typedef ::boost::container::vector - <node_base_ptr, node_base_ptr_allocator> index_type; - typedef typename index_type::iterator index_iterator; - typedef typename index_type::const_iterator const_index_iterator; - typedef typename index_type::size_type size_type; - - static const size_type ExtraPointers = 3; - //Stable vector stores metadata at the end of the index (node_base_ptr vector) with additional 3 pointers: - // back() is this->index.back() - ExtraPointers; - // end node index is *(this->index.end() - 3) - // Node cache first is *(this->index.end() - 2); - // Node cache last is this->index.back(); - - static node_base_ptr_ptr ptr_to_node_base_ptr(node_base_ptr &n) - { return node_base_ptr_ptr_traits::pointer_to(n); } - - static void fix_up_pointers(index_iterator first, index_iterator last) - { - while(first != last){ - typedef typename index_type::reference node_base_ptr_ref; - node_base_ptr_ref nbp = *first; - nbp->up = index_traits::ptr_to_node_base_ptr(nbp); - ++first; - } - } - - static index_iterator get_fix_up_end(index_type &index) - { return index.end() - (ExtraPointers - 1); } - - static void fix_up_pointers_from(index_type & index, index_iterator first) - { index_traits::fix_up_pointers(first, index_traits::get_fix_up_end(index)); } - - static void readjust_end_node(index_type &index, node_base_type &end_node) - { - if(!index.empty()){ - index_iterator end_node_it(index_traits::get_fix_up_end(index)); - node_base_ptr &end_node_idx_ref = *(--end_node_it); - end_node_idx_ref = node_base_ptr_traits::pointer_to(end_node); - end_node.up = node_base_ptr_ptr_traits::pointer_to(end_node_idx_ref); - } - else{ - end_node.up = node_base_ptr_ptr(); - } - } - - static void initialize_end_node(index_type &index, node_base_type &end_node, const size_type index_capacity_if_empty) - { - if(index.empty()){ - index.reserve(index_capacity_if_empty + ExtraPointers); - index.resize(ExtraPointers); - node_base_ptr &end_node_ref = *index.data(); - end_node_ref = node_base_ptr_traits::pointer_to(end_node); - end_node.up = index_traits::ptr_to_node_base_ptr(end_node_ref); - } - } - - #ifdef STABLE_VECTOR_ENABLE_INVARIANT_CHECKING - static bool invariants(index_type &index) - { - for( index_iterator it = index.begin() - , it_end = index_traits::get_fix_up_end(index) - ; it != it_end - ; ++it){ - if((*it)->up != index_traits::ptr_to_node_base_ptr(*it)){ - return false; - } - } - return true; - } - #endif //STABLE_VECTOR_ENABLE_INVARIANT_CHECKING -}; - -} //namespace stable_vector_detail - -template<typename Pointer, bool IsConst> -class stable_vector_iterator -{ - typedef boost::intrusive::pointer_traits<Pointer> non_const_ptr_traits; - public: - typedef std::random_access_iterator_tag iterator_category; - typedef typename non_const_ptr_traits::element_type value_type; - typedef typename non_const_ptr_traits::difference_type difference_type; - typedef typename ::boost::container::dtl::if_c - < IsConst - , typename non_const_ptr_traits::template - rebind_pointer<const value_type>::type - , Pointer - >::type pointer; - typedef boost::intrusive::pointer_traits<pointer> ptr_traits; - typedef typename ptr_traits::reference reference; - class nat; - typedef typename dtl::if_c< IsConst - , stable_vector_iterator<Pointer, false> - , nat>::type nonconst_iterator; - - private: - typedef typename non_const_ptr_traits::template - rebind_pointer<void>::type void_ptr; - typedef stable_vector_detail::node<Pointer> node_type; - typedef stable_vector_detail::node_base<void_ptr> node_base_type; - typedef typename non_const_ptr_traits::template - rebind_pointer<node_type>::type node_ptr; - typedef boost::intrusive:: - pointer_traits<node_ptr> node_ptr_traits; - typedef typename non_const_ptr_traits::template - rebind_pointer<node_base_type>::type node_base_ptr; - typedef typename non_const_ptr_traits::template - rebind_pointer<node_base_ptr>::type node_base_ptr_ptr; - - node_base_ptr m_pn; - - public: - - explicit stable_vector_iterator(node_base_ptr p) BOOST_NOEXCEPT_OR_NOTHROW - : m_pn(p) - {} - - stable_vector_iterator() BOOST_NOEXCEPT_OR_NOTHROW - : m_pn() //Value initialization to achieve "null iterators" (N3644) - {} - - BOOST_CONTAINER_FORCEINLINE stable_vector_iterator(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW - : m_pn(other.node_pointer()) - {} - - stable_vector_iterator(const nonconst_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW - : m_pn(other.node_pointer()) - {} - - BOOST_CONTAINER_FORCEINLINE stable_vector_iterator & operator=(const stable_vector_iterator& other) BOOST_NOEXCEPT_OR_NOTHROW - { m_pn = other.node_pointer(); return *this; } - - BOOST_CONTAINER_FORCEINLINE node_ptr node_pointer() const BOOST_NOEXCEPT_OR_NOTHROW - { return node_ptr_traits::static_cast_from(m_pn); } - - public: - //Pointer like operators - reference operator*() const BOOST_NOEXCEPT_OR_NOTHROW - { return node_pointer()->value; } - - pointer operator->() const BOOST_NOEXCEPT_OR_NOTHROW - { return ptr_traits::pointer_to(this->operator*()); } - - //Increment / Decrement - stable_vector_iterator& operator++() BOOST_NOEXCEPT_OR_NOTHROW - { - node_base_ptr_ptr p(this->m_pn->up); - this->m_pn = *(++p); - return *this; - } - - stable_vector_iterator operator++(int) BOOST_NOEXCEPT_OR_NOTHROW - { stable_vector_iterator tmp(*this); ++*this; return stable_vector_iterator(tmp); } - - stable_vector_iterator& operator--() BOOST_NOEXCEPT_OR_NOTHROW - { - node_base_ptr_ptr p(this->m_pn->up); - this->m_pn = *(--p); - return *this; - } - - stable_vector_iterator operator--(int) BOOST_NOEXCEPT_OR_NOTHROW - { stable_vector_iterator tmp(*this); --*this; return stable_vector_iterator(tmp); } - - reference operator[](difference_type off) const BOOST_NOEXCEPT_OR_NOTHROW - { return node_ptr_traits::static_cast_from(this->m_pn->up[off])->value; } - - stable_vector_iterator& operator+=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { - if(off) this->m_pn = this->m_pn->up[off]; - return *this; - } - - friend stable_vector_iterator operator+(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { - stable_vector_iterator tmp(left); - tmp += off; - return tmp; - } - - friend stable_vector_iterator operator+(difference_type off, const stable_vector_iterator& right) BOOST_NOEXCEPT_OR_NOTHROW - { - stable_vector_iterator tmp(right); - tmp += off; - return tmp; - } - - stable_vector_iterator& operator-=(difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { *this += -off; return *this; } - - friend stable_vector_iterator operator-(const stable_vector_iterator &left, difference_type off) BOOST_NOEXCEPT_OR_NOTHROW - { - stable_vector_iterator tmp(left); - tmp -= off; - return tmp; - } - - friend difference_type operator-(const stable_vector_iterator &left, const stable_vector_iterator &right) BOOST_NOEXCEPT_OR_NOTHROW - { return left.m_pn->up - right.m_pn->up; } - - //Comparison operators - friend bool operator== (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_pn == r.m_pn; } - - friend bool operator!= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_pn != r.m_pn; } - - friend bool operator< (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_pn->up < r.m_pn->up; } - - friend bool operator<= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_pn->up <= r.m_pn->up; } - - friend bool operator> (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_pn->up > r.m_pn->up; } - - friend bool operator>= (const stable_vector_iterator& l, const stable_vector_iterator& r) BOOST_NOEXCEPT_OR_NOTHROW - { return l.m_pn->up >= r.m_pn->up; } -}; - - #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING) - - #define STABLE_VECTOR_CHECK_INVARIANT \ - invariant_checker BOOST_JOIN(check_invariant_,__LINE__)(*this); \ - BOOST_JOIN(check_invariant_,__LINE__).touch(); - - #else //STABLE_VECTOR_ENABLE_INVARIANT_CHECKING - - #define STABLE_VECTOR_CHECK_INVARIANT - - #endif //#if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING) - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! Originally developed by Joaquin M. Lopez Munoz, stable_vector is a std::vector -//! drop-in replacement implemented as a node container, offering iterator and reference -//! stability. -//! -//! Here are the details taken from the author's blog -//! (<a href="http://bannalia.blogspot.com/2008/09/introducing-stablevector.html" > -//! Introducing stable_vector</a>): -//! -//! We present stable_vector, a fully STL-compliant stable container that provides -//! most of the features of std::vector except element contiguity. -//! -//! General properties: stable_vector satisfies all the requirements of a container, -//! a reversible container and a sequence and provides all the optional operations -//! present in std::vector. Like std::vector, iterators are random access. -//! stable_vector does not provide element contiguity; in exchange for this absence, -//! the container is stable, i.e. references and iterators to an element of a stable_vector -//! remain valid as long as the element is not erased, and an iterator that has been -//! assigned the return value of end() always remain valid until the destruction of -//! the associated stable_vector. -//! -//! Operation complexity: The big-O complexities of stable_vector operations match -//! exactly those of std::vector. In general, insertion/deletion is constant time at -//! the end of the sequence and linear elsewhere. Unlike std::vector, stable_vector -//! does not internally perform any value_type destruction, copy or assignment -//! operations other than those exactly corresponding to the insertion of new -//! elements or deletion of stored elements, which can sometimes compensate in terms -//! of performance for the extra burden of doing more pointer manipulation and an -//! additional allocation per element. -//! -//! Exception safety: As stable_vector does not internally copy elements around, some -//! operations provide stronger exception safety guarantees than in std::vector. -//! -//! \tparam T The type of object that is stored in the stable_vector -//! \tparam Allocator The allocator used for all internal memory management -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED -template <class T, class Allocator = new_allocator<T> > -#else -template <class T, class Allocator> -#endif -class stable_vector -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef allocator_traits<Allocator> allocator_traits_type; - typedef boost::intrusive:: - pointer_traits - <typename allocator_traits_type::pointer> ptr_traits; - typedef typename ptr_traits:: - template rebind_pointer<void>::type void_ptr; - typedef typename allocator_traits_type:: - template portable_rebind_alloc - <void>::type void_allocator_type; - typedef stable_vector_detail::index_traits - <void_ptr, void_allocator_type> index_traits_type; - typedef typename index_traits_type::node_base_type node_base_type; - typedef typename index_traits_type::node_base_ptr node_base_ptr; - typedef typename index_traits_type:: - node_base_ptr_ptr node_base_ptr_ptr; - typedef typename index_traits_type:: - node_base_ptr_traits node_base_ptr_traits; - typedef typename index_traits_type:: - node_base_ptr_ptr_traits node_base_ptr_ptr_traits; - typedef typename index_traits_type::index_type index_type; - typedef typename index_traits_type::index_iterator index_iterator; - typedef typename index_traits_type:: - const_index_iterator const_index_iterator; - typedef stable_vector_detail::node - <typename ptr_traits::pointer> node_type; - typedef typename ptr_traits::template - rebind_pointer<node_type>::type node_ptr; - typedef boost::intrusive:: - pointer_traits<node_ptr> node_ptr_traits; - typedef typename ptr_traits::template - rebind_pointer<const node_type>::type const_node_ptr; - typedef boost::intrusive:: - pointer_traits<const_node_ptr> const_node_ptr_traits; - typedef typename node_ptr_traits::reference node_reference; - typedef typename const_node_ptr_traits::reference const_node_reference; - - typedef ::boost::container::dtl::integral_constant - <unsigned, boost::container::dtl:: - version<Allocator>::value> alloc_version; - typedef typename allocator_traits_type:: - template portable_rebind_alloc - <node_type>::type node_allocator_type; - - typedef ::boost::container::dtl:: - allocator_version_traits<node_allocator_type> allocator_version_traits_t; - typedef typename allocator_version_traits_t::multiallocation_chain multiallocation_chain; - - node_ptr allocate_one() - { return allocator_version_traits_t::allocate_one(this->priv_node_alloc()); } - - void deallocate_one(const node_ptr &p) - { allocator_version_traits_t::deallocate_one(this->priv_node_alloc(), p); } - - void allocate_individual(typename allocator_traits_type::size_type n, multiallocation_chain &m) - { allocator_version_traits_t::allocate_individual(this->priv_node_alloc(), n, m); } - - void deallocate_individual(multiallocation_chain &holder) - { allocator_version_traits_t::deallocate_individual(this->priv_node_alloc(), holder); } - - friend class stable_vector_detail::clear_on_destroy<stable_vector>; - typedef stable_vector_iterator - < typename allocator_traits<Allocator>::pointer - , false> iterator_impl; - typedef stable_vector_iterator - < typename allocator_traits<Allocator>::pointer - , true> const_iterator_impl; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - public: - - ////////////////////////////////////////////// - // - // types - // - ////////////////////////////////////////////// - typedef T value_type; - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::const_pointer const_pointer; - typedef typename ::boost::container::allocator_traits<Allocator>::reference reference; - typedef typename ::boost::container::allocator_traits<Allocator>::const_reference const_reference; - typedef typename ::boost::container::allocator_traits<Allocator>::size_type size_type; - typedef typename ::boost::container::allocator_traits<Allocator>::difference_type difference_type; - typedef Allocator allocator_type; - typedef node_allocator_type stored_allocator_type; - typedef BOOST_CONTAINER_IMPDEF(iterator_impl) iterator; - typedef BOOST_CONTAINER_IMPDEF(const_iterator_impl) const_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<iterator>) reverse_iterator; - typedef BOOST_CONTAINER_IMPDEF(boost::container::reverse_iterator<const_iterator>) const_reverse_iterator; - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - BOOST_COPYABLE_AND_MOVABLE(stable_vector) - static const size_type ExtraPointers = index_traits_type::ExtraPointers; - - class insert_rollback; - friend class insert_rollback; - - class push_back_rollback; - friend class push_back_rollback; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - - public: - ////////////////////////////////////////////// - // - // construct/copy/destroy - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Default constructs a stable_vector. - //! - //! <b>Throws</b>: If allocator_type's default constructor throws. - //! - //! <b>Complexity</b>: Constant. - stable_vector() BOOST_NOEXCEPT_IF(dtl::is_nothrow_default_constructible<Allocator>::value) - : internal_data(), index() - { - STABLE_VECTOR_CHECK_INVARIANT; - } - - //! <b>Effects</b>: Constructs a stable_vector taking the allocator as parameter. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - explicit stable_vector(const allocator_type& al) BOOST_NOEXCEPT_OR_NOTHROW - : internal_data(al), index(al) - { - STABLE_VECTOR_CHECK_INVARIANT; - } - - //! <b>Effects</b>: Constructs a stable_vector - //! and inserts n value initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit stable_vector(size_type n) - : internal_data(), index() - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->resize(n); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Constructs a stable_vector - //! and inserts n default initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - //! - //! <b>Note</b>: Non-standard extension - stable_vector(size_type n, default_init_t) - : internal_data(), index() - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->resize(n, default_init); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a - //! and inserts n value initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - explicit stable_vector(size_type n, const allocator_type &a) - : internal_data(), index(a) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->resize(n); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a - //! and inserts n default initialized values. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - //! - //! <b>Note</b>: Non-standard extension - stable_vector(size_type n, default_init_t, const allocator_type &a) - : internal_data(), index(a) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->resize(n, default_init); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a - //! and inserts n copies of value. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's default or copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - stable_vector(size_type n, const T& t, const allocator_type& al = allocator_type()) - : internal_data(al), index(al) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->insert(this->cend(), n, t); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a - //! and inserts a copy of the range [first, last) in the stable_vector. - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced InIt throws. - //! - //! <b>Complexity</b>: Linear to the range [first, last). - template <class InputIterator> - stable_vector(InputIterator first,InputIterator last, const allocator_type& al = allocator_type()) - : internal_data(al), index(al) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->insert(this->cend(), first, last); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Copy constructs a stable_vector. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Complexity</b>: Linear to the elements x contains. - stable_vector(const stable_vector& x) - : internal_data(allocator_traits<node_allocator_type>:: - select_on_container_copy_construction(x.priv_node_alloc())) - , index(allocator_traits<allocator_type>:: - select_on_container_copy_construction(x.index.get_stored_allocator())) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->insert(this->cend(), x.begin(), x.end()); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Constructs a stable_vector that will use a copy of allocator a - //! and inserts a copy of the range [il.begin(), il.last()) in the stable_vector - //! - //! <b>Throws</b>: If allocator_type's default constructor - //! throws or T's constructor taking a dereferenced initializer_list iterator throws. - //! - //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()). - stable_vector(std::initializer_list<value_type> il, const allocator_type& l = allocator_type()) - : internal_data(l), index(l) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - insert(cend(), il.begin(), il.end()); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } -#endif - - //! <b>Effects</b>: Move constructor. Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocator_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - stable_vector(BOOST_RV_REF(stable_vector) x) BOOST_NOEXCEPT_OR_NOTHROW - : internal_data(boost::move(x.priv_node_alloc())), index(boost::move(x.index)) - { - this->priv_swap_members(x); - } - - //! <b>Effects</b>: Copy constructs a stable_vector using the specified allocator. - //! - //! <b>Postcondition</b>: x == *this. - //! - //! <b>Complexity</b>: Linear to the elements x contains. - stable_vector(const stable_vector& x, const allocator_type &a) - : internal_data(a), index(a) - { - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->insert(this->cend(), x.begin(), x.end()); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - - //! <b>Effects</b>: Move constructor using the specified allocator. - //! Moves x's resources to *this. - //! - //! <b>Throws</b>: If allocator_type's copy constructor throws. - //! - //! <b>Complexity</b>: Constant if a == x.get_allocator(), linear otherwise - stable_vector(BOOST_RV_REF(stable_vector) x, const allocator_type &a) - : internal_data(a), index(a) - { - if(this->priv_node_alloc() == x.priv_node_alloc()){ - this->index.swap(x.index); - this->priv_swap_members(x); - } - else{ - stable_vector_detail::clear_on_destroy<stable_vector> cod(*this); - this->insert(this->cend(), boost::make_move_iterator(x.begin()), boost::make_move_iterator(x.end())); - STABLE_VECTOR_CHECK_INVARIANT; - cod.release(); - } - } - - //! <b>Effects</b>: Destroys the stable_vector. All stored values are destroyed - //! and used memory is deallocated. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements. - ~stable_vector() - { - this->clear(); - this->priv_clear_pool(); - } - - //! <b>Effects</b>: Makes *this contain the same elements as x. - //! - //! <b>Postcondition</b>: this->size() == x.size(). *this contains a copy - //! of each of x's elements. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the number of elements in x. - stable_vector& operator=(BOOST_COPY_ASSIGN_REF(stable_vector) x) - { - STABLE_VECTOR_CHECK_INVARIANT; - if (&x != this){ - node_allocator_type &this_alloc = this->priv_node_alloc(); - const node_allocator_type &x_alloc = x.priv_node_alloc(); - dtl::bool_<allocator_traits_type:: - propagate_on_container_copy_assignment::value> flag; - if(flag && this_alloc != x_alloc){ - this->clear(); - this->shrink_to_fit(); - } - dtl::assign_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag); - dtl::assign_alloc(this->index.get_stored_allocator(), x.index.get_stored_allocator(), flag); - this->assign(x.begin(), x.end()); - } - return *this; - } - - //! <b>Effects</b>: Move assignment. All x's values are transferred to *this. - //! - //! <b>Postcondition</b>: x.empty(). *this contains a the elements x had - //! before the function. - //! - //! <b>Throws</b>: If allocator_traits_type::propagate_on_container_move_assignment - //! is false and (allocation throws or T's move constructor throws) - //! - //! <b>Complexity</b>: Constant if allocator_traits_type:: - //! propagate_on_container_move_assignment is true or - //! this->get>allocator() == x.get_allocator(). Linear otherwise. - stable_vector& operator=(BOOST_RV_REF(stable_vector) x) - BOOST_NOEXCEPT_IF(allocator_traits_type::propagate_on_container_move_assignment::value - || allocator_traits_type::is_always_equal::value) - { - //for move constructor, no aliasing (&x != this) is assummed. - BOOST_ASSERT(this != &x); - node_allocator_type &this_alloc = this->priv_node_alloc(); - node_allocator_type &x_alloc = x.priv_node_alloc(); - const bool propagate_alloc = allocator_traits_type:: - propagate_on_container_move_assignment::value; - dtl::bool_<propagate_alloc> flag; - const bool allocators_equal = this_alloc == x_alloc; (void)allocators_equal; - //Resources can be transferred if both allocators are - //going to be equal after this function (either propagated or already equal) - if(propagate_alloc || allocators_equal){ - STABLE_VECTOR_CHECK_INVARIANT - //Destroy objects but retain memory in case x reuses it in the future - this->clear(); - //Move allocator if needed - dtl::move_alloc(this_alloc, x_alloc, flag); - //Take resources - this->index.swap(x.index); - this->priv_swap_members(x); - } - //Else do a one by one move - else{ - this->assign( boost::make_move_iterator(x.begin()) - , boost::make_move_iterator(x.end())); - } - return *this; - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Make *this container contains elements from il. - //! - //! <b>Complexity</b>: Linear to the range [il.begin(), il.end()). - stable_vector& operator=(std::initializer_list<value_type> il) - { - STABLE_VECTOR_CHECK_INVARIANT; - assign(il.begin(), il.end()); - return *this; - } -#endif - - //! <b>Effects</b>: Assigns the n copies of val to *this. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - void assign(size_type n, const T& t) - { - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - this->assign(cvalue_iterator(t, n), cvalue_iterator()); - } - - //! <b>Effects</b>: Assigns the the range [first, last) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing InpIt throws. - //! - //! <b>Complexity</b>: Linear to n. - template<typename InputIterator> - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - typename dtl::disable_if_convertible<InputIterator, size_type>::type - #else - void - #endif - assign(InputIterator first,InputIterator last) - { - STABLE_VECTOR_CHECK_INVARIANT; - iterator first1 = this->begin(); - iterator last1 = this->end(); - for ( ; first1 != last1 && first != last; ++first1, ++first) - *first1 = *first; - if (first == last){ - this->erase(first1, last1); - } - else{ - this->insert(last1, first, last); - } - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Effects</b>: Assigns the the range [il.begin(), il.end()) to *this. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's constructor from dereferencing initializer_list iterator throws. - //! - void assign(std::initializer_list<value_type> il) - { - STABLE_VECTOR_CHECK_INVARIANT; - assign(il.begin(), il.end()); - } -#endif - - //! <b>Effects</b>: Returns a copy of the internal allocator. - //! - //! <b>Throws</b>: If allocator's copy constructor throws. - //! - //! <b>Complexity</b>: Constant. - allocator_type get_allocator() const - { return this->priv_node_alloc(); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - const stored_allocator_type &get_stored_allocator() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->priv_node_alloc(); } - - //! <b>Effects</b>: Returns a reference to the internal allocator. - //! - //! <b>Throws</b>: Nothing - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension. - stored_allocator_type &get_stored_allocator() BOOST_NOEXCEPT_OR_NOTHROW - { return this->priv_node_alloc(); } - - ////////////////////////////////////////////// - // - // iterators - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns an iterator to the first element contained in the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW - { return (this->index.empty()) ? this->end(): iterator(node_ptr_traits::static_cast_from(this->index.front())); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW - { return (this->index.empty()) ? this->cend() : const_iterator(node_ptr_traits::static_cast_from(this->index.front())) ; } - - //! <b>Effects</b>: Returns an iterator to the end of the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - iterator end() BOOST_NOEXCEPT_OR_NOTHROW - { return iterator(this->priv_get_end_node()); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_iterator(this->priv_get_end_node()); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the beginning - //! of the reversed stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW - { return reverse_iterator(this->end()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->end()); } - - //! <b>Effects</b>: Returns a reverse_iterator pointing to the end - //! of the reversed stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW - { return reverse_iterator(this->begin()); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_reverse_iterator(this->begin()); } - - //! <b>Effects</b>: Returns a const_iterator to the first element contained in the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->begin(); } - - //! <b>Effects</b>: Returns a const_iterator to the end of the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->end(); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the beginning - //! of the reversed stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->rbegin(); } - - //! <b>Effects</b>: Returns a const_reverse_iterator pointing to the end - //! of the reversed stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reverse_iterator crend()const BOOST_NOEXCEPT_OR_NOTHROW - { return this->rend(); } - - ////////////////////////////////////////////// - // - // capacity - // - ////////////////////////////////////////////// - - //! <b>Effects</b>: Returns true if the stable_vector contains no elements. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->index.size() <= ExtraPointers; } - - //! <b>Effects</b>: Returns the number of the elements contained in the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW - { - const size_type index_size = this->index.size(); - return (index_size - ExtraPointers) & (size_type(0u) -size_type(index_size != 0)); - } - - //! <b>Effects</b>: Returns the largest possible size of the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type max_size() const BOOST_NOEXCEPT_OR_NOTHROW - { return this->index.max_size() - ExtraPointers; } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are value initialized. - //! - //! <b>Throws</b>: If memory allocation throws, or T's value initialization throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type n) - { - typedef value_init_construct_iterator<value_type, difference_type> value_init_iterator; - STABLE_VECTOR_CHECK_INVARIANT; - if(n > this->size()) - this->insert(this->cend(), value_init_iterator(n - this->size()), value_init_iterator()); - else if(n < this->size()) - this->erase(this->cbegin() + n, this->cend()); - } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are default initialized. - //! - //! <b>Throws</b>: If memory allocation throws, or T's default initialization throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - //! - //! <b>Note</b>: Non-standard extension - void resize(size_type n, default_init_t) - { - typedef default_init_construct_iterator<value_type, difference_type> default_init_iterator; - STABLE_VECTOR_CHECK_INVARIANT; - if(n > this->size()) - this->insert(this->cend(), default_init_iterator(n - this->size()), default_init_iterator()); - else if(n < this->size()) - this->erase(this->cbegin() + n, this->cend()); - } - - //! <b>Effects</b>: Inserts or erases elements at the end such that - //! the size becomes n. New elements are copy constructed from x. - //! - //! <b>Throws</b>: If memory allocation throws, or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to the difference between size() and new_size. - void resize(size_type n, const T& t) - { - STABLE_VECTOR_CHECK_INVARIANT; - if(n > this->size()) - this->insert(this->cend(), n - this->size(), t); - else if(n < this->size()) - this->erase(this->cbegin() + n, this->cend()); - } - - //! <b>Effects</b>: Number of elements for which memory has been allocated. - //! capacity() is always greater than or equal to size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - size_type capacity() const BOOST_NOEXCEPT_OR_NOTHROW - { - const size_type index_size = this->index.size(); - BOOST_ASSERT(!index_size || index_size >= ExtraPointers); - const size_type node_extra_capacity = this->internal_data.pool_size; - //Pool count must be less than index capacity, as index is a vector - BOOST_ASSERT(node_extra_capacity <= (this->index.capacity()- index_size)); - const size_type index_offset = - (node_extra_capacity - ExtraPointers) & (size_type(0u) - size_type(index_size != 0)); - return index_size + index_offset; - } - - //! <b>Effects</b>: If n is less than or equal to capacity(), this call has no - //! effect. Otherwise, it is a request for allocation of additional memory. - //! If the request is successful, then capacity() is greater than or equal to - //! n; otherwise, capacity() is unchanged. In either case, size() is unchanged. - //! - //! <b>Throws</b>: If memory allocation allocation throws. - void reserve(size_type n) - { - STABLE_VECTOR_CHECK_INVARIANT; - if(n > this->max_size()){ - throw_length_error("stable_vector::reserve max_size() exceeded"); - } - - size_type sz = this->size(); - size_type old_capacity = this->capacity(); - if(n > old_capacity){ - index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, n); - const void * old_ptr = &index[0]; - this->index.reserve(n + ExtraPointers); - bool realloced = &index[0] != old_ptr; - //Fix the pointers for the newly allocated buffer - if(realloced){ - index_traits_type::fix_up_pointers_from(this->index, this->index.begin()); - } - //Now fill pool if data is not enough - if((n - sz) > this->internal_data.pool_size){ - this->priv_increase_pool((n - sz) - this->internal_data.pool_size); - } - } - } - - //! <b>Effects</b>: Tries to deallocate the excess of memory created - //! with previous allocations. The size of the stable_vector is unchanged - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Linear to size(). - void shrink_to_fit() - { - if(this->capacity()){ - //First empty allocated node pool - this->priv_clear_pool(); - //If empty completely destroy the index, let's recover default-constructed state - if(this->empty()){ - this->index.clear(); - this->index.shrink_to_fit(); - this->internal_data.end_node.up = node_base_ptr_ptr(); - } - //Otherwise, try to shrink-to-fit the index and readjust pointers if necessary - else{ - const void* old_ptr = &index[0]; - this->index.shrink_to_fit(); - bool realloced = &index[0] != old_ptr; - //Fix the pointers for the newly allocated buffer - if(realloced){ - index_traits_type::fix_up_pointers_from(this->index, this->index.begin()); - } - } - } - } - - ////////////////////////////////////////////// - // - // element access - // - ////////////////////////////////////////////// - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the first - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference front() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return static_cast<node_reference>(*this->index.front()).value; - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the first - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference front() const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return static_cast<const_node_reference>(*this->index.front()).value; - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a reference to the last - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference back() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return static_cast<node_reference>(*this->index[this->size()-1u]).value; - } - - //! <b>Requires</b>: !empty() - //! - //! <b>Effects</b>: Returns a const reference to the last - //! element of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference back() const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - return static_cast<const_node_reference>(*this->index[this->size()-1u]).value; - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - reference operator[](size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() > n); - return static_cast<node_reference>(*this->index[n]).value; - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a const reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - const_reference operator[](size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() > n); - return static_cast<const_node_reference>(*this->index[n]).value; - } - - //! <b>Requires</b>: size() >= n. - //! - //! <b>Effects</b>: Returns an iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - iterator nth(size_type n) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() >= n); - return (this->index.empty()) ? this->end() : iterator(node_ptr_traits::static_cast_from(this->index[n])); - } - - //! <b>Requires</b>: size() >= n. - //! - //! <b>Effects</b>: Returns a const_iterator to the nth element - //! from the beginning of the container. Returns end() - //! if n == size(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - const_iterator nth(size_type n) const BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->size() >= n); - return (this->index.empty()) ? this->cend() : iterator(node_ptr_traits::static_cast_from(this->index[n])); - } - - //! <b>Requires</b>: begin() <= p <= end(). - //! - //! <b>Effects</b>: Returns the index of the element pointed by p - //! and size() if p == end(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - size_type index_of(iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { return this->priv_index_of(p.node_pointer()); } - - //! <b>Requires</b>: begin() <= p <= end(). - //! - //! <b>Effects</b>: Returns the index of the element pointed by p - //! and size() if p == end(). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - //! - //! <b>Note</b>: Non-standard extension - size_type index_of(const_iterator p) const BOOST_NOEXCEPT_OR_NOTHROW - { return this->priv_index_of(p.node_pointer()); } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: std::range_error if n >= size() - //! - //! <b>Complexity</b>: Constant. - reference at(size_type n) - { - if(n >= this->size()){ - throw_out_of_range("vector::at invalid subscript"); - } - return operator[](n); - } - - //! <b>Requires</b>: size() > n. - //! - //! <b>Effects</b>: Returns a const reference to the nth element - //! from the beginning of the container. - //! - //! <b>Throws</b>: std::range_error if n >= size() - //! - //! <b>Complexity</b>: Constant. - const_reference at(size_type n)const - { - if(n >= this->size()){ - throw_out_of_range("vector::at invalid subscript"); - } - return operator[](n); - } - - ////////////////////////////////////////////// - // - // modifiers - // - ////////////////////////////////////////////// - - #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... in the end of the stable_vector. - //! - //! <b>Returns</b>: A reference to the created object. - //! - //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - template<class ...Args> - reference emplace_back(Args &&...args) - { - typedef emplace_functor<Args...> EmplaceFunctor; - typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator; - EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...); - return *this->insert(this->cend(), EmplaceIterator(ef), EmplaceIterator()); - } - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Inserts an object of type T constructed with - //! std::forward<Args>(args)... before p - //! - //! <b>Throws</b>: If memory allocation throws or the in-place constructor throws. - //! - //! <b>Complexity</b>: If p is end(), amortized constant time - //! Linear time otherwise. - template<class ...Args> - iterator emplace(const_iterator p, Args && ...args) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - size_type pos_n = p - cbegin(); - typedef emplace_functor<Args...> EmplaceFunctor; - typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator; - EmplaceFunctor &&ef = EmplaceFunctor(boost::forward<Args>(args)...); - this->insert(p, EmplaceIterator(ef), EmplaceIterator()); - return iterator(this->begin() + pos_n); - } - - #else - - #define BOOST_CONTAINER_STABLE_VECTOR_EMPLACE_CODE(N) \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - reference emplace_back(BOOST_MOVE_UREF##N)\ - {\ - typedef emplace_functor##N\ - BOOST_MOVE_LT##N BOOST_MOVE_TARG##N BOOST_MOVE_GT##N EmplaceFunctor;\ - typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator;\ - EmplaceFunctor ef BOOST_MOVE_LP##N BOOST_MOVE_FWD##N BOOST_MOVE_RP##N;\ - return *this->insert(this->cend() , EmplaceIterator(ef), EmplaceIterator());\ - }\ - \ - BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \ - iterator emplace(const_iterator p BOOST_MOVE_I##N BOOST_MOVE_UREF##N)\ - {\ - BOOST_ASSERT(this->priv_in_range_or_end(p));\ - typedef emplace_functor##N\ - BOOST_MOVE_LT##N BOOST_MOVE_TARG##N BOOST_MOVE_GT##N EmplaceFunctor;\ - typedef emplace_iterator<value_type, EmplaceFunctor, difference_type> EmplaceIterator;\ - EmplaceFunctor ef BOOST_MOVE_LP##N BOOST_MOVE_FWD##N BOOST_MOVE_RP##N;\ - const size_type pos_n = p - this->cbegin();\ - this->insert(p, EmplaceIterator(ef), EmplaceIterator());\ - return this->begin() += pos_n;\ - }\ - // - BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_STABLE_VECTOR_EMPLACE_CODE) - #undef BOOST_CONTAINER_STABLE_VECTOR_EMPLACE_CODE - - #endif // !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Effects</b>: Inserts a copy of x at the end of the stable_vector. - //! - //! <b>Throws</b>: If memory allocation throws or - //! T's copy constructor throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_back(const T &x); - - //! <b>Effects</b>: Constructs a new element in the end of the stable_vector - //! and moves the resources of x to this new element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: Amortized constant time. - void push_back(T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH(push_back, T, void, priv_push_back) - #endif - - #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of x before p. - //! - //! <b>Returns</b>: An iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws or x's copy constructor throws. - //! - //! <b>Complexity</b>: If p is end(), amortized constant time - //! Linear time otherwise. - iterator insert(const_iterator p, const T &x); - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a new element before p with x's resources. - //! - //! <b>Returns</b>: an iterator to the inserted element. - //! - //! <b>Throws</b>: If memory allocation throws. - //! - //! <b>Complexity</b>: If p is end(), amortized constant time - //! Linear time otherwise. - iterator insert(const_iterator p, T &&x); - #else - BOOST_MOVE_CONVERSION_AWARE_CATCH_1ARG(insert, T, iterator, priv_insert, const_iterator, const_iterator) - #endif - - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert n copies of x before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if n is 0. - //! - //! <b>Throws</b>: If memory allocation throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to n. - iterator insert(const_iterator p, size_type n, const T& t) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - STABLE_VECTOR_CHECK_INVARIANT; - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - return this->insert(p, cvalue_iterator(t, n), cvalue_iterator()); - } - - //! <b>Requires</b>: p must be a valid iterator of *this. -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! <b>Requires</b>: p must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [il.begin(), il.end()) range before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if first == last. - //! - //! <b>Complexity</b>: Linear to distance [il.begin(), il.end()). - iterator insert(const_iterator p, std::initializer_list<value_type> il) - { - //Position checks done by insert() - STABLE_VECTOR_CHECK_INVARIANT; - return insert(p, il.begin(), il.end()); - } -#endif - - //! <b>Requires</b>: pos must be a valid iterator of *this. - //! - //! <b>Effects</b>: Insert a copy of the [first, last) range before p. - //! - //! <b>Returns</b>: an iterator to the first inserted element or p if first == last. - //! - //! <b>Throws</b>: If memory allocation throws, T's constructor from a - //! dereferenced InpIt throws or T's copy constructor throws. - //! - //! <b>Complexity</b>: Linear to distance [first, last). - template <class InputIterator> - iterator insert(const_iterator p, InputIterator first, InputIterator last - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - //Put this as argument instead of the return type as old GCC's like 3.4 - //detect this and the next disable_if_or as overloads - , typename dtl::disable_if_or - < void - , dtl::is_convertible<InputIterator, size_type> - , dtl::is_not_input_iterator<InputIterator> - >::type* = 0 - #endif - ) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - STABLE_VECTOR_CHECK_INVARIANT; - const size_type pos_n = p - this->cbegin(); - for(; first != last; ++first){ - this->emplace(p, *first); - } - return this->begin() + pos_n; - } - - #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) - template <class FwdIt> - typename dtl::disable_if_or - < iterator - , dtl::is_convertible<FwdIt, size_type> - , dtl::is_input_iterator<FwdIt> - >::type - insert(const_iterator p, FwdIt first, FwdIt last) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - const size_type num_new = static_cast<size_type>(boost::container::iterator_distance(first, last)); - const size_type idx = static_cast<size_type>(p - this->cbegin()); - if(num_new){ - //Fills the node pool and inserts num_new null pointers in idx. - //If a new buffer was needed fixes up pointers up to idx so - //past-new nodes are not aligned until the end of this function - //or in a rollback in case of exception - index_iterator it_past_newly_constructed(this->priv_insert_forward_non_templated(idx, num_new)); - const index_iterator it_past_new(it_past_newly_constructed + num_new); - { - //Prepare rollback - insert_rollback rollback(*this, it_past_newly_constructed, it_past_new); - while(first != last){ - const node_ptr n = this->priv_get_from_pool(); - BOOST_ASSERT(!!n); - //Put it in the index so rollback can return it in pool if construct_in_place throws - *it_past_newly_constructed = n; - //Constructs and fixes up pointers This can throw - this->priv_build_node_from_it(n, it_past_newly_constructed, first); - ++first; - ++it_past_newly_constructed; - } - //rollback.~insert_rollback() called in case of exception - } - //Fix up pointers for past-new nodes (new nodes were fixed during construction) and - //nodes before insertion p in priv_insert_forward_non_templated(...) - index_traits_type::fix_up_pointers_from(this->index, it_past_newly_constructed); - } - return this->begin() + idx; - } - #endif - - //! <b>Effects</b>: Removes the last element from the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant time. - void pop_back() BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(!this->empty()); - this->erase(--this->cend()); - } - - //! <b>Effects</b>: Erases the element at p. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the elements between p and the - //! last element. Constant if p is the last element. - iterator erase(const_iterator p) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(this->priv_in_range(p)); - STABLE_VECTOR_CHECK_INVARIANT; - const size_type d = p - this->cbegin(); - index_iterator it = this->index.begin() + d; - this->priv_delete_node(p.node_pointer()); - it = this->index.erase(it); - index_traits_type::fix_up_pointers_from(this->index, it); - return iterator(node_ptr_traits::static_cast_from(*it)); - } - - //! <b>Effects</b>: Erases the elements pointed by [first, last). - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the distance between first and last - //! plus linear to the elements between p and the last element. - iterator erase(const_iterator first, const_iterator last) BOOST_NOEXCEPT_OR_NOTHROW - { - BOOST_ASSERT(first == last || - (first < last && this->priv_in_range(first) && this->priv_in_range_or_end(last))); - STABLE_VECTOR_CHECK_INVARIANT; - const const_iterator cbeg(this->cbegin()); - const size_type d1 = static_cast<size_type>(first - cbeg), - d2 = static_cast<size_type>(last - cbeg); - size_type d_dif = d2 - d1; - if(d_dif){ - multiallocation_chain holder; - const index_iterator it1(this->index.begin() + d1); - const index_iterator it2(it1 + d_dif); - index_iterator it(it1); - while(d_dif--){ - node_base_ptr &nb = *it; - ++it; - node_type &n = *node_ptr_traits::static_cast_from(nb); - this->priv_destroy_node(n); - holder.push_back(node_ptr_traits::pointer_to(n)); - } - this->priv_put_in_pool(holder); - const index_iterator e = this->index.erase(it1, it2); - index_traits_type::fix_up_pointers_from(this->index, e); - } - return iterator(last.node_pointer()); - } - - //! <b>Effects</b>: Swaps the contents of *this and x. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Constant. - void swap(stable_vector & x) - BOOST_NOEXCEPT_IF( allocator_traits_type::propagate_on_container_swap::value - || allocator_traits_type::is_always_equal::value) - { - BOOST_ASSERT(allocator_traits_type::propagate_on_container_swap::value || - allocator_traits_type::is_always_equal::value || - this->get_stored_allocator() == x.get_stored_allocator()); - STABLE_VECTOR_CHECK_INVARIANT; - dtl::bool_<allocator_traits_type::propagate_on_container_swap::value> flag; - dtl::swap_alloc(this->priv_node_alloc(), x.priv_node_alloc(), flag); - //vector's allocator is swapped here - this->index.swap(x.index); - this->priv_swap_members(x); - } - - //! <b>Effects</b>: Erases all the elements of the stable_vector. - //! - //! <b>Throws</b>: Nothing. - //! - //! <b>Complexity</b>: Linear to the number of elements in the stable_vector. - void clear() BOOST_NOEXCEPT_OR_NOTHROW - { this->erase(this->cbegin(),this->cend()); } - - //! <b>Effects</b>: Returns true if x and y are equal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator==(const stable_vector& x, const stable_vector& y) - { return x.size() == y.size() && ::boost::container::algo_equal(x.begin(), x.end(), y.begin()); } - - //! <b>Effects</b>: Returns true if x and y are unequal - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator!=(const stable_vector& x, const stable_vector& y) - { return !(x == y); } - - //! <b>Effects</b>: Returns true if x is less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<(const stable_vector& x, const stable_vector& y) - { return ::boost::container::algo_lexicographical_compare(x.begin(), x.end(), y.begin(), y.end()); } - - //! <b>Effects</b>: Returns true if x is greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>(const stable_vector& x, const stable_vector& y) - { return y < x; } - - //! <b>Effects</b>: Returns true if x is equal or less than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator<=(const stable_vector& x, const stable_vector& y) - { return !(y < x); } - - //! <b>Effects</b>: Returns true if x is equal or greater than y - //! - //! <b>Complexity</b>: Linear to the number of elements in the container. - friend bool operator>=(const stable_vector& x, const stable_vector& y) - { return !(x < y); } - - //! <b>Effects</b>: x.swap(y) - //! - //! <b>Complexity</b>: Constant. - friend void swap(stable_vector& x, stable_vector& y) - { x.swap(y); } - - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - private: - - bool priv_in_range(const_iterator pos) const - { - return (this->begin() <= pos) && (pos < this->end()); - } - - bool priv_in_range_or_end(const_iterator pos) const - { - return (this->begin() <= pos) && (pos <= this->end()); - } - - size_type priv_index_of(node_ptr p) const - { - //Check range - BOOST_ASSERT(this->index.empty() || (this->index.data() <= p->up)); - BOOST_ASSERT(this->index.empty() || p->up <= (this->index.data() + this->index.size())); - return this->index.empty() ? 0 : p->up - this->index.data(); - } - - class insert_rollback - { - public: - - insert_rollback(stable_vector &sv, index_iterator &it_past_constructed, const index_iterator &it_past_new) - : m_sv(sv), m_it_past_constructed(it_past_constructed), m_it_past_new(it_past_new) - {} - - ~insert_rollback() - { - if(m_it_past_constructed != m_it_past_new){ - m_sv.priv_put_in_pool(node_ptr_traits::static_cast_from(*m_it_past_constructed)); - index_iterator e = m_sv.index.erase(m_it_past_constructed, m_it_past_new); - index_traits_type::fix_up_pointers_from(m_sv.index, e); - } - } - - private: - stable_vector &m_sv; - index_iterator &m_it_past_constructed; - const index_iterator &m_it_past_new; - }; - - class push_back_rollback - { - public: - push_back_rollback(stable_vector &sv, const node_ptr &p) - : m_sv(sv), m_p(p) - {} - - ~push_back_rollback() - { - if(m_p){ - m_sv.priv_put_in_pool(m_p); - } - } - - void release() - { m_p = node_ptr(); } - - private: - stable_vector &m_sv; - node_ptr m_p; - }; - - index_iterator priv_insert_forward_non_templated(size_type idx, size_type num_new) - { - index_traits_type::initialize_end_node(this->index, this->internal_data.end_node, num_new); - - //Now try to fill the pool with new data - if(this->internal_data.pool_size < num_new){ - this->priv_increase_pool(num_new - this->internal_data.pool_size); - } - - //Now try to make room in the vector - const node_base_ptr_ptr old_buffer = this->index.data(); - this->index.insert(this->index.begin() + idx, num_new, node_ptr()); - bool new_buffer = this->index.data() != old_buffer; - - //Fix the pointers for the newly allocated buffer - const index_iterator index_beg = this->index.begin(); - if(new_buffer){ - index_traits_type::fix_up_pointers(index_beg, index_beg + idx); - } - return index_beg + idx; - } - - bool priv_capacity_bigger_than_size() const - { - return this->index.capacity() > this->index.size() && - this->internal_data.pool_size > 0; - } - - template <class U> - void priv_push_back(BOOST_MOVE_CATCH_FWD(U) x) - { - if(BOOST_LIKELY(this->priv_capacity_bigger_than_size())){ - //Enough memory in the pool and in the index - const node_ptr p = this->priv_get_from_pool(); - BOOST_ASSERT(!!p); - { - push_back_rollback rollback(*this, p); - //This might throw - this->priv_build_node_from_convertible(p, ::boost::forward<U>(x)); - rollback.release(); - } - //This can't throw as there is room for a new elements in the index - index_iterator new_index = this->index.insert(this->index.end() - ExtraPointers, p); - index_traits_type::fix_up_pointers_from(this->index, new_index); - } - else{ - this->insert(this->cend(), ::boost::forward<U>(x)); - } - } - - iterator priv_insert(const_iterator p, const value_type &t) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - typedef constant_iterator<value_type, difference_type> cvalue_iterator; - return this->insert(p, cvalue_iterator(t, 1), cvalue_iterator()); - } - - iterator priv_insert(const_iterator p, BOOST_RV_REF(T) x) - { - BOOST_ASSERT(this->priv_in_range_or_end(p)); - typedef repeat_iterator<T, difference_type> repeat_it; - typedef boost::move_iterator<repeat_it> repeat_move_it; - //Just call more general insert(p, size, value) and return iterator - return this->insert(p, repeat_move_it(repeat_it(x, 1)), repeat_move_it(repeat_it())); - } - - void priv_clear_pool() - { - if(!this->index.empty() && this->index.back()){ - node_base_ptr &pool_first_ref = *(this->index.end() - 2); - node_base_ptr &pool_last_ref = this->index.back(); - - multiallocation_chain holder; - holder.incorporate_after( holder.before_begin() - , node_ptr_traits::static_cast_from(pool_first_ref) - , node_ptr_traits::static_cast_from(pool_last_ref) - , internal_data.pool_size); - this->deallocate_individual(holder); - pool_first_ref = pool_last_ref = 0; - this->internal_data.pool_size = 0; - } - } - - void priv_increase_pool(size_type n) - { - node_base_ptr &pool_first_ref = *(this->index.end() - 2); - node_base_ptr &pool_last_ref = this->index.back(); - multiallocation_chain holder; - holder.incorporate_after( holder.before_begin() - , node_ptr_traits::static_cast_from(pool_first_ref) - , node_ptr_traits::static_cast_from(pool_last_ref) - , internal_data.pool_size); - multiallocation_chain m; - this->allocate_individual(n, m); - holder.splice_after(holder.before_begin(), m, m.before_begin(), m.last(), n); - this->internal_data.pool_size += n; - std::pair<node_ptr, node_ptr> data(holder.extract_data()); - pool_first_ref = data.first; - pool_last_ref = data.second; - } - - void priv_put_in_pool(const node_ptr &p) - { - node_base_ptr &pool_first_ref = *(this->index.end()-2); - node_base_ptr &pool_last_ref = this->index.back(); - multiallocation_chain holder; - holder.incorporate_after( holder.before_begin() - , node_ptr_traits::static_cast_from(pool_first_ref) - , node_ptr_traits::static_cast_from(pool_last_ref) - , internal_data.pool_size); - holder.push_front(p); - ++this->internal_data.pool_size; - std::pair<node_ptr, node_ptr> ret(holder.extract_data()); - pool_first_ref = ret.first; - pool_last_ref = ret.second; - } - - void priv_put_in_pool(multiallocation_chain &ch) - { - node_base_ptr &pool_first_ref = *(this->index.end()-(ExtraPointers-1)); - node_base_ptr &pool_last_ref = this->index.back(); - ch.incorporate_after( ch.before_begin() - , node_ptr_traits::static_cast_from(pool_first_ref) - , node_ptr_traits::static_cast_from(pool_last_ref) - , internal_data.pool_size); - this->internal_data.pool_size = ch.size(); - const std::pair<node_ptr, node_ptr> ret(ch.extract_data()); - pool_first_ref = ret.first; - pool_last_ref = ret.second; - } - - node_ptr priv_get_from_pool() - { - //Precondition: index is not empty - BOOST_ASSERT(!this->index.empty()); - node_base_ptr &pool_first_ref = *(this->index.end() - (ExtraPointers-1)); - node_base_ptr &pool_last_ref = this->index.back(); - multiallocation_chain holder; - holder.incorporate_after( holder.before_begin() - , node_ptr_traits::static_cast_from(pool_first_ref) - , node_ptr_traits::static_cast_from(pool_last_ref) - , internal_data.pool_size); - node_ptr ret = holder.pop_front(); - --this->internal_data.pool_size; - if(!internal_data.pool_size){ - pool_first_ref = pool_last_ref = node_ptr(); - } - else{ - const std::pair<node_ptr, node_ptr> data(holder.extract_data()); - pool_first_ref = data.first; - pool_last_ref = data.second; - } - return ret; - } - - node_base_ptr priv_get_end_node() const - { return node_base_ptr_traits::pointer_to(const_cast<node_base_type&>(this->internal_data.end_node)); } - - void priv_destroy_node(const node_type &n) - { - allocator_traits<node_allocator_type>:: - destroy(this->priv_node_alloc(), dtl::addressof(n.value)); - static_cast<const node_base_type*>(&n)->~node_base_type(); - } - - void priv_delete_node(const node_ptr &n) - { - this->priv_destroy_node(*n); - this->priv_put_in_pool(n); - } - - template<class Iterator> - void priv_build_node_from_it(const node_ptr &p, const index_iterator &up_index, const Iterator &it) - { - //This can throw - boost::container::construct_in_place - ( this->priv_node_alloc() - , dtl::addressof(p->value) - , it); - //This does not throw - ::new(static_cast<node_base_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) - node_base_type(index_traits_type::ptr_to_node_base_ptr(*up_index)); - } - - template<class ValueConvertible> - void priv_build_node_from_convertible(const node_ptr &p, BOOST_FWD_REF(ValueConvertible) value_convertible) - { - //This can throw - boost::container::allocator_traits<node_allocator_type>::construct - ( this->priv_node_alloc() - , dtl::addressof(p->value) - , ::boost::forward<ValueConvertible>(value_convertible)); - //This does not throw - ::new(static_cast<node_base_type*>(boost::movelib::to_raw_pointer(p)), boost_container_new_t()) node_base_type; - } - - void priv_swap_members(stable_vector &x) - { - boost::adl_move_swap(this->internal_data.pool_size, x.internal_data.pool_size); - index_traits_type::readjust_end_node(this->index, this->internal_data.end_node); - index_traits_type::readjust_end_node(x.index, x.internal_data.end_node); - } - - #if defined(STABLE_VECTOR_ENABLE_INVARIANT_CHECKING) - bool priv_invariant()const - { - index_type & index_ref = const_cast<index_type&>(this->index); - - const size_type index_size = this->index.size(); - if(!index_size) - return !this->capacity() && !this->size(); - - if(index_size < ExtraPointers) - return false; - - const size_type bucket_extra_capacity = this->index.capacity()- index_size; - const size_type node_extra_capacity = this->internal_data.pool_size; - if(bucket_extra_capacity < node_extra_capacity){ - return false; - } - - if(this->priv_get_end_node() != *(index.end() - ExtraPointers)){ - return false; - } - - if(!index_traits_type::invariants(index_ref)){ - return false; - } - - size_type n = this->capacity() - this->size(); - node_base_ptr &pool_first_ref = *(index_ref.end() - (ExtraPointers-1)); - node_base_ptr &pool_last_ref = index_ref.back(); - multiallocation_chain holder; - holder.incorporate_after( holder.before_begin() - , node_ptr_traits::static_cast_from(pool_first_ref) - , node_ptr_traits::static_cast_from(pool_last_ref) - , internal_data.pool_size); - typename multiallocation_chain::iterator beg(holder.begin()), end(holder.end()); - size_type num_pool = 0; - while(beg != end){ - ++num_pool; - ++beg; - } - return n >= num_pool && num_pool == internal_data.pool_size; - } - - class invariant_checker - { - invariant_checker(const invariant_checker &); - invariant_checker & operator=(const invariant_checker &); - const stable_vector* p; - - public: - invariant_checker(const stable_vector& v):p(&v){} - ~invariant_checker(){BOOST_ASSERT(p->priv_invariant());} - void touch(){} - }; - #endif - - class ebo_holder - : public node_allocator_type - { - private: - BOOST_MOVABLE_BUT_NOT_COPYABLE(ebo_holder) - - public: - template<class AllocatorRLValue> - explicit ebo_holder(BOOST_FWD_REF(AllocatorRLValue) a) - : node_allocator_type(boost::forward<AllocatorRLValue>(a)) - , pool_size(0) - , end_node() - {} - - ebo_holder() - : node_allocator_type() - , pool_size(0) - , end_node() - {} - - size_type pool_size; - node_base_type end_node; - } internal_data; - - node_allocator_type &priv_node_alloc() { return internal_data; } - const node_allocator_type &priv_node_alloc() const { return internal_data; } - - index_type index; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED -}; - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -#undef STABLE_VECTOR_CHECK_INVARIANT - -} //namespace container { - -//!has_trivial_destructor_after_move<> == true_type -//!specialization for optimizations -template <class T, class Allocator> -struct has_trivial_destructor_after_move<boost::container::stable_vector<T, Allocator> > -{ - typedef typename ::boost::container::allocator_traits<Allocator>::pointer pointer; - static const bool value = ::boost::has_trivial_destructor_after_move<Allocator>::value && - ::boost::has_trivial_destructor_after_move<pointer>::value; -}; - -namespace container { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -}} //namespace boost{ namespace container { - -#include <boost/container/detail/config_end.hpp> - -#endif //BOOST_CONTAINER_STABLE_VECTOR_HPP diff --git a/contrib/restricted/boost/boost/container/static_vector.hpp b/contrib/restricted/boost/boost/container/static_vector.hpp deleted file mode 100644 index b40d5c37f6..0000000000 --- a/contrib/restricted/boost/boost/container/static_vector.hpp +++ /dev/null @@ -1,1242 +0,0 @@ -// Boost.Container static_vector -// -// Copyright (c) 2012-2013 Adam Wulkiewicz, Lodz, Poland. -// Copyright (c) 2011-2013 Andrew Hundt. -// Copyright (c) 2013-2014 Ion Gaztanaga -// -// Use, modification and distribution is subject to the Boost Software License, -// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at -// http://www.boost.org/LICENSE_1_0.txt) - -#ifndef BOOST_CONTAINER_STATIC_VECTOR_HPP -#define BOOST_CONTAINER_STATIC_VECTOR_HPP - -#ifndef BOOST_CONFIG_HPP -# include <boost/config.hpp> -#endif - -#if defined(BOOST_HAS_PRAGMA_ONCE) -# pragma once -#endif - -#include <boost/container/detail/config_begin.hpp> -#include <boost/container/detail/workaround.hpp> -#include <boost/container/detail/type_traits.hpp> -#include <boost/container/vector.hpp> - -#include <cstddef> -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) -#include <initializer_list> -#endif - -namespace boost { namespace container { - -#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -namespace dtl { - -template<class T, std::size_t N> -class static_storage_allocator -{ - public: - typedef T value_type; - - BOOST_CONTAINER_FORCEINLINE static_storage_allocator() BOOST_NOEXCEPT_OR_NOTHROW - {} - - BOOST_CONTAINER_FORCEINLINE static_storage_allocator(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - {} - - BOOST_CONTAINER_FORCEINLINE static_storage_allocator & operator=(const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return *this; } - - BOOST_CONTAINER_FORCEINLINE T* internal_storage() const BOOST_NOEXCEPT_OR_NOTHROW - { return const_cast<T*>(static_cast<const T*>(static_cast<const void*>(storage.data))); } - - BOOST_CONTAINER_FORCEINLINE T* internal_storage() BOOST_NOEXCEPT_OR_NOTHROW - { return static_cast<T*>(static_cast<void*>(storage.data)); } - - static const std::size_t internal_capacity = N; - - std::size_t max_size() const - { return N; } - - typedef boost::container::dtl::version_type<static_storage_allocator, 0> version; - - BOOST_CONTAINER_FORCEINLINE friend bool operator==(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return false; } - - BOOST_CONTAINER_FORCEINLINE friend bool operator!=(const static_storage_allocator &, const static_storage_allocator &) BOOST_NOEXCEPT_OR_NOTHROW - { return true; } - - private: - typename aligned_storage<sizeof(T)*N, alignment_of<T>::value>::type storage; -}; - -} //namespace dtl { - -#endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! -//!@brief A variable-size array container with fixed capacity. -//! -//!static_vector is a sequence container like boost::container::vector with contiguous storage that can -//!change in size, along with the static allocation, low overhead, and fixed capacity of boost::array. -//! -//!A static_vector is a sequence that supports random access to elements, constant time insertion and -//!removal of elements at the end, and linear time insertion and removal of elements at the beginning or -//!in the middle. The number of elements in a static_vector may vary dynamically up to a fixed capacity -//!because elements are stored within the object itself similarly to an array. However, objects are -//!initialized as they are inserted into static_vector unlike C arrays or std::array which must construct -//!all elements on instantiation. The behavior of static_vector enables the use of statically allocated -//!elements in cases with complex object lifetime requirements that would otherwise not be trivially -//!possible. -//! -//!@par Error Handling -//! Insertion beyond the capacity result in throwing std::bad_alloc() if exceptions are enabled or -//! calling throw_bad_alloc() if not enabled. -//! -//! std::out_of_range is thrown if out of bound access is performed in <code>at()</code> if exceptions are -//! enabled, throw_out_of_range() if not enabled. -//! -//!@tparam Value The type of element that will be stored. -//!@tparam Capacity The maximum number of elements static_vector can store, fixed at compile time. -template <typename Value, std::size_t Capacity> -class static_vector - : public vector<Value, dtl::static_storage_allocator<Value, Capacity> > -{ - #ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - typedef vector<Value, dtl::static_storage_allocator<Value, Capacity> > base_t; - - BOOST_COPYABLE_AND_MOVABLE(static_vector) - - template<class U, std::size_t OtherCapacity> - friend class static_vector; - - public: - typedef dtl::static_storage_allocator<Value, Capacity> allocator_type; - #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED - -public: - //! @brief The type of elements stored in the container. - typedef typename base_t::value_type value_type; - //! @brief The unsigned integral type used by the container. - typedef typename base_t::size_type size_type; - //! @brief The pointers difference type. - typedef typename base_t::difference_type difference_type; - //! @brief The pointer type. - typedef typename base_t::pointer pointer; - //! @brief The const pointer type. - typedef typename base_t::const_pointer const_pointer; - //! @brief The value reference type. - typedef typename base_t::reference reference; - //! @brief The value const reference type. - typedef typename base_t::const_reference const_reference; - //! @brief The iterator type. - typedef typename base_t::iterator iterator; - //! @brief The const iterator type. - typedef typename base_t::const_iterator const_iterator; - //! @brief The reverse iterator type. - typedef typename base_t::reverse_iterator reverse_iterator; - //! @brief The const reverse iterator. - typedef typename base_t::const_reverse_iterator const_reverse_iterator; - - //! @brief The capacity/max size of the container - static const size_type static_capacity = Capacity; - - //! @brief Constructs an empty static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - BOOST_CONTAINER_FORCEINLINE static_vector() BOOST_NOEXCEPT_OR_NOTHROW - : base_t() - {} - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Constructs a static_vector containing count value initialized values. - //! - //! @param count The number of values which will be contained in the container. - //! - //! @par Throws - //! If Value's value initialization throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE explicit static_vector(size_type count) - : base_t(count) - {} - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Constructs a static_vector containing count default initialized values. - //! - //! @param count The number of values which will be contained in the container. - //! - //! @par Throws - //! If Value's default initialization throws. - //! - //! @par Complexity - //! Linear O(N). - //! - //! @par Note - //! Non-standard extension - BOOST_CONTAINER_FORCEINLINE static_vector(size_type count, default_init_t) - : base_t(count, default_init_t()) - {} - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Constructs a static_vector containing count copies of value. - //! - //! @param count The number of copies of a values that will be contained in the container. - //! @param value The value which will be used to copy construct values. - //! - //! @par Throws - //! If Value's copy constructor throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector(size_type count, value_type const& value) - : base_t(count, value) - {} - - //! @pre - //! @li <tt>distance(first, last) <= capacity()</tt> - //! @li Iterator must meet the \c ForwardTraversalIterator concept. - //! - //! @brief Constructs a static_vector containing copy of a range <tt>[first, last)</tt>. - //! - //! @param first The iterator to the first element in range. - //! @param last The iterator to the one after the last element in range. - //! - //! @par Throws - //! If Value's constructor taking a dereferenced Iterator throws. - //! - //! @par Complexity - //! Linear O(N). - template <typename Iterator> - BOOST_CONTAINER_FORCEINLINE static_vector(Iterator first, Iterator last) - : base_t(first, last) - {} - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! @pre - //! @li <tt>distance(il.begin(), il.end()) <= capacity()</tt> - //! - //! @brief Constructs a static_vector containing copy of a range <tt>[il.begin(), il.end())</tt>. - //! - //! @param il std::initializer_list with values to initialize vector. - //! - //! @par Throws - //! If Value's constructor taking a dereferenced std::initializer_list throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector(std::initializer_list<value_type> il) - : base_t(il) - {} -#endif - - //! @brief Constructs a copy of other static_vector. - //! - //! @param other The static_vector which content will be copied to this one. - //! - //! @par Throws - //! If Value's copy constructor throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector(static_vector const& other) - : base_t(other) - {} - - BOOST_CONTAINER_FORCEINLINE static_vector(static_vector const& other, const allocator_type &) - : base_t(other) - {} - - BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF(static_vector) other, const allocator_type &) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<value_type>::value) - : base_t(BOOST_MOVE_BASE(base_t, other)) - {} - - BOOST_CONTAINER_FORCEINLINE explicit static_vector(const allocator_type &) - : base_t() - {} - - //! @pre <tt>other.size() <= capacity()</tt>. - //! - //! @brief Constructs a copy of other static_vector. - //! - //! @param other The static_vector which content will be copied to this one. - //! - //! @par Throws - //! If Value's copy constructor throws. - //! - //! @par Complexity - //! Linear O(N). - template <std::size_t C> - BOOST_CONTAINER_FORCEINLINE static_vector(static_vector<value_type, C> const& other) - : base_t(other) - {} - - //! @brief Move constructor. Moves Values stored in the other static_vector to this one. - //! - //! @param other The static_vector which content will be moved to this one. - //! - //! @par Throws - //! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor throws. - //! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF(static_vector) other) - BOOST_NOEXCEPT_IF(boost::container::dtl::is_nothrow_move_constructible<value_type>::value) - : base_t(BOOST_MOVE_BASE(base_t, other)) - {} - - //! @pre <tt>other.size() <= capacity()</tt> - //! - //! @brief Move constructor. Moves Values stored in the other static_vector to this one. - //! - //! @param other The static_vector which content will be moved to this one. - //! - //! @par Throws - //! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor throws. - //! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor throws. - //! - //! @par Complexity - //! Linear O(N). - template <std::size_t C> - BOOST_CONTAINER_FORCEINLINE static_vector(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other) - : base_t(BOOST_MOVE_BASE(typename static_vector<value_type BOOST_MOVE_I C>::base_t, other)) - {} - - //! @brief Copy assigns Values stored in the other static_vector to this one. - //! - //! @param other The static_vector which content will be copied to this one. - //! - //! @par Throws - //! If Value's copy constructor or copy assignment throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_COPY_ASSIGN_REF(static_vector) other) - { - return static_cast<static_vector&>(base_t::operator=(static_cast<base_t const&>(other))); - } - -#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) - //! @brief Copy assigns Values stored in std::initializer_list to *this. - //! - //! @param il The std::initializer_list which content will be copied to this one. - //! - //! @par Throws - //! If Value's copy constructor or copy assignment throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector & operator=(std::initializer_list<value_type> il) - { return static_cast<static_vector&>(base_t::operator=(il)); } -#endif - - //! @pre <tt>other.size() <= capacity()</tt> - //! - //! @brief Copy assigns Values stored in the other static_vector to this one. - //! - //! @param other The static_vector which content will be copied to this one. - //! - //! @par Throws - //! If Value's copy constructor or copy assignment throws. - //! - //! @par Complexity - //! Linear O(N). - template <std::size_t C> - BOOST_CONTAINER_FORCEINLINE static_vector & operator=(static_vector<value_type, C> const& other) - { - return static_cast<static_vector&>(base_t::operator= - (static_cast<typename static_vector<value_type, C>::base_t const&>(other))); - } - - //! @brief Move assignment. Moves Values stored in the other static_vector to this one. - //! - //! @param other The static_vector which content will be moved to this one. - //! - //! @par Throws - //! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws. - //! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws. - //! - //! @par Complexity - //! Linear O(N). - BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF(static_vector) other) - { - return static_cast<static_vector&>(base_t::operator=(BOOST_MOVE_BASE(base_t, other))); - } - - //! @pre <tt>other.size() <= capacity()</tt> - //! - //! @brief Move assignment. Moves Values stored in the other static_vector to this one. - //! - //! @param other The static_vector which content will be moved to this one. - //! - //! @par Throws - //! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws. - //! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws. - //! - //! @par Complexity - //! Linear O(N). - template <std::size_t C> - BOOST_CONTAINER_FORCEINLINE static_vector & operator=(BOOST_RV_REF_BEG static_vector<value_type, C> BOOST_RV_REF_END other) - { - return static_cast<static_vector&>(base_t::operator= - (BOOST_MOVE_BASE(typename static_vector<value_type BOOST_MOVE_I C>::base_t, other))); - } - -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - - //! @brief Destructor. Destroys Values stored in this container. - //! - //! @par Throws - //! Nothing - //! - //! @par Complexity - //! Linear O(N). - ~static_vector(); - - //! @brief Swaps contents of the other static_vector and this one. - //! - //! @param other The static_vector which content will be swapped with this one's content. - //! - //! @par Throws - //! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws, - //! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws, - //! - //! @par Complexity - //! Linear O(N). - void swap(static_vector & other); - - //! @pre <tt>other.size() <= capacity() && size() <= other.capacity()</tt> - //! - //! @brief Swaps contents of the other static_vector and this one. - //! - //! @param other The static_vector which content will be swapped with this one's content. - //! - //! @par Throws - //! @li If \c has_nothrow_move<Value>::value is \c true and Value's move constructor or move assignment throws, - //! @li If \c has_nothrow_move<Value>::value is \c false and Value's copy constructor or copy assignment throws, - //! - //! @par Complexity - //! Linear O(N). - template <std::size_t C> - void swap(static_vector<value_type, C> & other); - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Inserts or erases elements at the end such that - //! the size becomes count. New elements are value initialized. - //! - //! @param count The number of elements which will be stored in the container. - //! - //! @par Throws - //! If Value's value initialization throws. - //! - //! @par Complexity - //! Linear O(N). - void resize(size_type count); - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Inserts or erases elements at the end such that - //! the size becomes count. New elements are default initialized. - //! - //! @param count The number of elements which will be stored in the container. - //! - //! @par Throws - //! If Value's default initialization throws. - //! - //! @par Complexity - //! Linear O(N). - //! - //! @par Note - //! Non-standard extension - void resize(size_type count, default_init_t); - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Inserts or erases elements at the end such that - //! the size becomes count. New elements are copy constructed from value. - //! - //! @param count The number of elements which will be stored in the container. - //! @param value The value used to copy construct the new element. - //! - //! @par Throws - //! If Value's copy constructor throws. - //! - //! @par Complexity - //! Linear O(N). - void resize(size_type count, value_type const& value); - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief This call has no effect because the Capacity of this container is constant. - //! - //! @param count The number of elements which the container should be able to contain. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Linear O(N). - void reserve(size_type count) BOOST_NOEXCEPT_OR_NOTHROW; - - //! @pre <tt>size() < capacity()</tt> - //! - //! @brief Adds a copy of value at the end. - //! - //! @param value The value used to copy construct the new element. - //! - //! @par Throws - //! If Value's copy constructor throws. - //! - //! @par Complexity - //! Constant O(1). - void push_back(value_type const& value); - - //! @pre <tt>size() < capacity()</tt> - //! - //! @brief Moves value to the end. - //! - //! @param value The value to move construct the new element. - //! - //! @par Throws - //! If Value's move constructor throws. - //! - //! @par Complexity - //! Constant O(1). - void push_back(BOOST_RV_REF(value_type) value); - - //! @pre <tt>!empty()</tt> - //! - //! @brief Destroys last value and decreases the size. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - void pop_back(); - - //! @pre - //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. - //! @li <tt>size() < capacity()</tt> - //! - //! @brief Inserts a copy of element at p. - //! - //! @param p The position at which the new value will be inserted. - //! @param value The value used to copy construct the new element. - //! - //! @par Throws - //! @li If Value's copy constructor or copy assignment throws - //! @li If Value's move constructor or move assignment throws. - //! - //! @par Complexity - //! Constant or linear. - iterator insert(const_iterator p, value_type const& value); - - //! @pre - //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. - //! @li <tt>size() < capacity()</tt> - //! - //! @brief Inserts a move-constructed element at p. - //! - //! @param p The position at which the new value will be inserted. - //! @param value The value used to move construct the new element. - //! - //! @par Throws - //! If Value's move constructor or move assignment throws. - //! - //! @par Complexity - //! Constant or linear. - iterator insert(const_iterator p, BOOST_RV_REF(value_type) value); - - //! @pre - //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. - //! @li <tt>size() + count <= capacity()</tt> - //! - //! @brief Inserts a count copies of value at p. - //! - //! @param p The position at which new elements will be inserted. - //! @param count The number of new elements which will be inserted. - //! @param value The value used to copy construct new elements. - //! - //! @par Throws - //! @li If Value's copy constructor or copy assignment throws. - //! @li If Value's move constructor or move assignment throws. - //! - //! @par Complexity - //! Linear O(N). - iterator insert(const_iterator p, size_type count, value_type const& value); - - //! @pre - //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. - //! @li <tt>distance(first, last) <= capacity()</tt> - //! @li \c Iterator must meet the \c ForwardTraversalIterator concept. - //! - //! @brief Inserts a copy of a range <tt>[first, last)</tt> at p. - //! - //! @param p The position at which new elements will be inserted. - //! @param first The iterator to the first element of a range used to construct new elements. - //! @param last The iterator to the one after the last element of a range used to construct new elements. - //! - //! @par Throws - //! @li If Value's constructor and assignment taking a dereferenced \c Iterator. - //! @li If Value's move constructor or move assignment throws. - //! - //! @par Complexity - //! Linear O(N). - template <typename Iterator> - iterator insert(const_iterator p, Iterator first, Iterator last); - - //! @pre - //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt>. - //! @li <tt>distance(il.begin(), il.end()) <= capacity()</tt> - //! - //! @brief Inserts a copy of a range <tt>[il.begin(), il.end())</tt> at p. - //! - //! @param p The position at which new elements will be inserted. - //! @param il The std::initializer_list which contains elements that will be inserted. - //! - //! @par Throws - //! @li If Value's constructor and assignment taking a dereferenced std::initializer_list iterator. - //! - //! @par Complexity - //! Linear O(N). - iterator insert(const_iterator p, std::initializer_list<value_type> il); - - //! @pre \c p must be a valid iterator of \c *this in range <tt>[begin(), end())</tt> - //! - //! @brief Erases Value from p. - //! - //! @param p The position of the element which will be erased from the container. - //! - //! @par Throws - //! If Value's move assignment throws. - //! - //! @par Complexity - //! Linear O(N). - iterator erase(const_iterator p); - - //! @pre - //! @li \c first and \c last must define a valid range - //! @li iterators must be in range <tt>[begin(), end()]</tt> - //! - //! @brief Erases Values from a range <tt>[first, last)</tt>. - //! - //! @param first The position of the first element of a range which will be erased from the container. - //! @param last The position of the one after the last element of a range which will be erased from the container. - //! - //! @par Throws - //! If Value's move assignment throws. - //! - //! @par Complexity - //! Linear O(N). - iterator erase(const_iterator first, const_iterator last); - - //! @pre <tt>distance(first, last) <= capacity()</tt> - //! - //! @brief Assigns a range <tt>[first, last)</tt> of Values to this container. - //! - //! @param first The iterator to the first element of a range used to construct new content of this container. - //! @param last The iterator to the one after the last element of a range used to construct new content of this container. - //! - //! @par Throws - //! If Value's copy constructor or copy assignment throws, - //! - //! @par Complexity - //! Linear O(N). - template <typename Iterator> - void assign(Iterator first, Iterator last); - - //! @pre <tt>distance(il.begin(), il.end()) <= capacity()</tt> - //! - //! @brief Assigns a range <tt>[il.begin(), il.end())</tt> of Values to this container. - //! - //! @param il std::initializer_list with values used to construct new content of this container. - //! - //! @par Throws - //! If Value's copy constructor or copy assignment throws, - //! - //! @par Complexity - //! Linear O(N). - void assign(std::initializer_list<value_type> il); - - //! @pre <tt>count <= capacity()</tt> - //! - //! @brief Assigns a count copies of value to this container. - //! - //! @param count The new number of elements which will be container in the container. - //! @param value The value which will be used to copy construct the new content. - //! - //! @par Throws - //! If Value's copy constructor or copy assignment throws. - //! - //! @par Complexity - //! Linear O(N). - void assign(size_type count, value_type const& value); - - //! @pre <tt>size() < capacity()</tt> - //! - //! @brief Inserts a Value constructed with - //! \c std::forward<Args>(args)... in the end of the container. - //! - //! @return A reference to the created object. - //! - //! @param args The arguments of the constructor of the new element which will be created at the end of the container. - //! - //! @par Throws - //! If in-place constructor throws or Value's move constructor throws. - //! - //! @par Complexity - //! Constant O(1). - template<class ...Args> - reference emplace_back(Args &&...args); - - //! @pre - //! @li \c p must be a valid iterator of \c *this in range <tt>[begin(), end()]</tt> - //! @li <tt>size() < capacity()</tt> - //! - //! @brief Inserts a Value constructed with - //! \c std::forward<Args>(args)... before p - //! - //! @param p The position at which new elements will be inserted. - //! @param args The arguments of the constructor of the new element. - //! - //! @par Throws - //! If in-place constructor throws or if Value's move constructor or move assignment throws. - //! - //! @par Complexity - //! Constant or linear. - template<class ...Args> - iterator emplace(const_iterator p, Args &&...args); - - //! @brief Removes all elements from the container. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - void clear() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @pre <tt>i < size()</tt> - //! - //! @brief Returns reference to the i-th element. - //! - //! @param i The element's index. - //! - //! @return reference to the i-th element - //! from the beginning of the container. - //! - //! @par Throws - //! \c std::out_of_range exception by default. - //! - //! @par Complexity - //! Constant O(1). - reference at(size_type i); - - //! @pre <tt>i < size()</tt> - //! - //! @brief Returns const reference to the i-th element. - //! - //! @param i The element's index. - //! - //! @return const reference to the i-th element - //! from the beginning of the container. - //! - //! @par Throws - //! \c std::out_of_range exception by default. - //! - //! @par Complexity - //! Constant O(1). - const_reference at(size_type i) const; - - //! @pre <tt>i < size()</tt> - //! - //! @brief Returns reference to the i-th element. - //! - //! @param i The element's index. - //! - //! @return reference to the i-th element - //! from the beginning of the container. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - reference operator[](size_type i); - - //! @pre <tt>i < size()</tt> - //! - //! @brief Returns const reference to the i-th element. - //! - //! @param i The element's index. - //! - //! @return const reference to the i-th element - //! from the beginning of the container. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - const_reference operator[](size_type i) const; - - //! @pre <tt>i =< size()</tt> - //! - //! @brief Returns a iterator to the i-th element. - //! - //! @param i The element's index. - //! - //! @return a iterator to the i-th element. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - iterator nth(size_type i); - - //! @pre <tt>i =< size()</tt> - //! - //! @brief Returns a const_iterator to the i-th element. - //! - //! @param i The element's index. - //! - //! @return a const_iterator to the i-th element. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - const_iterator nth(size_type i) const; - - //! @pre <tt>begin() <= p <= end()</tt> - //! - //! @brief Returns the index of the element pointed by p. - //! - //! @param p An iterator to the element. - //! - //! @return The index of the element pointed by p. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - size_type index_of(iterator p); - - //! @pre <tt>begin() <= p <= end()</tt> - //! - //! @brief Returns the index of the element pointed by p. - //! - //! @param p A const_iterator to the element. - //! - //! @return a const_iterator to the i-th element. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - size_type index_of(const_iterator p) const; - - //! @pre \c !empty() - //! - //! @brief Returns reference to the first element. - //! - //! @return reference to the first element - //! from the beginning of the container. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - reference front(); - - //! @pre \c !empty() - //! - //! @brief Returns const reference to the first element. - //! - //! @return const reference to the first element - //! from the beginning of the container. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - const_reference front() const; - - //! @pre \c !empty() - //! - //! @brief Returns reference to the last element. - //! - //! @return reference to the last element - //! from the beginning of the container. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - reference back(); - - //! @pre \c !empty() - //! - //! @brief Returns const reference to the first element. - //! - //! @return const reference to the last element - //! from the beginning of the container. - //! - //! @par Throws - //! Nothing by default. - //! - //! @par Complexity - //! Constant O(1). - const_reference back() const; - - //! @brief Pointer such that <tt>[data(), data() + size())</tt> is a valid range. - //! For a non-empty vector <tt>data() == &front()</tt>. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - Value * data() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Const pointer such that <tt>[data(), data() + size())</tt> is a valid range. - //! For a non-empty vector <tt>data() == &front()</tt>. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const Value * data() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns iterator to the first element. - //! - //! @return iterator to the first element contained in the vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - iterator begin() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const iterator to the first element. - //! - //! @return const_iterator to the first element contained in the vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_iterator begin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const iterator to the first element. - //! - //! @return const_iterator to the first element contained in the vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_iterator cbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns iterator to the one after the last element. - //! - //! @return iterator pointing to the one after the last element contained in the vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - iterator end() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const iterator to the one after the last element. - //! - //! @return const_iterator pointing to the one after the last element contained in the vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_iterator end() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const iterator to the one after the last element. - //! - //! @return const_iterator pointing to the one after the last element contained in the vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_iterator cend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns reverse iterator to the first element of the reversed container. - //! - //! @return reverse_iterator pointing to the beginning - //! of the reversed static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - reverse_iterator rbegin() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const reverse iterator to the first element of the reversed container. - //! - //! @return const_reverse_iterator pointing to the beginning - //! of the reversed static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_reverse_iterator rbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const reverse iterator to the first element of the reversed container. - //! - //! @return const_reverse_iterator pointing to the beginning - //! of the reversed static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_reverse_iterator crbegin() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns reverse iterator to the one after the last element of the reversed container. - //! - //! @return reverse_iterator pointing to the one after the last element - //! of the reversed static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - reverse_iterator rend() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const reverse iterator to the one after the last element of the reversed container. - //! - //! @return const_reverse_iterator pointing to the one after the last element - //! of the reversed static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_reverse_iterator rend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns const reverse iterator to the one after the last element of the reversed container. - //! - //! @return const_reverse_iterator pointing to the one after the last element - //! of the reversed static_vector. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - const_reverse_iterator crend() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns container's capacity. - //! - //! @return container's capacity. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - static size_type capacity() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns container's capacity. - //! - //! @return container's capacity. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - static size_type max_size() BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Returns the number of stored elements. - //! - //! @return Number of elements contained in the container. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - size_type size() const BOOST_NOEXCEPT_OR_NOTHROW; - - //! @brief Queries if the container contains elements. - //! - //! @return true if the number of elements contained in the - //! container is equal to 0. - //! - //! @par Throws - //! Nothing. - //! - //! @par Complexity - //! Constant O(1). - bool empty() const BOOST_NOEXCEPT_OR_NOTHROW; -#else - - BOOST_CONTAINER_FORCEINLINE friend void swap(static_vector &x, static_vector &y) - { - x.swap(y); - } - -#endif // BOOST_CONTAINER_DOXYGEN_INVOKED - -}; - -#ifdef BOOST_CONTAINER_DOXYGEN_INVOKED - -//! @brief Checks if contents of two static_vectors are equal. -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @return \c true if containers have the same size and elements in both containers are equal. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -bool operator== (static_vector<V, C1> const& x, static_vector<V, C2> const& y); - -//! @brief Checks if contents of two static_vectors are not equal. -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @return \c true if containers have different size or elements in both containers are not equal. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -bool operator!= (static_vector<V, C1> const& x, static_vector<V, C2> const& y); - -//! @brief Lexicographically compares static_vectors. -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @return \c true if x compares lexicographically less than y. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -bool operator< (static_vector<V, C1> const& x, static_vector<V, C2> const& y); - -//! @brief Lexicographically compares static_vectors. -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @return \c true if y compares lexicographically less than x. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -bool operator> (static_vector<V, C1> const& x, static_vector<V, C2> const& y); - -//! @brief Lexicographically compares static_vectors. -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @return \c true if y don't compare lexicographically less than x. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -bool operator<= (static_vector<V, C1> const& x, static_vector<V, C2> const& y); - -//! @brief Lexicographically compares static_vectors. -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @return \c true if x don't compare lexicographically less than y. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -bool operator>= (static_vector<V, C1> const& x, static_vector<V, C2> const& y); - -//! @brief Swaps contents of two static_vectors. -//! -//! This function calls static_vector::swap(). -//! -//! @ingroup static_vector_non_member -//! -//! @param x The first static_vector. -//! @param y The second static_vector. -//! -//! @par Complexity -//! Linear O(N). -template<typename V, std::size_t C1, std::size_t C2> -inline void swap(static_vector<V, C1> & x, static_vector<V, C2> & y); - -#else - -template<typename V, std::size_t C1, std::size_t C2> -inline void swap(static_vector<V, C1> & x, static_vector<V, C2> & y - , typename dtl::enable_if_c< C1 != C2>::type * = 0) -{ - x.swap(y); -} - -#endif // BOOST_CONTAINER_DOXYGEN_INVOKED - -}} // namespace boost::container - -#include <boost/container/detail/config_end.hpp> - -#endif // BOOST_CONTAINER_STATIC_VECTOR_HPP diff --git a/contrib/restricted/boost/container/CMakeLists.txt b/contrib/restricted/boost/container/CMakeLists.txt new file mode 100644 index 0000000000..ddda932a55 --- /dev/null +++ b/contrib/restricted/boost/container/CMakeLists.txt @@ -0,0 +1,45 @@ + +# This file was gererated by the build system used internally in the Yandex monorepo. +# Only simple modifications are allowed (adding source-files to targets, adding simple properties +# like target_include_directories). These modifications will be ported to original +# ya.make files by maintainers. Any complex modifications which can't be ported back to the +# original buildsystem will not be accepted. + + + +add_library(restricted-boost-container) +target_include_directories(restricted-boost-container PUBLIC + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/include +) +target_link_libraries(restricted-boost-container PUBLIC + contrib-libs-cxxsupp + yutil + restricted-boost-assert + restricted-boost-config + restricted-boost-container_hash + restricted-boost-core + restricted-boost-intrusive + restricted-boost-move + restricted-boost-static_assert + restricted-boost-type_traits +) +target_sources(restricted-boost-container PRIVATE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/alloc_lib.c + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/dlmalloc.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/global_resource.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/monotonic_buffer_resource.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/pool_resource.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/synchronized_pool_resource.cpp + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/unsynchronized_pool_resource.cpp +) +set_property( + SOURCE + ${CMAKE_SOURCE_DIR}/contrib/restricted/boost/container/src/alloc_lib.c + APPEND + PROPERTY + COMPILE_OPTIONS + -Wno-deprecated-declarations + -Wno-incompatible-pointer-types + -Wno-macro-redefined + -Wno-null-pointer-arithmetic +) diff --git a/contrib/restricted/boost/boost/container/allocator_traits.hpp b/contrib/restricted/boost/container/include/boost/container/allocator_traits.hpp index af32f182b6..af32f182b6 100644 --- a/contrib/restricted/boost/boost/container/allocator_traits.hpp +++ b/contrib/restricted/boost/container/include/boost/container/allocator_traits.hpp diff --git a/contrib/restricted/boost/boost/container/container_fwd.hpp b/contrib/restricted/boost/container/include/boost/container/container_fwd.hpp index e4fe6f85c3..e4fe6f85c3 100644 --- a/contrib/restricted/boost/boost/container/container_fwd.hpp +++ b/contrib/restricted/boost/container/include/boost/container/container_fwd.hpp diff --git a/contrib/restricted/boost/boost/container/detail/addressof.hpp b/contrib/restricted/boost/container/include/boost/container/detail/addressof.hpp index b3b8a4dd6f..b3b8a4dd6f 100644 --- a/contrib/restricted/boost/boost/container/detail/addressof.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/addressof.hpp diff --git a/contrib/restricted/boost/boost/container/detail/advanced_insert_int.hpp b/contrib/restricted/boost/container/include/boost/container/detail/advanced_insert_int.hpp index d9cba4858b..d9cba4858b 100644 --- a/contrib/restricted/boost/boost/container/detail/advanced_insert_int.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/advanced_insert_int.hpp diff --git a/contrib/restricted/boost/boost/container/detail/algorithm.hpp b/contrib/restricted/boost/container/include/boost/container/detail/algorithm.hpp index 11844220e1..11844220e1 100644 --- a/contrib/restricted/boost/boost/container/detail/algorithm.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/algorithm.hpp diff --git a/contrib/restricted/boost/boost/container/detail/alloc_helpers.hpp b/contrib/restricted/boost/container/include/boost/container/detail/alloc_helpers.hpp index 57c59e46c1..57c59e46c1 100644 --- a/contrib/restricted/boost/boost/container/detail/alloc_helpers.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/alloc_helpers.hpp diff --git a/contrib/restricted/boost/boost/container/detail/alloc_lib.h b/contrib/restricted/boost/container/include/boost/container/detail/alloc_lib.h index 950ff722a5..950ff722a5 100644 --- a/contrib/restricted/boost/boost/container/detail/alloc_lib.h +++ b/contrib/restricted/boost/container/include/boost/container/detail/alloc_lib.h diff --git a/contrib/restricted/boost/boost/container/detail/allocation_type.hpp b/contrib/restricted/boost/container/include/boost/container/detail/allocation_type.hpp index 1e8aa67310..1e8aa67310 100644 --- a/contrib/restricted/boost/boost/container/detail/allocation_type.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/allocation_type.hpp diff --git a/contrib/restricted/boost/boost/container/detail/allocator_version_traits.hpp b/contrib/restricted/boost/container/include/boost/container/detail/allocator_version_traits.hpp index 18460bdf08..18460bdf08 100644 --- a/contrib/restricted/boost/boost/container/detail/allocator_version_traits.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/allocator_version_traits.hpp diff --git a/contrib/restricted/boost/boost/container/detail/auto_link.hpp b/contrib/restricted/boost/container/include/boost/container/detail/auto_link.hpp index 264b1ba112..264b1ba112 100644 --- a/contrib/restricted/boost/boost/container/detail/auto_link.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/auto_link.hpp diff --git a/contrib/restricted/boost/boost/container/detail/block_list.hpp b/contrib/restricted/boost/container/include/boost/container/detail/block_list.hpp index 1a6057cb4a..1a6057cb4a 100644 --- a/contrib/restricted/boost/boost/container/detail/block_list.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/block_list.hpp diff --git a/contrib/restricted/boost/boost/container/detail/block_slist.hpp b/contrib/restricted/boost/container/include/boost/container/detail/block_slist.hpp index 278e6414a7..278e6414a7 100644 --- a/contrib/restricted/boost/boost/container/detail/block_slist.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/block_slist.hpp diff --git a/contrib/restricted/boost/boost/container/detail/compare_functors.hpp b/contrib/restricted/boost/container/include/boost/container/detail/compare_functors.hpp index 28f9093b9a..28f9093b9a 100644 --- a/contrib/restricted/boost/boost/container/detail/compare_functors.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/compare_functors.hpp diff --git a/contrib/restricted/boost/boost/container/detail/config_begin.hpp b/contrib/restricted/boost/container/include/boost/container/detail/config_begin.hpp index 4df9e35d8b..4df9e35d8b 100644 --- a/contrib/restricted/boost/boost/container/detail/config_begin.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/config_begin.hpp diff --git a/contrib/restricted/boost/boost/container/detail/config_end.hpp b/contrib/restricted/boost/container/include/boost/container/detail/config_end.hpp index f93c8f6f79..f93c8f6f79 100644 --- a/contrib/restricted/boost/boost/container/detail/config_end.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/config_end.hpp diff --git a/contrib/restricted/boost/boost/container/detail/construct_in_place.hpp b/contrib/restricted/boost/container/include/boost/container/detail/construct_in_place.hpp index b131f06a86..b131f06a86 100644 --- a/contrib/restricted/boost/boost/container/detail/construct_in_place.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/construct_in_place.hpp diff --git a/contrib/restricted/boost/boost/container/detail/copy_move_algo.hpp b/contrib/restricted/boost/container/include/boost/container/detail/copy_move_algo.hpp index cc87e4abc0..cc87e4abc0 100644 --- a/contrib/restricted/boost/boost/container/detail/copy_move_algo.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/copy_move_algo.hpp diff --git a/contrib/restricted/boost/boost/container/detail/destroyers.hpp b/contrib/restricted/boost/container/include/boost/container/detail/destroyers.hpp index 9b0be44e66..9b0be44e66 100644 --- a/contrib/restricted/boost/boost/container/detail/destroyers.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/destroyers.hpp diff --git a/contrib/restricted/boost/boost/container/detail/dispatch_uses_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/detail/dispatch_uses_allocator.hpp index 0b8cfea66c..0b8cfea66c 100644 --- a/contrib/restricted/boost/boost/container/detail/dispatch_uses_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/dispatch_uses_allocator.hpp diff --git a/contrib/restricted/boost/boost/container/detail/dlmalloc.hpp b/contrib/restricted/boost/container/include/boost/container/detail/dlmalloc.hpp index 15086c399f..15086c399f 100644 --- a/contrib/restricted/boost/boost/container/detail/dlmalloc.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/dlmalloc.hpp diff --git a/contrib/restricted/boost/boost/container/detail/iterator.hpp b/contrib/restricted/boost/container/include/boost/container/detail/iterator.hpp index 2ceaf26001..2ceaf26001 100644 --- a/contrib/restricted/boost/boost/container/detail/iterator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/iterator.hpp diff --git a/contrib/restricted/boost/boost/container/detail/iterators.hpp b/contrib/restricted/boost/container/include/boost/container/detail/iterators.hpp index 1676be8be9..1676be8be9 100644 --- a/contrib/restricted/boost/boost/container/detail/iterators.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/iterators.hpp diff --git a/contrib/restricted/boost/boost/container/detail/min_max.hpp b/contrib/restricted/boost/container/include/boost/container/detail/min_max.hpp index 35cf06617d..35cf06617d 100644 --- a/contrib/restricted/boost/boost/container/detail/min_max.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/min_max.hpp diff --git a/contrib/restricted/boost/boost/container/detail/minimal_char_traits_header.hpp b/contrib/restricted/boost/container/include/boost/container/detail/minimal_char_traits_header.hpp index a92a31a2b4..a92a31a2b4 100644 --- a/contrib/restricted/boost/boost/container/detail/minimal_char_traits_header.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/minimal_char_traits_header.hpp diff --git a/contrib/restricted/boost/boost/container/detail/mpl.hpp b/contrib/restricted/boost/container/include/boost/container/detail/mpl.hpp index 4bb3cc7d22..4bb3cc7d22 100644 --- a/contrib/restricted/boost/boost/container/detail/mpl.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/mpl.hpp diff --git a/contrib/restricted/boost/boost/container/detail/multiallocation_chain.hpp b/contrib/restricted/boost/container/include/boost/container/detail/multiallocation_chain.hpp index c10f809bb4..c10f809bb4 100644 --- a/contrib/restricted/boost/boost/container/detail/multiallocation_chain.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/multiallocation_chain.hpp diff --git a/contrib/restricted/boost/boost/container/detail/next_capacity.hpp b/contrib/restricted/boost/container/include/boost/container/detail/next_capacity.hpp index 7e6554ded0..7e6554ded0 100644 --- a/contrib/restricted/boost/boost/container/detail/next_capacity.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/next_capacity.hpp diff --git a/contrib/restricted/boost/boost/container/detail/node_alloc_holder.hpp b/contrib/restricted/boost/container/include/boost/container/detail/node_alloc_holder.hpp index ad7b713d6e..ad7b713d6e 100644 --- a/contrib/restricted/boost/boost/container/detail/node_alloc_holder.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/node_alloc_holder.hpp diff --git a/contrib/restricted/boost/boost/container/detail/pair.hpp b/contrib/restricted/boost/container/include/boost/container/detail/pair.hpp index 6b00db1483..6b00db1483 100644 --- a/contrib/restricted/boost/boost/container/detail/pair.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/pair.hpp diff --git a/contrib/restricted/boost/boost/container/detail/pair_key_mapped_of_value.hpp b/contrib/restricted/boost/container/include/boost/container/detail/pair_key_mapped_of_value.hpp index 6112b87826..6112b87826 100644 --- a/contrib/restricted/boost/boost/container/detail/pair_key_mapped_of_value.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/pair_key_mapped_of_value.hpp diff --git a/contrib/restricted/boost/boost/container/detail/placement_new.hpp b/contrib/restricted/boost/container/include/boost/container/detail/placement_new.hpp index c50981f685..c50981f685 100644 --- a/contrib/restricted/boost/boost/container/detail/placement_new.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/placement_new.hpp diff --git a/contrib/restricted/boost/boost/container/detail/pool_resource.hpp b/contrib/restricted/boost/container/include/boost/container/detail/pool_resource.hpp index e5f59f5186..e5f59f5186 100644 --- a/contrib/restricted/boost/boost/container/detail/pool_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/pool_resource.hpp diff --git a/contrib/restricted/boost/boost/container/detail/std_fwd.hpp b/contrib/restricted/boost/container/include/boost/container/detail/std_fwd.hpp index 09678123ff..09678123ff 100644 --- a/contrib/restricted/boost/boost/container/detail/std_fwd.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/std_fwd.hpp diff --git a/contrib/restricted/boost/boost/container/detail/transform_iterator.hpp b/contrib/restricted/boost/container/include/boost/container/detail/transform_iterator.hpp index ce81813ebb..ce81813ebb 100644 --- a/contrib/restricted/boost/boost/container/detail/transform_iterator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/transform_iterator.hpp diff --git a/contrib/restricted/boost/boost/container/detail/tree.hpp b/contrib/restricted/boost/container/include/boost/container/detail/tree.hpp index 8d41158490..8d41158490 100644 --- a/contrib/restricted/boost/boost/container/detail/tree.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/tree.hpp diff --git a/contrib/restricted/boost/boost/container/detail/type_traits.hpp b/contrib/restricted/boost/container/include/boost/container/detail/type_traits.hpp index 686cc409b7..686cc409b7 100644 --- a/contrib/restricted/boost/boost/container/detail/type_traits.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/type_traits.hpp diff --git a/contrib/restricted/boost/boost/container/detail/value_functors.hpp b/contrib/restricted/boost/container/include/boost/container/detail/value_functors.hpp index a2c494c5e7..a2c494c5e7 100644 --- a/contrib/restricted/boost/boost/container/detail/value_functors.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/value_functors.hpp diff --git a/contrib/restricted/boost/boost/container/detail/value_init.hpp b/contrib/restricted/boost/container/include/boost/container/detail/value_init.hpp index 35b0aa11d3..35b0aa11d3 100644 --- a/contrib/restricted/boost/boost/container/detail/value_init.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/value_init.hpp diff --git a/contrib/restricted/boost/boost/container/detail/variadic_templates_tools.hpp b/contrib/restricted/boost/container/include/boost/container/detail/variadic_templates_tools.hpp index 1e6f3df742..1e6f3df742 100644 --- a/contrib/restricted/boost/boost/container/detail/variadic_templates_tools.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/variadic_templates_tools.hpp diff --git a/contrib/restricted/boost/boost/container/detail/version_type.hpp b/contrib/restricted/boost/container/include/boost/container/detail/version_type.hpp index c2531ccc31..c2531ccc31 100644 --- a/contrib/restricted/boost/boost/container/detail/version_type.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/version_type.hpp diff --git a/contrib/restricted/boost/boost/container/detail/workaround.hpp b/contrib/restricted/boost/container/include/boost/container/detail/workaround.hpp index 736326b779..736326b779 100644 --- a/contrib/restricted/boost/boost/container/detail/workaround.hpp +++ b/contrib/restricted/boost/container/include/boost/container/detail/workaround.hpp diff --git a/contrib/restricted/boost/boost/container/map.hpp b/contrib/restricted/boost/container/include/boost/container/map.hpp index 63e10b4af0..63e10b4af0 100644 --- a/contrib/restricted/boost/boost/container/map.hpp +++ b/contrib/restricted/boost/container/include/boost/container/map.hpp diff --git a/contrib/restricted/boost/boost/container/new_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/new_allocator.hpp index 9af015d1d6..9af015d1d6 100644 --- a/contrib/restricted/boost/boost/container/new_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/new_allocator.hpp diff --git a/contrib/restricted/boost/boost/container/node_handle.hpp b/contrib/restricted/boost/container/include/boost/container/node_handle.hpp index ef1d71f355..ef1d71f355 100644 --- a/contrib/restricted/boost/boost/container/node_handle.hpp +++ b/contrib/restricted/boost/container/include/boost/container/node_handle.hpp diff --git a/contrib/restricted/boost/boost/container/options.hpp b/contrib/restricted/boost/container/include/boost/container/options.hpp index 2ac7783e46..2ac7783e46 100644 --- a/contrib/restricted/boost/boost/container/options.hpp +++ b/contrib/restricted/boost/container/include/boost/container/options.hpp diff --git a/contrib/restricted/boost/boost/container/pmr/global_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/global_resource.hpp index 219309b072..219309b072 100644 --- a/contrib/restricted/boost/boost/container/pmr/global_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/global_resource.hpp diff --git a/contrib/restricted/boost/boost/container/pmr/memory_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/memory_resource.hpp index 72338a7559..72338a7559 100644 --- a/contrib/restricted/boost/boost/container/pmr/memory_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/memory_resource.hpp diff --git a/contrib/restricted/boost/boost/container/pmr/monotonic_buffer_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/monotonic_buffer_resource.hpp index dfffe87dc3..dfffe87dc3 100644 --- a/contrib/restricted/boost/boost/container/pmr/monotonic_buffer_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/monotonic_buffer_resource.hpp diff --git a/contrib/restricted/boost/boost/container/pmr/pool_options.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/pool_options.hpp index e9f72896b1..e9f72896b1 100644 --- a/contrib/restricted/boost/boost/container/pmr/pool_options.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/pool_options.hpp diff --git a/contrib/restricted/boost/boost/container/pmr/synchronized_pool_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/synchronized_pool_resource.hpp index e4d4dd54a1..e4d4dd54a1 100644 --- a/contrib/restricted/boost/boost/container/pmr/synchronized_pool_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/synchronized_pool_resource.hpp diff --git a/contrib/restricted/boost/boost/container/pmr/unsynchronized_pool_resource.hpp b/contrib/restricted/boost/container/include/boost/container/pmr/unsynchronized_pool_resource.hpp index 21d30b1ebc..21d30b1ebc 100644 --- a/contrib/restricted/boost/boost/container/pmr/unsynchronized_pool_resource.hpp +++ b/contrib/restricted/boost/container/include/boost/container/pmr/unsynchronized_pool_resource.hpp diff --git a/contrib/restricted/boost/boost/container/scoped_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/scoped_allocator.hpp index 6cd69fe430..6cd69fe430 100644 --- a/contrib/restricted/boost/boost/container/scoped_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/scoped_allocator.hpp diff --git a/contrib/restricted/boost/boost/container/scoped_allocator_fwd.hpp b/contrib/restricted/boost/container/include/boost/container/scoped_allocator_fwd.hpp index cddf7fad15..cddf7fad15 100644 --- a/contrib/restricted/boost/boost/container/scoped_allocator_fwd.hpp +++ b/contrib/restricted/boost/container/include/boost/container/scoped_allocator_fwd.hpp diff --git a/contrib/restricted/boost/boost/container/set.hpp b/contrib/restricted/boost/container/include/boost/container/set.hpp index f6cde190de..f6cde190de 100644 --- a/contrib/restricted/boost/boost/container/set.hpp +++ b/contrib/restricted/boost/container/include/boost/container/set.hpp diff --git a/contrib/restricted/boost/boost/container/small_vector.hpp b/contrib/restricted/boost/container/include/boost/container/small_vector.hpp index 70704d6b63..70704d6b63 100644 --- a/contrib/restricted/boost/boost/container/small_vector.hpp +++ b/contrib/restricted/boost/container/include/boost/container/small_vector.hpp diff --git a/contrib/restricted/boost/boost/container/string.hpp b/contrib/restricted/boost/container/include/boost/container/string.hpp index 8829fdaadb..8829fdaadb 100644 --- a/contrib/restricted/boost/boost/container/string.hpp +++ b/contrib/restricted/boost/container/include/boost/container/string.hpp diff --git a/contrib/restricted/boost/boost/container/throw_exception.hpp b/contrib/restricted/boost/container/include/boost/container/throw_exception.hpp index 1b6eec1179..1b6eec1179 100644 --- a/contrib/restricted/boost/boost/container/throw_exception.hpp +++ b/contrib/restricted/boost/container/include/boost/container/throw_exception.hpp diff --git a/contrib/restricted/boost/boost/container/uses_allocator.hpp b/contrib/restricted/boost/container/include/boost/container/uses_allocator.hpp index e0e3518081..e0e3518081 100644 --- a/contrib/restricted/boost/boost/container/uses_allocator.hpp +++ b/contrib/restricted/boost/container/include/boost/container/uses_allocator.hpp diff --git a/contrib/restricted/boost/boost/container/uses_allocator_fwd.hpp b/contrib/restricted/boost/container/include/boost/container/uses_allocator_fwd.hpp index 42a5b904f0..42a5b904f0 100644 --- a/contrib/restricted/boost/boost/container/uses_allocator_fwd.hpp +++ b/contrib/restricted/boost/container/include/boost/container/uses_allocator_fwd.hpp diff --git a/contrib/restricted/boost/boost/container/vector.hpp b/contrib/restricted/boost/container/include/boost/container/vector.hpp index 52e3c2391a..52e3c2391a 100644 --- a/contrib/restricted/boost/boost/container/vector.hpp +++ b/contrib/restricted/boost/container/include/boost/container/vector.hpp diff --git a/contrib/restricted/boost/libs/container/src/alloc_lib.c b/contrib/restricted/boost/container/src/alloc_lib.c index 077768b946..077768b946 100644 --- a/contrib/restricted/boost/libs/container/src/alloc_lib.c +++ b/contrib/restricted/boost/container/src/alloc_lib.c diff --git a/contrib/restricted/boost/libs/container/src/dlmalloc.cpp b/contrib/restricted/boost/container/src/dlmalloc.cpp index 6ab6de3a53..6ab6de3a53 100644 --- a/contrib/restricted/boost/libs/container/src/dlmalloc.cpp +++ b/contrib/restricted/boost/container/src/dlmalloc.cpp diff --git a/contrib/restricted/boost/libs/container/src/dlmalloc_2_8_6.c b/contrib/restricted/boost/container/src/dlmalloc_2_8_6.c index bb105b63fb..bb105b63fb 100644 --- a/contrib/restricted/boost/libs/container/src/dlmalloc_2_8_6.c +++ b/contrib/restricted/boost/container/src/dlmalloc_2_8_6.c diff --git a/contrib/restricted/boost/libs/container/src/dlmalloc_ext_2_8_6.c b/contrib/restricted/boost/container/src/dlmalloc_ext_2_8_6.c index 3328d72975..3328d72975 100644 --- a/contrib/restricted/boost/libs/container/src/dlmalloc_ext_2_8_6.c +++ b/contrib/restricted/boost/container/src/dlmalloc_ext_2_8_6.c diff --git a/contrib/restricted/boost/libs/container/src/global_resource.cpp b/contrib/restricted/boost/container/src/global_resource.cpp index 15f4fe404c..15f4fe404c 100644 --- a/contrib/restricted/boost/libs/container/src/global_resource.cpp +++ b/contrib/restricted/boost/container/src/global_resource.cpp diff --git a/contrib/restricted/boost/libs/container/src/monotonic_buffer_resource.cpp b/contrib/restricted/boost/container/src/monotonic_buffer_resource.cpp index f9f6f4cbe5..f9f6f4cbe5 100644 --- a/contrib/restricted/boost/libs/container/src/monotonic_buffer_resource.cpp +++ b/contrib/restricted/boost/container/src/monotonic_buffer_resource.cpp diff --git a/contrib/restricted/boost/libs/container/src/pool_resource.cpp b/contrib/restricted/boost/container/src/pool_resource.cpp index e6829e28e7..e6829e28e7 100644 --- a/contrib/restricted/boost/libs/container/src/pool_resource.cpp +++ b/contrib/restricted/boost/container/src/pool_resource.cpp diff --git a/contrib/restricted/boost/libs/container/src/synchronized_pool_resource.cpp b/contrib/restricted/boost/container/src/synchronized_pool_resource.cpp index b98bed4f63..b98bed4f63 100644 --- a/contrib/restricted/boost/libs/container/src/synchronized_pool_resource.cpp +++ b/contrib/restricted/boost/container/src/synchronized_pool_resource.cpp diff --git a/contrib/restricted/boost/libs/container/src/unsynchronized_pool_resource.cpp b/contrib/restricted/boost/container/src/unsynchronized_pool_resource.cpp index 0c84f694a3..0c84f694a3 100644 --- a/contrib/restricted/boost/libs/container/src/unsynchronized_pool_resource.cpp +++ b/contrib/restricted/boost/container/src/unsynchronized_pool_resource.cpp diff --git a/contrib/restricted/boost/libs/thread/CMakeLists.darwin.txt b/contrib/restricted/boost/libs/thread/CMakeLists.darwin.txt index 09d0bffba7..ed8bce3e20 100644 --- a/contrib/restricted/boost/libs/thread/CMakeLists.darwin.txt +++ b/contrib/restricted/boost/libs/thread/CMakeLists.darwin.txt @@ -34,6 +34,7 @@ target_link_libraries(boost-libs-thread PUBLIC contrib-libs-cxxsupp contrib-restricted-boost restricted-boost-atomic + restricted-boost-container restricted-boost-exception restricted-boost-chrono restricted-boost-system diff --git a/contrib/restricted/boost/libs/thread/CMakeLists.linux.txt b/contrib/restricted/boost/libs/thread/CMakeLists.linux.txt index 0d9a6b1e46..596e1d42e5 100644 --- a/contrib/restricted/boost/libs/thread/CMakeLists.linux.txt +++ b/contrib/restricted/boost/libs/thread/CMakeLists.linux.txt @@ -33,6 +33,7 @@ target_link_libraries(boost-libs-thread PUBLIC contrib-libs-cxxsupp contrib-restricted-boost restricted-boost-atomic + restricted-boost-container restricted-boost-exception restricted-boost-chrono restricted-boost-system |