senf::pool_alloc_mixin< Self > Class Template Reference

Mixin to assign pool allocator to a class. More...

#include <senf/Utils/pool_alloc_mixin.hh>

List of all members.


Detailed Description

template<class Self>
class senf::pool_alloc_mixin< Self >

Mixin to assign pool allocator to a class.

This mixin will overload a classes operator new and operator delete so as to make the class use the Boost.Pool memory allocator by default. Using this allocator does however introduce a few restrictions:

  • The operator is defined for a fixed size. Therefore if you derive from the class you must not change it's size.
  • If you change the size of the class in a derived class you have to derive from pool_alloc_mixin again.
Usage:
  class SomeClass
      : public senf::pool_alloc_mixin<SomeClass>
  {
      // ...
  };
Note:
pool_alloc_mixin uses the Boost.Pool singleton pool interface with the tag pool_alloc_mixin_tag. This class is accessible via the pool member. Using this member, it is simple to call relevant pool functions, e.g. SomeClass::pool<>::release_memory().

Definition at line 67 of file pool_alloc_mixin.hh.


Classes

struct   pool
  Templated typedef for the pool used. More...

Static Public Member Functions

static void *  operator new (size_t size)
  Operator new utilizing pool allocation.
static void  operator delete (void *p, size_t size)
  Operator delete utilizing pool allocation.

Member Function Documentation

template<class Self >
void senf::pool_alloc_mixin< Self >::operator
delete ( void *  p,
size_t  size )

Operator delete utilizing pool allocation.

Definition at line 49 of file pool_alloc_mixin.cti.

template<class Self >
void * senf::pool_alloc_mixin< Self >::operator
new ( size_t  size )

Operator new utilizing pool allocation.

Definition at line 35 of file pool_alloc_mixin.cti.


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