pool_allocator.hpp
Go to the documentation of this file.
1 #pragma once
2 
15 #include <boost/make_shared.hpp>
16 #include <boost/pool/pool_alloc.hpp>
17 
18 namespace cras
19 {
20 
31 template <typename T, class... Args>
33 {
34  using allocator_t = ::boost::fast_pool_allocator<::boost::shared_ptr<T>>;
35  return ::boost::allocate_shared<T, allocator_t, Args...>(allocator_t(), ::boost::detail::sp_forward<Args>( args )...);
36 }
37 
48 template <typename T, class... Args>
50 {
51  using allocator_t = ::boost::pool_allocator<::boost::shared_ptr<T>>;
52  return ::boost::allocate_shared<T, allocator_t, Args...>(allocator_t(), ::boost::detail::sp_forward<Args>( args )...);
53 }
54 
55 }
void *(* allocator_t)(size_t)
Allocator function that should allocate a buffer of the given size on the caller side and return a po...
Definition: c_api.h:36
Definition: any.hpp:15
::boost::shared_ptr< T > make_shared_from_fast_pool(Args &&... args)
Make a shared instance of an object from Boost fast pool (suitable for e.g. elements of a std::list o...
::boost::shared_ptr< T > make_shared_from_pool(Args &&... args)
Make a shared instance of an object from Boost pool (suitable for e.g. elements of a std::vector or a...


cras_cpp_common
Author(s): Martin Pecka
autogenerated on Sat Jun 17 2023 02:32:53