lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
Classes | Typedefs | Functions
lean::memory Namespace Reference

Provides a flexible heap concept, memory alignment facilities and a comprehensive way of handling out-of-memory situations. More...

Classes

class  aligned
 Aligns derived classes according to the given alignment template argument. More...
struct  check_alignment
 Checks whether the given alignment is a valid power of two. More...
struct  stack_aligned
 Aligns derived classes according to the given alignment template argument when instances are created on the stack. More...
struct  optional_mem_block
 Block of memory that may be zero-sized. More...
struct  optional_mem_block< 0 >
class  chunk_heap
 Contiguous chunk allocator heap. More...
struct  crt_heap
 Default CRT heap. More...
class  heap_allocator
 STL allocator heap adapter. More...
class  heap_bound
 Always allocates space for derived classes on the same specified heap. More...
class  object_pool
 Object pool. More...
struct  win_heap
 Windows heap. More...

Typedefs

typedef LEAN_DEFAULT_HEAP default_heap
 Default heap to be used by all subsequent definitions that make use of the heap concept.
typedef bool(* new_handler )()
 Lean new handler, returns true to request retry, false to abort allocation.

Functions

template<size_t Alignment, class Integer >
LEAN_INLINE Integer nalign_integer (Integer integer)
 (Negatively) aligns the given unsigned integer on the given alignment boundaries.
template<size_t Alignment, class Value >
LEAN_INLINE Value * nalign (Value *pointer)
 (Negatively) aligns the given pointer on the given alignment boundaries.
template<size_t Alignment, class Integer >
LEAN_INLINE Integer align_integer (Integer integer)
 Aligns the given unsigned integer on the given alignment boundaries.
template<size_t Alignment, class Value >
LEAN_INLINE Value * align (Value *pointer)
 Aligns the given pointer on the given alignment boundaries.
template<size_t Alignment, class Integer >
LEAN_INLINE Integer upper_align_integer (Integer integer)
 Aligns the given unsigned integer on the given alignment boundaries, incrementing it at least by one.
template<size_t Alignment, class Value >
LEAN_INLINE Value * upper_align (Value *pointer)
 Aligns the given pointer on the given alignment boundaries, incrementing it at least by one.
template<class Element , class Heap , size_t Alignment, class Other >
LEAN_INLINE bool operator== (const heap_allocator< Element, Heap, Alignment > &, const heap_allocator< Other, Heap, Alignment > &)
 Checks the given two allocators for equivalence.
template<class Element , class Heap , size_t Alignment, class Other >
LEAN_INLINE bool operator!= (const heap_allocator< Element, Heap, Alignment > &, const heap_allocator< Other, Heap, Alignment > &)
 Checks the given two allocators for inequivalence.
LEAN_MAYBE_EXPORT new_handler set_new_handler (new_handler newHandler)
 Sets a new new_handler.
LEAN_MAYBE_EXPORT bool call_new_handler ()
 Calls the current new handler.

Detailed Description

Provides a flexible heap concept, memory alignment facilities and a comprehensive way of handling out-of-memory situations.