CookMem 1.4.0
A C++ memory context / allocator
Loading...
Searching...
No Matches
cookmem::MemContextProvider< Context > Class Template Reference

#include <allocator.h>

Public Types

typedef Context context_type
 
typedef std::false_type propagate_on_container_copy_assignment
 
typedef std::false_type propagate_on_container_move_assignment
 
typedef std::false_type propagate_on_container_swap
 
typedef std::false_type is_always_equal
 

Public Member Functions

 MemContextProvider (Context &context)
 
Context & get () const
 
bool operator== (const MemContextProvider &other) const
 
bool operator!= (const MemContextProvider &other) const
 

Detailed Description

template<class Context>
class cookmem::MemContextProvider< Context >

Provides a caller-owned memory context to Allocator.

Allocator instances copy this provider, so they continue to refer to the same context without being always equal across different contexts.

Member Typedef Documentation

◆ context_type

The type of the memory context.

◆ is_always_equal

template<class Context >
typedef std::false_type cookmem::MemContextProvider< Context >::is_always_equal

Providers are equal only when they refer to the same context.

◆ propagate_on_container_copy_assignment

template<class Context >
typedef std::false_type cookmem::MemContextProvider< Context >::propagate_on_container_copy_assignment

Containers keep their own allocator when copy-assigned.

◆ propagate_on_container_move_assignment

template<class Context >
typedef std::false_type cookmem::MemContextProvider< Context >::propagate_on_container_move_assignment

Containers keep their own allocator when move-assigned.

◆ propagate_on_container_swap

template<class Context >
typedef std::false_type cookmem::MemContextProvider< Context >::propagate_on_container_swap

Containers keep their own allocator when swapped.

Constructor & Destructor Documentation

◆ MemContextProvider()

template<class Context >
cookmem::MemContextProvider< Context >::MemContextProvider ( Context &  context)
inlineexplicit

Constructor.

Parameters
contextthe memory context to provide. The caller owns it, and it must outlive every allocator that uses this provider.

Member Function Documentation

◆ get()

template<class Context >
Context & cookmem::MemContextProvider< Context >::get ( ) const
inline

Get the memory context.

Returns
the memory context this provider refers to.

◆ operator!=()

Check if two providers refer to different memory contexts.

Parameters
otherthe provider to compare with.
Returns
true if the providers refer to different contexts.

◆ operator==()

Check if two providers refer to the same memory context.

Parameters
otherthe provider to compare with.
Returns
true if both providers refer to the same context.

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