ders::mp_newbuf< T > Class Template Reference

Helper class for exception-safe memory allocation. More...

#include <mem_pool.hpp>

List of all members.

Public Member Functions

 mp_newbuf (mem_pool &m)
 ~mp_newbuf ()
mem_poolpool () const
void * get () const
T * rls (T *p)


Detailed Description

template<class T>
class ders::mp_newbuf< T >

Helper class for exception-safe memory allocation.

Definition at line 46 of file mem_pool.hpp.


Constructor & Destructor Documentation

template<class T>
ders::mp_newbuf< T >::mp_newbuf ( mem_pool m  )  [inline, explicit]

Definition at line 54 of file mem_pool.hpp.

00054 : mp(m), ptr(m.allocate(sizeof(T))) {}

template<class T>
ders::mp_newbuf< T >::~mp_newbuf (  )  [inline]

Definition at line 55 of file mem_pool.hpp.

00055 { if (ptr) mp.deallocate(ptr, sizeof(T)); }


Member Function Documentation

template<class T>
mem_pool& ders::mp_newbuf< T >::pool (  )  const [inline]

Definition at line 57 of file mem_pool.hpp.

00057 { return mp; }

template<class T>
void* ders::mp_newbuf< T >::get (  )  const [inline]

Definition at line 58 of file mem_pool.hpp.

00058 { return ptr; }

template<class T>
T* ders::mp_newbuf< T >::rls ( T *  p  )  [inline]

Definition at line 59 of file mem_pool.hpp.

00059 { ptr=0; return p; }


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

Generated on Tue Dec 8 11:35:33 2009 for derslib by  doxygen 1.5.5