asio-grpc v1.4.0
Asynchronous gRPC with Asio/unified executors
|
Helper class that associates an allocator to an object. More...
#include <agrpc/bindAllocator.hpp>
Public Member Functions | |
template<class... Args> | |
AllocatorBinder (const Allocator &allocator, Args &&... args) | |
Construct from an allocator and argument pack. More... | |
AllocatorBinder (const AllocatorBinder &other)=default | |
Default copy constructor. | |
template<class OtherTarget , class OtherAllocator > | |
AllocatorBinder (const AllocatorBinder< OtherTarget, OtherAllocator > &other) | |
Copy construct from a different agrpc::AllocatorBinder. | |
template<class OtherTarget , class OtherAllocator > | |
AllocatorBinder (const Allocator &allocator, AllocatorBinder< OtherTarget, OtherAllocator > &other) | |
Copy construct from a different agrpc::AllocatorBinder and specified allocator. | |
template<class OtherTarget , class OtherAllocator > | |
AllocatorBinder (const Allocator &allocator, const AllocatorBinder< OtherTarget, OtherAllocator > &other) | |
Copy construct from a different const agrpc::AllocatorBinder and specified allocator. | |
AllocatorBinder (AllocatorBinder &&other)=default | |
Default move constructor. | |
template<class OtherTarget , class OtherAllocator > | |
AllocatorBinder (AllocatorBinder< OtherTarget, OtherAllocator > &&other) | |
Move construct from a different agrpc::AllocatorBinder. | |
template<class OtherTarget , class OtherAllocator > | |
AllocatorBinder (const Allocator &allocator, AllocatorBinder< OtherTarget, OtherAllocator > &&other) | |
Move construct from a different agrpc::AllocatorBinder and specified allocator. | |
~AllocatorBinder ()=default | |
Default destructor. | |
AllocatorBinder & | operator= (const AllocatorBinder &other)=default |
Default copy assignment operator. | |
AllocatorBinder & | operator= (AllocatorBinder &&other)=default |
Default move assignment operator. | |
target_type & | get () noexcept |
Get the target (mutable) | |
const target_type & | get () const noexcept |
Get the target (const) | |
executor_type | get_executor () const noexcept |
Get the target's associated executor. | |
allocator_type | get_allocator () const noexcept |
Get the bound allocator. | |
template<class... Args> | |
decltype(auto) | operator() (Args &&... args) && |
Invoke target with arguments (rvalue overload) | |
template<class... Args> | |
decltype(auto) | operator() (Args &&... args) & |
Invoke target with arguments (lvalue overload) | |
template<class... Args> | |
decltype(auto) | operator() (Args &&... args) const & |
Invoke target with arguments (const lvalue overload) | |
Helper class that associates an allocator to an object.
This class can be used to customize the allocator of an asynchronous operation. Especially useful when the completion token has an associated executor already or when asio::require
ing a different allocator from the executor is not possible:
In contrast to asio::bind_allocator
this class performs empty class optimization on the provided allocator.
|
inlineexplicit |
Construct from an allocator and argument pack.
Supports deduction guide when constructing from a single argument. The following creates an AllocatorBinder<int std::allocator<std::byte>>