diff options
Diffstat (limited to 'boost/interprocess/allocators/allocator.hpp')
-rw-r--r-- | boost/interprocess/allocators/allocator.hpp | 27 |
1 files changed, 14 insertions, 13 deletions
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 |