vecmem 1.18.0
|
This memory resource conditionally allocates memory. More...
#include <vecmem/memory/choice_memory_resource.hpp>
Public Member Functions | |
VECMEM_CORE_EXPORT | choice_memory_resource (std::function< memory_resource &(std::size_t, std::size_t)> decision) |
Construct the choice memory resource. | |
VECMEM_CORE_EXPORT | choice_memory_resource (choice_memory_resource &&parent) noexcept |
Move constructor. | |
choice_memory_resource (const choice_memory_resource &)=delete | |
Disallow copying the memory resource. | |
VECMEM_CORE_EXPORT | ~choice_memory_resource () override |
Destructor. | |
VECMEM_CORE_EXPORT choice_memory_resource & | operator= (choice_memory_resource &&rhs) noexcept |
Move assignment operator. | |
choice_memory_resource & | operator= (const choice_memory_resource &)=delete |
Disallow copying the memory resource. | |
Protected Member Functions | |
Function(s) implementing @c vecmem::memory_resource | |
VECMEM_CORE_EXPORT bool | do_is_equal (const memory_resource &other) const noexcept override |
Compare the equality of *this memory resource with another. | |
Private Member Functions | |
Function(s) implementing @c vecmem::memory_resource | |
VECMEM_CORE_EXPORT void * | do_allocate (std::size_t, std::size_t) override |
Allocate memory with one of the underlying resources. | |
VECMEM_CORE_EXPORT void | do_deallocate (void *p, std::size_t, std::size_t) override |
De-allocate a previously allocated memory block. | |
This memory resource conditionally allocates memory.
It is constructed with a function that determines which upstream resource to use.
This resource can be used to construct complex conditional allocation schemes.
|
explicit |
Construct the choice memory resource.
[in] | upstreams | The upstream memory resources to use. |
[in] | decision | The function which picks the upstream memory resource to use by index. |
|
overrideprotectednoexceptinherited |
Compare the equality of *this
memory resource with another.
other | The other memory resource to compare with |
true
if the two memory resources are equal, false
otherwise