vecmem 1.18.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
vecmem::conditional_memory_resource Class Referencefinal

This memory resource conditionally allocates memory. More...

#include <vecmem/memory/conditional_memory_resource.hpp>

Inheritance diagram for vecmem::conditional_memory_resource:
vecmem::details::memory_resource_base

Public Member Functions

VECMEM_CORE_EXPORT conditional_memory_resource (memory_resource &upstream, std::function< bool(std::size_t, std::size_t)> pred)
 Constructs the conditional memory resource.
 
VECMEM_CORE_EXPORT conditional_memory_resource (conditional_memory_resource &&parent) noexcept
 Move constructor.
 
 conditional_memory_resource (const conditional_memory_resource &)=delete
 Disallow copying the memory resource.
 
VECMEM_CORE_EXPORT ~conditional_memory_resource () override
 Destructor.
 
VECMEM_CORE_EXPORT conditional_memory_resourceoperator= (conditional_memory_resource &&rhs) noexcept
 Move assignment operator.
 
conditional_memory_resourceoperator= (const conditional_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 voiddo_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.
 

Detailed Description

This memory resource conditionally allocates memory.

It is constructed with a predicate function that determines whether an allocation should succeed or not.

This resource can be used to construct complex conditional allocation schemes.

Constructor & Destructor Documentation

◆ conditional_memory_resource()

vecmem::conditional_memory_resource::conditional_memory_resource ( memory_resource &  upstream,
std::function< bool(std::size_t, std::size_t)>  pred 
)

Constructs the conditional memory resource.

Parameters
[in]upstreamThe upstream memory resource to use.
[in]predThe predicate function that determines whether the allocation should succeed.

Member Function Documentation

◆ do_is_equal()

bool vecmem::details::memory_resource_base::do_is_equal ( const memory_resource &  other) const
overrideprotectednoexceptinherited

Compare the equality of *this memory resource with another.

Parameters
otherThe other memory resource to compare with
Returns
true if the two memory resources are equal, false otherwise

The documentation for this class was generated from the following files: