diff --git a/doc/interprocess.qbk b/doc/interprocess.qbk index fe722b1..ad7a47e 100644 --- a/doc/interprocess.qbk +++ b/doc/interprocess.qbk @@ -3419,6 +3419,8 @@ For more information about managed mapped file capabilities, see [endsect] +[endsect] + [section:managed_memory_segment_features Managed Memory Segment Features] The following features are common to all managed memory segment classes, but @@ -3463,13 +3465,38 @@ of a managed memory segment or objects constructed in the managed segment. [endsect] -[section:allocation_types Object construction function family] +[section:object_constrution Object construction and uses-allocator protocol] + +[*Boost.Interprocess]' managed memory segments allows a varied object +construction styles: associated with a name, anonymous or "singleton-like" +objects. + +The object construction API allows constructing both individual elements +and arrays of objects. An array can be constructed with the same +parameters for all objects within the array or we can define a different +parameter from a list of iterators. + +Since Boost 1.91, [*Boost.Interprocess] uses [Boost.Container's] +extended uses-allocator construction utilities like `uninitialized_construct_using_allocator` +(see [@https://www.boost.org/doc/libs/latest/doc/html/container/cpp_conformance.html Boost.Container] +so that constructing objects that use shared-memory allocators is simplified. A +user taking advantage of the uses-allocator protocol: + +* Does not longer need to explicitly pass allocator arguments when constructing an + object by means of the managed memory segment utilities. + +* [*Boost.Inteprocess] allocators' `construct` operations, in cooperation with [*Boost.Containers] + take advantage of the uses-allocator protocol to automatically propagate the state of the shared + memory allocator to compatible types. + +[endsect] + +[section:named Named Object construction function family] When constructing objects in a managed memory segment (managed shared memory, managed mapped files...) associated with a name, the user has a varied object construction family to "construct" or to "construct if not found". [*Boost.Interprocess] -can construct a single object or an array of objects. The array can be constructed with -the same parameters for all objects or we can define each parameter from a list of iterators: +can construct a single object or an array of objects. [c++] @@ -4428,8 +4455,6 @@ through a message queue and duplicated in another buffer: [endsect] -[endsect] - [section:allocators_containers Allocators and memory allocation algorithms] [section:allocator_introduction Introduction to Interprocess allocators] diff --git a/include/boost/interprocess/detail/named_proxy.hpp b/include/boost/interprocess/detail/named_proxy.hpp index 910d19c..99cbca6 100644 --- a/include/boost/interprocess/detail/named_proxy.hpp +++ b/include/boost/interprocess/detail/named_proxy.hpp @@ -31,8 +31,9 @@ #include #include #endif //#ifdef BOOST_INTERPROCESS_PERFECT_FORWARDING + +#include #include -#include #include #include @@ -96,21 +97,17 @@ struct CtorArgN template void construct(void* mem, SegmentManager *segment_manager, true_, const index_tuple&) { - boost::container::dtl::allocator_traits_dummy atd; typedef uses_segment_manager uses_segment_manager_t; - boost::container::dtl::dispatch_uses_allocator - (atd, uses_segment_manager_t(segment_manager), static_cast(mem), *boost::forward((get)(args_))...); + boost::container::uninitialized_construct_using_allocator + (static_cast(mem), uses_segment_manager_t(segment_manager), *boost::forward((get)(args_))...); } - //{ ::new((void*)mem, boost_container_new_t()) T(*boost::forward((get)(args_))...); } - template void construct(void *mem, SegmentManager *segment_manager, false_, const index_tuple&) { typedef uses_segment_manager uses_segment_manager_t; - boost::container::dtl::allocator_traits_dummy atd; - boost::container::dtl::dispatch_uses_allocator - (atd, uses_segment_manager_t(segment_manager), static_cast(mem), boost::forward((get)(args_))...); + boost::container::uninitialized_construct_using_allocator + (static_cast(mem), uses_segment_manager_t(segment_manager), boost::forward((get)(args_))...); } template