summaryrefslogtreecommitdiff
path: root/boost/interprocess
diff options
context:
space:
mode:
Diffstat (limited to 'boost/interprocess')
-rw-r--r--boost/interprocess/allocators/adaptive_pool.hpp21
-rw-r--r--boost/interprocess/allocators/allocator.hpp27
-rw-r--r--boost/interprocess/allocators/cached_adaptive_pool.hpp13
-rw-r--r--boost/interprocess/allocators/cached_node_allocator.hpp13
-rw-r--r--boost/interprocess/allocators/detail/adaptive_node_pool.hpp6
-rw-r--r--boost/interprocess/allocators/detail/allocator_common.hpp35
-rw-r--r--boost/interprocess/allocators/detail/node_pool.hpp6
-rw-r--r--boost/interprocess/allocators/detail/node_tools.hpp6
-rw-r--r--boost/interprocess/allocators/node_allocator.hpp21
-rw-r--r--boost/interprocess/allocators/private_adaptive_pool.hpp19
-rw-r--r--boost/interprocess/allocators/private_node_allocator.hpp19
-rw-r--r--boost/interprocess/anonymous_shared_memory.hpp6
-rw-r--r--boost/interprocess/containers/allocation_type.hpp8
-rw-r--r--boost/interprocess/containers/containers_fwd.hpp6
-rw-r--r--boost/interprocess/containers/deque.hpp6
-rw-r--r--boost/interprocess/containers/flat_map.hpp6
-rw-r--r--boost/interprocess/containers/flat_set.hpp6
-rw-r--r--boost/interprocess/containers/list.hpp6
-rw-r--r--boost/interprocess/containers/map.hpp6
-rw-r--r--boost/interprocess/containers/pair.hpp6
-rw-r--r--boost/interprocess/containers/set.hpp6
-rw-r--r--boost/interprocess/containers/slist.hpp6
-rw-r--r--boost/interprocess/containers/stable_vector.hpp6
-rw-r--r--boost/interprocess/containers/string.hpp6
-rw-r--r--boost/interprocess/containers/vector.hpp6
-rw-r--r--boost/interprocess/containers/version_type.hpp6
-rw-r--r--boost/interprocess/creation_tags.hpp6
-rw-r--r--boost/interprocess/detail/atomic.hpp6
-rw-r--r--boost/interprocess/detail/cast_tags.hpp18
-rw-r--r--boost/interprocess/detail/config_begin.hpp1
-rw-r--r--boost/interprocess/detail/file_locking_helpers.hpp6
-rw-r--r--boost/interprocess/detail/file_wrapper.hpp11
-rw-r--r--boost/interprocess/detail/in_place_interface.hpp10
-rw-r--r--boost/interprocess/detail/intermodule_singleton.hpp6
-rw-r--r--boost/interprocess/detail/intermodule_singleton_common.hpp10
-rw-r--r--boost/interprocess/detail/interprocess_tester.hpp6
-rw-r--r--boost/interprocess/detail/intersegment_ptr.hpp28
-rw-r--r--boost/interprocess/detail/managed_global_memory.hpp6
-rw-r--r--boost/interprocess/detail/managed_memory_impl.hpp61
-rw-r--r--boost/interprocess/detail/managed_multi_shared_memory.hpp15
-rw-r--r--boost/interprocess/detail/managed_open_or_create_impl.hpp12
-rw-r--r--boost/interprocess/detail/math_functions.hpp6
-rw-r--r--boost/interprocess/detail/min_max.hpp6
-rw-r--r--boost/interprocess/detail/move.hpp6
-rw-r--r--boost/interprocess/detail/mpl.hpp6
-rw-r--r--boost/interprocess/detail/multi_segment_services.hpp46
-rw-r--r--boost/interprocess/detail/named_proxy.hpp205
-rw-r--r--boost/interprocess/detail/nothrow.hpp41
-rw-r--r--boost/interprocess/detail/os_file_functions.hpp19
-rw-r--r--boost/interprocess/detail/os_thread_functions.hpp8
-rw-r--r--boost/interprocess/detail/pointer_type.hpp6
-rw-r--r--boost/interprocess/detail/portable_intermodule_singleton.hpp6
-rw-r--r--boost/interprocess/detail/posix_time_types_wrk.hpp6
-rw-r--r--boost/interprocess/detail/preprocessor.hpp203
-rw-r--r--boost/interprocess/detail/ptime_wrk.hpp6
-rw-r--r--boost/interprocess/detail/robust_emulation.hpp6
-rw-r--r--boost/interprocess/detail/segment_manager_helper.hpp68
-rw-r--r--boost/interprocess/detail/shared_dir_helpers.hpp6
-rw-r--r--boost/interprocess/detail/simple_swap.hpp29
-rw-r--r--boost/interprocess/detail/std_fwd.hpp65
-rw-r--r--boost/interprocess/detail/transform_iterator.hpp49
-rw-r--r--boost/interprocess/detail/type_traits.hpp6
-rw-r--r--boost/interprocess/detail/utilities.hpp19
-rw-r--r--boost/interprocess/detail/variadic_templates_tools.hpp138
-rw-r--r--boost/interprocess/detail/win32_api.hpp29
-rw-r--r--boost/interprocess/detail/windows_intermodule_singleton.hpp6
-rw-r--r--boost/interprocess/detail/workaround.hpp173
-rw-r--r--boost/interprocess/detail/xsi_shared_memory_device.hpp9
-rw-r--r--boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp6
-rw-r--r--boost/interprocess/errors.hpp6
-rw-r--r--boost/interprocess/exceptions.hpp7
-rw-r--r--boost/interprocess/file_mapping.hpp15
-rw-r--r--boost/interprocess/indexes/flat_map_index.hpp13
-rw-r--r--boost/interprocess/indexes/iset_index.hpp14
-rw-r--r--boost/interprocess/indexes/iunordered_set_index.hpp42
-rw-r--r--boost/interprocess/indexes/map_index.hpp11
-rw-r--r--boost/interprocess/indexes/null_index.hpp6
-rw-r--r--boost/interprocess/indexes/unordered_map_index.hpp11
-rw-r--r--boost/interprocess/interprocess_fwd.hpp42
-rw-r--r--boost/interprocess/ipc/message_queue.hpp34
-rw-r--r--boost/interprocess/managed_external_buffer.hpp6
-rw-r--r--boost/interprocess/managed_heap_memory.hpp8
-rw-r--r--boost/interprocess/managed_mapped_file.hpp6
-rw-r--r--boost/interprocess/managed_shared_memory.hpp6
-rw-r--r--boost/interprocess/managed_windows_shared_memory.hpp6
-rw-r--r--boost/interprocess/managed_xsi_shared_memory.hpp6
-rw-r--r--boost/interprocess/mapped_region.hpp20
-rw-r--r--boost/interprocess/mem_algo/detail/mem_algo_common.hpp64
-rw-r--r--boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp61
-rw-r--r--boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp983
-rw-r--r--boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp215
-rw-r--r--boost/interprocess/mem_algo/rbtree_best_fit.hpp237
-rw-r--r--boost/interprocess/mem_algo/simple_seq_fit.hpp6
-rw-r--r--boost/interprocess/offset_ptr.hpp36
-rw-r--r--boost/interprocess/permissions.hpp6
-rw-r--r--boost/interprocess/segment_manager.hpp84
-rw-r--r--boost/interprocess/shared_memory_object.hpp16
-rw-r--r--boost/interprocess/smart_ptr/deleter.hpp6
-rw-r--r--boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp6
-rw-r--r--boost/interprocess/smart_ptr/detail/shared_count.hpp20
-rw-r--r--boost/interprocess/smart_ptr/detail/sp_counted_base.hpp6
-rw-r--r--boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp8
-rw-r--r--boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp9
-rw-r--r--boost/interprocess/smart_ptr/enable_shared_from_this.hpp6
-rw-r--r--boost/interprocess/smart_ptr/intrusive_ptr.hpp11
-rw-r--r--boost/interprocess/smart_ptr/scoped_ptr.hpp12
-rw-r--r--boost/interprocess/smart_ptr/shared_ptr.hpp14
-rw-r--r--boost/interprocess/smart_ptr/unique_ptr.hpp6
-rw-r--r--boost/interprocess/smart_ptr/weak_ptr.hpp11
-rw-r--r--boost/interprocess/streams/bufferstream.hpp6
-rw-r--r--boost/interprocess/streams/vectorstream.hpp6
-rw-r--r--boost/interprocess/sync/detail/common_algorithms.hpp6
-rw-r--r--boost/interprocess/sync/detail/condition_algorithm_8a.hpp6
-rw-r--r--boost/interprocess/sync/detail/condition_any_algorithm.hpp6
-rw-r--r--boost/interprocess/sync/detail/locks.hpp6
-rw-r--r--boost/interprocess/sync/file_lock.hpp6
-rw-r--r--boost/interprocess/sync/interprocess_condition.hpp6
-rw-r--r--boost/interprocess/sync/interprocess_condition_any.hpp6
-rw-r--r--boost/interprocess/sync/interprocess_mutex.hpp6
-rw-r--r--boost/interprocess/sync/interprocess_recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/interprocess_semaphore.hpp8
-rw-r--r--boost/interprocess/sync/interprocess_sharable_mutex.hpp6
-rw-r--r--boost/interprocess/sync/interprocess_upgradable_mutex.hpp6
-rw-r--r--boost/interprocess/sync/lock_options.hpp6
-rw-r--r--boost/interprocess/sync/mutex_family.hpp6
-rw-r--r--boost/interprocess/sync/named_condition.hpp6
-rw-r--r--boost/interprocess/sync/named_condition_any.hpp6
-rw-r--r--boost/interprocess/sync/named_mutex.hpp6
-rw-r--r--boost/interprocess/sync/named_recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/named_semaphore.hpp6
-rw-r--r--boost/interprocess/sync/named_sharable_mutex.hpp6
-rw-r--r--boost/interprocess/sync/named_upgradable_mutex.hpp6
-rw-r--r--boost/interprocess/sync/null_mutex.hpp6
-rw-r--r--boost/interprocess/sync/posix/condition.hpp6
-rw-r--r--boost/interprocess/sync/posix/mutex.hpp6
-rw-r--r--boost/interprocess/sync/posix/named_mutex.hpp6
-rw-r--r--boost/interprocess/sync/posix/named_semaphore.hpp6
-rw-r--r--boost/interprocess/sync/posix/pthread_helpers.hpp6
-rw-r--r--boost/interprocess/sync/posix/ptime_to_timespec.hpp6
-rw-r--r--boost/interprocess/sync/posix/recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/posix/semaphore.hpp6
-rw-r--r--boost/interprocess/sync/posix/semaphore_wrapper.hpp14
-rw-r--r--boost/interprocess/sync/scoped_lock.hpp11
-rw-r--r--boost/interprocess/sync/sharable_lock.hpp11
-rw-r--r--boost/interprocess/sync/shm/named_condition.hpp6
-rw-r--r--boost/interprocess/sync/shm/named_condition_any.hpp6
-rw-r--r--boost/interprocess/sync/shm/named_creation_functor.hpp11
-rw-r--r--boost/interprocess/sync/shm/named_mutex.hpp6
-rw-r--r--boost/interprocess/sync/shm/named_recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/shm/named_semaphore.hpp6
-rw-r--r--boost/interprocess/sync/shm/named_upgradable_mutex.hpp6
-rw-r--r--boost/interprocess/sync/spin/condition.hpp6
-rw-r--r--boost/interprocess/sync/spin/interprocess_barrier.hpp6
-rw-r--r--boost/interprocess/sync/spin/mutex.hpp6
-rw-r--r--boost/interprocess/sync/spin/recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/spin/semaphore.hpp6
-rw-r--r--boost/interprocess/sync/spin/wait.hpp6
-rw-r--r--boost/interprocess/sync/upgradable_lock.hpp10
-rw-r--r--boost/interprocess/sync/windows/condition.hpp6
-rw-r--r--boost/interprocess/sync/windows/mutex.hpp6
-rw-r--r--boost/interprocess/sync/windows/named_condition.hpp6
-rw-r--r--boost/interprocess/sync/windows/named_condition_any.hpp6
-rw-r--r--boost/interprocess/sync/windows/named_mutex.hpp6
-rw-r--r--boost/interprocess/sync/windows/named_recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/windows/named_semaphore.hpp6
-rw-r--r--boost/interprocess/sync/windows/named_sync.hpp6
-rw-r--r--boost/interprocess/sync/windows/recursive_mutex.hpp6
-rw-r--r--boost/interprocess/sync/windows/semaphore.hpp6
-rw-r--r--boost/interprocess/sync/windows/sync_utils.hpp6
-rw-r--r--boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp6
-rw-r--r--boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp6
-rw-r--r--boost/interprocess/sync/windows/winapi_wrapper_common.hpp6
-rw-r--r--boost/interprocess/sync/xsi/advanced_xsi_semaphore.hpp6
-rw-r--r--boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp6
-rw-r--r--boost/interprocess/sync/xsi/xsi_named_mutex.hpp18
-rw-r--r--boost/interprocess/windows_shared_memory.hpp13
-rw-r--r--boost/interprocess/xsi_key.hpp6
-rw-r--r--boost/interprocess/xsi_shared_memory.hpp22
178 files changed, 1761 insertions, 2458 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,
diff --git a/boost/interprocess/anonymous_shared_memory.hpp b/boost/interprocess/anonymous_shared_memory.hpp
index aed868fb62..f73b55735d 100644
--- a/boost/interprocess/anonymous_shared_memory.hpp
+++ b/boost/interprocess/anonymous_shared_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_ANONYMOUS_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_ANONYMOUS_SHARED_MEMORY_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/containers/allocation_type.hpp b/boost/interprocess/containers/allocation_type.hpp
index cae9612fb4..7175207473 100644
--- a/boost/interprocess/containers/allocation_type.hpp
+++ b/boost/interprocess/containers/allocation_type.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_ALLOCATION_TYPE_HPP
#define BOOST_INTERPROCESS_CONTAINERS_ALLOCATION_TYPE_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -37,4 +41,4 @@ static const allocation_type zero_memory = boost::container::zero_memory;
#include <boost/interprocess/detail/config_end.hpp>
-#endif // #ifndef BOOST_INTERPROCESS_CONTAINERS_VERSION_TYPE_HPP
+#endif // #ifndef BOOST_INTERPROCESS_CONTAINERS_ALLOCATION_TYPE_HPP
diff --git a/boost/interprocess/containers/containers_fwd.hpp b/boost/interprocess/containers/containers_fwd.hpp
index 4175390599..9620a92ee9 100644
--- a/boost/interprocess/containers/containers_fwd.hpp
+++ b/boost/interprocess/containers/containers_fwd.hpp
@@ -13,7 +13,11 @@
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-#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/containers/deque.hpp b/boost/interprocess/containers/deque.hpp
index a40db80a19..5007306005 100644
--- a/boost/interprocess/containers/deque.hpp
+++ b/boost/interprocess/containers/deque.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_DEQUE_HPP
#define BOOST_INTERPROCESS_CONTAINERS_DEQUE_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/containers/flat_map.hpp b/boost/interprocess/containers/flat_map.hpp
index 744d6e972e..6b9262b8df 100644
--- a/boost/interprocess/containers/flat_map.hpp
+++ b/boost/interprocess/containers/flat_map.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_FLAT_MAP_HPP
#define BOOST_INTERPROCESS_CONTAINERS_FLAT_MAP_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/containers/flat_set.hpp b/boost/interprocess/containers/flat_set.hpp
index 51c49925c0..9c729a67e0 100644
--- a/boost/interprocess/containers/flat_set.hpp
+++ b/boost/interprocess/containers/flat_set.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_FLAT_SET_HPP
#define BOOST_INTERPROCESS_CONTAINERS_FLAT_SET_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/containers/list.hpp b/boost/interprocess/containers/list.hpp
index 0e855efaaf..465e882864 100644
--- a/boost/interprocess/containers/list.hpp
+++ b/boost/interprocess/containers/list.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_LIST_HPP
#define BOOST_INTERPROCESS_CONTAINERS_LIST_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/containers/map.hpp b/boost/interprocess/containers/map.hpp
index 4efed89c10..966abdf396 100644
--- a/boost/interprocess/containers/map.hpp
+++ b/boost/interprocess/containers/map.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_MAP_HPP
#define BOOST_INTERPROCESS_CONTAINERS_MAP_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/containers/pair.hpp b/boost/interprocess/containers/pair.hpp
index 2ca631db4a..62a1453284 100644
--- a/boost/interprocess/containers/pair.hpp
+++ b/boost/interprocess/containers/pair.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_PAIR_HPP
#define BOOST_INTERPROCESS_CONTAINERS_PAIR_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/containers/set.hpp b/boost/interprocess/containers/set.hpp
index 09ea6c116d..433607ba28 100644
--- a/boost/interprocess/containers/set.hpp
+++ b/boost/interprocess/containers/set.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_SET_HPP
#define BOOST_INTERPROCESS_CONTAINERS_SET_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/containers/slist.hpp b/boost/interprocess/containers/slist.hpp
index c3e1744ea3..1f1aee63de 100644
--- a/boost/interprocess/containers/slist.hpp
+++ b/boost/interprocess/containers/slist.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_SLIST_HPP
#define BOOST_INTERPROCESS_CONTAINERS_SLIST_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/containers/stable_vector.hpp b/boost/interprocess/containers/stable_vector.hpp
index 530056dd6e..f6d1ee1b04 100644
--- a/boost/interprocess/containers/stable_vector.hpp
+++ b/boost/interprocess/containers/stable_vector.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_STABLE_VECTOR_HPP
#define BOOST_INTERPROCESS_CONTAINERS_STABLE_VECTOR_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/containers/string.hpp b/boost/interprocess/containers/string.hpp
index 805bfe4f14..bd1286411a 100644
--- a/boost/interprocess/containers/string.hpp
+++ b/boost/interprocess/containers/string.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_STRING_HPP
#define BOOST_INTERPROCESS_CONTAINERS_STRING_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/containers/vector.hpp b/boost/interprocess/containers/vector.hpp
index bfae4f833f..89b3e47149 100644
--- a/boost/interprocess/containers/vector.hpp
+++ b/boost/interprocess/containers/vector.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_VECTOR_HPP
#define BOOST_INTERPROCESS_CONTAINERS_VECTOR_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/containers/version_type.hpp b/boost/interprocess/containers/version_type.hpp
index 92ef49f31d..22b5eef4ff 100644
--- a/boost/interprocess/containers/version_type.hpp
+++ b/boost/interprocess/containers/version_type.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONTAINERS_VERSION_TYPE_HPP
#define BOOST_INTERPROCESS_CONTAINERS_VERSION_TYPE_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/creation_tags.hpp b/boost/interprocess/creation_tags.hpp
index 9ff27bffa0..faf4e6f2d6 100644
--- a/boost/interprocess/creation_tags.hpp
+++ b/boost/interprocess/creation_tags.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CREATION_TAGS_HPP
#define BOOST_INTERPROCESS_CREATION_TAGS_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/detail/atomic.hpp b/boost/interprocess/detail/atomic.hpp
index 96b7729d7e..e32f056c3d 100644
--- a/boost/interprocess/detail/atomic.hpp
+++ b/boost/interprocess/detail/atomic.hpp
@@ -15,7 +15,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_ATOMIC_HPP
#define BOOST_INTERPROCESS_DETAIL_ATOMIC_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/detail/cast_tags.hpp b/boost/interprocess/detail/cast_tags.hpp
index 0019af7933..e47b86344c 100644
--- a/boost/interprocess/detail/cast_tags.hpp
+++ b/boost/interprocess/detail/cast_tags.hpp
@@ -8,16 +8,17 @@
//
//////////////////////////////////////////////////////////////////////////////
-#ifndef BOOST_INTERPROCESS_CAST_TAGS_HPP
-#define BOOST_INTERPROCESS_CAST_TAGS_HPP
+#ifndef BOOST_INTERPROCESS_DETAIL_CAST_TAGS_HPP
+#define BOOST_INTERPROCESS_DETAIL_CAST_TAGS_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-
namespace boost { namespace interprocess { namespace ipcdetail {
struct static_cast_tag {};
@@ -27,7 +28,4 @@ struct reinterpret_cast_tag {};
}}} //namespace boost { namespace interprocess { namespace ipcdetail {
-#include <boost/interprocess/detail/config_end.hpp>
-
-#endif //#ifndef BOOST_INTERPROCESS_CAST_TAGS_HPP
-
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_CAST_TAGS_HPP
diff --git a/boost/interprocess/detail/config_begin.hpp b/boost/interprocess/detail/config_begin.hpp
index 8bcdcac587..b1cf078e00 100644
--- a/boost/interprocess/detail/config_begin.hpp
+++ b/boost/interprocess/detail/config_begin.hpp
@@ -24,6 +24,7 @@
#pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data
#pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier"
#pragma warning (disable : 4355) // "this" : used in base member initializer list
+ #pragma warning (disable : 4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
#pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated
#pragma warning (disable : 4511) // copy constructor could not be generated
#pragma warning (disable : 4512) // assignment operator could not be generated
diff --git a/boost/interprocess/detail/file_locking_helpers.hpp b/boost/interprocess/detail/file_locking_helpers.hpp
index 6a7ce8ef3b..c6688e619c 100644
--- a/boost/interprocess/detail/file_locking_helpers.hpp
+++ b/boost/interprocess/detail/file_locking_helpers.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_HPP
#define BOOST_INTERPROCESS_FILE_LOCKING_HELPERS_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/detail/file_wrapper.hpp b/boost/interprocess/detail/file_wrapper.hpp
index 507ec478dc..58f28e97f8 100644
--- a/boost/interprocess/detail/file_wrapper.hpp
+++ b/boost/interprocess/detail/file_wrapper.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_FILE_WRAPPER_HPP
#define BOOST_INTERPROCESS_DETAIL_FILE_WRAPPER_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -21,6 +25,7 @@
#include <boost/interprocess/creation_tags.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/interprocess/creation_tags.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
namespace boost {
namespace interprocess {
@@ -127,8 +132,8 @@ inline bool file_wrapper::get_size(offset_t &size) const
inline void file_wrapper::swap(file_wrapper &other)
{
- std::swap(m_handle, other.m_handle);
- std::swap(m_mode, other.m_mode);
+ (simple_swap)(m_handle, other.m_handle);
+ (simple_swap)(m_mode, other.m_mode);
m_filename.swap(other.m_filename);
}
diff --git a/boost/interprocess/detail/in_place_interface.hpp b/boost/interprocess/detail/in_place_interface.hpp
index 5af5a0d2df..013691ad78 100644
--- a/boost/interprocess/detail/in_place_interface.hpp
+++ b/boost/interprocess/detail/in_place_interface.hpp
@@ -11,14 +11,18 @@
#ifndef BOOST_INTERPROCESS_IN_PLACE_INTERFACE_HPP
#define BOOST_INTERPROCESS_IN_PLACE_INTERFACE_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
-#include <boost/type_traits/alignment_of.hpp>
+#include <boost/container/detail/type_traits.hpp> //alignment_of, aligned_storage
#include <typeinfo> //typeid
//!\file
@@ -47,7 +51,7 @@ template<class T>
struct placement_destroy : public in_place_interface
{
placement_destroy()
- : in_place_interface(::boost::alignment_of<T>::value, sizeof(T), typeid(T).name())
+ : in_place_interface(::boost::container::container_detail::alignment_of<T>::value, sizeof(T), typeid(T).name())
{}
virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed)
diff --git a/boost/interprocess/detail/intermodule_singleton.hpp b/boost/interprocess/detail/intermodule_singleton.hpp
index a99934893d..9279e92b4c 100644
--- a/boost/interprocess/detail/intermodule_singleton.hpp
+++ b/boost/interprocess/detail/intermodule_singleton.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_HPP
#define BOOST_INTERPROCESS_INTERMODULE_SINGLETON_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/detail/intermodule_singleton_common.hpp b/boost/interprocess/detail/intermodule_singleton_common.hpp
index 10c9eceabb..c890c326bc 100644
--- a/boost/interprocess/detail/intermodule_singleton_common.hpp
+++ b/boost/interprocess/detail/intermodule_singleton_common.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP
#define BOOST_INTERPROCESS_INTERMODULE_SINGLETON_COMMON_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
@@ -21,7 +25,7 @@
#include <boost/interprocess/detail/atomic.hpp>
#include <boost/interprocess/detail/os_thread_functions.hpp>
#include <boost/interprocess/exceptions.hpp>
-#include <boost/type_traits/type_with_alignment.hpp>
+#include <boost/container/detail/type_traits.hpp> //alignment_of, aligned_storage
#include <boost/interprocess/detail/mpl.hpp>
#include <boost/interprocess/sync/spin/wait.hpp>
#include <boost/assert.hpp>
@@ -286,7 +290,7 @@ class intermodule_singleton_common
static union mem_holder_t
{
unsigned char map_mem [sizeof(ThreadSafeGlobalMap)];
- ::boost::detail::max_align aligner;
+ ::boost::container::container_detail::max_align_t aligner;
} mem_holder;
};
diff --git a/boost/interprocess/detail/interprocess_tester.hpp b/boost/interprocess/detail/interprocess_tester.hpp
index 8c00c4c0c4..368820f82a 100644
--- a/boost/interprocess/detail/interprocess_tester.hpp
+++ b/boost/interprocess/detail/interprocess_tester.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_INTERPROCESS_TESTER_HPP
#define BOOST_INTERPROCESS_DETAIL_INTERPROCESS_TESTER_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/detail/intersegment_ptr.hpp b/boost/interprocess/detail/intersegment_ptr.hpp
index fa1b277ef4..1bf97e5a2b 100644
--- a/boost/interprocess/detail/intersegment_ptr.hpp
+++ b/boost/interprocess/detail/intersegment_ptr.hpp
@@ -11,32 +11,36 @@
#ifndef BOOST_INTERPROCESS_INTERSEGMENT_PTR_HPP
#define BOOST_INTERPROCESS_INTERSEGMENT_PTR_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-
+// interprocess
#include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
-#include <boost/interprocess/detail/math_functions.hpp>
-#include <boost/interprocess/detail/cast_tags.hpp>
-#include <boost/assert.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/interprocess/sync/interprocess_mutex.hpp>
#include <boost/interprocess/containers/flat_map.hpp>
#include <boost/interprocess/containers/vector.hpp> //vector
#include <boost/interprocess/containers/set.hpp> //set
-#include <boost/detail/no_exceptions_support.hpp>
+// interprocess/detail
+#include <boost/interprocess/detail/multi_segment_services.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/interprocess/detail/math_functions.hpp>
+#include <boost/interprocess/detail/cast_tags.hpp>
#include <boost/interprocess/detail/mpl.hpp>
-#include <climits>
-#include <iterator>
+// other boost
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/static_assert.hpp> //BOOST_STATIC_ASSERT
-#include <climits> //CHAR_BIT
#include <boost/integer/static_log2.hpp>
#include <boost/assert.hpp> //BOOST_ASSERT
-#include <boost/interprocess/detail/multi_segment_services.hpp>
+// std
+#include <climits> //CHAR_BIT
//!\file
//!
@@ -753,7 +757,7 @@ class intersegment_ptr : public flat_map_intersegment<interprocess_mutex>
bool operator! () const
{ return base_t::is_null(); }
- //!Swaps two intersegment_ptr-s. More efficient than std::swap.
+ //!Swaps two intersegment_ptr-s. More efficient than standard swap.
//!Never throws.
void swap(intersegment_ptr &other)
{ base_t::swap(other); }
diff --git a/boost/interprocess/detail/managed_global_memory.hpp b/boost/interprocess/detail/managed_global_memory.hpp
index baa6361e69..0f389fda27 100644
--- a/boost/interprocess/detail/managed_global_memory.hpp
+++ b/boost/interprocess/detail/managed_global_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_HPP
#define BOOST_INTERPROCESS_BASIC_GLOBAL_MEMORY_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/detail/managed_memory_impl.hpp b/boost/interprocess/detail/managed_memory_impl.hpp
index b77c53274d..0a82230cbd 100644
--- a/boost/interprocess/detail/managed_memory_impl.hpp
+++ b/boost/interprocess/detail/managed_memory_impl.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MANAGED_MEMORY_IMPL_HPP
#define BOOST_INTERPROCESS_DETAIL_MANAGED_MEMORY_IMPL_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -25,12 +29,12 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/segment_manager.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
+#include <boost/interprocess/detail/nothrow.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
//
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
//
-#include <utility>
-#include <fstream>
-#include <new>
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
#include <boost/assert.hpp>
//!\file
@@ -173,7 +177,7 @@ class basic_managed_memory_impl
//throw if constructor allocates memory. So we must catch it.
BOOST_TRY{
//Let's construct the allocator in memory
- mp_header = new(addr) segment_manager(size);
+ mp_header = ::new(addr, boost_container_new_t()) segment_manager(size);
}
BOOST_CATCH(...){
return false;
@@ -278,24 +282,19 @@ class basic_managed_memory_impl
//!Searches for nbytes of free memory in the segment, marks the
//!memory as used and return the pointer to the memory. If no memory
//!is available returns 0. Never throws.
- void* allocate (size_type nbytes, std::nothrow_t nothrow)
- { return mp_header->allocate(nbytes, nothrow); }
+ void* allocate (size_type nbytes, const std::nothrow_t &tag)
+ { return mp_header->allocate(nbytes, tag); }
//!Allocates nbytes bytes aligned to "alignment" bytes. "alignment"
//!must be power of two. If no memory
//!is available returns 0. Never throws.
- void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t nothrow)
- { return mp_header->allocate_aligned(nbytes, alignment, nothrow); }
+ void * allocate_aligned (size_type nbytes, size_type alignment, const std::nothrow_t &tag)
+ { return mp_header->allocate_aligned(nbytes, alignment, tag); }
template<class T>
- std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- T *reuse_ptr = 0)
- {
- return mp_header->allocation_command
- (command, limit_size, preferred_size, received_size, reuse_ptr);
- }
+ T * allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type &prefer_in_recvd_out_size, T *&reuse)
+ { return mp_header->allocation_command(command, limit_size, prefer_in_recvd_out_size, reuse); }
//!Allocates nbytes bytes aligned to "alignment" bytes. "alignment"
//!must be power of two. If no
@@ -319,14 +318,14 @@ class basic_managed_memory_impl
//!Allocates n_elements of elem_bytes bytes.
//!Non-throwing version. chain.size() is not increased on failure.
- void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
- { mp_header->allocate_many(std::nothrow_t(), elem_bytes, n_elements, chain); }
+ void allocate_many(const std::nothrow_t &tag, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
+ { mp_header->allocate_many(tag, elem_bytes, n_elements, chain); }
//!Allocates n_elements, each one of
//!element_lengths[i]*sizeof_element bytes.
//!Non-throwing version. chain.size() is not increased on failure.
- void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
- { mp_header->allocate_many(std::nothrow_t(), elem_sizes, n_elements, sizeof_element, chain); }
+ void allocate_many(const std::nothrow_t &tag, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
+ { mp_header->allocate_many(tag, elem_sizes, n_elements, sizeof_element, chain); }
//!Deallocates all elements contained in chain.
//!Never throws.
@@ -406,8 +405,8 @@ class basic_managed_memory_impl
//!before freeing the memory.
template <class T>
typename segment_manager::template construct_proxy<T>::type
- construct(char_ptr_holder_t name, std::nothrow_t nothrow)
- { return mp_header->template construct<T>(name, nothrow); }
+ construct(char_ptr_holder_t name, const std::nothrow_t &tag)
+ { return mp_header->template construct<T>(name, tag); }
//!Finds or creates a named object or array in memory
//!
@@ -427,8 +426,8 @@ class basic_managed_memory_impl
//!before freeing the memory.
template <class T>
typename segment_manager::template construct_proxy<T>::type
- find_or_construct(char_ptr_holder_t name, std::nothrow_t nothrow)
- { return mp_header->template find_or_construct<T>(name, nothrow); }
+ find_or_construct(char_ptr_holder_t name, const std::nothrow_t &tag)
+ { return mp_header->template find_or_construct<T>(name, tag); }
//!Creates a named array from iterators in memory
//!
@@ -492,8 +491,8 @@ class basic_managed_memory_impl
//!destructors of created objects are called before freeing the memory.*/
template <class T>
typename segment_manager::template construct_iter_proxy<T>::type
- construct_it(char_ptr_holder_t name, std::nothrow_t nothrow)
- { return mp_header->template construct_it<T>(name, nothrow); }
+ construct_it(char_ptr_holder_t name, const std::nothrow_t &tag)
+ { return mp_header->template construct_it<T>(name, tag); }
//!Finds or creates a named array from iterators in memory
//!
@@ -515,8 +514,8 @@ class basic_managed_memory_impl
//!destructors of created objects are called before freeing the memory.*/
template <class T>
typename segment_manager::template construct_iter_proxy<T>::type
- find_or_construct_it(char_ptr_holder_t name, std::nothrow_t nothrow)
- { return mp_header->template find_or_construct_it<T>(name, nothrow); }
+ find_or_construct_it(char_ptr_holder_t name, const std::nothrow_t &tag)
+ { return mp_header->template find_or_construct_it<T>(name, tag); }
//!Calls a functor and guarantees that no new construction, search or
//!destruction will be executed by any process while executing the object
@@ -716,7 +715,7 @@ class basic_managed_memory_impl
//!Swaps the segment manager's managed by this managed memory segment.
//!NOT thread-safe. Never throws.
void swap(basic_managed_memory_impl &other)
- { std::swap(mp_header, other.mp_header); }
+ { (simple_swap)(mp_header, other.mp_header); }
private:
segment_manager *mp_header;
diff --git a/boost/interprocess/detail/managed_multi_shared_memory.hpp b/boost/interprocess/detail/managed_multi_shared_memory.hpp
index 4c2ef14dcc..3d0ba669de 100644
--- a/boost/interprocess/detail/managed_multi_shared_memory.hpp
+++ b/boost/interprocess/detail/managed_multi_shared_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_MULTI_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_MANAGED_MULTI_SHARED_MEMORY_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -20,7 +24,7 @@
#include <boost/interprocess/detail/managed_memory_impl.hpp>
#include <boost/interprocess/creation_tags.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/interprocess/detail/multi_segment_services.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
@@ -29,10 +33,13 @@
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/permissions.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp> //managed_open_or_create_impl
-#include <new>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/streams/vectorstream.hpp>
-#include <memory>
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
+#include <string> //string
+#include <new> //bad_alloc
+#include <ostream>//std::ends
+
#include <boost/assert.hpp>
//These includes needed to fulfill default template parameters of
//predeclarations in interprocess_fwd.hpp
diff --git a/boost/interprocess/detail/managed_open_or_create_impl.hpp b/boost/interprocess/detail/managed_open_or_create_impl.hpp
index bd08be56d3..9351f391f9 100644
--- a/boost/interprocess/detail/managed_open_or_create_impl.hpp
+++ b/boost/interprocess/detail/managed_open_or_create_impl.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_OPEN_OR_CREATE_IMPL
#define BOOST_INTERPROCESS_MANAGED_OPEN_OR_CREATE_IMPL
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -27,8 +31,7 @@
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/detail/mpl.hpp>
#include <boost/interprocess/permissions.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <boost/type_traits/type_with_alignment.hpp>
+#include <boost/container/detail/type_traits.hpp> //alignment_of, aligned_storage
#include <boost/interprocess/sync/spin/wait.hpp>
#include <boost/move/move.hpp>
#include <boost/cstdint.hpp>
@@ -112,7 +115,8 @@ class managed_open_or_create_impl
ct_rounded_size
< sizeof(boost::uint32_t)
, MemAlignment ? (MemAlignment) :
- (::boost::alignment_of< ::boost::detail::max_align >::value)
+ (::boost::container::container_detail::alignment_of
+ < ::boost::container::container_detail::max_align_t >::value)
>::value;
managed_open_or_create_impl()
diff --git a/boost/interprocess/detail/math_functions.hpp b/boost/interprocess/detail/math_functions.hpp
index 3826f161e2..a19efac1a4 100644
--- a/boost/interprocess/detail/math_functions.hpp
+++ b/boost/interprocess/detail/math_functions.hpp
@@ -16,7 +16,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_HPP
#define BOOST_INTERPROCESS_DETAIL_MATH_FUNCTIONS_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/detail/min_max.hpp b/boost/interprocess/detail/min_max.hpp
index a5d01f404b..2097ff4246 100644
--- a/boost/interprocess/detail/min_max.hpp
+++ b/boost/interprocess/detail/min_max.hpp
@@ -13,7 +13,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MIN_MAX_HPP
#define BOOST_INTERPROCESS_DETAIL_MIN_MAX_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/detail/move.hpp b/boost/interprocess/detail/move.hpp
index 22df7bd771..3a2c29b051 100644
--- a/boost/interprocess/detail/move.hpp
+++ b/boost/interprocess/detail/move.hpp
@@ -14,7 +14,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MOVE_HPP
#define BOOST_INTERPROCESS_DETAIL_MOVE_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/detail/mpl.hpp b/boost/interprocess/detail/mpl.hpp
index 29f3893038..08167db7fb 100644
--- a/boost/interprocess/detail/mpl.hpp
+++ b/boost/interprocess/detail/mpl.hpp
@@ -13,7 +13,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MPL_HPP
#define BOOST_INTERPROCESS_DETAIL_MPL_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/detail/multi_segment_services.hpp b/boost/interprocess/detail/multi_segment_services.hpp
deleted file mode 100644
index dd9d5f82fd..0000000000
--- a/boost/interprocess/detail/multi_segment_services.hpp
+++ /dev/null
@@ -1,46 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-2012. 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/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTERPROCESS_MULTI_SEGMENT_SERVICES_HPP
-#define BOOST_INTERPROCESS_MULTI_SEGMENT_SERVICES_HPP
-
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-
-
-/*!\file
- Describes a named shared memory allocation user class.
-*/
-
-namespace boost {
-
-namespace interprocess {
-
-class multi_segment_services
-{
- public:
- virtual std::pair<void *, std::size_t> create_new_segment(std::size_t mem) = 0;
- virtual bool update_segments () = 0;
- virtual ~multi_segment_services() = 0;
-};
-
-inline multi_segment_services::~multi_segment_services()
-{}
-
-
-}} //namespace boost { namespace interprocess {
-
-#include <boost/interprocess/detail/config_end.hpp>
-
-#endif //#ifdef BOOST_INTERPROCESS_MULTI_SEGMENT_SERVICES_HPP
diff --git a/boost/interprocess/detail/named_proxy.hpp b/boost/interprocess/detail/named_proxy.hpp
index ee6668c2d5..04030f2d4f 100644
--- a/boost/interprocess/detail/named_proxy.hpp
+++ b/boost/interprocess/detail/named_proxy.hpp
@@ -11,24 +11,28 @@
#ifndef BOOST_INTERPROCESS_NAMED_PROXY_HPP
#define BOOST_INTERPROCESS_NAMED_PROXY_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <new>
-#include <iterator>
+// interprocess/detail
#include <boost/interprocess/detail/in_place_interface.hpp>
#include <boost/interprocess/detail/mpl.hpp>
-
+#include <boost/move/utility_core.hpp>
#ifndef BOOST_INTERPROCESS_PERFECT_FORWARDING
-#include <boost/interprocess/detail/preprocessor.hpp>
+#include <boost/move/detail/fwd_macros.hpp>
#else
#include <boost/move/utility_core.hpp>
#include <boost/interprocess/detail/variadic_templates_tools.hpp>
#endif //#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
+#include <boost/container/detail/placement_new.hpp>
//!\file
//!Describes a proxy class that implements named allocation syntax.
@@ -40,10 +44,10 @@ namespace ipcdetail {
#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
template<class T, bool is_iterator, class ...Args>
-struct CtorNArg : public placement_destroy<T>
+struct CtorArgN : public placement_destroy<T>
{
typedef bool_<is_iterator> IsIterator;
- typedef CtorNArg<T, is_iterator, Args...> self_t;
+ typedef CtorArgN<T, is_iterator, Args...> self_t;
typedef typename build_number_seq<sizeof...(Args)>::type index_tuple_t;
self_t& operator++()
@@ -54,7 +58,7 @@ struct CtorNArg : public placement_destroy<T>
self_t operator++(int) { return ++*this; *this; }
- CtorNArg(Args && ...args)
+ CtorArgN(Args && ...args)
: args_(args...)
{}
@@ -72,11 +76,11 @@ struct CtorNArg : public placement_destroy<T>
private:
template<int ...IdxPack>
void construct(void *mem, true_, const index_tuple<IdxPack...>&)
- { new((void*)mem)T(*boost::forward<Args>(get<IdxPack>(args_))...); }
+ { ::new((void*)mem, boost_container_new_t())T(*boost::forward<Args>(get<IdxPack>(args_))...); }
template<int ...IdxPack>
void construct(void *mem, false_, const index_tuple<IdxPack...>&)
- { new((void*)mem)T(boost::forward<Args>(get<IdxPack>(args_))...); }
+ { ::new((void*)mem, boost_container_new_t())T(boost::forward<Args>(get<IdxPack>(args_))...); }
template<int ...IdxPack>
void do_increment(true_, const index_tuple<IdxPack...>&)
@@ -120,7 +124,7 @@ class named_proxy
template<class ...Args>
T *operator()(Args &&...args) const
{
- CtorNArg<T, is_iterator, Args...> &&ctor_obj = CtorNArg<T, is_iterator, Args...>
+ CtorArgN<T, is_iterator, Args...> &&ctor_obj = CtorArgN<T, is_iterator, Args...>
(boost::forward<Args>(args)...);
return mp_mngr->template
generic_construct<T>(mp_name, m_num, m_find, m_dothrow, ctor_obj);
@@ -133,29 +137,6 @@ class named_proxy
#else //#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
-//!Function object that makes placement new
-//!without arguments
-template<class T>
-struct Ctor0Arg : public placement_destroy<T>
-{
- typedef Ctor0Arg self_t;
-
- Ctor0Arg(){}
-
- self_t& operator++() { return *this; }
- self_t operator++(int) { return *this; }
-
- void construct(void *mem)
- { new((void*)mem)T; }
-
- virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed)
- {
- T* memory = static_cast<T*>(mem);
- for(constructed = 0; constructed < num; ++constructed)
- new((void*)memory++)T;
- }
-};
-
////////////////////////////////////////////////////////////////
// What the macro should generate (n == 2):
//
@@ -207,66 +188,61 @@ struct Ctor0Arg : public placement_destroy<T>
// };
////////////////////////////////////////////////////////////////
-//Note:
-//We define template parameters as const references to
-//be able to bind temporaries. After that we will un-const them.
-//This cast is ugly but it is necessary until "perfect forwarding"
-//is achieved in C++0x. Meanwhile, if we want to be able to
-//bind lvalues with non-const references, we have to be ugly
-#define BOOST_PP_LOCAL_MACRO(n) \
- template<class T, bool is_iterator, BOOST_PP_ENUM_PARAMS(n, class P) > \
- struct BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) \
- : public placement_destroy<T> \
- { \
- typedef bool_<is_iterator> IsIterator; \
- typedef BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) self_t; \
- \
- void do_increment(true_) \
- { BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_INC, _); } \
- \
- void do_increment(false_){} \
- \
- self_t& operator++() \
- { \
- this->do_increment(IsIterator()); \
- return *this; \
- } \
- \
- self_t operator++(int) { return ++*this; *this; } \
- \
- BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) \
- ( BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_LIST, _) ) \
- : BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_INIT, _) {} \
- \
- virtual void construct_n(void *mem \
- , std::size_t num \
- , std::size_t &constructed) \
- { \
- T* memory = static_cast<T*>(mem); \
- for(constructed = 0; constructed < num; ++constructed){ \
- this->construct(memory++, IsIterator()); \
- this->do_increment(IsIterator()); \
- } \
- } \
- \
- private: \
- void construct(void *mem, true_) \
- { \
- new((void*)mem) T \
- (BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD, _)); \
- } \
- \
- void construct(void *mem, false_) \
- { \
- new((void*)mem) T \
- (BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_MEMBER_FORWARD, _)); \
- } \
- \
- BOOST_PP_REPEAT(n, BOOST_INTERPROCESS_PP_PARAM_DEFINE, _) \
- }; \
+#define BOOST_INTERPROCESS_NAMED_PROXY_CTORARGN(N)\
+\
+template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
+struct CtorArg##N : placement_destroy<T>\
+{\
+ typedef CtorArg##N self_t;\
+ \
+ CtorArg##N ( BOOST_MOVE_UREF##N )\
+ BOOST_MOVE_COLON##N BOOST_MOVE_FWD_INIT##N{}\
+ \
+ virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed)\
+ {\
+ T* memory = static_cast<T*>(mem);\
+ for(constructed = 0; constructed < num; ++constructed){\
+ ::new((void*)memory++) T ( BOOST_MOVE_MFWD##N );\
+ }\
+ }\
+ \
+ private:\
+ BOOST_MOVE_MREF##N\
+};\
//!
-#define BOOST_PP_LOCAL_LIMITS (1, BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS)
-#include BOOST_PP_LOCAL_ITERATE()
+BOOST_MOVE_ITERATE_0TO9(BOOST_INTERPROCESS_NAMED_PROXY_CTORARGN)
+#undef BOOST_INTERPROCESS_NAMED_PROXY_CTORARGN
+
+#define BOOST_INTERPROCESS_NAMED_PROXY_CTORITN(N)\
+\
+template<class T BOOST_MOVE_I##N BOOST_MOVE_CLASS##N > \
+struct CtorIt##N : public placement_destroy<T>\
+{\
+ typedef CtorIt##N self_t;\
+ \
+ self_t& operator++()\
+ { BOOST_MOVE_MINC##N; return *this; }\
+ \
+ self_t operator++(int) { return ++*this; *this; }\
+ \
+ CtorIt##N ( BOOST_MOVE_VAL##N )\
+ BOOST_MOVE_COLON##N BOOST_MOVE_VAL_INIT##N{}\
+ \
+ virtual void construct_n(void *mem, std::size_t num, std::size_t &constructed)\
+ {\
+ T* memory = static_cast<T*>(mem);\
+ for(constructed = 0; constructed < num; ++constructed){\
+ ::new((void*)memory++) T( BOOST_MOVE_MITFWD##N );\
+ ++(*this);\
+ }\
+ }\
+ \
+ private:\
+ BOOST_MOVE_MEMB##N\
+};\
+//!
+BOOST_MOVE_ITERATE_0TO9(BOOST_INTERPROCESS_NAMED_PROXY_CTORITN)
+#undef BOOST_INTERPROCESS_NAMED_PROXY_CTORITN
//!Describes a proxy class that implements named
//!allocation syntax.
@@ -290,32 +266,21 @@ class named_proxy
, m_find(find), m_dothrow(dothrow)
{}
- //!makes a named allocation and calls the
- //!default constructor
- T *operator()() const
- {
- Ctor0Arg<T> ctor_obj;
- return mp_mngr->template
- generic_construct<T>(mp_name, m_num, m_find, m_dothrow, ctor_obj);
- }
- //!
-
- #define BOOST_PP_LOCAL_MACRO(n) \
- template<BOOST_PP_ENUM_PARAMS(n, class P)> \
- T *operator()(BOOST_PP_ENUM (n, BOOST_INTERPROCESS_PP_PARAM_LIST, _)) const\
- { \
- typedef BOOST_PP_CAT(BOOST_PP_CAT(Ctor, n), Arg) \
- <T, is_iterator, BOOST_PP_ENUM_PARAMS(n, P)> \
- ctor_obj_t; \
- ctor_obj_t ctor_obj \
- (BOOST_PP_ENUM(n, BOOST_INTERPROCESS_PP_PARAM_FORWARD, _)); \
- return mp_mngr->template generic_construct<T> \
- (mp_name, m_num, m_find, m_dothrow, ctor_obj); \
- } \
- //!
-
- #define BOOST_PP_LOCAL_LIMITS ( 1, BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS )
- #include BOOST_PP_LOCAL_ITERATE()
+ #define BOOST_INTERPROCESS_NAMED_PROXY_CALL_OPERATOR(N)\
+ \
+ BOOST_MOVE_TMPL_LT##N BOOST_MOVE_CLASS##N BOOST_MOVE_GT##N \
+ T *operator()( BOOST_MOVE_UREF##N ) const\
+ {\
+ typedef typename if_c<is_iterator \
+ , CtorIt##N<T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \
+ , CtorArg##N<T BOOST_MOVE_I##N BOOST_MOVE_TARG##N> \
+ >::type ctor_obj_t;\
+ ctor_obj_t ctor_obj = ctor_obj_t( BOOST_MOVE_FWD##N );\
+ return mp_mngr->template generic_construct<T>(mp_name, m_num, m_find, m_dothrow, ctor_obj);\
+ }\
+ //
+ BOOST_MOVE_ITERATE_0TO9(BOOST_INTERPROCESS_NAMED_PROXY_CALL_OPERATOR)
+ #undef BOOST_INTERPROCESS_NAMED_PROXY_CALL_OPERATOR
////////////////////////////////////////////////////////////////////////
// What the macro should generate (n == 2)
@@ -324,7 +289,7 @@ class named_proxy
// template <class P1, class P2>
// T *operator()(P1 &p1, P2 &p2) const
// {
- // typedef Ctor2Arg
+ // typedef CtorArg2
// <T, is_iterator, P1, P2>
// ctor_obj_t;
// ctor_obj_t ctor_obj(p1, p2);
diff --git a/boost/interprocess/detail/nothrow.hpp b/boost/interprocess/detail/nothrow.hpp
new file mode 100644
index 0000000000..646c9e04a3
--- /dev/null
+++ b/boost/interprocess/detail/nothrow.hpp
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_INTERPROCESS_DETAIL_NOTHROW_HPP
+#define BOOST_INTERPROCESS_DETAIL_NOTHROW_HPP
+
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
+# pragma once
+#endif
+
+namespace std { //no namespace versioning in clang+libc++
+
+struct nothrow_t;
+
+} //namespace std {
+
+namespace boost{ namespace interprocess {
+
+template <int Dummy = 0>
+struct nothrow
+{
+ static const std::nothrow_t &get() { return *pnothrow; }
+ static std::nothrow_t *pnothrow;
+};
+
+template <int Dummy>
+std::nothrow_t *nothrow<Dummy>::pnothrow;
+
+}} //namespace boost{ namespace interprocess {
+
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_NOTHROW_HPP
diff --git a/boost/interprocess/detail/os_file_functions.hpp b/boost/interprocess/detail/os_file_functions.hpp
index 1b54807ab1..bcb9576a19 100644
--- a/boost/interprocess/detail/os_file_functions.hpp
+++ b/boost/interprocess/detail/os_file_functions.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_OS_FILE_FUNCTIONS_HPP
#define BOOST_INTERPROCESS_DETAIL_OS_FILE_FUNCTIONS_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -23,7 +27,7 @@
#include <string>
#include <limits>
#include <climits>
-#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/move/detail/type_traits.hpp> //make_unsigned
#if defined (BOOST_INTERPROCESS_WINDOWS)
# include <boost/interprocess/detail/win32_api.hpp>
@@ -52,8 +56,8 @@ namespace interprocess {
#if defined (BOOST_INTERPROCESS_WINDOWS)
-typedef void * file_handle_t;
-typedef long long offset_t;
+typedef void * file_handle_t;
+typedef __int64 offset_t;
typedef struct mapping_handle_impl_t{
void * handle;
bool is_shm;
@@ -150,10 +154,11 @@ inline bool truncate_file (file_handle_t hnd, std::size_t size)
if(!winapi::get_file_size(hnd, filesize))
return false;
- typedef boost::make_unsigned<offset_t>::type uoffset_t;
+ typedef ::boost::move_detail::make_unsigned<offset_t>::type uoffset_t;
const uoffset_t max_filesize = uoffset_t((std::numeric_limits<offset_t>::max)());
+ const uoffset_t uoff_size = uoffset_t(size);
//Avoid unused variable warnings in 32 bit systems
- if(uoffset_t(size) > max_filesize){
+ if(uoff_size > max_filesize){
winapi::set_last_error(winapi::error_file_too_large);
return false;
}
@@ -476,7 +481,7 @@ inline bool delete_file(const char *name)
inline bool truncate_file (file_handle_t hnd, std::size_t size)
{
- typedef boost::make_unsigned<off_t>::type uoff_t;
+ typedef boost::move_detail::make_unsigned<off_t>::type uoff_t;
if(uoff_t((std::numeric_limits<off_t>::max)()) < size){
errno = EINVAL;
return false;
diff --git a/boost/interprocess/detail/os_thread_functions.hpp b/boost/interprocess/detail/os_thread_functions.hpp
index 4604683645..8469862cc9 100644
--- a/boost/interprocess/detail/os_thread_functions.hpp
+++ b/boost/interprocess/detail/os_thread_functions.hpp
@@ -22,7 +22,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_OS_THREAD_FUNCTIONS_HPP
#define BOOST_INTERPROCESS_DETAIL_OS_THREAD_FUNCTIONS_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -31,7 +35,7 @@
#include <boost/interprocess/streams/bufferstream.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <cstddef>
-#include <memory>
+#include <ostream>
#if defined(BOOST_INTERPROCESS_WINDOWS)
# include <boost/interprocess/detail/win32_api.hpp>
diff --git a/boost/interprocess/detail/pointer_type.hpp b/boost/interprocess/detail/pointer_type.hpp
index 28b053c2ae..125858653e 100644
--- a/boost/interprocess/detail/pointer_type.hpp
+++ b/boost/interprocess/detail/pointer_type.hpp
@@ -14,7 +14,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_HPP
#define BOOST_INTERPROCESS_DETAIL_POINTER_TYPE_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/detail/portable_intermodule_singleton.hpp b/boost/interprocess/detail/portable_intermodule_singleton.hpp
index 80897f2721..43df34c736 100644
--- a/boost/interprocess/detail/portable_intermodule_singleton.hpp
+++ b/boost/interprocess/detail/portable_intermodule_singleton.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_HPP
#define BOOST_INTERPROCESS_PORTABLE_INTERMODULE_SINGLETON_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/detail/posix_time_types_wrk.hpp b/boost/interprocess/detail/posix_time_types_wrk.hpp
index dbde3d1771..ba4973028f 100644
--- a/boost/interprocess/detail/posix_time_types_wrk.hpp
+++ b/boost/interprocess/detail/posix_time_types_wrk.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_POSIX_TIMES_WRK_HPP
#define BOOST_INTERPROCESS_POSIX_TIMES_WRK_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/detail/preprocessor.hpp b/boost/interprocess/detail/preprocessor.hpp
deleted file mode 100644
index 06d1354ee1..0000000000
--- a/boost/interprocess/detail/preprocessor.hpp
+++ /dev/null
@@ -1,203 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2008-2012. 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/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
-#define BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
-
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-#include <boost/interprocess/detail/config_begin.hpp>
-
-#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
-#error "This file is not needed when perfect forwarding is available"
-#endif
-
-#include <boost/preprocessor/iteration/local.hpp>
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/cat.hpp>
-#include <boost/preprocessor/repetition/enum.hpp>
-#include <boost/preprocessor/repetition/repeat.hpp>
-
-#define BOOST_INTERPROCESS_MAX_CONSTRUCTOR_PARAMETERS 10
-
-//Note:
-//We define template parameters as const references to
-//be able to bind temporaries. After that we will un-const them.
-//This cast is ugly but it is necessary until "perfect forwarding"
-//is achieved in C++0x. Meanwhile, if we want to be able to
-//bind rvalues with non-const references, we have to be ugly
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
- BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
- //!
-#else
- #define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
- const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
- //!
-#endif
-
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
- #define BOOST_INTERPROCESS_PP_PARAM(U, u) \
- U && u \
- //!
-#else
- #define BOOST_INTERPROCESS_PP_PARAM(U, u) \
- const U & u \
- //!
-#endif
-
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-
- #define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
- //!
-
-#else //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-
- #define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
- BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
- //!
-#endif
-
-#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
-
- #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
-
- namespace boost {
- namespace interprocess {
- namespace ipcdetail {
- template<class T>
- struct ref_holder;
-
- template<class T>
- struct ref_holder<T &>
- {
- ref_holder(T &t)
- : t_(t)
- {}
- T &t_;
- T & get() { return t_; }
- T & get_lvalue() { return t_; }
- };
-
- template<class T>
- struct ref_holder<const T>
- {
- ref_holder(const T &t)
- : t_(t)
- {}
- const T &t_;
- const T & get() { return t_; }
- const T & get_lvalue() { return t_; }
- };
-
- template<class T>
- struct ref_holder<const T &&>
- {
- ref_holder(const T &t)
- : t_(t)
- {}
- const T &t_;
- const T & get() { return t_; }
- const T & get_lvalue() { return t_; }
- };
-
- template<class T>
- struct ref_holder
- {
- ref_holder(T &&t)
- : t_(t)
- {}
- T &t_;
- T && get() { return ::boost::move(t_); }
- T & get_lvalue() { return t_; }
- };
-
- template<class T>
- struct ref_holder<T &&>
- {
- ref_holder(T &&t)
- : t(t)
- {}
- T &t;
- T && get() { return ::boost::move(t_); }
- T & get_lvalue() { return t_; }
- };
-
- } //namespace ipcdetail {
- } //namespace interprocess {
- } //namespace boost {
-
- #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \
- ::boost::interprocess::ipcdetail::ref_holder<BOOST_PP_CAT(P, n)> BOOST_PP_CAT(m_p, n); \
- //!
-
- #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \
- BOOST_PP_CAT(++m_p, n).get_lvalue() \
- //!
-
- #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
-
- #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data)\
- BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \
- //!
-
- #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \
- BOOST_PP_CAT(++m_p, n) \
- //!
-
- #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
-
-#else
- #define BOOST_INTERPROCESS_PP_PARAM_DEFINE(z, n, data) \
- BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
- //!
-
- #define BOOST_INTERPROCESS_PP_PARAM_INC(z, n, data) \
- BOOST_PP_CAT(++m_p, n) \
- //!
-
-#endif
-
-#define BOOST_INTERPROCESS_PP_PARAM_FORWARD(z, n, data) \
-::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
-//!
-
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
-
- #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \
- //!
-
- #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \
- BOOST_PP_CAT(*m_p, n).get_lvalue() \
- //!
-
-#else
-
- #define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) \
- ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(m_p, n) ) \
- //!
-
- #define BOOST_INTERPROCESS_PP_MEMBER_IT_FORWARD(z, n, data) \
- BOOST_PP_CAT(*m_p, n) \
- //!
-
-
-#endif //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
-
-#include <boost/interprocess/detail/config_end.hpp>
-
-#else
-#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING
-#error "This file is not needed when perfect forwarding is available"
-#endif
-#endif //#ifndef BOOST_INTERPROCESS_DETAIL_PREPROCESSOR_HPP
diff --git a/boost/interprocess/detail/ptime_wrk.hpp b/boost/interprocess/detail/ptime_wrk.hpp
index 87f05e25c2..ca58b7d40c 100644
--- a/boost/interprocess/detail/ptime_wrk.hpp
+++ b/boost/interprocess/detail/ptime_wrk.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_PTIME_WRK_HPP
#define BOOST_INTERPROCESS_PTIME_WRK_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/detail/robust_emulation.hpp b/boost/interprocess/detail/robust_emulation.hpp
index d586db5071..d3e4fa619a 100644
--- a/boost/interprocess/detail/robust_emulation.hpp
+++ b/boost/interprocess/detail/robust_emulation.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_ROBUST_EMULATION_HPP
#define BOOST_INTERPROCESS_ROBUST_EMULATION_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/detail/segment_manager_helper.hpp b/boost/interprocess/detail/segment_manager_helper.hpp
index 1809a8d91a..cfa4bd2ba7 100644
--- a/boost/interprocess/detail/segment_manager_helper.hpp
+++ b/boost/interprocess/detail/segment_manager_helper.hpp
@@ -11,33 +11,35 @@
#ifndef BOOST_INTERPROCESS_SEGMENT_MANAGER_BASE_HPP
#define BOOST_INTERPROCESS_SEGMENT_MANAGER_BASE_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/intrusive/pointer_traits.hpp>
-
-#include <boost/detail/no_exceptions_support.hpp>
+// interprocess
+#include <boost/interprocess/exceptions.hpp>
+// interprocess/detail
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/in_place_interface.hpp>
-#include <boost/interprocess/exceptions.hpp>
-#include <boost/type_traits/make_unsigned.hpp>
-#include <boost/type_traits/alignment_of.hpp>
+// container/detail
+#include <boost/container/detail/type_traits.hpp> //alignment_of
+#include <boost/container/detail/minimal_char_traits_header.hpp>
+// intrusive
#include <boost/intrusive/pointer_traits.hpp>
-#include <cstddef> //std::size_t
-#include <string> //char_traits
-#include <new> //std::nothrow
-#include <utility> //std::pair
-#include <iterator> //std::iterator_traits
+// move/detail
+#include <boost/move/detail/type_traits.hpp> //make_unsigned
+// other boost
#include <boost/assert.hpp> //BOOST_ASSERT
-#include <functional> //unary_function
-#ifndef BOOST_NO_EXCEPTIONS
-#include <exception>
-#endif
+#include <boost/core/no_exceptions_support.hpp>
+// std
+#include <cstddef> //std::size_t
//!\file
//!Describes the object placed in a memory segment that provides
@@ -115,7 +117,7 @@ struct block_header
{
return get_rounded_size
( size_type(sizeof(Header))
- , size_type(::boost::alignment_of<block_header<size_type> >::value))
+ , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value))
+ total_size();
}
@@ -155,21 +157,19 @@ struct block_header
{
return m_num_char < b.m_num_char ||
(m_num_char < b.m_num_char &&
- std::char_traits<CharType>::compare
- (name<CharType>(), b.name<CharType>(), m_num_char) < 0);
+ std::char_traits<CharType>::compare(name<CharType>(), b.name<CharType>(), m_num_char) < 0);
}
template<class CharType>
bool equal_comp(const block_header<size_type> &b) const
{
return m_num_char == b.m_num_char &&
- std::char_traits<CharType>::compare
- (name<CharType>(), b.name<CharType>(), m_num_char) == 0;
+ std::char_traits<CharType>::compare(name<CharType>(), b.name<CharType>(), m_num_char) == 0;
}
template<class T>
static block_header<size_type> *block_header_from_value(T *value)
- { return block_header_from_value(value, sizeof(T), ::boost::alignment_of<T>::value); }
+ { return block_header_from_value(value, sizeof(T), ::boost::container::container_detail::alignment_of<T>::value); }
static block_header<size_type> *block_header_from_value(const void *value, std::size_t sz, std::size_t algn)
{
@@ -189,7 +189,8 @@ struct block_header
{
block_header<size_type> * hdr =
reinterpret_cast<block_header<size_type>*>(reinterpret_cast<char*>(header) +
- get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of<block_header<size_type> >::value)));
+ get_rounded_size( size_type(sizeof(Header))
+ , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)));
//Some sanity checks
return hdr;
}
@@ -199,7 +200,8 @@ struct block_header
{
Header * hdr =
reinterpret_cast<Header*>(reinterpret_cast<char*>(bheader) -
- get_rounded_size(size_type(sizeof(Header)), size_type(::boost::alignment_of<block_header<size_type> >::value)));
+ get_rounded_size( size_type(sizeof(Header))
+ , size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)));
//Some sanity checks
return hdr;
}
@@ -273,7 +275,7 @@ struct intrusive_value_type_impl
intrusive_value_type_impl(){}
- enum { BlockHdrAlignment = ::boost::alignment_of<block_header<size_type> >::value };
+ enum { BlockHdrAlignment = ::boost::container::container_detail::alignment_of<block_header<size_type> >::value };
block_header<size_type> *get_block_header() const
{
@@ -346,7 +348,7 @@ struct index_key
rebind_pointer<const CharT>::type const_char_ptr_t;
typedef CharT char_type;
typedef typename boost::intrusive::pointer_traits<const_char_ptr_t>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ typedef typename boost::move_detail::make_unsigned<difference_type>::type size_type;
private:
//Offset pointer to the object's name
@@ -365,9 +367,8 @@ struct index_key
{
return (m_len < right.m_len) ||
(m_len == right.m_len &&
- std::char_traits<char_type>::compare
- (to_raw_pointer(mp_str)
- ,to_raw_pointer(right.mp_str), m_len) < 0);
+ std::char_traits<char_type>::compare
+ (to_raw_pointer(mp_str),to_raw_pointer(right.mp_str), m_len) < 0);
}
//!Equal to function for index ordering
@@ -375,8 +376,7 @@ struct index_key
{
return m_len == right.m_len &&
std::char_traits<char_type>::compare
- (to_raw_pointer(mp_str),
- to_raw_pointer(right.mp_str), m_len) == 0;
+ (to_raw_pointer(mp_str), to_raw_pointer(right.mp_str), m_len) == 0;
}
void name(const CharT *nm)
@@ -399,7 +399,7 @@ struct index_data
{
typedef VoidPointer void_pointer;
void_pointer m_ptr;
- index_data(void *ptr) : m_ptr(ptr){}
+ explicit index_data(void *ptr) : m_ptr(ptr){}
void *value() const
{ return static_cast<void*>(to_raw_pointer(m_ptr)); }
@@ -481,12 +481,10 @@ class segment_manager_iterator_value_adaptor<Iterator, false>
template<class Iterator, bool intrusive>
struct segment_manager_iterator_transform
- : std::unary_function< typename std::iterator_traits<Iterator>::value_type
- , segment_manager_iterator_value_adaptor<Iterator, intrusive> >
{
typedef segment_manager_iterator_value_adaptor<Iterator, intrusive> result_type;
- result_type operator()(const typename std::iterator_traits<Iterator>::value_type &arg) const
+ template <class T> result_type operator()(const T &arg) const
{ return result_type(arg); }
};
diff --git a/boost/interprocess/detail/shared_dir_helpers.hpp b/boost/interprocess/detail/shared_dir_helpers.hpp
index 469ea04ac1..a0ac766f4c 100644
--- a/boost/interprocess/detail/shared_dir_helpers.hpp
+++ b/boost/interprocess/detail/shared_dir_helpers.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_HPP
#define BOOST_INTERPROCESS_DETAIL_SHARED_DIR_HELPERS_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/detail/simple_swap.hpp b/boost/interprocess/detail/simple_swap.hpp
new file mode 100644
index 0000000000..797a997075
--- /dev/null
+++ b/boost/interprocess/detail/simple_swap.hpp
@@ -0,0 +1,29 @@
+#ifndef BOOST_INTERPROCESS_DETAIL_SWAP_HPP
+#define BOOST_INTERPROCESS_DETAIL_SWAP_HPP
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
+# pragma once
+#endif
+
+namespace boost { namespace interprocess {
+
+template<class T>
+void simple_swap(T&x, T&y)
+{ T tmp(x); x = y; y = tmp; }
+
+}} //namespace boost{ namespace interprocess {
+
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_SWAP_HPP
diff --git a/boost/interprocess/detail/std_fwd.hpp b/boost/interprocess/detail/std_fwd.hpp
new file mode 100644
index 0000000000..e3f6fc52a8
--- /dev/null
+++ b/boost/interprocess/detail/std_fwd.hpp
@@ -0,0 +1,65 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (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/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_INTERPROCESS_DETAIL_STD_FWD_HPP
+#define BOOST_INTERPROCESS_DETAIL_STD_FWD_HPP
+
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
+# pragma once
+#endif
+
+//////////////////////////////////////////////////////////////////////////////
+// Standard predeclarations
+//////////////////////////////////////////////////////////////////////////////
+
+#if defined(__clang__) && defined(_LIBCPP_VERSION)
+ #define BOOST_INTERPROCESS_CLANG_INLINE_STD_NS
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wc++11-extensions"
+ #define BOOST_INTERPROCESS_STD_NS_BEG _LIBCPP_BEGIN_NAMESPACE_STD
+ #define BOOST_INTERPROCESS_STD_NS_END _LIBCPP_END_NAMESPACE_STD
+#elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE_VERSION) //GCC >= 4.6
+ #define BOOST_INTERPROCESS_STD_NS_BEG namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION
+ #define BOOST_INTERPROCESS_STD_NS_END _GLIBCXX_END_NAMESPACE_VERSION } // namespace
+#elif defined(BOOST_GNU_STDLIB) && defined(_GLIBCXX_BEGIN_NAMESPACE) //GCC >= 4.2
+ #define BOOST_INTERPROCESS_STD_NS_BEG _GLIBCXX_BEGIN_NAMESPACE(std)
+ #define BOOST_INTERPROCESS_STD_NS_END _GLIBCXX_END_NAMESPACE
+#else
+ #define BOOST_INTERPROCESS_STD_NS_BEG namespace std{
+ #define BOOST_INTERPROCESS_STD_NS_END }
+#endif
+
+BOOST_INTERPROCESS_STD_NS_BEG
+
+struct input_iterator_tag;
+struct forward_iterator_tag;
+struct bidirectional_iterator_tag;
+struct random_access_iterator_tag;
+
+template<class T>
+struct char_traits;
+
+template<class CharT, class Traits>
+class basic_ostream;
+
+template<class CharT, class Traits>
+class basic_istream;
+
+BOOST_INTERPROCESS_STD_NS_END
+
+#ifdef BOOST_INTERPROCESS_CLANG_INLINE_STD_NS
+ #pragma GCC diagnostic pop
+ #undef BOOST_INTERPROCESS_CLANG_INLINE_STD_NS
+#endif //BOOST_INTERPROCESS_CLANG_INLINE_STD_NS
+
+#endif //#ifndef BOOST_INTERPROCESS_DETAIL_STD_FWD_HPP
diff --git a/boost/interprocess/detail/transform_iterator.hpp b/boost/interprocess/detail/transform_iterator.hpp
index 5496d19568..1c4dcd3aeb 100644
--- a/boost/interprocess/detail/transform_iterator.hpp
+++ b/boost/interprocess/detail/transform_iterator.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2012.
+// (C) Copyright Ion Gaztanaga 2005-2015.
// (C) Copyright Gennaro Prota 2003 - 2004.
//
// Distributed under the Boost Software License, Version 1.0.
@@ -14,17 +14,23 @@
#ifndef BOOST_INTERPROCESS_DETAIL_TRANSFORM_ITERATORS_HPP
#define BOOST_INTERPROCESS_DETAIL_TRANSFORM_ITERATORS_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+// interprocess
#include <boost/interprocess/interprocess_fwd.hpp>
-
-#include <iterator>
+// interprocess/detail
#include <boost/interprocess/detail/type_traits.hpp>
+// move/detail
+#include <boost/container/detail/iterator.hpp>
namespace boost {
namespace interprocess {
@@ -60,14 +66,14 @@ struct operator_arrow_proxy<T&>
template <class Iterator, class UnaryFunction>
class transform_iterator
: public UnaryFunction
- , public std::iterator
- < typename std::iterator_traits<Iterator>::iterator_category
- , typename ipcdetail::remove_reference<typename UnaryFunction::result_type>::type
- , typename std::iterator_traits<Iterator>::difference_type
- , operator_arrow_proxy<typename UnaryFunction::result_type>
- , typename UnaryFunction::result_type>
{
public:
+ typedef typename ::boost::container::iterator_traits<Iterator>::iterator_category iterator_category;
+ typedef typename ipcdetail::remove_reference<typename UnaryFunction::result_type>::type value_type;
+ typedef typename ::boost::container::iterator_traits<Iterator>::difference_type difference_type;
+ typedef operator_arrow_proxy<typename UnaryFunction::result_type> pointer;
+ typedef typename UnaryFunction::result_type reference;
+
explicit transform_iterator(const Iterator &it, const UnaryFunction &f = UnaryFunction())
: UnaryFunction(f), m_it(it)
{}
@@ -115,33 +121,33 @@ class transform_iterator
friend bool operator>= (const transform_iterator& i, const transform_iterator& i2)
{ return !(i < i2); }
- friend typename std::iterator_traits<Iterator>::difference_type operator- (const transform_iterator& i, const transform_iterator& i2)
+ friend difference_type operator- (const transform_iterator& i, const transform_iterator& i2)
{ return i2.distance_to(i); }
//Arithmetic
- transform_iterator& operator+=(typename std::iterator_traits<Iterator>::difference_type off)
+ transform_iterator& operator+=(difference_type off)
{ this->advance(off); return *this; }
- transform_iterator operator+(typename std::iterator_traits<Iterator>::difference_type off) const
+ transform_iterator operator+(difference_type off) const
{
transform_iterator other(*this);
other.advance(off);
return other;
}
- friend transform_iterator operator+(typename std::iterator_traits<Iterator>::difference_type off, const transform_iterator& right)
+ friend transform_iterator operator+(difference_type off, const transform_iterator& right)
{ return right + off; }
- transform_iterator& operator-=(typename std::iterator_traits<Iterator>::difference_type off)
+ transform_iterator& operator-=(difference_type off)
{ this->advance(-off); return *this; }
- transform_iterator operator-(typename std::iterator_traits<Iterator>::difference_type off) const
+ transform_iterator operator-(difference_type off) const
{ return *this + (-off); }
typename UnaryFunction::result_type operator*() const
{ return dereference(); }
- typename UnaryFunction::result_type operator[](typename std::iterator_traits<Iterator>::difference_type off) const
+ typename UnaryFunction::result_type operator[](difference_type off) const
{ return UnaryFunction::operator()(m_it[off]); }
operator_arrow_proxy<typename UnaryFunction::result_type>
@@ -172,11 +178,11 @@ class transform_iterator
typename UnaryFunction::result_type dereference() const
{ return UnaryFunction::operator()(*m_it); }
- void advance(typename std::iterator_traits<Iterator>::difference_type n)
- { std::advance(m_it, n); }
+ void advance(difference_type n)
+ { ::boost::container::iterator_advance(m_it, n); }
- typename std::iterator_traits<Iterator>::difference_type distance_to(const transform_iterator &other)const
- { return std::distance(other.m_it, m_it); }
+ difference_type distance_to(const transform_iterator &other)const
+ { return ::boost::container::iterator_distance(other.m_it, m_it); }
};
template <class Iterator, class UnaryFunc>
@@ -192,4 +198,3 @@ make_transform_iterator(Iterator it, UnaryFunc fun)
#include <boost/interprocess/detail/config_end.hpp>
#endif //#ifndef BOOST_INTERPROCESS_DETAIL_TRANSFORM_ITERATORS_HPP
-
diff --git a/boost/interprocess/detail/type_traits.hpp b/boost/interprocess/detail/type_traits.hpp
index e56a495754..5765c888e7 100644
--- a/boost/interprocess/detail/type_traits.hpp
+++ b/boost/interprocess/detail/type_traits.hpp
@@ -13,7 +13,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
#define BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_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/detail/utilities.hpp b/boost/interprocess/detail/utilities.hpp
index 351b76cce4..f1375d7361 100644
--- a/boost/interprocess/detail/utilities.hpp
+++ b/boost/interprocess/detail/utilities.hpp
@@ -14,7 +14,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP
#define BOOST_INTERPROCESS_DETAIL_UTILITIES_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -23,17 +27,12 @@
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/move/utility_core.hpp>
-#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/interprocess/detail/min_max.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
-#include <boost/interprocess/detail/transform_iterator.hpp>
#include <boost/interprocess/detail/mpl.hpp>
-#include <boost/interprocess/containers/version_type.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/static_assert.hpp>
-#include <utility>
-#include <algorithm>
#include <climits>
namespace boost {
@@ -49,14 +48,6 @@ inline typename boost::intrusive::pointer_traits<Pointer>::element_type*
to_raw_pointer(const Pointer &p)
{ return boost::interprocess::ipcdetail::to_raw_pointer(p.operator->()); }
-//!To avoid ADL problems with swap
-template <class T>
-inline void do_swap(T& x, T& y)
-{
- using std::swap;
- swap(x, y);
-}
-
//Rounds "orig_size" by excess to round_to bytes
template<class SizeType>
inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to)
diff --git a/boost/interprocess/detail/variadic_templates_tools.hpp b/boost/interprocess/detail/variadic_templates_tools.hpp
index 80154e05d2..c0f591312b 100644
--- a/boost/interprocess/detail/variadic_templates_tools.hpp
+++ b/boost/interprocess/detail/variadic_templates_tools.hpp
@@ -11,143 +11,25 @@
#ifndef BOOST_INTERPROCESS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
#define BOOST_INTERPROCESS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/interprocess/detail/type_traits.hpp>
-#include <cstddef> //std::size_t
+#include <boost/container/detail/variadic_templates_tools.hpp>
namespace boost {
namespace interprocess {
namespace ipcdetail {
-template<typename... Values>
-class tuple;
-
-template<> class tuple<>
-{};
-
-template<typename Head, typename... Tail>
-class tuple<Head, Tail...>
- : private tuple<Tail...>
-{
- typedef tuple<Tail...> inherited;
-
- public:
- tuple() { }
-
- // implicit copy-constructor is okay
- // Construct tuple from separate arguments.
- tuple(typename add_const_reference<Head>::type v,
- typename add_const_reference<Tail>::type... vtail)
- : inherited(vtail...), m_head(v)
- {}
-
- // Construct tuple from another tuple.
- template<typename... VValues>
- tuple(const tuple<VValues...>& other)
- : m_head(other.head()), inherited(other.tail())
- {}
-
- template<typename... VValues>
- tuple& operator=(const tuple<VValues...>& other)
- {
- m_head = other.head();
- tail() = other.tail();
- return this;
- }
-
- typename add_reference<Head>::type head() { return m_head; }
- typename add_reference<const Head>::type head() const { return m_head; }
-
- inherited& tail() { return *this; }
- const inherited& tail() const { return *this; }
-
- protected:
- Head m_head;
-};
-
-
-template<typename... Values>
-tuple<Values&&...> tie_forward(Values&&... values)
-{ return tuple<Values&&...>(values...); }
-
-template<int I, typename Tuple>
-struct tuple_element;
-
-template<int I, typename Head, typename... Tail>
-struct tuple_element<I, tuple<Head, Tail...> >
-{
- typedef typename tuple_element<I-1, tuple<Tail...> >::type type;
-};
-
-template<typename Head, typename... Tail>
-struct tuple_element<0, tuple<Head, Tail...> >
-{
- typedef Head type;
-};
-
-template<int I, typename Tuple>
-class get_impl;
-
-template<int I, typename Head, typename... Values>
-class get_impl<I, tuple<Head, Values...> >
-{
- typedef typename tuple_element<I-1, tuple<Values...> >::type Element;
- typedef get_impl<I-1, tuple<Values...> > Next;
-
- public:
- typedef typename add_reference<Element>::type type;
- typedef typename add_const_reference<Element>::type const_type;
- static type get(tuple<Head, Values...>& t) { return Next::get(t.tail()); }
- static const_type get(const tuple<Head, Values...>& t) { return Next::get(t.tail()); }
-};
-
-template<typename Head, typename... Values>
-class get_impl<0, tuple<Head, Values...> >
-{
- public:
- typedef typename add_reference<Head>::type type;
- typedef typename add_const_reference<Head>::type const_type;
- static type get(tuple<Head, Values...>& t) { return t.head(); }
- static const_type get(const tuple<Head, Values...>& t){ return t.head(); }
-};
-
-template<int I, typename... Values>
-typename get_impl<I, tuple<Values...> >::type get(tuple<Values...>& t)
-{ return get_impl<I, tuple<Values...> >::get(t); }
-
-template<int I, typename... Values>
-typename get_impl<I, tuple<Values...> >::const_type get(const tuple<Values...>& t)
-{ return get_impl<I, tuple<Values...> >::get(t); }
-
-////////////////////////////////////////////////////
-// Builds an index_tuple<0, 1, 2, ..., Num-1>, that will
-// be used to "unpack" into comma-separated values
-// in a function call.
-////////////////////////////////////////////////////
-
-template<int... Indexes>
-struct index_tuple{};
-
-template<std::size_t Num, typename Tuple = index_tuple<> >
-struct build_number_seq;
-
-template<std::size_t Num, int... Indexes>
-struct build_number_seq<Num, index_tuple<Indexes...> >
- : build_number_seq<Num - 1, index_tuple<Indexes..., sizeof...(Indexes)> >
-{};
-
-template<int... Indexes>
-struct build_number_seq<0, index_tuple<Indexes...> >
-{ typedef index_tuple<Indexes...> type; };
-
+using boost::container::container_detail::tuple;
+using boost::container::container_detail::build_number_seq;
+using boost::container::container_detail::index_tuple;
+using boost::container::container_detail::get;
}}} //namespace boost { namespace interprocess { namespace ipcdetail {
-#include <boost/interprocess/detail/config_end.hpp>
-
#endif //#ifndef BOOST_INTERPROCESS_DETAIL_VARIADIC_TEMPLATES_TOOLS_HPP
diff --git a/boost/interprocess/detail/win32_api.hpp b/boost/interprocess/detail/win32_api.hpp
index d9d3e70330..b924341c32 100644
--- a/boost/interprocess/detail/win32_api.hpp
+++ b/boost/interprocess/detail/win32_api.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_WIN32_API_HPP
#define BOOST_INTERPROCESS_WIN32_API_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -26,7 +30,6 @@
#include <boost/assert.hpp>
#include <string>
#include <vector>
-#include <memory>
#ifdef BOOST_USE_WINDOWS_H
#include <windows.h>
@@ -57,6 +60,12 @@
//
//////////////////////////////////////////////////////////////////////////////
+//Ignore -pedantic errors here (anonymous structs, etc.)
+#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-pedantic"
+#endif
+
namespace boost {
namespace interprocess {
namespace winapi {
@@ -95,7 +104,7 @@ struct decimal
unsigned long Lo32;
unsigned long Mid32;
};
- unsigned __int64 Lo64;
+ ::boost::ulong_long_type Lo64;
};
};
@@ -740,8 +749,8 @@ union system_timeofday_information
__int64 liExpTimeZoneBias;
unsigned long uCurrentTimeZoneId;
unsigned long dwReserved;
- unsigned __int64 ullBootTimeBias;
- unsigned __int64 ullSleepTimeBias;
+ ::boost::ulong_long_type ullBootTimeBias;
+ ::boost::ulong_long_type ullSleepTimeBias;
} data;
unsigned char Reserved1[sizeof(data_t)];
};
@@ -1314,7 +1323,7 @@ class interprocess_all_access_security
{ return &sa; }
};
-inline void * create_file_mapping (void * handle, unsigned long access, unsigned __int64 file_offset, const char * name, interprocess_security_attributes *psec)
+inline void * create_file_mapping (void * handle, unsigned long access, ::boost::ulong_long_type file_offset, const char * name, interprocess_security_attributes *psec)
{
const unsigned long high_size(file_offset >> 32), low_size((boost::uint32_t)file_offset);
return CreateFileMappingA (handle, psec, access, high_size, low_size, name);
@@ -1323,9 +1332,9 @@ inline void * create_file_mapping (void * handle, unsigned long access, unsigned
inline void * open_file_mapping (unsigned long access, const char *name)
{ return OpenFileMappingA (access, 0, name); }
-inline void *map_view_of_file_ex(void *handle, unsigned long file_access, unsigned __int64 offset, std::size_t numbytes, void *base_addr)
+inline void *map_view_of_file_ex(void *handle, unsigned long file_access, ::boost::ulong_long_type offset, std::size_t numbytes, void *base_addr)
{
- const unsigned long offset_low = (unsigned long)(offset & ((unsigned __int64)0xFFFFFFFF));
+ const unsigned long offset_low = (unsigned long)(offset & ((::boost::ulong_long_type)0xFFFFFFFF));
const unsigned long offset_high = offset >> 32;
return MapViewOfFileEx(handle, file_access, offset_high, offset_low, numbytes, base_addr);
}
@@ -2332,6 +2341,10 @@ inline unsigned long get_tick_count()
} //namespace interprocess
} //namespace boost
+#if defined(BOOST_GCC) && (BOOST_GCC >= 40600)
+# pragma GCC diagnostic pop
+#endif
+
#include <boost/interprocess/detail/config_end.hpp>
#endif //#ifdef BOOST_INTERPROCESS_WIN32_API_HPP
diff --git a/boost/interprocess/detail/windows_intermodule_singleton.hpp b/boost/interprocess/detail/windows_intermodule_singleton.hpp
index 58102689da..12ad2015e3 100644
--- a/boost/interprocess/detail/windows_intermodule_singleton.hpp
+++ b/boost/interprocess/detail/windows_intermodule_singleton.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_HPP
#define BOOST_INTERPROCESS_WINDOWS_INTERMODULE_SINGLETON_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/detail/workaround.hpp b/boost/interprocess/detail/workaround.hpp
index d0456b5053..daf4455be5 100644
--- a/boost/interprocess/detail/workaround.hpp
+++ b/boost/interprocess/detail/workaround.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
#define BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -26,7 +30,24 @@
#else
#include <unistd.h>
- #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0)
+ //////////////////////////////////////////////////////
+ //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
+ //////////////////////////////////////////////////////
+ #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__)
+ #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
+ #endif
+
+ //////////////////////////////////////////////////////
+ // From SUSv3/UNIX 98, pthread_mutexattr_settype is mandatory
+ //////////////////////////////////////////////////////
+ #if defined(_XOPEN_UNIX) && ((_XOPEN_VERSION + 0) >= 500)
+ #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
+ #endif
+
+ //////////////////////////////////////////////////////
+ // _POSIX_THREAD_PROCESS_SHARED (POSIX.1b/POSIX.4)
+ //////////////////////////////////////////////////////
+ #if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED + 0) > 0)
//Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
#if defined(__CYGWIN__)
#define BOOST_INTERPROCESS_BUGGY_POSIX_PROCESS_SHARED
@@ -51,62 +72,12 @@
#endif
#endif
- #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS - 0) > 0)
- #define BOOST_INTERPROCESS_POSIX_BARRIERS
- #endif
-
- #if defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES - 0) > 0)
- #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
- #if defined(__CYGWIN__)
- #define BOOST_INTERPROCESS_POSIX_SEMAPHORES_NO_UNLINK
- #endif
- //Some platforms have a limited (name length) named semaphore support
- #elif (defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || defined(__APPLE__)
- #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
- #endif
-
- #if (defined (_V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
- (defined (_V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
- (defined (_V6_LPBIG_OFFBIG) &&(_V6_LPBIG_OFFBIG - 0 > 0)) ||\
- (defined (_XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
- (defined (_XBS5_LP64_OFF64) &&(_XBS5_LP64_OFF64 - 0 > 0)) ||\
- (defined (_XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
- (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
- (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
- #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
- #endif
-
- //Check for XSI shared memory objects. They are available in nearly all UNIX platforms
- #if !defined(__QNXNTO__) && !defined(__ANDROID__)
- #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS
- #endif
-
- #if defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS - 0) > 0)
+ //////////////////////////////////////////////////////
+ // _POSIX_SHARED_MEMORY_OBJECTS (POSIX.1b/POSIX.4)
+ //////////////////////////////////////////////////////
+ #if ( defined(_POSIX_SHARED_MEMORY_OBJECTS) && ((_POSIX_SHARED_MEMORY_OBJECTS + 0) > 0) ) ||\
+ (defined(__vms) && __CRTL_VER >= 70200000)
#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
- #else
- //VMS and MACOS don't define it but they have shm_open/close interface
- #if defined(__vms)
- #if __CRTL_VER >= 70200000
- #define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
- #endif
- //Mac OS has some non-conformant features like names limited to SHM_NAME_MAX
- #elif defined (__APPLE__)
- //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
- //#define BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS_NO_GROW
- #endif
- #endif
-
- //Now check if we have only XSI shared memory
- #if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS) &&\
- !defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
- //#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY
- #endif
-
- #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS - 0) > 0)
- #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
- #endif
-
- #ifdef BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS
//Some systems have filesystem-based resources, so the
//portable "/shmname" format does not work due to permission issues
//For those systems we need to form a path to a temporary directory:
@@ -114,23 +85,52 @@
#if defined(__hpux) || defined(__osf__) || defined(__vms) || (defined(__FreeBSD__) && (__FreeBSD__ < 7))
#define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
//Some systems have "jailed" environments where shm usage is restricted at runtime
- //and temporary file file based shm is possible in those executions.
+ //and temporary file based shm is possible in those executions.
#elif defined(__FreeBSD__)
#define BOOST_INTERPROCESS_RUNTIME_FILESYSTEM_BASED_POSIX_SHARED_MEMORY
#endif
#endif
- #ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+ //////////////////////////////////////////////////////
+ // _POSIX_MAPPED_FILES (POSIX.1b/POSIX.4)
+ //////////////////////////////////////////////////////
+ #if defined(_POSIX_MAPPED_FILES) && ((_POSIX_MAPPED_FILES + 0) > 0)
+ #define BOOST_INTERPROCESS_POSIX_MAPPED_FILES
+ #endif
+
+ //////////////////////////////////////////////////////
+ // _POSIX_SEMAPHORES (POSIX.1b/POSIX.4)
+ //////////////////////////////////////////////////////
+ #if ( defined(_POSIX_SEMAPHORES) && ((_POSIX_SEMAPHORES + 0) > 0) ) ||\
+ ( defined(__FreeBSD__) && (__FreeBSD__ >= 4)) || \
+ defined(__APPLE__)
+ #define BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+ //MacOsX declares _POSIX_SEMAPHORES but sem_init returns ENOSYS
+ #if !defined(__APPLE__)
+ #define BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
+ #endif
#if defined(__osf__) || defined(__vms)
#define BOOST_INTERPROCESS_FILESYSTEM_BASED_POSIX_SEMAPHORES
#endif
#endif
- #if defined(_POSIX_VERSION) && defined(_XOPEN_VERSION) && \
- (((_POSIX_VERSION + 0)>= 200112L || (_XOPEN_VERSION + 0)>= 500))
- #define BOOST_INTERPROCESS_POSIX_RECURSIVE_MUTEXES
+ //////////////////////////////////////////////////////
+ // _POSIX_BARRIERS (SUSv3/Unix03)
+ //////////////////////////////////////////////////////
+ #if defined(_POSIX_BARRIERS) && ((_POSIX_BARRIERS + 0) >= 200112L)
+ #define BOOST_INTERPROCESS_POSIX_BARRIERS
#endif
+ //////////////////////////////////////////////////////
+ // _POSIX_TIMEOUTS (SUSv3/Unix03)
+ //////////////////////////////////////////////////////
+ #if defined(_POSIX_TIMEOUTS) && ((_POSIX_TIMEOUTS + 0L) >= 200112L)
+ #define BOOST_INTERPROCESS_POSIX_TIMEOUTS
+ #endif
+
+ //////////////////////////////////////////////////////
+ // Detect BSD derivatives to detect sysctl
+ //////////////////////////////////////////////////////
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
#define BOOST_INTERPROCESS_BSD_DERIVATIVE
//Some *BSD systems (OpenBSD & NetBSD) need sys/param.h before sys/sysctl.h, whereas
@@ -142,10 +142,24 @@
//#define BOOST_INTERPROCESS_HAS_KERNEL_BOOTTIME
#endif
#endif
+
+ //////////////////////////////////////////////////////
+ //64 bit offset
+ //////////////////////////////////////////////////////
+ #if (defined (_V6_ILP32_OFFBIG) &&(_V6_ILP32_OFFBIG - 0 > 0)) ||\
+ (defined (_V6_LP64_OFF64) &&(_V6_LP64_OFF64 - 0 > 0)) ||\
+ (defined (_V6_LPBIG_OFFBIG) &&(_V6_LPBIG_OFFBIG - 0 > 0)) ||\
+ (defined (_XBS5_ILP32_OFFBIG)&&(_XBS5_ILP32_OFFBIG - 0 > 0)) ||\
+ (defined (_XBS5_LP64_OFF64) &&(_XBS5_LP64_OFF64 - 0 > 0)) ||\
+ (defined (_XBS5_LPBIG_OFFBIG)&&(_XBS5_LPBIG_OFFBIG - 0 > 0)) ||\
+ (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))||\
+ (defined (_FILE_OFFSET_BITS) &&(_FILE_OFFSET_BITS - 0 >= 64))
+ #define BOOST_INTERPROCESS_UNIX_64_BIT_OR_BIGGER_OFF_T
+ #endif
#endif //!defined(BOOST_INTERPROCESS_WINDOWS)
-#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
- #define BOOST_INTERPROCESS_PERFECT_FORWARDING
+#if defined(BOOST_INTERPROCESS_WINDOWS) || defined(BOOST_INTERPROCESS_POSIX_MAPPED_FILES)
+# define BOOST_INTERPROCESS_MAPPED_FILES
#endif
//Now declare some Boost.Interprocess features depending on the implementation
@@ -154,6 +168,10 @@
#define BOOST_INTERPROCESS_NAMED_SEMAPHORE_USES_POSIX_SEMAPHORES
#endif
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
+ #define BOOST_INTERPROCESS_PERFECT_FORWARDING
+#endif
+
// Timeout duration use if BOOST_INTERPROCESS_ENABLE_TIMEOUT_WHEN_LOCKING is set
#ifndef BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS
#define BOOST_INTERPROCESS_TIMEOUT_WHEN_LOCKING_DURATION_MS 10000
@@ -166,37 +184,10 @@
//with processes compiled with those versions.
#define BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX
-//Inline attributes
-#if defined(_MSC_VER)
- #define BOOST_INTERPROCESS_ALWAYS_INLINE __forceinline
-#elif defined (__GNUC__)
- #define BOOST_INTERPROCESS_ALWAYS_INLINE __attribute__((__always_inline__))
-#else
- #define BOOST_INTERPROCESS_ALWAYS_INLINE inline
-#endif
-
-#if defined(_MSC_VER)
- #define BOOST_INTERPROCESS_NEVER_INLINE __declspec(noinline)
-#elif defined (__GNUC__)
- #define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__))
-#endif
-
//Macros for documentation purposes. For code, expands to the argument
#define BOOST_INTERPROCESS_IMPDEF(TYPE) TYPE
#define BOOST_INTERPROCESS_SEEDOC(TYPE) TYPE
-#if defined(BOOST_NO_CXX11_NOEXCEPT)
- #if defined(BOOST_MSVC)
- #define BOOST_INTERPROCESS_NOEXCEPT throw()
- #else
- #define BOOST_INTERPROCESS_NOEXCEPT
- #endif
- #define BOOST_INTERPROCESS_NOEXCEPT_IF(x)
-#else
- #define BOOST_INTERPROCESS_NOEXCEPT noexcept
- #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) noexcept(x)
-#endif
-
#include <boost/interprocess/detail/config_end.hpp>
#endif //#ifndef BOOST_INTERPROCESS_DETAIL_WORKAROUND_HPP
diff --git a/boost/interprocess/detail/xsi_shared_memory_device.hpp b/boost/interprocess/detail/xsi_shared_memory_device.hpp
index 5bb077179a..2f256a5f6c 100644
--- a/boost/interprocess/detail/xsi_shared_memory_device.hpp
+++ b/boost/interprocess/detail/xsi_shared_memory_device.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_DEVICE_HPP
#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_DEVICE_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -28,6 +32,7 @@
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/detail/shared_dir_helpers.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/exceptions.hpp>
@@ -181,7 +186,7 @@ inline const char *xsi_shared_memory_device::get_name() const
inline void xsi_shared_memory_device::swap(xsi_shared_memory_device &other)
{
m_shm.swap(other.m_shm);
- std::swap(m_mode, other.m_mode);
+ (simple_swap)(m_mode, other.m_mode);
m_name.swap(other.m_name);
}
diff --git a/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp b/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp
index d1c71d55f5..b1fe449281 100644
--- a/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp
+++ b/boost/interprocess/detail/xsi_shared_memory_file_wrapper.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_FILE_WRAPPER_HPP
#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_FILE_WRAPPER_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/errors.hpp b/boost/interprocess/errors.hpp
index 6d4572f718..46dc417a59 100644
--- a/boost/interprocess/errors.hpp
+++ b/boost/interprocess/errors.hpp
@@ -24,7 +24,11 @@
#ifndef BOOST_INTERPROCESS_ERRORS_HPP
#define BOOST_INTERPROCESS_ERRORS_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/exceptions.hpp b/boost/interprocess/exceptions.hpp
index 36e5e2ca5b..7c87722d24 100644
--- a/boost/interprocess/exceptions.hpp
+++ b/boost/interprocess/exceptions.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_EXCEPTIONS_HPP
#define BOOST_INTERPROCESS_EXCEPTIONS_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -19,7 +23,6 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/errors.hpp>
#include <stdexcept>
-#include <new>
//!\file
//!Describes exceptions thrown by interprocess classes
diff --git a/boost/interprocess/file_mapping.hpp b/boost/interprocess/file_mapping.hpp
index 935260354f..0d1cf1fe41 100644
--- a/boost/interprocess/file_mapping.hpp
+++ b/boost/interprocess/file_mapping.hpp
@@ -11,18 +11,27 @@
#ifndef BOOST_INTERPROCESS_FILE_MAPPING_HPP
#define BOOST_INTERPROCESS_FILE_MAPPING_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+#if !defined(BOOST_INTERPROCESS_MAPPED_FILES)
+#error "Boost.Interprocess: This platform does not support memory mapped files!"
+#endif
+
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/detail/os_file_functions.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
#include <boost/move/utility_core.hpp>
#include <string> //std::string
@@ -118,8 +127,8 @@ inline const char *file_mapping::get_name() const
inline void file_mapping::swap(file_mapping &other)
{
- std::swap(m_handle, other.m_handle);
- std::swap(m_mode, other.m_mode);
+ (simple_swap)(m_handle, other.m_handle);
+ (simple_swap)(m_mode, other.m_mode);
m_filename.swap(other.m_filename);
}
diff --git a/boost/interprocess/indexes/flat_map_index.hpp b/boost/interprocess/indexes/flat_map_index.hpp
index 4307dedb0e..027b75be47 100644
--- a/boost/interprocess/indexes/flat_map_index.hpp
+++ b/boost/interprocess/indexes/flat_map_index.hpp
@@ -10,17 +10,24 @@
#ifndef BOOST_INTERPROCESS_FLAT_MAP_INDEX_HPP
#define BOOST_INTERPROCESS_FLAT_MAP_INDEX_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <functional>
-#include <utility>
+// interprocess
#include <boost/interprocess/containers/flat_map.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
+// intrusive/detail
+#include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
+
//!\file
//!Describes index adaptor of boost::map container, to use it
diff --git a/boost/interprocess/indexes/iset_index.hpp b/boost/interprocess/indexes/iset_index.hpp
index 170e5dac1b..ffaa24fa77 100644
--- a/boost/interprocess/indexes/iset_index.hpp
+++ b/boost/interprocess/indexes/iset_index.hpp
@@ -11,20 +11,24 @@
#ifndef BOOST_INTERPROCESS_ISET_INDEX_HPP
#define BOOST_INTERPROCESS_ISET_INDEX_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <string>
-#include <functional>
-#include <utility>
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
+#include <boost/container/detail/minimal_char_traits_header.hpp> //std::char_traits
#include <boost/intrusive/set.hpp>
-
//!\file
//!Describes index adaptor of boost::intrusive::set container, to use it
//!as name/shared memory index
diff --git a/boost/interprocess/indexes/iunordered_set_index.hpp b/boost/interprocess/indexes/iunordered_set_index.hpp
index c85c557c25..6cd1452f68 100644
--- a/boost/interprocess/indexes/iunordered_set_index.hpp
+++ b/boost/interprocess/indexes/iunordered_set_index.hpp
@@ -11,20 +11,25 @@
#ifndef BOOST_INTERPROCESS_IUNORDERED_SET_INDEX_HPP
#define BOOST_INTERPROCESS_IUNORDERED_SET_INDEX_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <functional>
-#include <utility>
-
#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/intrusive/unordered_set.hpp>
-#include <boost/interprocess/allocators/allocator.hpp>
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
+#include <boost/container/detail/minimal_char_traits_header.hpp> //std::char_traits
+#include <boost/container/detail/placement_new.hpp>
//!\file
//!Describes index adaptor of boost::intrusive::unordered_set container, to use it
@@ -168,7 +173,7 @@ class iunordered_set_index
bucket_ptr buckets = alloc.allocate(num);
bucket_ptr buckets_init = buckets;
for(size_type i = 0; i < num; ++i){
- new(to_raw_pointer(buckets_init++))bucket_type();
+ ::new(to_raw_pointer(buckets_init++), boost_container_new_t())bucket_type();
}
return buckets;
}
@@ -179,9 +184,9 @@ class iunordered_set_index
{
if(old_size <= new_size )
return old_size;
- size_type received_size;
+ size_type received_size = new_size;
if(!alloc.allocation_command
- (boost::interprocess::try_shrink_in_place | boost::interprocess::nothrow_allocation, old_size, new_size, received_size, buckets).first){
+ (boost::interprocess::try_shrink_in_place | boost::interprocess::nothrow_allocation, old_size, received_size, buckets)){
return old_size;
}
@@ -193,7 +198,7 @@ class iunordered_set_index
}
bucket_ptr shunk_p = alloc.allocation_command
- (boost::interprocess::shrink_in_place | boost::interprocess::nothrow_allocation, received_size, received_size, received_size, buckets).first;
+ (boost::interprocess::shrink_in_place | boost::interprocess::nothrow_allocation, received_size, received_size, buckets);
BOOST_ASSERT(buckets == shunk_p); (void)shunk_p;
bucket_ptr buckets_init = buckets + received_size;
@@ -207,24 +212,23 @@ class iunordered_set_index
( bucket_ptr old_buckets, const size_type old_num
, allocator_type &alloc, const size_type new_num)
{
- size_type received_size;
- std::pair<bucket_ptr, bool> ret =
- alloc.allocation_command
- (boost::interprocess::expand_fwd | boost::interprocess::allocate_new, new_num, new_num, received_size, old_buckets);
- if(ret.first == old_buckets){
+ size_type received_size = new_num;
+ bucket_ptr reuse(old_buckets);
+ bucket_ptr ret = alloc.allocation_command
+ (boost::interprocess::expand_fwd | boost::interprocess::allocate_new, new_num, received_size, reuse);
+ if(ret == old_buckets){
bucket_ptr buckets_init = old_buckets + old_num;
for(size_type i = 0; i < (new_num - old_num); ++i){
- new(to_raw_pointer(buckets_init++))bucket_type();
+ ::new(to_raw_pointer(buckets_init++), boost_container_new_t())bucket_type();
}
}
else{
- bucket_ptr buckets_init = ret.first;
+ bucket_ptr buckets_init = ret;
for(size_type i = 0; i < new_num; ++i){
- new(to_raw_pointer(buckets_init++))bucket_type();
+ ::new(to_raw_pointer(buckets_init++), boost_container_new_t())bucket_type();
}
}
-
- return ret.first;
+ return ret;
}
static void destroy_buckets
diff --git a/boost/interprocess/indexes/map_index.hpp b/boost/interprocess/indexes/map_index.hpp
index a744e9000e..c7c3c865d1 100644
--- a/boost/interprocess/indexes/map_index.hpp
+++ b/boost/interprocess/indexes/map_index.hpp
@@ -11,17 +11,22 @@
#ifndef BOOST_INTERPROCESS_MAP_INDEX_HPP
#define BOOST_INTERPROCESS_MAP_INDEX_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <functional>
-#include <utility>
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/allocators/private_adaptive_pool.hpp>
+#include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
//!\file
//!Describes index adaptor of boost::map container, to use it
diff --git a/boost/interprocess/indexes/null_index.hpp b/boost/interprocess/indexes/null_index.hpp
index d0e026b896..ed4797f8f7 100644
--- a/boost/interprocess/indexes/null_index.hpp
+++ b/boost/interprocess/indexes/null_index.hpp
@@ -10,7 +10,11 @@
#ifndef BOOST_INTERPROCESS_NULL_INDEX_HPP
#define BOOST_INTERPROCESS_NULL_INDEX_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/indexes/unordered_map_index.hpp b/boost/interprocess/indexes/unordered_map_index.hpp
index f40d970819..6a5ad5ddb1 100644
--- a/boost/interprocess/indexes/unordered_map_index.hpp
+++ b/boost/interprocess/indexes/unordered_map_index.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_UNORDERED_MAP_INDEX_HPP
#define BOOST_INTERPROCESS_UNORDERED_MAP_INDEX_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -19,11 +23,14 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <functional>
-#include <utility>
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
#include <boost/unordered_map.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/allocators/private_adaptive_pool.hpp>
+#include <boost/intrusive/detail/minimal_pair_header.hpp> //std::pair
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
+
//!\file
//!Describes index adaptor of boost::unordered_map container, to use it
//!as name/shared memory index
diff --git a/boost/interprocess/interprocess_fwd.hpp b/boost/interprocess/interprocess_fwd.hpp
index 6c9675b401..14b7c2ba96 100644
--- a/boost/interprocess/interprocess_fwd.hpp
+++ b/boost/interprocess/interprocess_fwd.hpp
@@ -11,10 +11,16 @@
#ifndef BOOST_INTERPROCESS_FWD_HPP
#define BOOST_INTERPROCESS_FWD_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
+#include <boost/interprocess/detail/std_fwd.hpp>
+
//! \file
//! This header file forward declares the basic interprocess types:
//! - boost::interprocess::offset_ptr;
@@ -123,20 +129,8 @@
// Standard predeclarations
//////////////////////////////////////////////////////////////////////////////
-namespace boost{
-namespace intrusive{
-}}
-
-namespace boost{
-namespace interprocess{
-namespace bi = boost::intrusive;
-}}
-
-#include <utility>
-#include <memory>
-#include <functional>
-#include <iosfwd>
-#include <string>
+namespace boost{ namespace intrusive{ } }
+namespace boost{ namespace interprocess{ namespace bi = boost::intrusive; } }
namespace boost { namespace interprocess {
@@ -225,19 +219,16 @@ class private_node_allocator;
template<class T, class SegmentManager, std::size_t NodesPerBlock = 64>
class cached_node_allocator;
-template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
- , unsigned char OverheadPercent = 5
->
+template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
+ , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
class adaptive_pool;
-template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
- , unsigned char OverheadPercent = 5
->
+template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
+ , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
class private_adaptive_pool;
-template<class T, class SegmentManager, std::size_t NodesPerBlock = 64, std::size_t MaxFreeBlocks = 2
- , unsigned char OverheadPercent = 5
->
+template< class T, class SegmentManager, std::size_t NodesPerBlock = 64
+ , std::size_t MaxFreeBlocks = 2, unsigned char OverheadPercent = 5 >
class cached_adaptive_pool;
@@ -247,7 +238,8 @@ class cached_adaptive_pool;
static const std::size_t offset_type_alignment = 0;
-template <class T, class DifferenceType = std::ptrdiff_t, class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
+template < class T, class DifferenceType = std::ptrdiff_t
+ , class OffsetType = std::size_t, std::size_t Alignment = offset_type_alignment>
class offset_ptr;
//////////////////////////////////////////////////////////////////////////////
diff --git a/boost/interprocess/ipc/message_queue.hpp b/boost/interprocess/ipc/message_queue.hpp
index 09290587d9..db422cc9d3 100644
--- a/boost/interprocess/ipc/message_queue.hpp
+++ b/boost/interprocess/ipc/message_queue.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MESSAGE_QUEUE_HPP
#define BOOST_INTERPROCESS_MESSAGE_QUEUE_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -28,11 +32,10 @@
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/permissions.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/intrusive/pointer_traits.hpp>
-#include <boost/type_traits/make_unsigned.hpp>
-#include <boost/type_traits/alignment_of.hpp>
+#include <boost/move/detail/type_traits.hpp> //make_unsigned, alignment_of
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/assert.hpp>
#include <algorithm> //std::lower_bound
@@ -71,7 +74,7 @@ class message_queue_t
pointer_traits<void_pointer>::template
rebind_pointer<char>::type char_ptr;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
//!Creates a process shared message queue with name "name". For this message queue,
//!the maximum number of messages will be "max_num_msg" and the maximum message size
@@ -208,7 +211,7 @@ class msg_hdr_t
pointer_traits<void_pointer>::template
rebind_pointer<char>::type char_ptr;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
public:
size_type len; // Message length
@@ -293,7 +296,8 @@ class mq_hdr_t
rebind_pointer<msg_header>::type msg_hdr_ptr_t;
typedef typename boost::intrusive::pointer_traits
<msg_hdr_ptr_t>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ typedef typename boost::container::
+ container_detail::make_unsigned<difference_type>::type size_type;
typedef typename boost::intrusive::
pointer_traits<void_pointer>::template
rebind_pointer<msg_hdr_ptr_t>::type msg_hdr_ptr_ptr_t;
@@ -525,8 +529,8 @@ class mq_hdr_t
(size_type max_msg_size, size_type max_num_msg)
{
const size_type
- msg_hdr_align = ::boost::alignment_of<msg_header>::value,
- index_align = ::boost::alignment_of<msg_hdr_ptr_t>::value,
+ msg_hdr_align = ::boost::container::container_detail::alignment_of<msg_header>::value,
+ index_align = ::boost::container::container_detail::alignment_of<msg_hdr_ptr_t>::value,
r_hdr_size = ipcdetail::ct_rounded_size<sizeof(mq_hdr_t), index_align>::value,
r_index_size = ipcdetail::get_rounded_size<size_type>(max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align),
r_max_msg_size = ipcdetail::get_rounded_size<size_type>(max_msg_size, msg_hdr_align) + sizeof(msg_header);
@@ -539,8 +543,8 @@ class mq_hdr_t
void initialize_memory()
{
const size_type
- msg_hdr_align = ::boost::alignment_of<msg_header>::value,
- index_align = ::boost::alignment_of<msg_hdr_ptr_t>::value,
+ msg_hdr_align = ::boost::container::container_detail::alignment_of<msg_header>::value,
+ index_align = ::boost::container::container_detail::alignment_of<msg_hdr_ptr_t>::value,
r_hdr_size = ipcdetail::ct_rounded_size<sizeof(mq_hdr_t), index_align>::value,
r_index_size = ipcdetail::get_rounded_size<size_type>(m_max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align),
r_max_msg_size = ipcdetail::get_rounded_size<size_type>(m_max_msg_size, msg_hdr_align) + sizeof(msg_header);
@@ -596,9 +600,11 @@ class msg_queue_initialization_func_t
public:
typedef typename boost::intrusive::
pointer_traits<VoidPointer>::template
- rebind_pointer<char>::type char_ptr;
- typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ rebind_pointer<char>::type char_ptr;
+ typedef typename boost::intrusive::pointer_traits<char_ptr>::
+ difference_type difference_type;
+ typedef typename boost::container::container_detail::
+ make_unsigned<difference_type>::type size_type;
msg_queue_initialization_func_t(size_type maxmsg = 0,
size_type maxmsgsize = 0)
diff --git a/boost/interprocess/managed_external_buffer.hpp b/boost/interprocess/managed_external_buffer.hpp
index aa0c8c9d19..1e8f1cca49 100644
--- a/boost/interprocess/managed_external_buffer.hpp
+++ b/boost/interprocess/managed_external_buffer.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_EXTERNAL_BUFFER_HPP
#define BOOST_INTERPROCESS_MANAGED_EXTERNAL_BUFFER_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/managed_heap_memory.hpp b/boost/interprocess/managed_heap_memory.hpp
index 77ba56d75a..c4503281e8 100644
--- a/boost/interprocess/managed_heap_memory.hpp
+++ b/boost/interprocess/managed_heap_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_HEAP_MEMORY_HPP
#define BOOST_INTERPROCESS_MANAGED_HEAP_MEMORY_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -21,7 +25,7 @@
#include <boost/move/utility_core.hpp>
#include <vector>
#include <boost/interprocess/detail/managed_memory_impl.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
//These includes needed to fulfill default template parameters of
//predeclarations in interprocess_fwd.hpp
#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
diff --git a/boost/interprocess/managed_mapped_file.hpp b/boost/interprocess/managed_mapped_file.hpp
index ee74c9f165..14ec160614 100644
--- a/boost/interprocess/managed_mapped_file.hpp
+++ b/boost/interprocess/managed_mapped_file.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_MAPPED_FILE_HPP
#define BOOST_INTERPROCESS_MANAGED_MAPPED_FILE_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/managed_shared_memory.hpp b/boost/interprocess/managed_shared_memory.hpp
index b58ca51dfc..fadc19a71e 100644
--- a/boost/interprocess/managed_shared_memory.hpp
+++ b/boost/interprocess/managed_shared_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_MANAGED_SHARED_MEMORY_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/managed_windows_shared_memory.hpp b/boost/interprocess/managed_windows_shared_memory.hpp
index 2298c799ba..2ff30c9222 100644
--- a/boost/interprocess/managed_windows_shared_memory.hpp
+++ b/boost/interprocess/managed_windows_shared_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_WINDOWS_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_MANAGED_WINDOWS_SHARED_MEMORY_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/managed_xsi_shared_memory.hpp b/boost/interprocess/managed_xsi_shared_memory.hpp
index f7a4b35c35..096a6d255f 100644
--- a/boost/interprocess/managed_xsi_shared_memory.hpp
+++ b/boost/interprocess/managed_xsi_shared_memory.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MANAGED_XSI_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_MANAGED_XSI_SHARED_MEMORY_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/mapped_region.hpp b/boost/interprocess/mapped_region.hpp
index 24e55263ea..912b490900 100644
--- a/boost/interprocess/mapped_region.hpp
+++ b/boost/interprocess/mapped_region.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MAPPED_REGION_HPP
#define BOOST_INTERPROCESS_MAPPED_REGION_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -26,6 +30,8 @@
#include <string>
#include <boost/cstdint.hpp>
#include <boost/assert.hpp>
+#include <boost/move/adl_move_swap.hpp>
+
//Some Unixes use caddr_t instead of void * in madvise
// SunOS Tru64 HP-UX AIX
#if defined(sun) || defined(__sun) || defined(__osf__) || defined(__osf) || defined(_hpux) || defined(hpux) || defined(_AIX)
@@ -853,14 +859,14 @@ inline std::size_t mapped_region::get_page_size()
inline void mapped_region::swap(mapped_region &other)
{
- ipcdetail::do_swap(this->m_base, other.m_base);
- ipcdetail::do_swap(this->m_size, other.m_size);
- ipcdetail::do_swap(this->m_page_offset, other.m_page_offset);
- ipcdetail::do_swap(this->m_mode, other.m_mode);
+ ::boost::adl_move_swap(this->m_base, other.m_base);
+ ::boost::adl_move_swap(this->m_size, other.m_size);
+ ::boost::adl_move_swap(this->m_page_offset, other.m_page_offset);
+ ::boost::adl_move_swap(this->m_mode, other.m_mode);
#if defined (BOOST_INTERPROCESS_WINDOWS)
- ipcdetail::do_swap(this->m_file_or_mapping_hnd, other.m_file_or_mapping_hnd);
+ ::boost::adl_move_swap(this->m_file_or_mapping_hnd, other.m_file_or_mapping_hnd);
#else
- ipcdetail::do_swap(this->m_is_xsi, other.m_is_xsi);
+ ::boost::adl_move_swap(this->m_is_xsi, other.m_is_xsi);
#endif
}
diff --git a/boost/interprocess/mem_algo/detail/mem_algo_common.hpp b/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
index 8af256aab9..87293d18fa 100644
--- a/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
+++ b/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
@@ -11,27 +11,32 @@
#ifndef BOOST_INTERPROCESS_DETAIL_MEM_ALGO_COMMON_HPP
#define BOOST_INTERPROCESS_DETAIL_MEM_ALGO_COMMON_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+// interprocess
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/containers/allocation_type.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
-#include <boost/interprocess/detail/type_traits.hpp>
+// interprocess/detail
#include <boost/interprocess/detail/math_functions.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
-#include <boost/move/utility_core.hpp>
#include <boost/interprocess/detail/min_max.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
+// container/detail
#include <boost/container/detail/multiallocation_chain.hpp>
-#include <boost/assert.hpp>
+#include <boost/container/detail/placement_new.hpp>
+// move
+#include <boost/move/utility_core.hpp>
+// other boost
#include <boost/static_assert.hpp>
-#include <algorithm>
-#include <utility>
-#include <iterator>
#include <boost/assert.hpp>
//!\file
@@ -240,10 +245,11 @@ class memory_algorithm_common
return 0;
}
- size_type real_size;
+ size_type real_size = nbytes;
if(alignment <= Alignment){
+ void *ignore_reuse = 0;
return memory_algo->priv_allocate
- (boost::interprocess::allocate_new, nbytes, nbytes, real_size).first;
+ (boost::interprocess::allocate_new, nbytes, real_size, ignore_reuse);
}
if(nbytes > UsableByPreviousChunk)
@@ -268,8 +274,9 @@ class memory_algorithm_common
);
//Now allocate the buffer
- void *buffer = memory_algo->priv_allocate
- (boost::interprocess::allocate_new, request, request, real_size).first;
+ real_size = request;
+ void *ignore_reuse = 0;
+ void *buffer = memory_algo->priv_allocate(boost::interprocess::allocate_new, request, real_size, ignore_reuse);
if(!buffer){
return 0;
}
@@ -358,9 +365,9 @@ class memory_algorithm_common
static bool try_shrink
(MemoryAlgorithm *memory_algo, void *ptr
- ,const size_type max_size, const size_type preferred_size
- ,size_type &received_size)
+ ,const size_type max_size, size_type &received_size)
{
+ size_type const preferred_size = received_size;
(void)memory_algo;
//Obtain the real block
block_ctrl *block = memory_algo->priv_get_block(ptr);
@@ -414,15 +421,14 @@ class memory_algorithm_common
static bool shrink
(MemoryAlgorithm *memory_algo, void *ptr
- ,const size_type max_size, const size_type preferred_size
- ,size_type &received_size)
+ ,const size_type max_size, size_type &received_size)
{
+ size_type const preferred_size = received_size;
//Obtain the real block
block_ctrl *block = memory_algo->priv_get_block(ptr);
size_type old_block_units = (size_type)block->m_size;
- if(!try_shrink
- (memory_algo, ptr, max_size, preferred_size, received_size)){
+ if(!try_shrink(memory_algo, ptr, max_size, received_size)){
return false;
}
@@ -492,14 +498,15 @@ class memory_algorithm_common
: memory_algo->priv_get_total_units(elem_sizes[low_idx]*sizeof_element);
min_allocation = min_allocation*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
- size_type received_size;
- std::pair<void *, bool> ret = memory_algo->priv_allocate
- (boost::interprocess::allocate_new, min_allocation, total_bytes, received_size, 0);
- if(!ret.first){
+ size_type received_size = total_bytes;
+ void *ignore_reuse = 0;
+ void *ret = memory_algo->priv_allocate
+ (boost::interprocess::allocate_new, min_allocation, received_size, ignore_reuse);
+ if(!ret){
break;
}
- block_ctrl *block = memory_algo->priv_get_block(ret.first);
+ block_ctrl *block = memory_algo->priv_get_block(ret);
size_type received_units = (size_type)block->m_size;
char *block_address = reinterpret_cast<char*>(block);
@@ -521,8 +528,8 @@ class memory_algorithm_common
(total_used_units + elem_units +
((!sizeof_element)
? elem_units
- : std::max(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units))
- ) > received_units){
+ : max_value(memory_algo->priv_get_total_units(elem_sizes[low_idx+1]*sizeof_element), ptr_size_units))
+ > received_units)){
//By default, the new block will use the rest of the buffer
new_block->m_size = received_units - total_used_units;
memory_algo->priv_mark_new_allocated_block(new_block);
@@ -530,13 +537,12 @@ class memory_algorithm_common
//If the remaining units are bigger than needed and we can
//split it obtaining a new free memory block do it.
if((received_units - total_used_units) >= (elem_units + MemoryAlgorithm::BlockCtrlUnits)){
- size_type shrunk_received;
size_type shrunk_request = elem_units*Alignment - AllocatedCtrlBytes + UsableByPreviousChunk;
+ size_type shrunk_received = shrunk_request;
bool shrink_ok = shrink
(memory_algo
,memory_algo->priv_get_user_buffer(new_block)
,shrunk_request
- ,shrunk_request
,shrunk_received);
(void)shrink_ok;
//Shrink must always succeed with passed parameters
@@ -559,7 +565,7 @@ class memory_algorithm_common
total_used_units += (size_type)new_block->m_size;
//Check we have enough room to overwrite the intrusive pointer
BOOST_ASSERT((new_block->m_size*Alignment - AllocatedCtrlUnits) >= sizeof(void_pointer));
- void_pointer p = new(memory_algo->priv_get_user_buffer(new_block))void_pointer(0);
+ void_pointer p = ::new(memory_algo->priv_get_user_buffer(new_block), boost_container_new_t())void_pointer(0);
chain.push_back(p);
++low_idx;
}
diff --git a/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp b/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp
deleted file mode 100644
index dd11bdbb50..0000000000
--- a/boost/interprocess/mem_algo/detail/multi_simple_seq_fit.hpp
+++ /dev/null
@@ -1,61 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-2011. 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/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTERPROCESS_MULTI_SIMPLE_SEQ_FIT_HPP
-#define BOOST_INTERPROCESS_MULTI_SIMPLE_SEQ_FIT_HPP
-
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-
-#include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp>
-#include <boost/interprocess/intersegment_ptr.hpp>
-
-/*!\file
- Describes sequential fit algorithm used to allocate objects in shared memory.
-*/
-
-namespace boost {
-
-namespace interprocess {
-
-/*!This class implements the simple sequential fit algorithm with a simply
- linked list of free buffers.*/
-template<class MutexFamily, class VoidPtr>
-class multi_simple_seq_fit
- : public ipcdetail::simple_seq_fit_impl<MutexFamily, VoidPtr>
-{
- typedef ipcdetail::simple_seq_fit_impl<MutexFamily, VoidPtr> base_t;
- public:
- /*!Constructor. "size" is the total size of the managed memory segment,
- "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(multi_simple_seq_fit)
- offset that the allocator should not use at all.*/
- multi_simple_seq_fit (size_type size, size_type extra_hdr_bytes)
- : base_t(size, extra_hdr_bytes){}
-
- /*!Allocates bytes from existing segments. If there is no memory, it uses
- the growing functor associated with the group to allocate a new segment.
- If this fails, returns 0.*/
- void* allocate (size_type nbytes)
- { return base_t::multi_allocate(nbytes); }
-};
-
-} //namespace interprocess {
-
-} //namespace boost {
-
-#include <boost/interprocess/detail/config_end.hpp>
-
-#endif //#ifndef BOOST_INTERPROCESS_MULTI_SIMPLE_SEQ_FIT_HPP
-
diff --git a/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp b/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp
deleted file mode 100644
index c84d4e6fb7..0000000000
--- a/boost/interprocess/mem_algo/detail/multi_simple_seq_fit_impl.hpp
+++ /dev/null
@@ -1,983 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Ion Gaztanaga 2005-2011. 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/interprocess for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_INTERPROCESS_MEM_ALGO_DETAIL_SIMPLE_SEQ_FIT_IMPL_HPP
-#define BOOST_INTERPROCESS_MEM_ALGO_DETAIL_SIMPLE_SEQ_FIT_IMPL_HPP
-
-#if defined(_MSC_VER)
-# pragma once
-#endif
-
-#include <boost/interprocess/detail/config_begin.hpp>
-#include <boost/interprocess/detail/workaround.hpp>
-
-#include <boost/intrusive/pointer_traits.hpp>
-
-#include <boost/interprocess/interprocess_fwd.hpp>
-#include <boost/interprocess/containers/allocation_type.hpp>
-#include <boost/interprocess/offset_ptr.hpp>
-#include <boost/interprocess/sync/interprocess_mutex.hpp>
-#include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
-#include <boost/interprocess/detail/multi_segment_services.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <boost/type_traits/type_with_alignment.hpp>
-#include <boost/interprocess/detail/min_max.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
-#include <boost/intrusive/pointer_traits.hpp>
-#include <algorithm>
-#include <utility>
-#include <cstring>
-
-#include <boost/assert.hpp>
-#include <new>
-
-/*!\file
- Describes sequential fit algorithm used to allocate objects in shared memory.
- This class is intended as a base class for single segment and multi-segment
- implementations.
-*/
-
-namespace boost {
-
-namespace interprocess {
-
-namespace ipcdetail {
-
-/*!This class implements the simple sequential fit algorithm with a simply
- linked list of free buffers.
- This class is intended as a base class for single segment and multi-segment
- implementations.*/
-template<class MutexFamily, class VoidPointer>
-class simple_seq_fit_impl
-{
- //Non-copyable
- simple_seq_fit_impl();
- simple_seq_fit_impl(const simple_seq_fit_impl &);
- simple_seq_fit_impl &operator=(const simple_seq_fit_impl &);
-
- public:
- /*!Shared interprocess_mutex family used for the rest of the Interprocess framework*/
- typedef MutexFamily mutex_family;
- /*!Pointer type to be used with the rest of the Interprocess framework*/
- typedef VoidPointer void_pointer;
-
- typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
-
-
- private:
- struct block_ctrl;
- typedef typename boost::intrusive::
- pointer_traits<void_pointer>::template
- rebind_pointer<block_ctrl>::type block_ctrl_ptr;
-
- /*!Block control structure*/
- struct block_ctrl
- {
- /*!Offset pointer to the next block.*/
- block_ctrl_ptr m_next;
- /*!This block's memory size (including block_ctrl
- header) in BasicSize units*/
- size_type m_size;
-
- size_type get_user_bytes() const
- { return this->m_size*Alignment - BlockCtrlBytes; }
-
- size_type get_total_bytes() const
- { return this->m_size*Alignment; }
-
- static block_ctrl *get_block_from_addr(void *addr)
- {
- return reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(addr) - BlockCtrlBytes);
- }
-
- void *get_addr() const
- {
- return reinterpret_cast<block_ctrl*>
- (reinterpret_cast<const char*>(this) + BlockCtrlBytes);
- }
-
- };
-
- /*!Shared interprocess_mutex to protect memory allocate/deallocate*/
- typedef typename MutexFamily::mutex_type interprocess_mutex;
-
- /*!This struct includes needed data and derives from
- interprocess_mutex to allow EBO when using null interprocess_mutex*/
- struct header_t : public interprocess_mutex
- {
- /*!Pointer to the first free block*/
- block_ctrl m_root;
- /*!Allocated bytes for internal checking*/
- size_type m_allocated;
- /*!The size of the memory segment*/
- size_type m_size;
- } m_header;
-
- public:
- /*!Constructor. "size" is the total size of the managed memory segment,
- "extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit_impl)
- offset that the allocator should not use at all.*/
- simple_seq_fit_impl (size_type size, size_type extra_hdr_bytes);
- /*!Destructor.*/
- ~simple_seq_fit_impl();
- /*!Obtains the minimum size needed by the algorithm*/
- static size_type get_min_size (size_type extra_hdr_bytes);
-
- //Functions for single segment management
-
- /*!Allocates bytes, returns 0 if there is not more memory*/
- void* allocate (size_type nbytes);
-
- /*!Deallocates previously allocated bytes*/
- void deallocate (void *addr);
-
- /*!Returns the size of the memory segment*/
- size_type get_size() const;
-
- /*!Increases managed memory in extra_size bytes more*/
- void grow(size_type extra_size);
-
- /*!Returns true if all allocated memory has been deallocated*/
- bool all_memory_deallocated();
-
- /*!Makes an internal sanity check and returns true if success*/
- bool check_sanity();
-
- //!Initializes to zero all the memory that's not in use.
- //!This function is normally used for security reasons.
- void clear_free_memory();
-
- std::pair<void *, bool>
- allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- void *reuse_ptr = 0, size_type backwards_multiple = 1);
-
- /*!Returns the size of the buffer previously allocated pointed by ptr*/
- size_type size(void *ptr) const;
-
- /*!Allocates aligned bytes, returns 0 if there is not more memory.
- Alignment must be power of 2*/
- void* allocate_aligned (size_type nbytes, size_type alignment);
-
- /*!Allocates bytes, if there is no more memory, it executes functor
- f(size_type) to allocate a new segment to manage. The functor returns
- std::pair<void*, size_type> indicating the base address and size of
- the new segment. If the new segment can't be allocated, allocate
- it will return 0.*/
- void* multi_allocate(size_type nbytes);
-
- private:
- /*!Real allocation algorithm with min allocation option*/
- std::pair<void *, bool> priv_allocate(boost::interprocess::allocation_type command
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr = 0);
- /*!Returns next block if it's free.
- Returns 0 if next block is not free.*/
- block_ctrl *priv_next_block_if_free(block_ctrl *ptr);
-
- /*!Returns previous block's if it's free.
- Returns 0 if previous block is not free.*/
- std::pair<block_ctrl*, block_ctrl*>priv_prev_block_if_free(block_ctrl *ptr);
-
- /*!Real expand function implementation*/
- bool priv_expand(void *ptr
- ,size_type min_size, size_type preferred_size
- ,size_type &received_size);
-
- /*!Real expand to both sides implementation*/
- void* priv_expand_both_sides(boost::interprocess::allocation_type command
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr
- ,bool only_preferred_backwards);
-
- /*!Real shrink function implementation*/
- bool priv_shrink(void *ptr
- ,size_type max_size, size_type preferred_size
- ,size_type &received_size);
-
- //!Real private aligned allocation function
- void* priv_allocate_aligned (size_type nbytes, size_type alignment);
-
- /*!Checks if block has enough memory and splits/unlinks the block
- returning the address to the users*/
- void* priv_check_and_allocate(size_type units
- ,block_ctrl* prev
- ,block_ctrl* block
- ,size_type &received_size);
- /*!Real deallocation algorithm*/
- void priv_deallocate(void *addr);
-
- /*!Makes a new memory portion available for allocation*/
- void priv_add_segment(void *addr, size_type size);
-
- static const std::size_t Alignment = ::boost::alignment_of<boost::ipcdetail::max_align>::value;
- static const std::size_t BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
- static const std::size_t BlockCtrlSize = BlockCtrlBytes/Alignment;
- static const std::size_t MinBlockSize = BlockCtrlSize + Alignment;
-
- public:
- static const std::size_t PayloadPerAllocation = BlockCtrlBytes;
-};
-
-template<class MutexFamily, class VoidPointer>
-inline simple_seq_fit_impl<MutexFamily, VoidPointer>::
- simple_seq_fit_impl(size_type size, size_type extra_hdr_bytes)
-{
- //Initialize sizes and counters
- m_header.m_allocated = 0;
- m_header.m_size = size;
-
- //Initialize pointers
- size_type block1_off = ipcdetail::get_rounded_size(sizeof(*this)+extra_hdr_bytes, Alignment);
- m_header.m_root.m_next = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(this) + block1_off);
- m_header.m_root.m_next->m_size = (size - block1_off)/Alignment;
- m_header.m_root.m_next->m_next = &m_header.m_root;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline simple_seq_fit_impl<MutexFamily, VoidPointer>::~simple_seq_fit_impl()
-{
- //There is a memory leak!
-// BOOST_ASSERT(m_header.m_allocated == 0);
-// BOOST_ASSERT(m_header.m_root.m_next->m_next == block_ctrl_ptr(&m_header.m_root));
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::grow(size_type extra_size)
-{
- //Old highest address block's end offset
- size_type old_end = m_header.m_size/Alignment*Alignment;
-
- //Update managed buffer's size
- m_header.m_size += extra_size;
-
- //We need at least MinBlockSize blocks to create a new block
- if((m_header.m_size - old_end) < MinBlockSize){
- return;
- }
-
- //We'll create a new free block with extra_size bytes
- block_ctrl *new_block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(this) + old_end);
-
- new_block->m_next = 0;
- new_block->m_size = (m_header.m_size - old_end)/Alignment;
- m_header.m_allocated += new_block->m_size*Alignment;
- this->priv_deallocate(reinterpret_cast<char*>(new_block) + BlockCtrlBytes);
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, size_type size)
-{
- //Check size
- BOOST_ASSERT(!(size < MinBlockSize));
- if(size < MinBlockSize)
- return;
- //Construct big block using the new segment
- block_ctrl *new_block = static_cast<block_ctrl *>(addr);
- new_block->m_size = size/Alignment;
- new_block->m_next = 0;
- //Simulate this block was previously allocated
- m_header.m_allocated += new_block->m_size*Alignment;
- //Return block and insert it in the free block list
- this->priv_deallocate(reinterpret_cast<char*>(new_block) + BlockCtrlBytes);
-}
-
-template<class MutexFamily, class VoidPointer>
-inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
-simple_seq_fit_impl<MutexFamily, VoidPointer>::get_size() const
- { return m_header.m_size; }
-
-template<class MutexFamily, class VoidPointer>
-inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
-simple_seq_fit_impl<MutexFamily, VoidPointer>::
- get_min_size (size_type extra_hdr_bytes)
-{
- return ipcdetail::get_rounded_size(sizeof(simple_seq_fit_impl)+extra_hdr_bytes
- ,Alignment)
- + MinBlockSize;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
- all_memory_deallocated()
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- return m_header.m_allocated == 0 &&
- ipcdetail::to_raw_pointer(m_header.m_root.m_next->m_next) == &m_header.m_root;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::clear_free_memory()
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- block_ctrl *block = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
-
- //Iterate through all free portions
- do{
- //Just clear user the memory part reserved for the user
- std::memset( reinterpret_cast<char*>(block) + BlockCtrlBytes
- , 0
- , block->m_size*Alignment - BlockCtrlBytes);
- block = ipcdetail::to_raw_pointer(block->m_next);
- }
- while(block != &m_header.m_root);
-}
-
-template<class MutexFamily, class VoidPointer>
-inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
- check_sanity()
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- block_ctrl *block = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
-
- size_type free_memory = 0;
-
- //Iterate through all blocks obtaining their size
- do{
- //Free blocks's next must be always valid
- block_ctrl *next = ipcdetail::to_raw_pointer(block->m_next);
- if(!next){
- return false;
- }
- free_memory += block->m_size*Alignment;
- block = next;
- }
- while(block != &m_header.m_root);
-
- //Check allocated bytes are less than size
- if(m_header.m_allocated > m_header.m_size){
- return false;
- }
-
- //Check free bytes are less than size
- if(free_memory > m_header.m_size){
- return false;
- }
- return true;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocate(size_type nbytes)
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- size_type ignore;
- return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocate_aligned(size_type nbytes, size_type alignment)
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- return priv_allocate_aligned(nbytes, alignment);
-}
-
-template<class MutexFamily, class VoidPointer>
-inline std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- allocation_command (boost::interprocess::allocation_type command, size_type min_size,
- size_type preferred_size,size_type &received_size,
- void *reuse_ptr, size_type backwards_multiple)
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- (void)backwards_multiple;
- command &= ~boost::interprocess::expand_bwd;
- if(!command)
- return std::pair<void *, bool>(0, false);
- return priv_allocate(command, min_size, preferred_size, received_size, reuse_ptr);
-}
-
-template<class MutexFamily, class VoidPointer>
-inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
-simple_seq_fit_impl<MutexFamily, VoidPointer>::
- size(void *ptr) const
-{
- //We need no synchronization since this block is not going
- //to be modified
- //Obtain the real size of the block
- block_ctrl *block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(ptr) - BlockCtrlBytes);
- return block->m_size*Alignment - BlockCtrlBytes;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- multi_allocate(size_type nbytes)
-{
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- //Multisegment pointer. Let's try first the normal allocation
- //since it's faster.
- size_type ignore;
- void *addr = this->priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
- if(!addr){
- //If this fails we will try the allocation through the segment
- //creator.
- size_type group, id;
- //Obtain the segment group of this segment
- void_pointer::get_group_and_id(this, group, id);
- if(group == 0){
- //Ooops, group 0 is not valid.
- return 0;
- }
- //Now obtain the polymorphic functor that creates
- //new segments and try to allocate again.
- boost::interprocess::multi_segment_services *p_services =
- static_cast<boost::interprocess::multi_segment_services*>
- (void_pointer::find_group_data(group));
- BOOST_ASSERT(p_services);
- std::pair<void *, std::size_t> ret =
- p_services->create_new_segment(MinBlockSize > nbytes ? MinBlockSize : nbytes);
- if(ret.first){
- priv_add_segment(ret.first, ret.second);
- addr = this->priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
- }
- }
- return addr;
-}
-
-template<class MutexFamily, class VoidPointer>
-void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_expand_both_sides(boost::interprocess::allocation_type command
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr
- ,bool only_preferred_backwards)
-{
- typedef std::pair<block_ctrl *, block_ctrl *> prev_block_t;
- block_ctrl *reuse = block_ctrl::get_block_from_addr(reuse_ptr);
- received_size = 0;
-
- if(this->size(reuse_ptr) > min_size){
- received_size = this->size(reuse_ptr);
- return reuse_ptr;
- }
-
- if(command & boost::interprocess::expand_fwd){
- if(priv_expand(reuse_ptr, min_size, preferred_size, received_size))
- return reuse_ptr;
- }
- else{
- received_size = this->size(reuse_ptr);
- }
- if(command & boost::interprocess::expand_bwd){
- size_type extra_forward = !received_size ? 0 : received_size + BlockCtrlBytes;
- prev_block_t prev_pair = priv_prev_block_if_free(reuse);
- block_ctrl *prev = prev_pair.second;
- if(!prev){
- return 0;
- }
-
- size_type needs_backwards =
- ipcdetail::get_rounded_size(preferred_size - extra_forward, Alignment);
-
- if(!only_preferred_backwards){
- needs_backwards =
- max_value(ipcdetail::get_rounded_size(min_size - extra_forward, Alignment)
- ,min_value(prev->get_user_bytes(), needs_backwards));
- }
-
- //Check if previous block has enough size
- if((prev->get_user_bytes()) >= needs_backwards){
- //Now take all next space. This will succeed
- if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){
- BOOST_ASSERT(0);
- }
-
- //We need a minimum size to split the previous one
- if((prev->get_user_bytes() - needs_backwards) > 2*BlockCtrlBytes){
- block_ctrl *new_block = reinterpret_cast<block_ctrl *>
- (reinterpret_cast<char*>(reuse) - needs_backwards - BlockCtrlBytes);
- new_block->m_next = 0;
- new_block->m_size =
- BlockCtrlSize + (needs_backwards + extra_forward)/Alignment;
- prev->m_size =
- (prev->get_total_bytes() - needs_backwards)/Alignment - BlockCtrlSize;
- received_size = needs_backwards + extra_forward;
- m_header.m_allocated += needs_backwards + BlockCtrlBytes;
- return new_block->get_addr();
- }
- else{
- //Just merge the whole previous block
- block_ctrl *prev_2_block = prev_pair.first;
- //Update received size and allocation
- received_size = extra_forward + prev->get_user_bytes();
- m_header.m_allocated += prev->get_total_bytes();
- //Now unlink it from previous block
- prev_2_block->m_next = prev->m_next;
- prev->m_size = reuse->m_size + prev->m_size;
- prev->m_next = 0;
- return prev->get_addr();
- }
- }
- }
- return 0;
-}
-
-template<class MutexFamily, class VoidPointer>
-std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_allocate(boost::interprocess::allocation_type command
- ,size_type limit_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr)
-{
- if(command & boost::interprocess::shrink_in_place){
- bool success =
- this->priv_shrink(reuse_ptr, limit_size, preferred_size, received_size);
- return std::pair<void *, bool> ((success ? reuse_ptr : 0), true);
- }
- typedef std::pair<void *, bool> return_type;
- received_size = 0;
-
- if(limit_size > preferred_size)
- return return_type(0, false);
-
- //Number of units to request (including block_ctrl header)
- size_type nunits = ipcdetail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlSize;
-
- //Get the root and the first memory block
- block_ctrl *prev = &m_header.m_root;
- block_ctrl *block = ipcdetail::to_raw_pointer(prev->m_next);
- block_ctrl *root = &m_header.m_root;
- block_ctrl *biggest_block = 0;
- block_ctrl *prev_biggest_block = 0;
- size_type biggest_size = limit_size;
-
- //Expand in place
- //reuse_ptr, limit_size, preferred_size, received_size
- //
- if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
- void *ret = priv_expand_both_sides
- (command, limit_size, preferred_size, received_size, reuse_ptr, true);
- if(ret)
- return return_type(ret, true);
- }
-
- if(command & boost::interprocess::allocate_new){
- received_size = 0;
- while(block != root){
- //Update biggest block pointers
- if(block->m_size > biggest_size){
- prev_biggest_block = prev;
- biggest_size = block->m_size;
- biggest_block = block;
- }
- void *addr = this->priv_check_and_allocate(nunits, prev, block, received_size);
- if(addr) return return_type(addr, false);
- //Bad luck, let's check next block
- prev = block;
- block = ipcdetail::to_raw_pointer(block->m_next);
- }
-
- //Bad luck finding preferred_size, now if we have any biggest_block
- //try with this block
- if(biggest_block){
- received_size = biggest_block->m_size*Alignment - BlockCtrlSize;
- nunits = ipcdetail::get_rounded_size(limit_size, Alignment)/Alignment + BlockCtrlSize;
- void *ret = this->priv_check_and_allocate
- (nunits, prev_biggest_block, biggest_block, received_size);
- if(ret)
- return return_type(ret, false);
- }
- }
- //Now try to expand both sides with min size
- if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
- return return_type(priv_expand_both_sides
- (command, limit_size, preferred_size, received_size, reuse_ptr, false), true);
- }
- return return_type(0, false);
-}
-
-template<class MutexFamily, class VoidPointer>
-inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *
- simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_next_block_if_free
- (typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *ptr)
-{
- //Take the address where the next block should go
- block_ctrl *next_block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(ptr) + ptr->m_size*Alignment);
-
- //Check if the adjacent block is in the managed segment
- size_type distance = (reinterpret_cast<char*>(next_block) - reinterpret_cast<char*>(this))/Alignment;
- if(distance >= (m_header.m_size/Alignment)){
- //"next_block" does not exist so we can't expand "block"
- return 0;
- }
-
- if(!next_block->m_next)
- return 0;
-
- return next_block;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline
- std::pair<typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *
- ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *>
- simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_prev_block_if_free
- (typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl *ptr)
-{
- typedef std::pair<block_ctrl *, block_ctrl *> prev_pair_t;
- //Take the address where the previous block should go
- block_ctrl *root = &m_header.m_root;
- block_ctrl *prev_2_block = root;
- block_ctrl *prev_block = ipcdetail::to_raw_pointer(root->m_next);
- while((reinterpret_cast<char*>(prev_block) + prev_block->m_size*Alignment)
- != (reinterpret_cast<char*>(ptr))
- && prev_block != root){
- prev_2_block = prev_block;
- prev_block = ipcdetail::to_raw_pointer(prev_block->m_next);
- }
-
- if(prev_block == root || !prev_block->m_next)
- return prev_pair_t(0, 0);
-
- //Check if the previous block is in the managed segment
- size_type distance = (reinterpret_cast<char*>(prev_block) - reinterpret_cast<char*>(this))/Alignment;
- if(distance >= (m_header.m_size/Alignment)){
- //"previous_block" does not exist so we can't expand "block"
- return prev_pair_t(0, 0);
- }
- return prev_pair_t(prev_2_block, prev_block);
-}
-
-
-template<class MutexFamily, class VoidPointer>
-inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_expand (void *ptr
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size)
-{
- //Obtain the real size of the block
- block_ctrl *block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(ptr) - BlockCtrlBytes);
- size_type old_block_size = block->m_size;
-
- //All used blocks' next is marked with 0 so check it
- BOOST_ASSERT(block->m_next == 0);
-
- //Put this to a safe value
- received_size = old_block_size*Alignment - BlockCtrlBytes;
-
- //Now translate it to Alignment units
- min_size = ipcdetail::get_rounded_size(min_size, Alignment)/Alignment;
- preferred_size = ipcdetail::get_rounded_size(preferred_size, Alignment)/Alignment;
-
- //Some parameter checks
- if(min_size > preferred_size)
- return false;
-
- size_type data_size = old_block_size - BlockCtrlSize;
-
- if(data_size >= min_size)
- return true;
-
- block_ctrl *next_block = priv_next_block_if_free(block);
- if(!next_block){
- return false;
- }
-
- //Is "block" + "next_block" big enough?
- size_type merged_size = old_block_size + next_block->m_size;
-
- //Now we can expand this block further than before
- received_size = merged_size*Alignment - BlockCtrlBytes;
-
- if(merged_size < (min_size + BlockCtrlSize)){
- return false;
- }
-
- //We can fill expand. Merge both blocks,
- block->m_next = next_block->m_next;
- block->m_size = merged_size;
-
- //Find the previous free block of next_block
- block_ctrl *prev = &m_header.m_root;
- while(ipcdetail::to_raw_pointer(prev->m_next) != next_block){
- prev = ipcdetail::to_raw_pointer(prev->m_next);
- }
-
- //Now insert merged block in the free list
- //This allows reusing allocation logic in this function
- m_header.m_allocated -= old_block_size*Alignment;
- prev->m_next = block;
-
- //Now use check and allocate to do the allocation logic
- preferred_size += BlockCtrlSize;
- size_type nunits = preferred_size < merged_size ? preferred_size : merged_size;
-
- //This must success since nunits is less than merged_size!
- if(!this->priv_check_and_allocate (nunits, prev, block, received_size)){
- //Something very ugly is happening here. This is a bug
- //or there is memory corruption
- BOOST_ASSERT(0);
- return false;
- }
- return true;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_shrink (void *ptr
- ,size_type max_size
- ,size_type preferred_size
- ,size_type &received_size)
-{
- //Obtain the real size of the block
- block_ctrl *block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(ptr) - BlockCtrlBytes);
- size_type block_size = block->m_size;
-
- //All used blocks' next is marked with 0 so check it
- BOOST_ASSERT(block->m_next == 0);
-
- //Put this to a safe value
- received_size = block_size*Alignment - BlockCtrlBytes;
-
- //Now translate it to Alignment units
- max_size = max_size/Alignment;
- preferred_size = ipcdetail::get_rounded_size(preferred_size, Alignment)/Alignment;
-
- //Some parameter checks
- if(max_size < preferred_size)
- return false;
-
- size_type data_size = block_size - BlockCtrlSize;
-
- if(data_size < preferred_size)
- return false;
-
- if(data_size == preferred_size)
- return true;
-
- //We must be able to create at least a new empty block
- if((data_size - preferred_size) < BlockCtrlSize){
- return false;
- }
-
- //Now we can just rewrite the size of the old buffer
- block->m_size = preferred_size + BlockCtrlSize;
-
- //Update new size
- received_size = preferred_size*Alignment;
-
- //We create the new block
- block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(block) + block->m_size*Alignment);
-
- //Write control data to simulate this new block was previously allocated
- block->m_next = 0;
- block->m_size = data_size - preferred_size;
-
- //Now deallocate the new block to insert it in the free list
- this->priv_deallocate(reinterpret_cast<char*>(block)+BlockCtrlBytes);
- return true;
-}
-
-template<class MutexFamily, class VoidPointer>
-inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_allocate_aligned(size_type nbytes, size_type alignment)
-{
- //Ensure power of 2
- if ((alignment & (alignment - size_type(1u))) != 0){
- //Alignment is not power of two
- BOOST_ASSERT((alignment & (alignment - size_type(1u))) != 0);
- return 0;
- }
-
- size_type ignore;
- if(alignment <= Alignment){
- return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
- }
-
- size_type request =
- nbytes + alignment + MinBlockSize*Alignment - BlockCtrlBytes;
- void *buffer = priv_allocate(boost::interprocess::allocate_new, request, request, ignore).first;
- if(!buffer)
- return 0;
- else if ((((std::size_t)(buffer)) % alignment) == 0)
- return buffer;
-
- char *aligned_portion = reinterpret_cast<char*>
- (reinterpret_cast<size_type>(static_cast<char*>(buffer) + alignment - 1) & -alignment);
-
- char *pos = ((aligned_portion - reinterpret_cast<char*>(buffer)) >= (MinBlockSize*Alignment)) ?
- aligned_portion : (aligned_portion + alignment);
-
- block_ctrl *first = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(buffer) - BlockCtrlBytes);
-
- block_ctrl *second = reinterpret_cast<block_ctrl*>(pos - BlockCtrlBytes);
-
- size_type old_size = first->m_size;
-
- first->m_size = (reinterpret_cast<char*>(second) - reinterpret_cast<char*>(first))/Alignment;
- second->m_size = old_size - first->m_size;
-
- //Write control data to simulate this new block was previously allocated
- second->m_next = 0;
-
- //Now deallocate the new block to insert it in the free list
- this->priv_deallocate(reinterpret_cast<char*>(first) + BlockCtrlBytes);
- return reinterpret_cast<char*>(second) + BlockCtrlBytes;
-}
-
-template<class MutexFamily, class VoidPointer> inline
-void* simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_check_and_allocate
- (size_type nunits
- ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl* prev
- ,typename simple_seq_fit_impl<MutexFamily, VoidPointer>::block_ctrl* block
- ,size_type &received_size)
-{
- size_type upper_nunits = nunits + BlockCtrlSize;
- bool found = false;
-
- if (block->m_size > upper_nunits){
- //This block is bigger than needed, split it in
- //two blocks, the first's size will be (block->m_size-units)
- //the second's size (units)
- size_type total_size = block->m_size;
- block->m_size = nunits;
- block_ctrl *new_block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(block) + Alignment*nunits);
- new_block->m_size = total_size - nunits;
- new_block->m_next = block->m_next;
- prev->m_next = new_block;
- found = true;
- }
- else if (block->m_size >= nunits){
- //This block has exactly the right size with an extra
- //unusable extra bytes.
- prev->m_next = block->m_next;
- found = true;
- }
-
- if(found){
- //We need block_ctrl for deallocation stuff, so
- //return memory user can overwrite
- m_header.m_allocated += block->m_size*Alignment;
- received_size = block->m_size*Alignment - BlockCtrlBytes;
- //Mark the block as allocated
- block->m_next = 0;
- //Check alignment
- BOOST_ASSERT(((reinterpret_cast<char*>(block) - reinterpret_cast<char*>(this))
- % Alignment) == 0 );
- return reinterpret_cast<char*>(block) + BlockCtrlBytes;
- }
- return 0;
-}
-
-template<class MutexFamily, class VoidPointer>
-void simple_seq_fit_impl<MutexFamily, VoidPointer>::deallocate(void* addr)
-{
- if(!addr) return;
- //-----------------------
- boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
- //-----------------------
- return this->priv_deallocate(addr);
-}
-
-template<class MutexFamily, class VoidPointer>
-void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_deallocate(void* addr)
-{
- if(!addr) return;
-
- //Let's get free block list. List is always sorted
- //by memory address to allow block merging.
- //Pointer next always points to the first
- //(lower address) block
- block_ctrl_ptr prev = &m_header.m_root;
- block_ctrl_ptr pos = m_header.m_root.m_next;
- block_ctrl_ptr block = reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(addr) - BlockCtrlBytes);
-
- //All used blocks' next is marked with 0 so check it
- BOOST_ASSERT(block->m_next == 0);
-
- //Check if alignment and block size are right
- BOOST_ASSERT((reinterpret_cast<char*>(addr) - reinterpret_cast<char*>(this))
- % Alignment == 0 );
-
- size_type total_size = Alignment*block->m_size;
- BOOST_ASSERT(m_header.m_allocated >= total_size);
-
- //Update used memory count
- m_header.m_allocated -= total_size;
-
- //Let's find the previous and the next block of the block to deallocate
- //This ordering comparison must be done with original pointers
- //types since their mapping to raw pointers can be different
- //in each process
- while((ipcdetail::to_raw_pointer(pos) != &m_header.m_root) && (block > pos)){
- prev = pos;
- pos = pos->m_next;
- }
-
- //Try to combine with upper block
- if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block))
- + Alignment*block->m_size) ==
- reinterpret_cast<char*>(ipcdetail::to_raw_pointer(pos))){
-
- block->m_size += pos->m_size;
- block->m_next = pos->m_next;
- }
- else{
- block->m_next = pos;
- }
-
- //Try to combine with lower block
- if ((reinterpret_cast<char*>(ipcdetail::to_raw_pointer(prev))
- + Alignment*prev->m_size) ==
- reinterpret_cast<char*>(ipcdetail::to_raw_pointer(block))){
- prev->m_size += block->m_size;
- prev->m_next = block->m_next;
- }
- else{
- prev->m_next = block;
- }
-}
-
-} //namespace ipcdetail {
-
-} //namespace interprocess {
-
-} //namespace boost {
-
-#include <boost/interprocess/detail/config_end.hpp>
-
-#endif //#ifndef BOOST_INTERPROCESS_MEM_ALGO_DETAIL_SIMPLE_SEQ_FIT_IMPL_HPP
-
diff --git a/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp b/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
index fa0e9caeb7..5c7a420b4a 100644
--- a/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
+++ b/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MEM_ALGO_DETAIL_SIMPLE_SEQ_FIT_IMPL_HPP
#define BOOST_INTERPROCESS_MEM_ALGO_DETAIL_SIMPLE_SEQ_FIT_IMPL_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -32,13 +36,10 @@
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/intrusive/pointer_traits.hpp>
#include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <boost/type_traits/type_with_alignment.hpp>
-#include <algorithm>
-#include <utility>
+#include <boost/move/detail/type_traits.hpp> //make_unsigned, alignment_of
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
#include <cstring>
#include <boost/assert.hpp>
-#include <new>
//!\file
//!Describes sequential fit algorithm used to allocate objects in shared memory.
@@ -75,7 +76,7 @@ class simple_seq_fit_impl
basic_multiallocation_chain<VoidPointer> multiallocation_chain;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
private:
@@ -192,15 +193,11 @@ class simple_seq_fit_impl
void zero_free_memory();
template<class T>
- std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- T *reuse_ptr = 0);
+ T *allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type &prefer_in_recvd_out_size, T *&reuse);
- std::pair<void *, bool>
- raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- void *reuse_ptr = 0, size_type sizeof_object = 1);
+ void * raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type &prefer_in_recvd_out_size, void *&reuse_ptr, size_type sizeof_object = 1);
//!Returns the size of the buffer previously allocated pointed by ptr
size_type size(const void *ptr) const;
@@ -218,18 +215,15 @@ class simple_seq_fit_impl
static block_ctrl *priv_get_block(const void *ptr);
//!Real allocation algorithm with min allocation option
- std::pair<void *, bool> priv_allocate(boost::interprocess::allocation_type command
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr = 0);
-
- std::pair<void *, bool> priv_allocation_command(boost::interprocess::allocation_type command
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr
- ,size_type sizeof_object);
+ void * priv_allocate(boost::interprocess::allocation_type command
+ ,size_type min_size
+ ,size_type &prefer_in_recvd_out_size, void *&reuse_ptr);
+
+ void * priv_allocation_command(boost::interprocess::allocation_type command
+ ,size_type min_size
+ ,size_type &prefer_in_recvd_out_size
+ ,void *&reuse_ptr
+ ,size_type sizeof_object);
//!Returns the number of total units that a user buffer
//!of "userbytes" bytes really occupies (including header)
@@ -247,18 +241,14 @@ class simple_seq_fit_impl
//!Returns previous block's if it's free.
//!Returns 0 if previous block is not free.
- std::pair<block_ctrl*, block_ctrl*>priv_prev_block_if_free(block_ctrl *ptr);
+ std::pair<block_ctrl*, block_ctrl*> priv_prev_block_if_free(block_ctrl *ptr);
//!Real expand function implementation
- bool priv_expand(void *ptr
- ,size_type min_size, size_type preferred_size
- ,size_type &received_size);
+ bool priv_expand(void *ptr, size_type min_size, size_type &prefer_in_recvd_out_size);
//!Real expand to both sides implementation
void* priv_expand_both_sides(boost::interprocess::allocation_type command
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
+ ,size_type min_size, size_type &prefer_in_recvd_out_size
,void *reuse_ptr
,bool only_preferred_backwards);
@@ -280,7 +270,8 @@ class simple_seq_fit_impl
void priv_mark_new_allocated_block(block_ctrl *block);
public:
- static const size_type Alignment = ::boost::alignment_of< ::boost::detail::max_align>::value;
+ static const size_type Alignment = ::boost::container::container_detail::alignment_of
+ < ::boost::container::container_detail::max_align_t>::value;
private:
static const size_type BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
@@ -409,8 +400,9 @@ void simple_seq_fit_impl<MutexFamily, VoidPointer>::shrink_to_fit()
void *unique_block = 0;
if(!m_header.m_allocated){
BOOST_ASSERT(prev == root);
- size_type ignore;
- unique_block = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first;
+ size_type ignore_recvd = 0;
+ void *ignore_reuse = 0;
+ unique_block = priv_allocate(boost::interprocess::allocate_new, 0, ignore_recvd, ignore_reuse);
if(!unique_block)
return;
last = ipcdetail::to_raw_pointer(m_header.m_root.m_next);
@@ -573,8 +565,9 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
//-----------------------
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
//-----------------------
- size_type ignore;
- return priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
+ size_type ignore_recvd = nbytes;
+ void *ignore_reuse = 0;
+ return priv_allocate(boost::interprocess::allocate_new, nbytes, ignore_recvd, ignore_reuse);
}
template<class MutexFamily, class VoidPointer>
@@ -590,61 +583,66 @@ inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
template<class MutexFamily, class VoidPointer>
template<class T>
-inline std::pair<T*, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
+inline T* simple_seq_fit_impl<MutexFamily, VoidPointer>::
allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- T *reuse_ptr)
+ size_type &prefer_in_recvd_out_size, T *&reuse_ptr)
{
- std::pair<void*, bool> ret = priv_allocation_command
- (command, limit_size, preferred_size, received_size, static_cast<void*>(reuse_ptr), sizeof(T));
-
- BOOST_ASSERT(0 == ((std::size_t)ret.first % ::boost::alignment_of<T>::value));
- return std::pair<T *, bool>(static_cast<T*>(ret.first), ret.second);
+ void *raw_reuse = reuse_ptr;
+ void * const ret = priv_allocation_command
+ (command, limit_size, prefer_in_recvd_out_size, raw_reuse, sizeof(T));
+ BOOST_ASSERT(0 == ((std::size_t)ret % ::boost::container::container_detail::alignment_of<T>::value));
+ reuse_ptr = static_cast<T*>(raw_reuse);
+ return static_cast<T*>(ret);
}
template<class MutexFamily, class VoidPointer>
-inline std::pair<void*, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
- raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
- size_type preferred_objects,size_type &received_objects,
- void *reuse_ptr, size_type sizeof_object)
+inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
+ raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
+ size_type &prefer_in_recvd_out_size, void *&reuse_ptr, size_type sizeof_object)
{
- if(!sizeof_object)
- return std::pair<void *, bool>(static_cast<void*>(0), false);
+ size_type const preferred_objects = prefer_in_recvd_out_size;
+ if(!sizeof_object){
+ return reuse_ptr = 0, static_cast<void*>(0);
+ }
if(command & boost::interprocess::try_shrink_in_place){
+ if(!reuse_ptr) return static_cast<void*>(0);
+ prefer_in_recvd_out_size = preferred_objects*sizeof_object;
bool success = algo_impl_t::try_shrink
- ( this, reuse_ptr, limit_objects*sizeof_object
- , preferred_objects*sizeof_object, received_objects);
- received_objects /= sizeof_object;
- return std::pair<void *, bool> ((success ? reuse_ptr : 0), true);
+ ( this, reuse_ptr, limit_objects*sizeof_object, prefer_in_recvd_out_size);
+ prefer_in_recvd_out_size /= sizeof_object;
+ return success ? reuse_ptr : 0;
+ }
+ else{
+ return priv_allocation_command
+ (command, limit_objects, prefer_in_recvd_out_size, reuse_ptr, sizeof_object);
}
- return priv_allocation_command
- (command, limit_objects, preferred_objects, received_objects, reuse_ptr, sizeof_object);
}
template<class MutexFamily, class VoidPointer>
-inline std::pair<void*, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
+inline void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size, size_type &received_size,
- void *reuse_ptr, size_type sizeof_object)
+ size_type &prefer_in_recvd_out_size, void *&reuse_ptr, size_type sizeof_object)
{
+ size_type const preferred_size = prefer_in_recvd_out_size;
command &= ~boost::interprocess::expand_bwd;
- if(!command) return std::pair<void *, bool>(static_cast<void*>(0), false);
+ if(!command){
+ return reuse_ptr = 0, static_cast<void*>(0);
+ }
- std::pair<void*, bool> ret;
size_type max_count = m_header.m_size/sizeof_object;
if(limit_size > max_count || preferred_size > max_count){
- ret.first = 0; return ret;
+ return reuse_ptr = 0, static_cast<void*>(0);
}
size_type l_size = limit_size*sizeof_object;
- size_type p_size = preferred_size*sizeof_object;
- size_type r_size;
+ size_type r_size = preferred_size*sizeof_object;
+ void *ret = 0;
{
//-----------------------
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
//-----------------------
- ret = priv_allocate(command, l_size, p_size, r_size, reuse_ptr);
+ ret = priv_allocate(command, l_size, r_size, reuse_ptr);
}
- received_size = r_size/sizeof_object;
+ prefer_in_recvd_out_size = r_size/sizeof_object;
return ret;
}
@@ -663,29 +661,29 @@ template<class MutexFamily, class VoidPointer>
void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
priv_expand_both_sides(boost::interprocess::allocation_type command
,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
+ ,size_type &prefer_in_recvd_out_size
,void *reuse_ptr
,bool only_preferred_backwards)
{
+ size_type const preferred_size = prefer_in_recvd_out_size;
typedef std::pair<block_ctrl *, block_ctrl *> prev_block_t;
block_ctrl *reuse = priv_get_block(reuse_ptr);
- received_size = 0;
+ prefer_in_recvd_out_size = 0;
if(this->size(reuse_ptr) > min_size){
- received_size = this->size(reuse_ptr);
+ prefer_in_recvd_out_size = this->size(reuse_ptr);
return reuse_ptr;
}
if(command & boost::interprocess::expand_fwd){
- if(priv_expand(reuse_ptr, min_size, preferred_size, received_size))
+ if(priv_expand(reuse_ptr, min_size, prefer_in_recvd_out_size = preferred_size))
return reuse_ptr;
}
else{
- received_size = this->size(reuse_ptr);
+ prefer_in_recvd_out_size = this->size(reuse_ptr);
}
if(command & boost::interprocess::expand_bwd){
- size_type extra_forward = !received_size ? 0 : received_size + BlockCtrlBytes;
+ size_type extra_forward = !prefer_in_recvd_out_size ? 0 : prefer_in_recvd_out_size + BlockCtrlBytes;
prev_block_t prev_pair = priv_prev_block_if_free(reuse);
block_ctrl *prev = prev_pair.second;
if(!prev){
@@ -703,7 +701,7 @@ void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
//Check if previous block has enough size
if((prev->get_user_bytes()) >= needs_backwards){
//Now take all next space. This will succeed
- if(!priv_expand(reuse_ptr, received_size, received_size, received_size)){
+ if(!priv_expand(reuse_ptr, prefer_in_recvd_out_size, prefer_in_recvd_out_size)){
BOOST_ASSERT(0);
}
@@ -717,7 +715,7 @@ void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
BlockCtrlUnits + (needs_backwards + extra_forward)/Alignment;
prev->m_size =
(prev->get_total_bytes() - needs_backwards)/Alignment - BlockCtrlUnits;
- received_size = needs_backwards + extra_forward;
+ prefer_in_recvd_out_size = needs_backwards + extra_forward;
m_header.m_allocated += needs_backwards + BlockCtrlBytes;
return priv_get_user_buffer(new_block);
}
@@ -725,7 +723,7 @@ void* simple_seq_fit_impl<MutexFamily, VoidPointer>::
//Just merge the whole previous block
block_ctrl *prev_2_block = prev_pair.first;
//Update received size and allocation
- received_size = extra_forward + prev->get_user_bytes();
+ prefer_in_recvd_out_size = extra_forward + prev->get_user_bytes();
m_header.m_allocated += prev->get_total_bytes();
//Now unlink it from previous block
prev_2_block->m_next = prev->m_next;
@@ -761,23 +759,21 @@ simple_seq_fit_impl<MutexFamily, VoidPointer>::
}
template<class MutexFamily, class VoidPointer>
-std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
+void * simple_seq_fit_impl<MutexFamily, VoidPointer>::
priv_allocate(boost::interprocess::allocation_type command
- ,size_type limit_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr)
+ ,size_type limit_size, size_type &prefer_in_recvd_out_size, void *&reuse_ptr)
{
+ size_type const preferred_size = prefer_in_recvd_out_size;
if(command & boost::interprocess::shrink_in_place){
- bool success =
- algo_impl_t::shrink(this, reuse_ptr, limit_size, preferred_size, received_size);
- return std::pair<void *, bool> ((success ? reuse_ptr : 0), true);
+ if(!reuse_ptr) return static_cast<void*>(0);
+ bool success = algo_impl_t::shrink(this, reuse_ptr, limit_size, prefer_in_recvd_out_size);
+ return success ? reuse_ptr : 0;
}
- typedef std::pair<void *, bool> return_type;
- received_size = 0;
+ prefer_in_recvd_out_size = 0;
- if(limit_size > preferred_size)
- return return_type(static_cast<void*>(0), false);
+ if(limit_size > preferred_size){
+ return reuse_ptr = 0, static_cast<void*>(0);
+ }
//Number of units to request (including block_ctrl header)
size_type nunits = ipcdetail::get_rounded_size(preferred_size, Alignment)/Alignment + BlockCtrlUnits;
@@ -791,19 +787,16 @@ std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
size_type biggest_size = 0;
//Expand in place
- //reuse_ptr, limit_size, preferred_size, received_size
- //
if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
- void *ret = priv_expand_both_sides
- (command, limit_size, preferred_size, received_size, reuse_ptr, true);
+ void *ret = priv_expand_both_sides(command, limit_size, prefer_in_recvd_out_size = preferred_size, reuse_ptr, true);
if(ret){
algo_impl_t::assert_alignment(ret);
- return return_type(ret, true);
+ return ret;
}
}
if(command & boost::interprocess::allocate_new){
- received_size = 0;
+ prefer_in_recvd_out_size = 0;
while(block != root){
//Update biggest block pointers
if(block->m_size > biggest_size){
@@ -812,10 +805,10 @@ std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
biggest_block = block;
}
algo_impl_t::assert_alignment(block);
- void *addr = this->priv_check_and_allocate(nunits, prev, block, received_size);
+ void *addr = this->priv_check_and_allocate(nunits, prev, block, prefer_in_recvd_out_size);
if(addr){
algo_impl_t::assert_alignment(addr);
- return return_type(addr, false);
+ return reuse_ptr = 0, addr;
}
//Bad luck, let's check next block
prev = block;
@@ -826,25 +819,23 @@ std::pair<void *, bool> simple_seq_fit_impl<MutexFamily, VoidPointer>::
//try with this block
if(biggest_block){
size_type limit_units = ipcdetail::get_rounded_size(limit_size, Alignment)/Alignment + BlockCtrlUnits;
- if(biggest_block->m_size < limit_units)
- return return_type(static_cast<void*>(0), false);
-
- received_size = biggest_block->m_size*Alignment - BlockCtrlUnits;
+ if(biggest_block->m_size < limit_units){
+ return reuse_ptr = 0, static_cast<void*>(0);
+ }
void *ret = this->priv_check_and_allocate
- (biggest_block->m_size, prev_biggest_block, biggest_block, received_size);
+ (biggest_block->m_size, prev_biggest_block, biggest_block, prefer_in_recvd_out_size = biggest_block->m_size*Alignment - BlockCtrlUnits);
BOOST_ASSERT(ret != 0);
algo_impl_t::assert_alignment(ret);
- return return_type(ret, false);
+ return reuse_ptr = 0, ret;
}
}
//Now try to expand both sides with min size
if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
- return_type ret (priv_expand_both_sides
- (command, limit_size, preferred_size, received_size, reuse_ptr, false), true);
- algo_impl_t::assert_alignment(ret.first);
+ void *ret = priv_expand_both_sides (command, limit_size, prefer_in_recvd_out_size = preferred_size, reuse_ptr, false);
+ algo_impl_t::assert_alignment(ret);
return ret;
}
- return return_type(static_cast<void*>(0), false);
+ return reuse_ptr = 0, static_cast<void*>(0);
}
template<class MutexFamily, class VoidPointer> inline
@@ -917,11 +908,9 @@ inline
template<class MutexFamily, class VoidPointer>
inline bool simple_seq_fit_impl<MutexFamily, VoidPointer>::
- priv_expand (void *ptr
- ,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size)
+ priv_expand (void *ptr, size_type min_size, size_type &received_size)
{
+ size_type preferred_size = received_size;
//Obtain the real size of the block
block_ctrl *block = reinterpret_cast<block_ctrl*>(priv_get_block(ptr));
size_type old_block_size = block->m_size;
diff --git a/boost/interprocess/mem_algo/rbtree_best_fit.hpp b/boost/interprocess/mem_algo/rbtree_best_fit.hpp
index fb04889c17..dc4307fe7b 100644
--- a/boost/interprocess/mem_algo/rbtree_best_fit.hpp
+++ b/boost/interprocess/mem_algo/rbtree_best_fit.hpp
@@ -11,42 +11,44 @@
#ifndef BOOST_INTERPROCESS_MEM_ALGO_RBTREE_BEST_FIT_HPP
#define BOOST_INTERPROCESS_MEM_ALGO_RBTREE_BEST_FIT_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/intrusive/pointer_traits.hpp>
-
+// interprocess
+#include <boost/interprocess/containers/allocation_type.hpp>
+#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/mem_algo/detail/mem_algo_common.hpp>
-#include <boost/interprocess/containers/allocation_type.hpp>
-#include <boost/container/detail/multiallocation_chain.hpp>
#include <boost/interprocess/offset_ptr.hpp>
-#include <boost/interprocess/exceptions.hpp>
-#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/interprocess/sync/scoped_lock.hpp>
+// interprocess/detail
#include <boost/interprocess/detail/min_max.hpp>
#include <boost/interprocess/detail/math_functions.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
-#include <boost/interprocess/sync/scoped_lock.hpp>
-#include <boost/type_traits/alignment_of.hpp>
-#include <boost/type_traits/type_with_alignment.hpp>
-#include <boost/type_traits/make_unsigned.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
+// container
+#include <boost/container/detail/multiallocation_chain.hpp>
+// container/detail
+#include <boost/container/detail/placement_new.hpp>
+// move/detail
+#include <boost/move/detail/type_traits.hpp> //make_unsigned, alignment_of
+// intrusive
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/intrusive/set.hpp>
+// other boost
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
-#include <algorithm>
-#include <utility>
+// std
#include <climits>
#include <cstring>
-#include <iterator>
-
-#include <boost/assert.hpp>
-#include <new>
-
-#include <boost/intrusive/set.hpp>
//#define BOOST_INTERPROCESS_RBTREE_BEST_FIT_ABI_V1_HPP
//to maintain ABI compatible with the original version
@@ -92,7 +94,7 @@ class rbtree_best_fit
typedef ipcdetail::basic_multiallocation_chain<VoidPointer> multiallocation_chain;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
- typedef typename boost::make_unsigned<difference_type>::type size_type;
+ typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
@@ -235,15 +237,12 @@ class rbtree_best_fit
bool check_sanity();
template<class T>
- std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- T *reuse_ptr = 0);
+ T * allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type &prefer_in_recvd_out_size, T *&reuse);
- std::pair<void *, bool>
- raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_object,
- size_type preferred_object,size_type &received_object,
- void *reuse_ptr = 0, size_type sizeof_object = 1);
+ void * raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_object,
+ size_type &prefer_in_recvd_out_size,
+ void *&reuse_ptr, size_type sizeof_object = 1);
//!Returns the size of the buffer previously allocated pointed by ptr
size_type size(const void *ptr) const;
@@ -260,19 +259,14 @@ class rbtree_best_fit
block_ctrl *priv_end_block();
- std::pair<void*, bool>
- priv_allocation_command(boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- void *reuse_ptr, size_type sizeof_object);
+ void* priv_allocation_command(boost::interprocess::allocation_type command, size_type limit_size,
+ size_type &prefer_in_recvd_out_size, void *&reuse_ptr, size_type sizeof_object);
//!Real allocation algorithm with min allocation option
- std::pair<void *, bool> priv_allocate(boost::interprocess::allocation_type command
- ,size_type limit_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr = 0
- ,size_type backwards_multiple = 1);
+ void * priv_allocate( boost::interprocess::allocation_type command
+ , size_type limit_size, size_type &prefer_in_recvd_out_size
+ , void *&reuse_ptr, size_type backwards_multiple = 1);
//!Obtains the block control structure of the user buffer
static block_ctrl *priv_get_block(const void *ptr);
@@ -285,15 +279,12 @@ class rbtree_best_fit
static size_type priv_get_total_units(size_type userbytes);
//!Real expand function implementation
- bool priv_expand(void *ptr
- ,const size_type min_size, const size_type preferred_size
- ,size_type &received_size);
+ bool priv_expand(void *ptr, const size_type min_size, size_type &prefer_in_recvd_out_size);
//!Real expand to both sides implementation
void* priv_expand_both_sides(boost::interprocess::allocation_type command
,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
+ ,size_type &prefer_in_recvd_out_size
,void *reuse_ptr
,bool only_preferred_backwards
,size_type backwards_multiple);
@@ -340,7 +331,8 @@ class rbtree_best_fit
public:
static const size_type Alignment = !MemAlignment
- ? size_type(::boost::alignment_of< ::boost::detail::max_align>::value)
+ ? size_type(::boost::container::container_detail::alignment_of
+ < ::boost::container::container_detail::max_align_t>::value)
: size_type(MemAlignment)
;
@@ -348,7 +340,7 @@ class rbtree_best_fit
//Due to embedded bits in size, Alignment must be at least 4
BOOST_STATIC_ASSERT((Alignment >= 4));
//Due to rbtree size optimizations, Alignment must have at least pointer alignment
- BOOST_STATIC_ASSERT((Alignment >= ::boost::alignment_of<void_pointer>::value));
+ BOOST_STATIC_ASSERT((Alignment >= ::boost::container::container_detail::alignment_of<void_pointer>::value));
static const size_type AlignmentMask = (Alignment - 1);
static const size_type BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
@@ -392,7 +384,7 @@ void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
BOOST_ASSERT(segment_size >= (BlockCtrlBytes + EndCtrlBlockBytes));
//Initialize the first big block and the "end" node
- block_ctrl *first_big_block = new(addr)block_ctrl;
+ block_ctrl *first_big_block = ::new(addr, boost_container_new_t())block_ctrl;
first_big_block->m_size = segment_size/Alignment - EndCtrlBlockUnits;
BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits);
@@ -540,8 +532,9 @@ void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::shrink_to_fit()
//Check if no memory is allocated between the first and last block
if(priv_next_block(first_block) == old_end_block){
//If so check if we can allocate memory
- size_type ignore;
- unique_buffer = priv_allocate(boost::interprocess::allocate_new, 0, 0, ignore).first;
+ size_type ignore_recvd = 0;
+ void *ignore_reuse = 0;
+ unique_buffer = priv_allocate(boost::interprocess::allocate_new, 0, ignore_recvd, ignore_reuse);
//If not, return, we can't shrink
if(!unique_buffer)
return;
@@ -675,9 +668,9 @@ inline void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- size_type ignore;
- void * ret = priv_allocate(boost::interprocess::allocate_new, nbytes, nbytes, ignore).first;
- return ret;
+ size_type ignore_recvd = nbytes;
+ void *ignore_reuse = 0;
+ return priv_allocate(boost::interprocess::allocate_new, nbytes, ignore_recvd, ignore_reuse);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
@@ -692,48 +685,51 @@ inline void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
template<class T>
-inline std::pair<T*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+inline T* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- T *reuse_ptr)
+ size_type &prefer_in_recvd_out_size, T *&reuse)
{
- std::pair<void*, bool> ret = priv_allocation_command
- (command, limit_size, preferred_size, received_size, static_cast<void*>(reuse_ptr), sizeof(T));
-
- BOOST_ASSERT(0 == ((std::size_t)ret.first % ::boost::alignment_of<T>::value));
- return std::pair<T *, bool>(static_cast<T*>(ret.first), ret.second);
+ void* raw_reuse = reuse;
+ void* const ret = priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, raw_reuse, sizeof(T));
+ reuse = static_cast<T*>(raw_reuse);
+ BOOST_ASSERT(0 == ((std::size_t)ret % ::boost::container::container_detail::alignment_of<T>::value));
+ return static_cast<T*>(ret);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::pair<void*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+inline void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
- size_type preferred_objects,size_type &received_objects,
- void *reuse_ptr, size_type sizeof_object)
+ size_type &prefer_in_recvd_out_objects, void *&reuse_ptr, size_type sizeof_object)
{
+ size_type const preferred_objects = prefer_in_recvd_out_objects;
if(!sizeof_object)
- return std::pair<void *, bool>(static_cast<void*>(0), false);
+ return reuse_ptr = 0, static_cast<void*>(0);
if(command & boost::interprocess::try_shrink_in_place){
- bool success = algo_impl_t::try_shrink
+ if(!reuse_ptr) return static_cast<void*>(0);
+ const bool success = algo_impl_t::try_shrink
( this, reuse_ptr, limit_objects*sizeof_object
- , preferred_objects*sizeof_object, received_objects);
- received_objects /= sizeof_object;
- return std::pair<void *, bool> ((success ? reuse_ptr : 0), true);
+ , prefer_in_recvd_out_objects = preferred_objects*sizeof_object);
+ prefer_in_recvd_out_objects /= sizeof_object;
+ return success ? reuse_ptr : 0;
+ }
+ else{
+ return priv_allocation_command
+ (command, limit_objects, prefer_in_recvd_out_objects, reuse_ptr, sizeof_object);
}
- return priv_allocation_command
- (command, limit_objects, preferred_objects, received_objects, reuse_ptr, sizeof_object);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-inline std::pair<void*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+inline void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
priv_allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- void *reuse_ptr, size_type sizeof_object)
+ size_type &prefer_in_recvd_out_size,
+ void *&reuse_ptr, size_type sizeof_object)
{
- std::pair<void*, bool> ret;
- size_type max_count = m_header.m_size/sizeof_object;
+ void* ret;
+ size_type const preferred_size = prefer_in_recvd_out_size;
+ size_type const max_count = m_header.m_size/sizeof_object;
if(limit_size > max_count || preferred_size > max_count){
- ret.first = 0; return ret;
+ return reuse_ptr = 0, static_cast<void*>(0);
}
size_type l_size = limit_size*sizeof_object;
size_type p_size = preferred_size*sizeof_object;
@@ -742,9 +738,9 @@ inline std::pair<void*, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlign
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- ret = priv_allocate(command, l_size, p_size, r_size, reuse_ptr, sizeof_object);
+ ret = priv_allocate(command, l_size, r_size = p_size, reuse_ptr, sizeof_object);
}
- received_size = r_size/sizeof_object;
+ prefer_in_recvd_out_size = r_size/sizeof_object;
return ret;
}
@@ -788,20 +784,20 @@ template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
priv_expand_both_sides(boost::interprocess::allocation_type command
,size_type min_size
- ,size_type preferred_size
- ,size_type &received_size
+ ,size_type &prefer_in_recvd_out_size
,void *reuse_ptr
,bool only_preferred_backwards
,size_type backwards_multiple)
{
+ size_type const preferred_size = prefer_in_recvd_out_size;
algo_impl_t::assert_alignment(reuse_ptr);
if(command & boost::interprocess::expand_fwd){
- if(priv_expand(reuse_ptr, min_size, preferred_size, received_size))
+ if(priv_expand(reuse_ptr, min_size, prefer_in_recvd_out_size = preferred_size))
return reuse_ptr;
}
else{
- received_size = this->size(reuse_ptr);
- if(received_size >= preferred_size || received_size >= min_size)
+ prefer_in_recvd_out_size = this->size(reuse_ptr);
+ if(prefer_in_recvd_out_size >= preferred_size || prefer_in_recvd_out_size >= min_size)
return reuse_ptr;
}
@@ -835,7 +831,7 @@ void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
size_type lcm;
if(!algo_impl_t::calculate_lcm_and_needs_backwards_lcmed
( backwards_multiple
- , received_size
+ , prefer_in_recvd_out_size
, only_preferred_backwards ? preferred_size : min_size
, lcm, needs_backwards_aligned)){
return 0;
@@ -846,10 +842,10 @@ void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
//Now take all next space. This will succeed
if(command & boost::interprocess::expand_fwd){
size_type received_size2;
- if(!priv_expand(reuse_ptr, received_size, received_size, received_size2)){
+ if(!priv_expand(reuse_ptr, prefer_in_recvd_out_size, received_size2 = prefer_in_recvd_out_size)){
BOOST_ASSERT(0);
}
- BOOST_ASSERT(received_size == received_size2);
+ BOOST_ASSERT(prefer_in_recvd_out_size == received_size2);
}
//We need a minimum size to split the previous one
if(prev_block->m_size >= (needs_backwards_aligned/Alignment + BlockCtrlUnits)){
@@ -858,7 +854,7 @@ void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
//Free old previous buffer
new_block->m_size =
- AllocatedCtrlUnits + (needs_backwards_aligned + (received_size - UsableByPreviousChunk))/Alignment;
+ AllocatedCtrlUnits + (needs_backwards_aligned + (prefer_in_recvd_out_size - UsableByPreviousChunk))/Alignment;
BOOST_ASSERT(new_block->m_size >= BlockCtrlUnits);
priv_mark_as_allocated_block(new_block);
@@ -880,7 +876,7 @@ void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
}
}
- received_size = needs_backwards_aligned + received_size;
+ prefer_in_recvd_out_size = needs_backwards_aligned + prefer_in_recvd_out_size;
m_header.m_allocated += needs_backwards_aligned;
//Check alignment
@@ -903,7 +899,7 @@ void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
//Just merge the whole previous block
//prev_block->m_size*Alignment is multiple of lcm (and backwards_multiple)
- received_size = received_size + (size_type)prev_block->m_size*Alignment;
+ prefer_in_recvd_out_size = prefer_in_recvd_out_size + (size_type)prev_block->m_size*Alignment;
m_header.m_allocated += (size_type)prev_block->m_size*Alignment;
//Now update sizes
@@ -937,28 +933,25 @@ inline void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
-std::pair<void *, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
+void * rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
priv_allocate(boost::interprocess::allocation_type command
,size_type limit_size
- ,size_type preferred_size
- ,size_type &received_size
- ,void *reuse_ptr
+ ,size_type &prefer_in_recvd_out_size
+ ,void *&reuse_ptr
,size_type backwards_multiple)
{
- //Remove me. Forbid backwards allocation
- //command &= (~boost::interprocess::expand_bwd);
-
+ size_type const preferred_size = prefer_in_recvd_out_size;
if(command & boost::interprocess::shrink_in_place){
+ if(!reuse_ptr) return static_cast<void*>(0);
bool success =
- algo_impl_t::shrink(this, reuse_ptr, limit_size, preferred_size, received_size);
- return std::pair<void *, bool> ((success ? reuse_ptr : 0), true);
+ algo_impl_t::shrink(this, reuse_ptr, limit_size, prefer_in_recvd_out_size = preferred_size);
+ return success ? reuse_ptr : 0;
}
- typedef std::pair<void *, bool> return_type;
- received_size = 0;
+ prefer_in_recvd_out_size = 0;
if(limit_size > preferred_size)
- return return_type(static_cast<void*>(0), false);
+ return reuse_ptr = 0, static_cast<void*>(0);
//Number of units to request (including block_ctrl header)
size_type preferred_units = priv_get_total_units(preferred_size);
@@ -967,11 +960,12 @@ std::pair<void *, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>:
size_type limit_units = priv_get_total_units(limit_size);
//Expand in place
+ prefer_in_recvd_out_size = preferred_size;
if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
void *ret = priv_expand_both_sides
- (command, limit_size, preferred_size, received_size, reuse_ptr, true, backwards_multiple);
+ (command, limit_size, prefer_in_recvd_out_size, reuse_ptr, true, backwards_multiple);
if(ret)
- return return_type(ret, true);
+ return ret;
}
if(command & boost::interprocess::allocate_new){
@@ -979,25 +973,24 @@ std::pair<void *, bool> rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>:
imultiset_iterator it(m_header.m_imultiset.lower_bound(preferred_units, comp));
if(it != m_header.m_imultiset.end()){
- return return_type(this->priv_check_and_allocate
- (preferred_units, ipcdetail::to_raw_pointer(&*it), received_size), false);
+ return reuse_ptr = 0, this->priv_check_and_allocate
+ (preferred_units, ipcdetail::to_raw_pointer(&*it), prefer_in_recvd_out_size);
}
if(it != m_header.m_imultiset.begin()&&
(--it)->m_size >= limit_units){
- return return_type(this->priv_check_and_allocate
- (it->m_size, ipcdetail::to_raw_pointer(&*it), received_size), false);
+ return reuse_ptr = 0, this->priv_check_and_allocate
+ (it->m_size, ipcdetail::to_raw_pointer(&*it), prefer_in_recvd_out_size);
}
}
//Now try to expand both sides with min size
if(reuse_ptr && (command & (boost::interprocess::expand_fwd | boost::interprocess::expand_bwd))){
- return return_type(priv_expand_both_sides
- (command, limit_size, preferred_size, received_size, reuse_ptr, false, backwards_multiple), true);
+ return priv_expand_both_sides
+ (command, limit_size, prefer_in_recvd_out_size = preferred_size, reuse_ptr, false, backwards_multiple);
}
-
- return return_type(static_cast<void*>(0), false);
+ return reuse_ptr = 0, static_cast<void*>(0);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
@@ -1030,11 +1023,9 @@ rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- priv_expand (void *ptr
- ,const size_type min_size
- ,const size_type preferred_size
- ,size_type &received_size)
+ priv_expand (void *ptr, const size_type min_size, size_type &prefer_in_recvd_out_size)
{
+ size_type const preferred_size = prefer_in_recvd_out_size;
//Obtain the real size of the block
block_ctrl *block = priv_get_block(ptr);
size_type old_block_units = block->m_size;
@@ -1043,8 +1034,8 @@ bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
BOOST_ASSERT(priv_is_allocated_block(block));
//Put this to a safe value
- received_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
- if(received_size >= preferred_size || received_size >= min_size)
+ prefer_in_recvd_out_size = (old_block_units - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
+ if(prefer_in_recvd_out_size >= preferred_size || prefer_in_recvd_out_size >= min_size)
return true;
//Now translate it to Alignment units
@@ -1057,7 +1048,7 @@ bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
block_ctrl *next_block;
if(priv_is_allocated_block(next_block = priv_next_block(block))){
- return received_size >= min_size ? true : false;
+ return prefer_in_recvd_out_size >= min_size;
}
algo_impl_t::assert_alignment(next_block);
@@ -1068,7 +1059,7 @@ bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
const size_type merged_user_units = merged_units - AllocatedCtrlUnits;
if(merged_user_units < min_user_units){
- received_size = merged_units*Alignment - UsableByPreviousChunk;
+ prefer_in_recvd_out_size = merged_units*Alignment - UsableByPreviousChunk;
return false;
}
@@ -1103,8 +1094,8 @@ bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
m_header.m_imultiset.erase(old_next_block_it);
}
//This is the remaining block
- block_ctrl *rem_block = new(reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(block) + intended_units*Alignment))block_ctrl;
+ block_ctrl *rem_block = ::new(reinterpret_cast<block_ctrl*>
+ (reinterpret_cast<char*>(block) + intended_units*Alignment), boost_container_new_t())block_ctrl;
rem_block->m_size = rem_units;
algo_impl_t::assert_alignment(rem_block);
BOOST_ASSERT(rem_block->m_size >= BlockCtrlUnits);
@@ -1132,7 +1123,7 @@ bool rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
m_header.m_allocated += (merged_units - old_block_units)*Alignment;
}
priv_mark_as_allocated_block(block);
- received_size = ((size_type)block->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
+ prefer_in_recvd_out_size = ((size_type)block->m_size - AllocatedCtrlUnits)*Alignment + UsableByPreviousChunk;
return true;
}
@@ -1267,8 +1258,8 @@ void* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::priv_check_and_al
BOOST_ASSERT(block->m_size >= BlockCtrlUnits);
//This is the remaining block
- block_ctrl *rem_block = new(reinterpret_cast<block_ctrl*>
- (reinterpret_cast<char*>(block) + Alignment*nunits))block_ctrl;
+ block_ctrl *rem_block = ::new(reinterpret_cast<block_ctrl*>
+ (reinterpret_cast<char*>(block) + Alignment*nunits), boost_container_new_t())block_ctrl;
algo_impl_t::assert_alignment(rem_block);
rem_block->m_size = block_old_size - nunits;
BOOST_ASSERT(rem_block->m_size >= BlockCtrlUnits);
diff --git a/boost/interprocess/mem_algo/simple_seq_fit.hpp b/boost/interprocess/mem_algo/simple_seq_fit.hpp
index aaa5d37497..69813f41bc 100644
--- a/boost/interprocess/mem_algo/simple_seq_fit.hpp
+++ b/boost/interprocess/mem_algo/simple_seq_fit.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SIMPLE_SEQ_FIT_HPP
#define BOOST_INTERPROCESS_SIMPLE_SEQ_FIT_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/offset_ptr.hpp b/boost/interprocess/offset_ptr.hpp
index 5f523ce521..dca55668b6 100644
--- a/boost/interprocess/offset_ptr.hpp
+++ b/boost/interprocess/offset_ptr.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_OFFSET_PTR_HPP
#define BOOST_INTERPROCESS_OFFSET_PTR_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -22,13 +26,9 @@
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/cast_tags.hpp>
#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/container/detail/type_traits.hpp> //alignment_of, aligned_storage
#include <boost/assert.hpp>
-#include <ostream>
-#include <istream>
-#include <iterator>
-#include <iostream>
-#include <boost/aligned_storage.hpp>
-#include <boost/type_traits/alignment_of.hpp>
+#include <iosfwd>
//!\file
//!Describes a smart pointer that stores the offset between this pointer and
@@ -40,9 +40,6 @@ namespace boost {
//Predeclarations
template <class T>
-struct has_trivial_constructor;
-
-template <class T>
struct has_trivial_destructor;
#endif //#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
@@ -59,10 +56,10 @@ namespace ipcdetail {
: m_offset(off)
{}
OffsetType m_offset; //Distance between this object and pointee address
- typename ::boost::aligned_storage
+ typename ::boost::container::container_detail::aligned_storage
< sizeof(OffsetType)
, (OffsetAlignment == offset_type_alignment) ?
- ::boost::alignment_of<OffsetType>::value : OffsetAlignment
+ ::boost::container::container_detail::alignment_of<OffsetType>::value : OffsetAlignment
>::type alignment_helper;
};
@@ -86,7 +83,7 @@ namespace ipcdetail {
#endif
template<int Dummy>
#ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_PTR
- BOOST_INTERPROCESS_NEVER_INLINE
+ BOOST_NOINLINE
#elif defined(NDEBUG)
inline
#endif
@@ -128,7 +125,7 @@ namespace ipcdetail {
template<int Dummy>
#ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF
- BOOST_INTERPROCESS_NEVER_INLINE
+ BOOST_NOINLINE
#elif defined(NDEBUG)
inline
#endif
@@ -177,7 +174,7 @@ namespace ipcdetail {
template<int Dummy>
#ifndef BOOST_INTERPROCESS_OFFSET_PTR_INLINE_TO_OFF_FROM_OTHER
- BOOST_INTERPROCESS_NEVER_INLINE
+ BOOST_NOINLINE
#elif defined(NDEBUG)
inline
#endif
@@ -642,20 +639,23 @@ inline boost::interprocess::offset_ptr<T1, P1, O1, A1>
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-//!has_trivial_constructor<> == true_type specialization for optimizations
+///has_trivial_destructor<> == true_type specialization for optimizations
template <class T, class P, class O, std::size_t A>
-struct has_trivial_constructor< boost::interprocess::offset_ptr<T, P, O, A> >
+struct has_trivial_destructor< ::boost::interprocess::offset_ptr<T, P, O, A> >
{
static const bool value = true;
};
+namespace move_detail {
+
///has_trivial_destructor<> == true_type specialization for optimizations
template <class T, class P, class O, std::size_t A>
-struct has_trivial_destructor< boost::interprocess::offset_ptr<T, P, O, A> >
+struct is_trivially_destructible< ::boost::interprocess::offset_ptr<T, P, O, A> >
{
static const bool value = true;
};
+} //namespace move_detail {
namespace interprocess {
diff --git a/boost/interprocess/permissions.hpp b/boost/interprocess/permissions.hpp
index 49ddbd09a7..87fea28be7 100644
--- a/boost/interprocess/permissions.hpp
+++ b/boost/interprocess/permissions.hpp
@@ -13,7 +13,11 @@
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-#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/segment_manager.hpp b/boost/interprocess/segment_manager.hpp
index 87c0041cf4..d00f17716b 100644
--- a/boost/interprocess/segment_manager.hpp
+++ b/boost/interprocess/segment_manager.hpp
@@ -11,19 +11,24 @@
#ifndef BOOST_INTERPROCESS_SEGMENT_MANAGER_HPP
#define BOOST_INTERPROCESS_SEGMENT_MANAGER_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/interprocess/detail/transform_iterator.hpp>
#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/interprocess/detail/nothrow.hpp>
#include <boost/interprocess/detail/segment_manager_helper.hpp>
#include <boost/interprocess/detail/named_proxy.hpp>
#include <boost/interprocess/detail/utilities.hpp>
@@ -34,10 +39,12 @@
#include <boost/interprocess/smart_ptr/deleter.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
+// container/detail
+#include <boost/container/detail/minimal_char_traits_header.hpp>
+#include <boost/container/detail/placement_new.hpp>
+// std
#include <cstddef> //std::size_t
-#include <string> //char_traits
-#include <new> //std::nothrow
-#include <utility> //std::pair
+#include <boost/intrusive/detail/minimal_pair_header.hpp>
#include <boost/assert.hpp>
#ifndef BOOST_NO_EXCEPTIONS
#include <exception>
@@ -117,7 +124,7 @@ class segment_manager_base
//!Allocates nbytes bytes. This function is only used in
//!single-segment management. Never throws
- void * allocate (size_type nbytes, std::nothrow_t)
+ void * allocate (size_type nbytes, const std::nothrow_t &)
{ return MemoryAlgorithm::allocate(nbytes); }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
@@ -147,13 +154,13 @@ class segment_manager_base
//!Allocates n_elements of elem_bytes bytes.
//!Non-throwing version. chain.size() is not increased on failure.
- void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
+ void allocate_many(const std::nothrow_t &, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
{ MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); }
//!Allocates n_elements, each one of
//!element_lengths[i]*sizeof_element bytes.
//!Non-throwing version. chain.size() is not increased on failure.
- void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
+ void allocate_many(const std::nothrow_t &, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
{ MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element, chain); }
//!Deallocates all elements contained in chain.
@@ -175,7 +182,7 @@ class segment_manager_base
//!Allocates nbytes bytes. This function is only used in
//!single-segment management. Never throws
- void * allocate_aligned (size_type nbytes, size_type alignment, std::nothrow_t)
+ void * allocate_aligned (size_type nbytes, size_type alignment, const std::nothrow_t &)
{ return MemoryAlgorithm::allocate_aligned(nbytes, alignment); }
//!Allocates nbytes bytes. This function is only used in
@@ -191,28 +198,23 @@ class segment_manager_base
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
template<class T>
- std::pair<T *, bool>
- allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
- size_type preferred_size,size_type &received_size,
- T *reuse_ptr = 0)
+ T *allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
+ size_type &prefer_in_recvd_out_size, T *&reuse)
{
- std::pair<T *, bool> ret = MemoryAlgorithm::allocation_command
- ( command | boost::interprocess::nothrow_allocation, limit_size, preferred_size, received_size
- , reuse_ptr);
- if(!(command & boost::interprocess::nothrow_allocation) && !ret.first)
+ T *ret = MemoryAlgorithm::allocation_command
+ (command | boost::interprocess::nothrow_allocation, limit_size, prefer_in_recvd_out_size, reuse);
+ if(!(command & boost::interprocess::nothrow_allocation) && !ret)
throw bad_alloc();
return ret;
}
- std::pair<void *, bool>
- raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
- size_type preferred_objects,size_type &received_objects,
- void *reuse_ptr = 0, size_type sizeof_object = 1)
+ void *raw_allocation_command (boost::interprocess::allocation_type command, size_type limit_objects,
+ size_type &prefer_in_recvd_out_size, void *&reuse, size_type sizeof_object = 1)
{
- std::pair<void *, bool> ret = MemoryAlgorithm::raw_allocation_command
- ( command | boost::interprocess::nothrow_allocation, limit_objects, preferred_objects, received_objects
- , reuse_ptr, sizeof_object);
- if(!(command & boost::interprocess::nothrow_allocation) && !ret.first)
+ void *ret = MemoryAlgorithm::raw_allocation_command
+ ( command | boost::interprocess::nothrow_allocation, limit_objects,
+ prefer_in_recvd_out_size, reuse, sizeof_object);
+ if(!(command & boost::interprocess::nothrow_allocation) && !ret)
throw bad_alloc();
return ret;
}
@@ -266,7 +268,7 @@ class segment_manager_base
, 0);
//Allocate memory
- void *ptr_struct = this->allocate(block_info.total_size(), std::nothrow_t());
+ void *ptr_struct = this->allocate(block_info.total_size(), nothrow<>::get());
//Check if there is enough memory
if(!ptr_struct){
@@ -282,7 +284,7 @@ class segment_manager_base
ipcdetail::mem_algo_deallocator<MemoryAlgorithm> mem(ptr_struct, *this);
//Now construct the header
- block_header_t * hdr = new(ptr_struct) block_header_t(block_info);
+ block_header_t * hdr = ::new(ptr_struct, boost_container_new_t()) block_header_t(block_info);
void *ptr = 0; //avoid gcc warning
ptr = hdr->value();
@@ -457,14 +459,14 @@ class segment_manager
//!object
template <class T>
typename construct_proxy<T>::type
- construct(char_ptr_holder_t name, std::nothrow_t)
+ construct(char_ptr_holder_t name, const std::nothrow_t &)
{ return typename construct_proxy<T>::type (this, name, false, false); }
//!Returns no throwing "search or construct"
//!proxy object
template <class T>
typename construct_proxy<T>::type
- find_or_construct(char_ptr_holder_t name, std::nothrow_t)
+ find_or_construct(char_ptr_holder_t name, const std::nothrow_t &)
{ return typename construct_proxy<T>::type (this, name, true, false); }
//!Returns throwing "construct from iterators" proxy object
@@ -484,14 +486,14 @@ class segment_manager
//!proxy object
template <class T>
typename construct_iter_proxy<T>::type
- construct_it(char_ptr_holder_t name, std::nothrow_t)
+ construct_it(char_ptr_holder_t name, const std::nothrow_t &)
{ return typename construct_iter_proxy<T>::type (this, name, false, false); }
//!Returns no throwing "search or construct from iterators"
//!proxy object
template <class T>
typename construct_iter_proxy<T>::type
- find_or_construct_it(char_ptr_holder_t name, std::nothrow_t)
+ find_or_construct_it(char_ptr_holder_t name, const std::nothrow_t &)
{ return typename construct_iter_proxy<T>::type (this, name, true, false); }
//!Calls object function blocking recursive interprocess_mutex and guarantees that
@@ -728,7 +730,7 @@ class segment_manager
//!and the object count. On failure the first member of the
//!returned pair is 0.
template <class T>
- std::pair<T*, size_type> priv_find__impl (const ipcdetail::unique_instance_t* name, bool lock)
+ std::pair<T*, size_type> priv_find_impl (const ipcdetail::unique_instance_t* name, bool lock)
{
ipcdetail::placement_destroy<T> table;
size_type size;
@@ -741,7 +743,7 @@ class segment_manager
{
void *ret;
//Security overflow check
- if(num > ((std::size_t)-1)/table.size){
+ if(num > ((std::size_t)-1)/table.size){
if(dothrow)
throw bad_alloc();
else
@@ -1019,7 +1021,7 @@ class segment_manager
//Check if the distance between the name pointer and the memory pointer
//is correct (this can detect incorrect type in destruction)
- std::size_t num = ctrl_data->m_value_bytes/table.size;
+ std::size_t num = ctrl_data->m_value_bytes/table.size;
void *values = ctrl_data->value();
//Sanity check
@@ -1127,14 +1129,14 @@ class segment_manager
}
else{
buffer_ptr = this->allocate
- (block_info.template total_size_with_header<intrusive_value_type>(), std::nothrow_t());
+ (block_info.template total_size_with_header<intrusive_value_type>(), nothrow<>::get());
if(!buffer_ptr)
return 0;
}
//Now construct the intrusive hook plus the header
- intrusive_value_type * intrusive_hdr = new(buffer_ptr) intrusive_value_type();
- block_header_t * hdr = new(intrusive_hdr->get_block_header())block_header_t(block_info);
+ intrusive_value_type * intrusive_hdr = ::new(buffer_ptr, boost_container_new_t()) intrusive_value_type();
+ block_header_t * hdr = ::new(intrusive_hdr->get_block_header(), boost_container_new_t())block_header_t(block_info);
void *ptr = 0; //avoid gcc warning
ptr = hdr->value();
@@ -1251,11 +1253,11 @@ class segment_manager
buffer_ptr = this->allocate(total_size);
}
else{
- buffer_ptr = this->allocate(total_size, std::nothrow_t());
+ buffer_ptr = this->allocate(total_size, nothrow<>::get());
if(!buffer_ptr)
return 0;
}
- index_it *idr = new(buffer_ptr) index_it(it);
+ index_it *idr = ::new(buffer_ptr, boost_container_new_t()) index_it(it);
hdr = block_header_t::template from_first_header<index_it>(idr);
}
else{
@@ -1263,14 +1265,14 @@ class segment_manager
buffer_ptr = this->allocate(block_info.total_size());
}
else{
- buffer_ptr = this->allocate(block_info.total_size(), std::nothrow_t());
+ buffer_ptr = this->allocate(block_info.total_size(), nothrow<>::get());
if(!buffer_ptr)
return 0;
}
hdr = static_cast<block_header_t*>(buffer_ptr);
}
- hdr = new(hdr)block_header_t(block_info);
+ hdr = ::new(hdr, boost_container_new_t())block_header_t(block_info);
void *ptr = 0; //avoid gcc warning
ptr = hdr->value();
diff --git a/boost/interprocess/shared_memory_object.hpp b/boost/interprocess/shared_memory_object.hpp
index 59ea343264..34a695d461 100644
--- a/boost/interprocess/shared_memory_object.hpp
+++ b/boost/interprocess/shared_memory_object.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SHARED_MEMORY_OBJECT_HPP
#define BOOST_INTERPROCESS_SHARED_MEMORY_OBJECT_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -25,13 +29,11 @@
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/detail/shared_dir_helpers.hpp>
#include <boost/interprocess/permissions.hpp>
+#include <boost/move/adl_move_swap.hpp>
#include <cstddef>
#include <string>
-#include <algorithm>
-#if defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS_ONLY)
-# include <sys/shm.h> //System V shared memory...
-#elif defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
+#if defined(BOOST_INTERPROCESS_POSIX_SHARED_MEMORY_OBJECTS)
# include <fcntl.h> //O_CREAT, O_*...
# include <sys/mman.h> //shm_xxx
# include <unistd.h> //ftruncate, close
@@ -164,8 +166,8 @@ inline bool shared_memory_object::get_size(offset_t &size) const
inline void shared_memory_object::swap(shared_memory_object &other)
{
- std::swap(m_handle, other.m_handle);
- std::swap(m_mode, other.m_mode);
+ boost::adl_move_swap(m_handle, other.m_handle);
+ boost::adl_move_swap(m_mode, other.m_mode);
m_filename.swap(other.m_filename);
}
diff --git a/boost/interprocess/smart_ptr/deleter.hpp b/boost/interprocess/smart_ptr/deleter.hpp
index 1a9e390018..3cd469df8b 100644
--- a/boost/interprocess/smart_ptr/deleter.hpp
+++ b/boost/interprocess/smart_ptr/deleter.hpp
@@ -13,7 +13,11 @@
#ifndef BOOST_INTERPROCESS_DELETER_HPP
#define BOOST_INTERPROCESS_DELETER_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/smart_ptr/detail/bad_weak_ptr.hpp b/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp
index 77ceda0c58..416f7a4110 100644
--- a/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp
+++ b/boost/interprocess/smart_ptr/detail/bad_weak_ptr.hpp
@@ -13,7 +13,11 @@
#ifndef BOOST_INTERPROCESS_BAD_WEAK_PTR_HPP_INCLUDED
#define BOOST_INTERPROCESS_BAD_WEAK_PTR_HPP_INCLUDED
-#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/smart_ptr/detail/shared_count.hpp b/boost/interprocess/smart_ptr/detail/shared_count.hpp
index aed83eb2ab..61cf9ea198 100644
--- a/boost/interprocess/smart_ptr/detail/shared_count.hpp
+++ b/boost/interprocess/smart_ptr/detail/shared_count.hpp
@@ -14,9 +14,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SHARED_COUNT_HPP_INCLUDED
#define BOOST_INTERPROCESS_DETAIL_SHARED_COUNT_HPP_INCLUDED
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -29,8 +31,10 @@
#include <boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/container/allocator_traits.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
-#include <functional> // std::less
+#include <boost/core/no_exceptions_support.hpp>
+#include <boost/move/adl_move_swap.hpp>
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
+#include <boost/container/detail/placement_new.hpp>
namespace boost {
namespace interprocess {
@@ -104,7 +108,7 @@ class shared_count
deallocator(m_pi, alloc);
//It's more correct to use VoidAllocator::construct but
//this needs copy constructor and we don't like it
- new(ipcdetail::to_raw_pointer(m_pi))counted_impl(p, a, d);
+ ::new(ipcdetail::to_raw_pointer(m_pi), boost_container_new_t())counted_impl(p, a, d);
deallocator.release();
}
}
@@ -189,7 +193,7 @@ class shared_count
}
void swap(shared_count & r) // nothrow
- { ipcdetail::do_swap(m_px, r.m_px); ipcdetail::do_swap(m_pi, r.m_pi); }
+ { ::boost::adl_move_swap(m_px, r.m_px); ::boost::adl_move_swap(m_pi, r.m_pi); }
long use_count() const // nothrow
{ return m_pi != 0? m_pi->use_count(): 0; }
@@ -306,7 +310,7 @@ class weak_count
}
void swap(weak_count & r) // nothrow
- { ipcdetail::do_swap(m_px, r.m_px); ipcdetail::do_swap(m_pi, r.m_pi); }
+ { ::boost::adl_move_swap(m_px, r.m_px); ::boost::adl_move_swap(m_pi, r.m_pi); }
long use_count() const // nothrow
{ return m_pi != 0? m_pi->use_count() : 0; }
diff --git a/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp b/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp
index 47743c1b91..3b6a0876f9 100644
--- a/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp
+++ b/boost/interprocess/smart_ptr/detail/sp_counted_base.hpp
@@ -12,7 +12,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
-#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/smart_ptr/detail/sp_counted_base_atomic.hpp b/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp
index 6ec1d56e59..50392741d0 100644
--- a/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp
+++ b/boost/interprocess/smart_ptr/detail/sp_counted_base_atomic.hpp
@@ -1,9 +1,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_ATOMIC_HPP_INCLUDED
#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_BASE_ATOMIC_HPP_INCLUDED
-// MS compatible compilers support #pragma once
-
-#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/smart_ptr/detail/sp_counted_impl.hpp b/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
index 3e01be5531..a025309bd5 100644
--- a/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
+++ b/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
@@ -1,9 +1,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
#define BOOST_INTERPROCESS_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
-// MS compatible compilers support #pragma once
-
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -23,6 +25,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
+#include <boost/interprocess/containers/version_type.hpp>
#include <boost/interprocess/smart_ptr/detail/sp_counted_base.hpp>
#include <boost/interprocess/smart_ptr/scoped_ptr.hpp>
#include <boost/interprocess/detail/utilities.hpp>
diff --git a/boost/interprocess/smart_ptr/enable_shared_from_this.hpp b/boost/interprocess/smart_ptr/enable_shared_from_this.hpp
index 0ca3b0a390..188b68d678 100644
--- a/boost/interprocess/smart_ptr/enable_shared_from_this.hpp
+++ b/boost/interprocess/smart_ptr/enable_shared_from_this.hpp
@@ -14,7 +14,11 @@
#ifndef BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
#define BOOST_INTERPROCESS_ENABLE_SHARED_FROM_THIS_HPP_INCLUDED
-#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/smart_ptr/intrusive_ptr.hpp b/boost/interprocess/smart_ptr/intrusive_ptr.hpp
index ff66512251..e2cf45fdbb 100644
--- a/boost/interprocess/smart_ptr/intrusive_ptr.hpp
+++ b/boost/interprocess/smart_ptr/intrusive_ptr.hpp
@@ -14,7 +14,11 @@
#ifndef BOOST_INTERPROCESS_INTRUSIVE_PTR_HPP_INCLUDED
#define BOOST_INTERPROCESS_INTRUSIVE_PTR_HPP_INCLUDED
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -27,10 +31,11 @@
#include <boost/assert.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/move/adl_move_swap.hpp>
-#include <functional> // for std::less
#include <iosfwd> // for std::basic_ostream
+#include <boost/intrusive/detail/minimal_less_equal_header.hpp> //std::less
namespace boost {
namespace interprocess {
@@ -168,7 +173,7 @@ class intrusive_ptr
//!Exchanges the contents of the two smart pointers.
//!Does not throw
void swap(intrusive_ptr & rhs)
- { ipcdetail::do_swap(m_ptr, rhs.m_ptr); }
+ { ::boost::adl_move_swap(m_ptr, rhs.m_ptr); }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
diff --git a/boost/interprocess/smart_ptr/scoped_ptr.hpp b/boost/interprocess/smart_ptr/scoped_ptr.hpp
index e628608c9a..5506040b63 100644
--- a/boost/interprocess/smart_ptr/scoped_ptr.hpp
+++ b/boost/interprocess/smart_ptr/scoped_ptr.hpp
@@ -15,7 +15,11 @@
#ifndef BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED
#define BOOST_INTERPROCESS_SCOPED_PTR_HPP_INCLUDED
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -24,6 +28,7 @@
#include <boost/interprocess/detail/pointer_type.hpp>
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/assert.hpp>
+#include <boost/move/adl_move_swap.hpp>
//!\file
//!Describes the smart pointer scoped_ptr
@@ -129,7 +134,10 @@ class scoped_ptr
//!Exchanges the internal pointer and deleter with other scoped_ptr
//!Never throws.
void swap(scoped_ptr & b) // never throws
- { ipcdetail::do_swap<Deleter>(*this, b); ipcdetail::do_swap(m_ptr, b.m_ptr); }
+ {
+ ::boost::adl_move_swap(static_cast<Deleter&>(*this), static_cast<Deleter&>(b));
+ ::boost::adl_move_swap(m_ptr, b.m_ptr);
+ }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
diff --git a/boost/interprocess/smart_ptr/shared_ptr.hpp b/boost/interprocess/smart_ptr/shared_ptr.hpp
index fdf7235727..18e2222629 100644
--- a/boost/interprocess/smart_ptr/shared_ptr.hpp
+++ b/boost/interprocess/smart_ptr/shared_ptr.hpp
@@ -16,7 +16,11 @@
#ifndef BOOST_INTERPROCESS_SHARED_PTR_HPP_INCLUDED
#define BOOST_INTERPROCESS_SHARED_PTR_HPP_INCLUDED
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -28,6 +32,7 @@
#include <boost/assert.hpp>
#include <boost/interprocess/smart_ptr/detail/shared_count.hpp>
#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/interprocess/detail/nothrow.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
@@ -35,10 +40,7 @@
#include <boost/static_assert.hpp>
#include <boost/intrusive/pointer_traits.hpp>
-#include <algorithm> // for std::swap
-#include <functional> // for std::less
-#include <typeinfo> // for std::bad_cast
-#include <iosfwd> // for std::basic_ostream
+#include <iosfwd> // for std::basic_ostream
//!\file
//!Describes the smart pointer shared_ptr
@@ -391,7 +393,7 @@ inline typename managed_shared_ptr<T, ManagedMemory>::type
//!Does not throw, return null shared pointer in error.
template<class T, class ManagedMemory>
inline typename managed_shared_ptr<T, ManagedMemory>::type
- make_managed_shared_ptr(T *constructed_object, ManagedMemory &managed_memory, std::nothrow_t)
+ make_managed_shared_ptr(T *constructed_object, ManagedMemory &managed_memory, const std::nothrow_t &)
{
try{
return typename managed_shared_ptr<T, ManagedMemory>::type
diff --git a/boost/interprocess/smart_ptr/unique_ptr.hpp b/boost/interprocess/smart_ptr/unique_ptr.hpp
index 9e51c93508..919b91d71b 100644
--- a/boost/interprocess/smart_ptr/unique_ptr.hpp
+++ b/boost/interprocess/smart_ptr/unique_ptr.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED
#define BOOST_INTERPROCESS_UNIQUE_PTR_HPP_INCLUDED
-#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/smart_ptr/weak_ptr.hpp b/boost/interprocess/smart_ptr/weak_ptr.hpp
index e4c47cb253..c6e52ddabe 100644
--- a/boost/interprocess/smart_ptr/weak_ptr.hpp
+++ b/boost/interprocess/smart_ptr/weak_ptr.hpp
@@ -15,7 +15,11 @@
#ifndef BOOST_INTERPROCESS_WEAK_PTR_HPP_INCLUDED
#define BOOST_INTERPROCESS_WEAK_PTR_HPP_INCLUDED
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -23,10 +27,11 @@
#include <boost/interprocess/detail/workaround.hpp>
#include <boost/interprocess/smart_ptr/shared_ptr.hpp>
-#include <boost/detail/no_exceptions_support.hpp>
+#include <boost/core/no_exceptions_support.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/smart_ptr/deleter.hpp>
#include <boost/intrusive/pointer_traits.hpp>
+#include <boost/move/adl_move_swap.hpp>
//!\file
//!Describes the smart pointer weak_ptr.
@@ -197,7 +202,7 @@ class weak_ptr
//!
//!Throws: nothing.
void swap(this_type & other) // never throws
- { ipcdetail::do_swap(m_pn, other.m_pn); }
+ { ::boost::adl_move_swap(m_pn, other.m_pn); }
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
template<class T2, class A2, class D2>
diff --git a/boost/interprocess/streams/bufferstream.hpp b/boost/interprocess/streams/bufferstream.hpp
index cb3e637939..9a862e5e86 100644
--- a/boost/interprocess/streams/bufferstream.hpp
+++ b/boost/interprocess/streams/bufferstream.hpp
@@ -35,7 +35,11 @@
#ifndef BOOST_INTERPROCESS_BUFFERSTREAM_HPP
#define BOOST_INTERPROCESS_BUFFERSTREAM_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/streams/vectorstream.hpp b/boost/interprocess/streams/vectorstream.hpp
index 94a75723b6..b6f873e49c 100644
--- a/boost/interprocess/streams/vectorstream.hpp
+++ b/boost/interprocess/streams/vectorstream.hpp
@@ -36,7 +36,11 @@
#ifndef BOOST_INTERPROCESS_VECTORSTREAM_HPP
#define BOOST_INTERPROCESS_VECTORSTREAM_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/sync/detail/common_algorithms.hpp b/boost/interprocess/sync/detail/common_algorithms.hpp
index 76d1c5c9e8..1a72d686b4 100644
--- a/boost/interprocess/sync/detail/common_algorithms.hpp
+++ b/boost/interprocess/sync/detail/common_algorithms.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SYNC_DETAIL_COMMON_ALGORITHMS_HPP
#define BOOST_INTERPROCESS_SYNC_DETAIL_COMMON_ALGORITHMS_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/sync/detail/condition_algorithm_8a.hpp b/boost/interprocess/sync/detail/condition_algorithm_8a.hpp
index be93af7b8f..9978309b96 100644
--- a/boost/interprocess/sync/detail/condition_algorithm_8a.hpp
+++ b/boost/interprocess/sync/detail/condition_algorithm_8a.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_HPP
#define BOOST_INTERPROCESS_DETAIL_CONDITION_ALGORITHM_8A_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/sync/detail/condition_any_algorithm.hpp b/boost/interprocess/sync/detail/condition_any_algorithm.hpp
index 5819acfa28..6e94a84828 100644
--- a/boost/interprocess/sync/detail/condition_any_algorithm.hpp
+++ b/boost/interprocess/sync/detail/condition_any_algorithm.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_HPP
#define BOOST_INTERPROCESS_DETAIL_CONDITION_ANY_ALGORITHM_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/sync/detail/locks.hpp b/boost/interprocess/sync/detail/locks.hpp
index 05652003a8..88d9c0cb48 100644
--- a/boost/interprocess/sync/detail/locks.hpp
+++ b/boost/interprocess/sync/detail/locks.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_LOCKS_HPP
#define BOOST_INTERPROCESS_DETAIL_LOCKS_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/sync/file_lock.hpp b/boost/interprocess/sync/file_lock.hpp
index e8d3903dbe..a488b5ba59 100644
--- a/boost/interprocess/sync/file_lock.hpp
+++ b/boost/interprocess/sync/file_lock.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_FILE_LOCK_HPP
#define BOOST_INTERPROCESS_FILE_LOCK_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/sync/interprocess_condition.hpp b/boost/interprocess/sync/interprocess_condition.hpp
index 19fba30762..c98ece8821 100644
--- a/boost/interprocess/sync/interprocess_condition.hpp
+++ b/boost/interprocess/sync/interprocess_condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONDITION_HPP
#define BOOST_INTERPROCESS_CONDITION_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/sync/interprocess_condition_any.hpp b/boost/interprocess/sync/interprocess_condition_any.hpp
index 093d69cda2..899fd1d401 100644
--- a/boost/interprocess/sync/interprocess_condition_any.hpp
+++ b/boost/interprocess/sync/interprocess_condition_any.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_CONDITION_ANY_HPP
#define BOOST_INTERPROCESS_CONDITION_ANY_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/sync/interprocess_mutex.hpp b/boost/interprocess/sync/interprocess_mutex.hpp
index f4f7258ad8..f3d52f9141 100644
--- a/boost/interprocess/sync/interprocess_mutex.hpp
+++ b/boost/interprocess/sync/interprocess_mutex.hpp
@@ -17,7 +17,11 @@
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-#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/sync/interprocess_recursive_mutex.hpp b/boost/interprocess/sync/interprocess_recursive_mutex.hpp
index fcc0e97228..5da0c1f3b7 100644
--- a/boost/interprocess/sync/interprocess_recursive_mutex.hpp
+++ b/boost/interprocess/sync/interprocess_recursive_mutex.hpp
@@ -29,7 +29,11 @@
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-#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/sync/interprocess_semaphore.hpp b/boost/interprocess/sync/interprocess_semaphore.hpp
index df65193ceb..8ae0c7933f 100644
--- a/boost/interprocess/sync/interprocess_semaphore.hpp
+++ b/boost/interprocess/sync/interprocess_semaphore.hpp
@@ -13,7 +13,11 @@
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -25,7 +29,7 @@
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#if !defined(BOOST_INTERPROCESS_FORCE_GENERIC_EMULATION) && \
- (defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined(BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES))
+ (defined(BOOST_INTERPROCESS_POSIX_PROCESS_SHARED) && defined(BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES))
#include <boost/interprocess/sync/posix/semaphore.hpp>
#define BOOST_INTERPROCESS_USE_POSIX
//Experimental...
diff --git a/boost/interprocess/sync/interprocess_sharable_mutex.hpp b/boost/interprocess/sync/interprocess_sharable_mutex.hpp
index fbaf22a45f..59823b0c9b 100644
--- a/boost/interprocess/sync/interprocess_sharable_mutex.hpp
+++ b/boost/interprocess/sync/interprocess_sharable_mutex.hpp
@@ -15,7 +15,11 @@
#ifndef BOOST_INTERPROCESS_SHARABLE_MUTEX_HPP
#define BOOST_INTERPROCESS_SHARABLE_MUTEX_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/sync/interprocess_upgradable_mutex.hpp b/boost/interprocess/sync/interprocess_upgradable_mutex.hpp
index b90c71ef7f..15767d2c56 100644
--- a/boost/interprocess/sync/interprocess_upgradable_mutex.hpp
+++ b/boost/interprocess/sync/interprocess_upgradable_mutex.hpp
@@ -13,7 +13,11 @@
#ifndef BOOST_INTERPROCESS_UPGRADABLE_MUTEX_HPP
#define BOOST_INTERPROCESS_UPGRADABLE_MUTEX_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/sync/lock_options.hpp b/boost/interprocess/sync/lock_options.hpp
index 7e3305ba44..981ff5b6d3 100644
--- a/boost/interprocess/sync/lock_options.hpp
+++ b/boost/interprocess/sync/lock_options.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_LOCK_OPTIONS_HPP
#define BOOST_INTERPROCESS_LOCK_OPTIONS_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/sync/mutex_family.hpp b/boost/interprocess/sync/mutex_family.hpp
index f19805f1b2..b136ce4418 100644
--- a/boost/interprocess/sync/mutex_family.hpp
+++ b/boost/interprocess/sync/mutex_family.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_MUTEX_FAMILY_HPP
#define BOOST_INTERPROCESS_MUTEX_FAMILY_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/sync/named_condition.hpp b/boost/interprocess/sync/named_condition.hpp
index 4f0d61e253..6d9b7570d1 100644
--- a/boost/interprocess/sync/named_condition.hpp
+++ b/boost/interprocess/sync/named_condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_CONDITION_HPP
#define BOOST_INTERPROCESS_NAMED_CONDITION_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/sync/named_condition_any.hpp b/boost/interprocess/sync/named_condition_any.hpp
index 5d99d22ddd..a622470786 100644
--- a/boost/interprocess/sync/named_condition_any.hpp
+++ b/boost/interprocess/sync/named_condition_any.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_CONDITION_ANY_HPP
#define BOOST_INTERPROCESS_NAMED_CONDITION_ANY_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/sync/named_mutex.hpp b/boost/interprocess/sync/named_mutex.hpp
index e91b1f4d8f..127e8d8a8f 100644
--- a/boost/interprocess/sync/named_mutex.hpp
+++ b/boost/interprocess/sync/named_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_MUTEX_HPP
#define BOOST_INTERPROCESS_NAMED_MUTEX_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/sync/named_recursive_mutex.hpp b/boost/interprocess/sync/named_recursive_mutex.hpp
index f1f629dfcb..b2f1c200bf 100644
--- a/boost/interprocess/sync/named_recursive_mutex.hpp
+++ b/boost/interprocess/sync/named_recursive_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_RECURSIVE_MUTEX_HPP
#define BOOST_INTERPROCESS_NAMED_RECURSIVE_MUTEX_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/sync/named_semaphore.hpp b/boost/interprocess/sync/named_semaphore.hpp
index c4a421ec2b..1e56693a36 100644
--- a/boost/interprocess/sync/named_semaphore.hpp
+++ b/boost/interprocess/sync/named_semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_NAMED_SEMAPHORE_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/sync/named_sharable_mutex.hpp b/boost/interprocess/sync/named_sharable_mutex.hpp
index f4c0aaaee9..a2dca1c415 100644
--- a/boost/interprocess/sync/named_sharable_mutex.hpp
+++ b/boost/interprocess/sync/named_sharable_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_HPP
#define BOOST_INTERPROCESS_NAMED_SHARABLE_MUTEX_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/sync/named_upgradable_mutex.hpp b/boost/interprocess/sync/named_upgradable_mutex.hpp
index e313e72ed4..b285d1a42e 100644
--- a/boost/interprocess/sync/named_upgradable_mutex.hpp
+++ b/boost/interprocess/sync/named_upgradable_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_named_upgradable_mutex_HPP
#define BOOST_INTERPROCESS_named_upgradable_mutex_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/sync/null_mutex.hpp b/boost/interprocess/sync/null_mutex.hpp
index 16db64b8d2..f3c29eb256 100644
--- a/boost/interprocess/sync/null_mutex.hpp
+++ b/boost/interprocess/sync/null_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NULL_MUTEX_HPP
#define BOOST_INTERPROCESS_NULL_MUTEX_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/sync/posix/condition.hpp b/boost/interprocess/sync/posix/condition.hpp
index e09fe4a109..5372d96891 100644
--- a/boost/interprocess/sync/posix/condition.hpp
+++ b/boost/interprocess/sync/posix/condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_POSIX_CONDITION_HPP
#define BOOST_INTERPROCESS_POSIX_CONDITION_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/sync/posix/mutex.hpp b/boost/interprocess/sync/posix/mutex.hpp
index 4cd4207061..70adc23c96 100644
--- a/boost/interprocess/sync/posix/mutex.hpp
+++ b/boost/interprocess/sync/posix/mutex.hpp
@@ -27,7 +27,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_HPP
#define BOOST_INTERPROCESS_DETAIL_POSIX_MUTEX_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/sync/posix/named_mutex.hpp b/boost/interprocess/sync/posix/named_mutex.hpp
index 2b3be2f8be..28fafa83ed 100644
--- a/boost/interprocess/sync/posix/named_mutex.hpp
+++ b/boost/interprocess/sync/posix/named_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_POSIX_NAMED_MUTEX_HPP
#define BOOST_INTERPROCESS_POSIX_NAMED_MUTEX_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/sync/posix/named_semaphore.hpp b/boost/interprocess/sync/posix/named_semaphore.hpp
index 03510e3baa..8180da1e48 100644
--- a/boost/interprocess/sync/posix/named_semaphore.hpp
+++ b/boost/interprocess/sync/posix/named_semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_POSIX_NAMED_CONDITION_HPP
#define BOOST_INTERPROCESS_POSIX_NAMED_CONDITION_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/sync/posix/pthread_helpers.hpp b/boost/interprocess/sync/posix/pthread_helpers.hpp
index ce859d7918..c615c851eb 100644
--- a/boost/interprocess/sync/posix/pthread_helpers.hpp
+++ b/boost/interprocess/sync/posix/pthread_helpers.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_PTHREAD_HELPERS_HPP
#define BOOST_INTERPROCESS_PTHREAD_HELPERS_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/sync/posix/ptime_to_timespec.hpp b/boost/interprocess/sync/posix/ptime_to_timespec.hpp
index 65993de958..5aa09e0c19 100644
--- a/boost/interprocess/sync/posix/ptime_to_timespec.hpp
+++ b/boost/interprocess/sync/posix/ptime_to_timespec.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_HPP
#define BOOST_INTERPROCESS_DETAIL_PTIME_TO_TIMESPEC_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/sync/posix/recursive_mutex.hpp b/boost/interprocess/sync/posix/recursive_mutex.hpp
index ccb50da286..9ef4f12788 100644
--- a/boost/interprocess/sync/posix/recursive_mutex.hpp
+++ b/boost/interprocess/sync/posix/recursive_mutex.hpp
@@ -27,7 +27,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_HPP
#define BOOST_INTERPROCESS_DETAIL_POSIX_RECURSIVE_MUTEX_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/sync/posix/semaphore.hpp b/boost/interprocess/sync/posix/semaphore.hpp
index ba6a6f0eba..6fea766eda 100644
--- a/boost/interprocess/sync/posix/semaphore.hpp
+++ b/boost/interprocess/sync/posix/semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_POSIX_SEMAPHORE_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/sync/posix/semaphore_wrapper.hpp b/boost/interprocess/sync/posix/semaphore_wrapper.hpp
index 33f55fae54..ca0f519b68 100644
--- a/boost/interprocess/sync/posix/semaphore_wrapper.hpp
+++ b/boost/interprocess/sync/posix/semaphore_wrapper.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_POSIX_SEMAPHORE_WRAPPER_HPP
#define BOOST_INTERPROCESS_POSIX_SEMAPHORE_WRAPPER_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -47,6 +51,8 @@ namespace boost {
namespace interprocess {
namespace ipcdetail {
+#ifdef BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+
inline bool semaphore_open
(sem_t *&handle, create_enum_t type, const char *origname,
unsigned int count = 0, const permissions &perm = permissions())
@@ -130,6 +136,10 @@ inline bool semaphore_unlink(const char *semname)
}
}
+#endif //BOOST_INTERPROCESS_POSIX_NAMED_SEMAPHORES
+
+#ifdef BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
+
inline void semaphore_init(sem_t *handle, unsigned int initialCount)
{
int ret = sem_init(handle, 1, initialCount);
@@ -150,6 +160,8 @@ inline void semaphore_destroy(sem_t *handle)
}
}
+#endif //BOOST_INTERPROCESS_POSIX_UNNAMED_SEMAPHORES
+
inline void semaphore_post(sem_t *handle)
{
int ret = sem_post(handle);
diff --git a/boost/interprocess/sync/scoped_lock.hpp b/boost/interprocess/sync/scoped_lock.hpp
index c095530274..97986f0361 100644
--- a/boost/interprocess/sync/scoped_lock.hpp
+++ b/boost/interprocess/sync/scoped_lock.hpp
@@ -16,7 +16,11 @@
#ifndef BOOST_INTERPROCESS_SCOPED_LOCK_HPP
#define BOOST_INTERPROCESS_SCOPED_LOCK_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -29,6 +33,7 @@
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
//!\file
//!Describes the scoped_lock class.
@@ -353,8 +358,8 @@ class scoped_lock
//!Throws: Nothing.
void swap( scoped_lock<mutex_type> &other)
{
- std::swap(mp_mutex, other.mp_mutex);
- std::swap(m_locked, other.m_locked);
+ (simple_swap)(mp_mutex, other.mp_mutex);
+ (simple_swap)(m_locked, other.m_locked);
}
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
diff --git a/boost/interprocess/sync/sharable_lock.hpp b/boost/interprocess/sync/sharable_lock.hpp
index efbee6d10a..3df93ee1a0 100644
--- a/boost/interprocess/sync/sharable_lock.hpp
+++ b/boost/interprocess/sync/sharable_lock.hpp
@@ -16,7 +16,11 @@
#ifndef BOOST_INTERPROCESS_SHARABLE_LOCK_HPP
#define BOOST_INTERPROCESS_SHARABLE_LOCK_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -27,6 +31,7 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/mpl.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
#include <boost/move/utility_core.hpp>
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
@@ -286,8 +291,8 @@ class sharable_lock
//!Throws: Nothing.
void swap(sharable_lock<mutex_type> &other)
{
- std::swap(mp_mutex, other.mp_mutex);
- std::swap(m_locked, other.m_locked);
+ (simple_swap)(mp_mutex, other.mp_mutex);
+ (simple_swap)(m_locked, other.m_locked);
}
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
diff --git a/boost/interprocess/sync/shm/named_condition.hpp b/boost/interprocess/sync/shm/named_condition.hpp
index e2ff280b7b..e58f5ded7b 100644
--- a/boost/interprocess/sync/shm/named_condition.hpp
+++ b/boost/interprocess/sync/shm/named_condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SHM_NAMED_CONDITION_HPP
#define BOOST_INTERPROCESS_SHM_NAMED_CONDITION_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/sync/shm/named_condition_any.hpp b/boost/interprocess/sync/shm/named_condition_any.hpp
index 46bca92e45..6eb06b48ef 100644
--- a/boost/interprocess/sync/shm/named_condition_any.hpp
+++ b/boost/interprocess/sync/shm/named_condition_any.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_HPP
#define BOOST_INTERPROCESS_SHM_NAMED_CONDITION_ANY_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/sync/shm/named_creation_functor.hpp b/boost/interprocess/sync/shm/named_creation_functor.hpp
index 234e072aac..b4cc7786cb 100644
--- a/boost/interprocess/sync/shm/named_creation_functor.hpp
+++ b/boost/interprocess/sync/shm/named_creation_functor.hpp
@@ -11,13 +11,18 @@
#ifndef BOOST_INTERPROCESS_SYNC_NAMED_CREATION_FUNCTOR_HPP
#define BOOST_INTERPROCESS_SYNC_NAMED_CREATION_FUNCTOR_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/detail/type_traits.hpp>
#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/container/detail/placement_new.hpp>
namespace boost {
namespace interprocess {
@@ -35,11 +40,11 @@ class named_creation_functor
template<class ArgType>
void construct(void *address, typename enable_if_c<is_same<ArgType, no_arg_t>::value>::type * = 0) const
- { new(address)T; }
+ { ::new(address, boost_container_new_t())T; }
template<class ArgType>
void construct(void *address, typename enable_if_c<!is_same<ArgType, no_arg_t>::value>::type * = 0) const
- { new(address)T(m_arg); }
+ { ::new(address, boost_container_new_t())T(m_arg); }
bool operator()(void *address, std::size_t, bool created) const
{
diff --git a/boost/interprocess/sync/shm/named_mutex.hpp b/boost/interprocess/sync/shm/named_mutex.hpp
index fc66f3a704..846727463f 100644
--- a/boost/interprocess/sync/shm/named_mutex.hpp
+++ b/boost/interprocess/sync/shm/named_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SHM_NAMED_MUTEX_HPP
#define BOOST_INTERPROCESS_SHM_NAMED_MUTEX_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/sync/shm/named_recursive_mutex.hpp b/boost/interprocess/sync/shm/named_recursive_mutex.hpp
index 988ef66315..345eedaf55 100644
--- a/boost/interprocess/sync/shm/named_recursive_mutex.hpp
+++ b/boost/interprocess/sync/shm/named_recursive_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SHM_NAMED_RECURSIVE_MUTEX_HPP
#define BOOST_INTERPROCESS_SHM_NAMED_RECURSIVE_MUTEX_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/sync/shm/named_semaphore.hpp b/boost/interprocess/sync/shm/named_semaphore.hpp
index d952d12e14..4ac93e08fd 100644
--- a/boost/interprocess/sync/shm/named_semaphore.hpp
+++ b/boost/interprocess/sync/shm/named_semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_SHM_NAMED_SEMAPHORE_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/sync/shm/named_upgradable_mutex.hpp b/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
index 4c397927fb..ced2243bed 100644
--- a/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
+++ b/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_HPP
#define BOOST_INTERPROCESS_NAMED_UPGRADABLE_MUTEX_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/sync/spin/condition.hpp b/boost/interprocess/sync/spin/condition.hpp
index e587c32c9b..1a1878b8ac 100644
--- a/boost/interprocess/sync/spin/condition.hpp
+++ b/boost/interprocess/sync/spin/condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_CONDITION_HPP
#define BOOST_INTERPROCESS_DETAIL_SPIN_CONDITION_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/sync/spin/interprocess_barrier.hpp b/boost/interprocess/sync/spin/interprocess_barrier.hpp
index 5f88dd4faa..7a9580df2a 100644
--- a/boost/interprocess/sync/spin/interprocess_barrier.hpp
+++ b/boost/interprocess/sync/spin/interprocess_barrier.hpp
@@ -12,7 +12,11 @@
#include <boost/interprocess/detail/posix_time_types_wrk.hpp>
#include <boost/interprocess/sync/scoped_lock.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/sync/spin/mutex.hpp b/boost/interprocess/sync/spin/mutex.hpp
index 154dc6d916..7663673433 100644
--- a/boost/interprocess/sync/spin/mutex.hpp
+++ b/boost/interprocess/sync/spin/mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_MUTEX_HPP
#define BOOST_INTERPROCESS_DETAIL_SPIN_MUTEX_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/sync/spin/recursive_mutex.hpp b/boost/interprocess/sync/spin/recursive_mutex.hpp
index ce6b0d18ac..495efd900e 100644
--- a/boost/interprocess/sync/spin/recursive_mutex.hpp
+++ b/boost/interprocess/sync/spin/recursive_mutex.hpp
@@ -27,7 +27,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_RECURSIVE_MUTEX_HPP
#define BOOST_INTERPROCESS_DETAIL_SPIN_RECURSIVE_MUTEX_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/sync/spin/semaphore.hpp b/boost/interprocess/sync/spin/semaphore.hpp
index 94922afe43..ad86c4d05f 100644
--- a/boost/interprocess/sync/spin/semaphore.hpp
+++ b/boost/interprocess/sync/spin/semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SPIN_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_DETAIL_SPIN_SEMAPHORE_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/sync/spin/wait.hpp b/boost/interprocess/sync/spin/wait.hpp
index 220699bae1..984f91ad00 100644
--- a/boost/interprocess/sync/spin/wait.hpp
+++ b/boost/interprocess/sync/spin/wait.hpp
@@ -15,7 +15,11 @@
#ifndef BOOST_INTERPROCESS_SYNC_WAIT_HPP_INCLUDED
#define BOOST_INTERPROCESS_SYNC_WAIT_HPP_INCLUDED
-#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/sync/upgradable_lock.hpp b/boost/interprocess/sync/upgradable_lock.hpp
index 646019b433..d067751670 100644
--- a/boost/interprocess/sync/upgradable_lock.hpp
+++ b/boost/interprocess/sync/upgradable_lock.hpp
@@ -16,7 +16,11 @@
#ifndef BOOST_INTERPROCESS_UPGRADABLE_LOCK_HPP
#define BOOST_INTERPROCESS_UPGRADABLE_LOCK_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -290,8 +294,8 @@ class upgradable_lock
//!Throws: Nothing.
void swap(upgradable_lock<mutex_type> &other)
{
- std::swap(mp_mutex, other.mp_mutex);
- std::swap(m_locked, other.m_locked);
+ (simple_swap)(mp_mutex, other.mp_mutex);
+ (simple_swap)(m_locked, other.m_locked);
}
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
diff --git a/boost/interprocess/sync/windows/condition.hpp b/boost/interprocess/sync/windows/condition.hpp
index d5b77c7efe..58a43e25a5 100644
--- a/boost/interprocess/sync/windows/condition.hpp
+++ b/boost/interprocess/sync/windows/condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_HPP
#define BOOST_INTERPROCESS_DETAIL_WINDOWS_CONDITION_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/sync/windows/mutex.hpp b/boost/interprocess/sync/windows/mutex.hpp
index 0b1958cfb7..4747d0cc66 100644
--- a/boost/interprocess/sync/windows/mutex.hpp
+++ b/boost/interprocess/sync/windows/mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_MUTEX_HPP
#define BOOST_INTERPROCESS_DETAIL_WINDOWS_MUTEX_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/sync/windows/named_condition.hpp b/boost/interprocess/sync/windows/named_condition.hpp
index ba220fdc5b..9f148a3fb1 100644
--- a/boost/interprocess/sync/windows/named_condition.hpp
+++ b/boost/interprocess/sync/windows/named_condition.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_HPP
#define BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_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/sync/windows/named_condition_any.hpp b/boost/interprocess/sync/windows/named_condition_any.hpp
index fc2a7fce61..5dac8b77a7 100644
--- a/boost/interprocess/sync/windows/named_condition_any.hpp
+++ b/boost/interprocess/sync/windows/named_condition_any.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_HPP
#define BOOST_INTERPROCESS_WINDOWS_NAMED_CONDITION_ANY_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/sync/windows/named_mutex.hpp b/boost/interprocess/sync/windows/named_mutex.hpp
index 9d5738562b..64a83c94f8 100644
--- a/boost/interprocess/sync/windows/named_mutex.hpp
+++ b/boost/interprocess/sync/windows/named_mutex.hpp
@@ -10,7 +10,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_HPP
#define BOOST_INTERPROCESS_WINDOWS_NAMED_MUTEX_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/sync/windows/named_recursive_mutex.hpp b/boost/interprocess/sync/windows/named_recursive_mutex.hpp
index 695c44a5a9..2e591371aa 100644
--- a/boost/interprocess/sync/windows/named_recursive_mutex.hpp
+++ b/boost/interprocess/sync/windows/named_recursive_mutex.hpp
@@ -10,7 +10,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_HPP
#define BOOST_INTERPROCESS_WINDOWS_RECURSIVE_NAMED_MUTEX_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/sync/windows/named_semaphore.hpp b/boost/interprocess/sync/windows/named_semaphore.hpp
index 7adf91b751..e777a66895 100644
--- a/boost/interprocess/sync/windows/named_semaphore.hpp
+++ b/boost/interprocess/sync/windows/named_semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_WINDOWS_NAMED_SEMAPHORE_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/sync/windows/named_sync.hpp b/boost/interprocess/sync/windows/named_sync.hpp
index 5af7a3221a..cf19335a34 100644
--- a/boost/interprocess/sync/windows/named_sync.hpp
+++ b/boost/interprocess/sync/windows/named_sync.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_HPP
#define BOOST_INTERPROCESS_WINDOWS_NAMED_SYNC_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/sync/windows/recursive_mutex.hpp b/boost/interprocess/sync/windows/recursive_mutex.hpp
index 55a838583b..bf406f8fec 100644
--- a/boost/interprocess/sync/windows/recursive_mutex.hpp
+++ b/boost/interprocess/sync/windows/recursive_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_RECURSIVE_MUTEX_HPP
#define BOOST_INTERPROCESS_DETAIL_WINDOWS_RECURSIVE_MUTEX_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/sync/windows/semaphore.hpp b/boost/interprocess/sync/windows/semaphore.hpp
index 7fdbc41b3d..7a29d962e5 100644
--- a/boost/interprocess/sync/windows/semaphore.hpp
+++ b/boost/interprocess/sync/windows/semaphore.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINDOWS_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_DETAIL_WINDOWS_SEMAPHORE_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/sync/windows/sync_utils.hpp b/boost/interprocess/sync/windows/sync_utils.hpp
index 7e54cc36b2..8e054660ca 100644
--- a/boost/interprocess/sync/windows/sync_utils.hpp
+++ b/boost/interprocess/sync/windows/sync_utils.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_SYNC_UTILS_HPP
#define BOOST_INTERPROCESS_DETAIL_SYNC_UTILS_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/sync/windows/winapi_mutex_wrapper.hpp b/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp
index f7b78a9260..983e33571d 100644
--- a/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp
+++ b/boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_HPP
#define BOOST_INTERPROCESS_DETAIL_WINAPI_MUTEX_WRAPPER_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/sync/windows/winapi_semaphore_wrapper.hpp b/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp
index f64d506d4d..c98224f15d 100644
--- a/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp
+++ b/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_HPP
#define BOOST_INTERPROCESS_DETAIL_WINAPI_SEMAPHORE_WRAPPER_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/sync/windows/winapi_wrapper_common.hpp b/boost/interprocess/sync/windows/winapi_wrapper_common.hpp
index ccf2d65cb6..428a26eb66 100644
--- a/boost/interprocess/sync/windows/winapi_wrapper_common.hpp
+++ b/boost/interprocess/sync/windows/winapi_wrapper_common.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_DETAIL_WINAPI_WRAPPER_COMMON_HPP
#define BOOST_INTERPROCESS_DETAIL_WINAPI_WRAPPER_COMMON_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/sync/xsi/advanced_xsi_semaphore.hpp b/boost/interprocess/sync/xsi/advanced_xsi_semaphore.hpp
index b69cfbf934..49562f5cbd 100644
--- a/boost/interprocess/sync/xsi/advanced_xsi_semaphore.hpp
+++ b/boost/interprocess/sync/xsi/advanced_xsi_semaphore.hpp
@@ -30,7 +30,11 @@
#ifndef BOOST_INTERPROCESS_SYNC_XSI_ADVANCED_XSI_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_SYNC_XSI_ADVANCED_XSI_SEMAPHORE_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/sync/xsi/simple_xsi_semaphore.hpp b/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp
index 69ad34caf2..3d6fd882c6 100644
--- a/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp
+++ b/boost/interprocess/sync/xsi/simple_xsi_semaphore.hpp
@@ -10,7 +10,11 @@
#ifndef BOOST_INTERPROCESS_SYNC_XSI_SIMPLE_XSI_SEMAPHORE_HPP
#define BOOST_INTERPROCESS_SYNC_XSI_SIMPLE_XSI_SEMAPHORE_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/sync/xsi/xsi_named_mutex.hpp b/boost/interprocess/sync/xsi/xsi_named_mutex.hpp
index 1c4ee78a4f..7d8cf50a83 100644
--- a/boost/interprocess/sync/xsi/xsi_named_mutex.hpp
+++ b/boost/interprocess/sync/xsi/xsi_named_mutex.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_XSI_XSI_NAMED_MUTEX_HPP
#define BOOST_INTERPROCESS_XSI_XSI_NAMED_MUTEX_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
@@ -30,11 +34,13 @@
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/sync/xsi/basic_xsi_semaphore.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
+
#include <cstddef>
#include <boost/assert.hpp>
#include <boost/cstdint.hpp>
#include <string>
-#include <boost/assert.hpp>
+
//!\file
//!Describes a class representing a xsi-based named_mutex.
@@ -142,10 +148,10 @@ inline const char *xsi_named_mutex::get_path() const
inline void xsi_named_mutex::swap(xsi_named_mutex &other)
{
- std::swap(m_key, other.m_key);
- std::swap(m_id, other.m_id);
- std::swap(m_semid, other.m_semid);
- std::swap(m_perm, other.m_perm);
+ (simple_swap)(m_key, other.m_key);
+ (simple_swap)(m_id, other.m_id);
+ (simple_swap)(m_semid, other.m_semid);
+ (simple_swap)(m_perm, other.m_perm);
m_path.swap(other.m_path);
}
diff --git a/boost/interprocess/windows_shared_memory.hpp b/boost/interprocess/windows_shared_memory.hpp
index 5898b4b113..341674aec5 100644
--- a/boost/interprocess/windows_shared_memory.hpp
+++ b/boost/interprocess/windows_shared_memory.hpp
@@ -11,14 +11,19 @@
#ifndef BOOST_INTERPROCESS_WINDOWS_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_WINDOWS_SHARED_MEMORY_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/detail/workaround.hpp>
+
#include <boost/interprocess/permissions.hpp>
+#include <boost/interprocess/detail/simple_swap.hpp>
#if !defined(BOOST_INTERPROCESS_WINDOWS)
#error "This header can only be used in Windows operating systems"
@@ -149,8 +154,8 @@ inline const char *windows_shared_memory::get_name() const
inline void windows_shared_memory::swap(windows_shared_memory &other)
{
- std::swap(m_handle, other.m_handle);
- std::swap(m_mode, other.m_mode);
+ (simple_swap)(m_handle, other.m_handle);
+ (simple_swap)(m_mode, other.m_mode);
m_name.swap(other.m_name);
}
diff --git a/boost/interprocess/xsi_key.hpp b/boost/interprocess/xsi_key.hpp
index 38e990a57e..084411ed35 100644
--- a/boost/interprocess/xsi_key.hpp
+++ b/boost/interprocess/xsi_key.hpp
@@ -11,7 +11,11 @@
#ifndef BOOST_INTERPROCESS_XSI_KEY_HPP
#define BOOST_INTERPROCESS_XSI_KEY_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/xsi_shared_memory.hpp b/boost/interprocess/xsi_shared_memory.hpp
index 3451717d0b..cb5db8f799 100644
--- a/boost/interprocess/xsi_shared_memory.hpp
+++ b/boost/interprocess/xsi_shared_memory.hpp
@@ -11,13 +11,16 @@
#ifndef BOOST_INTERPROCESS_XSI_SHARED_MEMORY_HPP
#define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_HPP
-#if defined(_MSC_VER)
+#ifndef BOOST_CONFIG_HPP
+# include <boost/config.hpp>
+#endif
+#
+#if defined(BOOST_HAS_PRAGMA_ONCE)
# pragma once
#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/workaround.hpp>
-#include <boost/detail/workaround.hpp>
#if !defined(BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS)
#error "This header can't be used in operating systems without XSI (System V) shared memory support"
@@ -26,15 +29,22 @@
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/utilities.hpp>
-#include <boost/move/utility_core.hpp>
+
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/xsi_key.hpp>
#include <boost/interprocess/permissions.hpp>
-#include <sys/shm.h>
-#include <cstddef>
+#include <boost/interprocess/detail/simple_swap.hpp>
+// move
+#include <boost/move/utility_core.hpp>
+// other boost
#include <boost/cstdint.hpp>
+// std
+#include <cstddef>
+// OS
+#include <sys/shm.h>
+
//!\file
//!Describes a class representing a native xsi shared memory.
@@ -145,7 +155,7 @@ inline int xsi_shared_memory::get_shmid() const
inline void xsi_shared_memory::swap(xsi_shared_memory &other)
{
- std::swap(m_shmid, other.m_shmid);
+ (simple_swap)(m_shmid, other.m_shmid);
}
inline mapping_handle_t xsi_shared_memory::get_mapping_handle() const