|
CookMem 1.4.0
A C++ memory context / allocator
|
#include <allocator.h>
Public Types | |
| typedef Context | context_type |
| typedef std::true_type | propagate_on_container_copy_assignment |
| typedef std::true_type | propagate_on_container_move_assignment |
| typedef std::true_type | propagate_on_container_swap |
| typedef std::false_type | is_always_equal |
Public Member Functions | |
| TLSContextProvider () | |
| Context & | get () const |
| bool | operator== (const TLSContextProvider &other) const |
| bool | operator!= (const TLSContextProvider &other) const |
Static Public Member Functions | |
| static Context & | getActiveContext () |
| static Context & | getThreadContext () |
Friends | |
| template<class , class > | |
| class | TLSContextScope |
Provides one shared, default-constructed context per Context, Tag, and thread.
Use a distinct Tag type to give different allocator groups separate contexts.
| typedef Context cookmem::TLSContextProvider< Context, Tag >::context_type |
The type of the memory context.
| typedef std::false_type cookmem::TLSContextProvider< Context, Tag >::is_always_equal |
Providers are equal only when they refer to the same context.
| typedef std::true_type cookmem::TLSContextProvider< Context, Tag >::propagate_on_container_copy_assignment |
Containers take the allocator of the source when copy-assigned.
| typedef std::true_type cookmem::TLSContextProvider< Context, Tag >::propagate_on_container_move_assignment |
Containers take the allocator of the source when move-assigned.
| typedef std::true_type cookmem::TLSContextProvider< Context, Tag >::propagate_on_container_swap |
Containers exchange allocators when swapped.
|
inline |
Constructor. The provider refers to the active context of the current thread: the context of the innermost matching TLSContextScope if there is one, or the persistent thread-local context otherwise.
|
inline |
Get the memory context.
|
inlinestatic |
Returns the active context, or the persistent thread context when no scope is active.
|
inlinestatic |
Returns this thread's persistent context, even when a scope is active.
|
inline |
Check if two providers refer to different memory contexts.
| other | the provider to compare with. |
|
inline |
Check if two providers refer to the same memory context.
| other | the provider to compare with. |