mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Backport uses allocator logic for older compilers.
This commit is contained in:
@@ -173,6 +173,7 @@ class adaptive_pool_base
|
||||
segment_manager* get_segment_manager()const
|
||||
{ return node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->get_segment_manager(); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Requires</b>: Uses-allocator construction of T with allocator
|
||||
//! `segment_manager*` and constructor arguments `std::forward<Args>(args)...`
|
||||
//! is well-formed. [Note: uses-allocator construction is always well formed for
|
||||
@@ -191,6 +192,22 @@ class adaptive_pool_base
|
||||
(atd, this->get_segment_manager(), p, ::boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
#define BOOST_CONTAINER_ALLOCATORS_ADAPTIVE_POOL_CONSTRUCT_CODE(N) \
|
||||
template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\
|
||||
void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\
|
||||
{\
|
||||
boost::container::dtl::allocator_traits_dummy<U> atd;\
|
||||
boost::container::dtl::dispatch_uses_allocator\
|
||||
(atd, this->get_segment_manager(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATORS_ADAPTIVE_POOL_CONSTRUCT_CODE)
|
||||
#undef BOOST_CONTAINER_ALLOCATORS_ADAPTIVE_POOL_CONSTRUCT_CODE
|
||||
|
||||
#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
//!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)
|
||||
@@ -413,7 +430,7 @@ class adaptive_pool
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing unless the constructor for T throws.
|
||||
template <typename U, class ...Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)...args);
|
||||
void construct(U* p, Args&& ...args);
|
||||
|
||||
//!Returns maximum the number of objects the previously allocated memory
|
||||
//!pointed by p can hold. This size only works for memory allocated with
|
||||
|
||||
@@ -160,6 +160,7 @@ class allocator
|
||||
void deallocate(const pointer &ptr, size_type)
|
||||
{ mp_mngr->deallocate((void*)ipcdetail::to_raw_pointer(ptr)); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Requires</b>: Uses-allocator construction of T with allocator
|
||||
//! `segment_manager*` and constructor arguments `std::forward<Args>(args)...`
|
||||
//! is well-formed. [Note: uses-allocator construction is always well formed for
|
||||
@@ -178,6 +179,22 @@ class allocator
|
||||
(atd, this->get_segment_manager(), p, ::boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
#define BOOST_CONTAINER_ALLOCATORS_ALLOCATOR_CONSTRUCT_CODE(N) \
|
||||
template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\
|
||||
void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\
|
||||
{\
|
||||
boost::container::dtl::allocator_traits_dummy<U> atd;\
|
||||
boost::container::dtl::dispatch_uses_allocator\
|
||||
(atd, this->get_segment_manager(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATORS_ALLOCATOR_CONSTRUCT_CODE)
|
||||
#undef BOOST_CONTAINER_ALLOCATORS_ALLOCATOR_CONSTRUCT_CODE
|
||||
|
||||
#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
//!Returns the number of elements that could be allocated.
|
||||
//!Never throws
|
||||
size_type max_size() const
|
||||
|
||||
@@ -292,7 +292,7 @@ class cached_adaptive_pool
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing unless the constructor for T throws.
|
||||
template <typename U, class ...Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)...args);
|
||||
void construct(U* p, Args&& ...args);
|
||||
|
||||
//!Returns maximum the number of objects the previously allocated memory
|
||||
//!pointed by p can hold. This size only works for memory allocated with
|
||||
|
||||
@@ -264,7 +264,7 @@ class cached_node_allocator
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing unless the constructor for T throws.
|
||||
template <typename U, class ...Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)...args);
|
||||
void construct(U* p, Args&& ...args);
|
||||
|
||||
//!Destroys object. Throws if object's
|
||||
//!destructor throws
|
||||
|
||||
@@ -620,6 +620,7 @@ class cached_allocator_impl
|
||||
segment_manager* get_segment_manager()const
|
||||
{ return m_cache.get_segment_manager(); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Requires</b>: Uses-allocator construction of T with allocator
|
||||
//! `segment_manager*` and constructor arguments `std::forward<Args>(args)...`
|
||||
//! is well-formed. [Note: uses-allocator construction is always well formed for
|
||||
@@ -638,6 +639,22 @@ class cached_allocator_impl
|
||||
(atd, this->get_segment_manager(), p, ::boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
#define BOOST_CONTAINER_ALLOCATORS_ALLOCATOR_COMMON_CONSTRUCT_CODE(N) \
|
||||
template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\
|
||||
void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\
|
||||
{\
|
||||
boost::container::dtl::allocator_traits_dummy<U> atd;\
|
||||
boost::container::dtl::dispatch_uses_allocator\
|
||||
(atd, this->get_segment_manager(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATORS_ALLOCATOR_COMMON_CONSTRUCT_CODE)
|
||||
#undef BOOST_CONTAINER_ALLOCATORS_ALLOCATOR_COMMON_CONSTRUCT_CODE
|
||||
|
||||
#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
//!Sets the new max cached nodes value. This can provoke deallocations
|
||||
//!if "newmax" is less than current cached nodes. Never throws
|
||||
void set_max_cached_nodes(size_type newmax)
|
||||
|
||||
@@ -172,6 +172,7 @@ class node_allocator_base
|
||||
segment_manager* get_segment_manager()const
|
||||
{ return node_pool<0>::get(ipcdetail::to_raw_pointer(mp_node_pool))->get_segment_manager(); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Requires</b>: Uses-allocator construction of T with allocator
|
||||
//! `segment_manager*` and constructor arguments `std::forward<Args>(args)...`
|
||||
//! is well-formed. [Note: uses-allocator construction is always well formed for
|
||||
@@ -190,6 +191,22 @@ class node_allocator_base
|
||||
(atd, this->get_segment_manager(), p, ::boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
#define BOOST_CONTAINER_ALLOCATORS_NODE_ALLOCATOR_CONSTRUCT_CODE(N) \
|
||||
template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\
|
||||
void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\
|
||||
{\
|
||||
boost::container::dtl::allocator_traits_dummy<U> atd;\
|
||||
boost::container::dtl::dispatch_uses_allocator\
|
||||
(atd, this->get_segment_manager(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATORS_NODE_ALLOCATOR_CONSTRUCT_CODE)
|
||||
#undef BOOST_CONTAINER_ALLOCATORS_NODE_ALLOCATOR_CONSTRUCT_CODE
|
||||
|
||||
#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
//!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)
|
||||
@@ -398,7 +415,7 @@ class node_allocator
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing unless the constructor for T throws.
|
||||
template <typename U, class ...Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)...args);
|
||||
void construct(U* p, Args&& ...args);
|
||||
|
||||
//!Returns maximum the number of objects the previously allocated memory
|
||||
//!pointed by p can hold. This size only works for memory allocated with
|
||||
|
||||
@@ -177,6 +177,7 @@ class private_adaptive_pool_base
|
||||
segment_manager* get_segment_manager()const
|
||||
{ return m_node_pool.get_segment_manager(); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Requires</b>: Uses-allocator construction of T with allocator
|
||||
//! `segment_manager*` and constructor arguments `std::forward<Args>(args)...`
|
||||
//! is well-formed. [Note: uses-allocator construction is always well formed for
|
||||
@@ -195,6 +196,22 @@ class private_adaptive_pool_base
|
||||
(atd, this->get_segment_manager(), p, ::boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
#define BOOST_CONTAINER_ALLOCATORS_PRIVATE_ADAPTIVE_POOL_CONSTRUCT_CODE(N) \
|
||||
template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\
|
||||
void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\
|
||||
{\
|
||||
boost::container::dtl::allocator_traits_dummy<U> atd;\
|
||||
boost::container::dtl::dispatch_uses_allocator\
|
||||
(atd, this->get_segment_manager(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATORS_PRIVATE_ADAPTIVE_POOL_CONSTRUCT_CODE)
|
||||
#undef BOOST_CONTAINER_ALLOCATORS_PRIVATE_ADAPTIVE_POOL_CONSTRUCT_CODE
|
||||
|
||||
#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
//!Returns the internal node pool. Never throws
|
||||
node_pool_t* get_node_pool() const
|
||||
{ return const_cast<node_pool_t*>(&m_node_pool); }
|
||||
@@ -443,7 +460,7 @@ class private_adaptive_pool
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing unless the constructor for T throws.
|
||||
template <typename U, class ...Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)...args);
|
||||
void construct(U* p, Args&& ...args);
|
||||
|
||||
//!Returns maximum the number of objects the previously allocated memory
|
||||
//!pointed by p can hold. This size only works for memory allocated with
|
||||
|
||||
@@ -167,6 +167,7 @@ class private_node_allocator_base
|
||||
segment_manager* get_segment_manager()const
|
||||
{ return m_node_pool.get_segment_manager(); }
|
||||
|
||||
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
//! <b>Requires</b>: Uses-allocator construction of T with allocator
|
||||
//! `segment_manager*` and constructor arguments `std::forward<Args>(args)...`
|
||||
//! is well-formed. [Note: uses-allocator construction is always well formed for
|
||||
@@ -185,6 +186,22 @@ class private_node_allocator_base
|
||||
(atd, this->get_segment_manager(), p, ::boost::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
#else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
#define BOOST_CONTAINER_ALLOCATORS_PRIVATE_NODE_ALLOCATOR_CONSTRUCT_CODE(N) \
|
||||
template < typename U BOOST_MOVE_I##N BOOST_MOVE_CLASSQ##N >\
|
||||
void construct(U* p BOOST_MOVE_I##N BOOST_MOVE_UREFQ##N)\
|
||||
{\
|
||||
boost::container::dtl::allocator_traits_dummy<U> atd;\
|
||||
boost::container::dtl::dispatch_uses_allocator\
|
||||
(atd, this->get_segment_manager(), p BOOST_MOVE_I##N BOOST_MOVE_FWDQ##N);\
|
||||
}\
|
||||
//
|
||||
BOOST_MOVE_ITERATE_0TO9(BOOST_CONTAINER_ALLOCATORS_PRIVATE_NODE_ALLOCATOR_CONSTRUCT_CODE)
|
||||
#undef BOOST_CONTAINER_ALLOCATORS_PRIVATE_NODE_ALLOCATOR_CONSTRUCT_CODE
|
||||
|
||||
#endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
|
||||
|
||||
//!Returns the internal node pool. Never throws
|
||||
node_pool_t* get_node_pool() const
|
||||
{ return const_cast<node_pool_t*>(&m_node_pool); }
|
||||
@@ -418,7 +435,7 @@ class private_node_allocator
|
||||
//!
|
||||
//! <b>Throws</b>: Nothing unless the constructor for T throws.
|
||||
template <typename U, class ...Args>
|
||||
void construct(U* p, BOOST_FWD_REF(Args)...args);
|
||||
void construct(U* p, Args&& ...args);
|
||||
|
||||
//!Returns maximum the number of objects the previously allocated memory
|
||||
//!pointed by p can hold. This size only works for memory allocated with
|
||||
|
||||
Reference in New Issue
Block a user