diff options
Diffstat (limited to 'boost/interprocess/allocators')
11 files changed, 104 insertions, 82 deletions
diff --git a/boost/interprocess/allocators/adaptive_pool.hpp b/boost/interprocess/allocators/adaptive_pool.hpp index d21fe1eda4..3c0d50f5ec 100644 --- a/boost/interprocess/allocators/adaptive_pool.hpp +++ b/boost/interprocess/allocators/adaptive_pool.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_ADAPTIVE_POOL_HPP #define BOOST_INTERPROCESS_ADAPTIVE_POOL_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -26,12 +30,12 @@ #include <boost/interprocess/detail/utilities.hpp> #include <boost/interprocess/detail/type_traits.hpp> #include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp> +#include <boost/interprocess/containers/version_type.hpp> #include <boost/interprocess/exceptions.hpp> #include <boost/interprocess/allocators/detail/allocator_common.hpp> #include <boost/container/detail/multiallocation_chain.hpp> #include <boost/interprocess/detail/mpl.hpp> -#include <memory> -#include <algorithm> +#include <boost/move/adl_move_swap.hpp> #include <cstddef> //!\file @@ -137,7 +141,7 @@ class adaptive_pool_base adaptive_pool_base& operator=(const adaptive_pool_base &other) { adaptive_pool_base c(other); - swap(*this, c); + boost::adl_move_swap(*this, c); return *this; } @@ -167,7 +171,7 @@ class adaptive_pool_base //!Swaps allocators. Does not throw. If each allocator is placed in a //!different memory segment, the result is undefined. friend void swap(self_t &alloc1, self_t &alloc2) - { ipcdetail::do_swap(alloc1.mp_node_pool, alloc2.mp_node_pool); } + { boost::adl_move_swap(alloc1.mp_node_pool, alloc2.mp_node_pool); } #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) private: @@ -388,11 +392,8 @@ class adaptive_pool //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const; - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0); + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, diff --git a/boost/interprocess/allocators/allocator.hpp b/boost/interprocess/allocators/allocator.hpp index e3b5cc86c8..759e3d2605 100644 --- a/boost/interprocess/allocators/allocator.hpp +++ b/boost/interprocess/allocators/allocator.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_ALLOCATOR_HPP #define BOOST_INTERPROCESS_ALLOCATOR_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -30,10 +34,8 @@ #include <boost/assert.hpp> #include <boost/utility/addressof.hpp> #include <boost/interprocess/detail/type_traits.hpp> +#include <boost/container/detail/placement_new.hpp> -#include <memory> -#include <new> -#include <algorithm> #include <cstddef> #include <stdexcept> @@ -164,7 +166,7 @@ class allocator //!Swap segment manager. Does not throw. If each allocator is placed in //!different memory segments, the result is undefined. friend void swap(self_t &alloc1, self_t &alloc2) - { ipcdetail::do_swap(alloc1.mp_mngr, alloc2.mp_mngr); } + { boost::adl_move_swap(alloc1.mp_mngr, alloc2.mp_mngr); } //!Returns maximum the number of objects the previously allocated memory //!pointed by p can hold. This size only works for memory allocated with @@ -174,14 +176,13 @@ class allocator return (size_type)mp_mngr->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0) + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) { - return mp_mngr->allocation_command - (command, limit_size, preferred_size, received_size, ipcdetail::to_raw_pointer(reuse)); + value_type *reuse_raw = ipcdetail::to_raw_pointer(reuse); + pointer const p = mp_mngr->allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse_raw); + reuse = reuse_raw; + return p; } //!Allocates many elements of size elem_size in a contiguous block @@ -260,7 +261,7 @@ class allocator //!For backwards compatibility with libraries using C++03 allocators template<class P> void construct(const pointer &ptr, BOOST_FWD_REF(P) p) - { ::new((void*)ipcdetail::to_raw_pointer(ptr)) value_type(::boost::forward<P>(p)); } + { ::new((void*)ipcdetail::to_raw_pointer(ptr), boost_container_new_t()) value_type(::boost::forward<P>(p)); } //!Destroys object. Throws if object's //!destructor throws diff --git a/boost/interprocess/allocators/cached_adaptive_pool.hpp b/boost/interprocess/allocators/cached_adaptive_pool.hpp index 7b1921b254..0ccf1f3638 100644 --- a/boost/interprocess/allocators/cached_adaptive_pool.hpp +++ b/boost/interprocess/allocators/cached_adaptive_pool.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_CACHED_ADAPTIVE_POOL_HPP #define BOOST_INTERPROCESS_CACHED_ADAPTIVE_POOL_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -268,11 +272,8 @@ class cached_adaptive_pool //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const; - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0); + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, diff --git a/boost/interprocess/allocators/cached_node_allocator.hpp b/boost/interprocess/allocators/cached_node_allocator.hpp index 5ac6aab2c0..4eff061b0a 100644 --- a/boost/interprocess/allocators/cached_node_allocator.hpp +++ b/boost/interprocess/allocators/cached_node_allocator.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_CACHED_NODE_ALLOCATOR_HPP #define BOOST_INTERPROCESS_CACHED_NODE_ALLOCATOR_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -240,11 +244,8 @@ class cached_node_allocator //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const; - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0); + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, diff --git a/boost/interprocess/allocators/detail/adaptive_node_pool.hpp b/boost/interprocess/allocators/detail/adaptive_node_pool.hpp index dd697902c4..2996bc82ec 100644 --- a/boost/interprocess/allocators/detail/adaptive_node_pool.hpp +++ b/boost/interprocess/allocators/detail/adaptive_node_pool.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP #define BOOST_INTERPROCESS_DETAIL_ADAPTIVE_NODE_POOL_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif diff --git a/boost/interprocess/allocators/detail/allocator_common.hpp b/boost/interprocess/allocators/detail/allocator_common.hpp index eb8fbfc314..f613ffd822 100644 --- a/boost/interprocess/allocators/detail/allocator_common.hpp +++ b/boost/interprocess/allocators/detail/allocator_common.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_ALLOCATOR_DETAIL_ALLOCATOR_COMMON_HPP #define BOOST_INTERPROCESS_ALLOCATOR_DETAIL_ALLOCATOR_COMMON_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -33,9 +37,8 @@ #include <boost/move/utility_core.hpp> #include <boost/interprocess/detail/type_traits.hpp> #include <boost/interprocess/detail/utilities.hpp> -#include <algorithm> //std::swap -#include <utility> //std::pair -#include <new> +#include <boost/container/detail/placement_new.hpp> +#include <boost/move/adl_move_swap.hpp> namespace boost { namespace interprocess { @@ -295,9 +298,9 @@ class cache_impl public: void swap(cache_impl &other) { - ipcdetail::do_swap(mp_node_pool, other.mp_node_pool); - m_cached_nodes.swap(other.m_cached_nodes); - ipcdetail::do_swap(m_max_cached_nodes, other.m_max_cached_nodes); + ::boost::adl_move_swap(mp_node_pool, other.mp_node_pool); + ::boost::adl_move_swap(m_cached_nodes, other.m_cached_nodes); + ::boost::adl_move_swap(m_max_cached_nodes, other.m_max_cached_nodes); } }; @@ -338,14 +341,14 @@ class array_allocation_impl return (size_type)this->derived()->get_segment_manager()->size(ipcdetail::to_raw_pointer(p))/sizeof(T); } - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0) + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse) { - return this->derived()->get_segment_manager()->allocation_command - (command, limit_size, preferred_size, received_size, ipcdetail::to_raw_pointer(reuse)); + value_type *reuse_raw = ipcdetail::to_raw_pointer(reuse); + pointer const p = this->derived()->get_segment_manager()->allocation_command + (command, limit_size, prefer_in_recvd_out_size, reuse_raw); + reuse = reuse_raw; + return p; } //!Allocates many elements of size elem_size in a contiguous block @@ -399,7 +402,7 @@ class array_allocation_impl //!For backwards compatibility with libraries using C++03 allocators template<class P> void construct(const pointer &ptr, BOOST_FWD_REF(P) p) - { ::new((void*)ipcdetail::to_raw_pointer(ptr)) value_type(::boost::forward<P>(p)); } + { ::new((void*)ipcdetail::to_raw_pointer(ptr), boost_container_new_t()) value_type(::boost::forward<P>(p)); } //!Destroys object. Throws if object's //!destructor throws @@ -671,7 +674,7 @@ class cached_allocator_impl //!Swaps allocators. Does not throw. If each allocator is placed in a //!different shared memory segments, the result is undefined. friend void swap(cached_allocator_impl &alloc1, cached_allocator_impl &alloc2) - { alloc1.m_cache.swap(alloc2.m_cache); } + { ::boost::adl_move_swap(alloc1.m_cache, alloc2.m_cache); } void deallocate_cache() { m_cache.deallocate_all_cached_nodes(); } diff --git a/boost/interprocess/allocators/detail/node_pool.hpp b/boost/interprocess/allocators/detail/node_pool.hpp index cee9cdafc8..9b2041f4e2 100644 --- a/boost/interprocess/allocators/detail/node_pool.hpp +++ b/boost/interprocess/allocators/detail/node_pool.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP #define BOOST_INTERPROCESS_DETAIL_NODE_POOL_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif diff --git a/boost/interprocess/allocators/detail/node_tools.hpp b/boost/interprocess/allocators/detail/node_tools.hpp index e7115ece4e..7f5a4f515c 100644 --- a/boost/interprocess/allocators/detail/node_tools.hpp +++ b/boost/interprocess/allocators/detail/node_tools.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_DETAIL_NODE_TOOLS_HPP #define BOOST_INTERPROCESS_DETAIL_NODE_TOOLS_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif diff --git a/boost/interprocess/allocators/node_allocator.hpp b/boost/interprocess/allocators/node_allocator.hpp index af522f35b2..8bd6dfe2c3 100644 --- a/boost/interprocess/allocators/node_allocator.hpp +++ b/boost/interprocess/allocators/node_allocator.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_NODE_ALLOCATOR_HPP #define BOOST_INTERPROCESS_NODE_ALLOCATOR_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -26,11 +30,11 @@ #include <boost/interprocess/detail/utilities.hpp> #include <boost/interprocess/detail/type_traits.hpp> #include <boost/interprocess/allocators/detail/node_pool.hpp> +#include <boost/interprocess/containers/version_type.hpp> #include <boost/container/detail/multiallocation_chain.hpp> #include <boost/interprocess/exceptions.hpp> #include <boost/interprocess/allocators/detail/allocator_common.hpp> -#include <memory> -#include <algorithm> +#include <boost/move/adl_move_swap.hpp> #include <cstddef> //!\file @@ -144,7 +148,7 @@ class node_allocator_base node_allocator_base& operator=(const node_allocator_base &other) { node_allocator_base c(other); - swap(*this, c); + boost::adl_move_swap(*this, c); return *this; } @@ -166,7 +170,7 @@ class node_allocator_base //!Swaps allocators. Does not throw. If each allocator is placed in a //!different memory segment, the result is undefined. friend void swap(self_t &alloc1, self_t &alloc2) - { ipcdetail::do_swap(alloc1.mp_node_pool, alloc2.mp_node_pool); } + { boost::adl_move_swap(alloc1.mp_node_pool, alloc2.mp_node_pool); } #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) private: @@ -373,11 +377,8 @@ class node_allocator //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const; - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0); + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, diff --git a/boost/interprocess/allocators/private_adaptive_pool.hpp b/boost/interprocess/allocators/private_adaptive_pool.hpp index 529dc9d138..89299299c3 100644 --- a/boost/interprocess/allocators/private_adaptive_pool.hpp +++ b/boost/interprocess/allocators/private_adaptive_pool.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_PRIVATE_ADAPTIVE_POOL_HPP #define BOOST_INTERPROCESS_PRIVATE_ADAPTIVE_POOL_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -24,12 +28,12 @@ #include <boost/assert.hpp> #include <boost/utility/addressof.hpp> #include <boost/interprocess/allocators/detail/adaptive_node_pool.hpp> +#include <boost/interprocess/containers/version_type.hpp> #include <boost/container/detail/multiallocation_chain.hpp> #include <boost/interprocess/exceptions.hpp> #include <boost/interprocess/detail/utilities.hpp> #include <boost/interprocess/detail/workaround.hpp> -#include <memory> -#include <algorithm> +#include <boost/move/adl_move_swap.hpp> #include <cstddef> //!\file @@ -168,7 +172,7 @@ class private_adaptive_pool_base //!Swaps allocators. Does not throw. If each allocator is placed in a //!different shared memory segments, the result is undefined. friend void swap(self_t &alloc1,self_t &alloc2) - { alloc1.m_node_pool.swap(alloc2.m_node_pool); } + { boost::adl_move_swap(alloc1.m_node_pool, alloc2.m_node_pool); } #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) private: @@ -388,11 +392,8 @@ class private_adaptive_pool //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const; - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0); + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, diff --git a/boost/interprocess/allocators/private_node_allocator.hpp b/boost/interprocess/allocators/private_node_allocator.hpp index 8b546c3354..24fb84c156 100644 --- a/boost/interprocess/allocators/private_node_allocator.hpp +++ b/boost/interprocess/allocators/private_node_allocator.hpp @@ -11,7 +11,11 @@ #ifndef BOOST_INTERPROCESS_PRIVATE_NODE_ALLOCATOR_HPP #define BOOST_INTERPROCESS_PRIVATE_NODE_ALLOCATOR_HPP -#if defined(_MSC_VER) +#ifndef BOOST_CONFIG_HPP +# include <boost/config.hpp> +#endif +# +#if defined(BOOST_HAS_PRAGMA_ONCE) # pragma once #endif @@ -24,12 +28,12 @@ #include <boost/assert.hpp> #include <boost/utility/addressof.hpp> #include <boost/interprocess/allocators/detail/node_pool.hpp> +#include <boost/interprocess/containers/version_type.hpp> #include <boost/container/detail/multiallocation_chain.hpp> #include <boost/interprocess/exceptions.hpp> #include <boost/interprocess/detail/utilities.hpp> #include <boost/interprocess/detail/workaround.hpp> -#include <memory> -#include <algorithm> +#include <boost/move/adl_move_swap.hpp> #include <cstddef> //!\file @@ -160,7 +164,7 @@ class private_node_allocator_base //!Swaps allocators. Does not throw. If each allocator is placed in a //!different shared memory segments, the result is undefined. friend void swap(self_t &alloc1,self_t &alloc2) - { alloc1.m_node_pool.swap(alloc2.m_node_pool); } + { boost::adl_move_swap(alloc1.m_node_pool, alloc2.m_node_pool); } #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED) private: @@ -365,11 +369,8 @@ class private_node_allocator //!allocate, allocation_command and allocate_many. size_type size(const pointer &p) const; - std::pair<pointer, bool> - allocation_command(boost::interprocess::allocation_type command, - size_type limit_size, - size_type preferred_size, - size_type &received_size, const pointer &reuse = 0); + pointer allocation_command(boost::interprocess::allocation_type command, + size_type limit_size, size_type &prefer_in_recvd_out_size, pointer &reuse); //!Allocates many elements of size elem_size in a contiguous block //!of memory. The minimum number to be allocated is min_elements, |