Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

debug_alloc Class Template Reference

#include <stl_alloc.h>

List of all members.

Static Public Methods

void * allocate (size_t n)
void deallocate (void *p, size_t n)
void * reallocate (void *p, size_t old_sz, size_t new_sz)

Private Types

enum  { extra = 8 }

template<class Alloc>
class debug_alloc< Alloc >


Member Enumeration Documentation

template<class Alloc>
anonymous enum [private]
 

Enumeration values:
extra 

Definition at line 240 of file stl_alloc.h.

00240 {extra = 8};       // Size of space used to store size.  Note


Member Function Documentation

template<class Alloc>
void* debug_alloc< Alloc >::allocate size_t    n [inline, static]
 

Definition at line 246 of file stl_alloc.h.

References extra.

00247 {
00248     char *result = (char *)Alloc::allocate(n + extra);
00249     *(size_t *)result = n;
00250     return result + extra;
00251 }

template<class Alloc>
void debug_alloc< Alloc >::deallocate void *    p,
size_t    n
[inline, static]
 

Definition at line 253 of file stl_alloc.h.

References extra.

00254 {
00255     char * real_p = (char *)p - extra;
00256     assert(*(size_t *)real_p == n);
00257     Alloc::deallocate(real_p, n + extra);
00258 }

template<class Alloc>
void* debug_alloc< Alloc >::reallocate void *    p,
size_t    old_sz,
size_t    new_sz
[inline, static]
 

Definition at line 260 of file stl_alloc.h.

References extra.

00261 {
00262     char * real_p = (char *)p - extra;
00263     assert(*(size_t *)real_p == old_sz);
00264     char * result = (char *)
00265                   Alloc::reallocate(real_p, old_sz + extra, new_sz + extra);
00266     *(size_t *)result = new_sz;
00267     return result + extra;
00268 }


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

Documentation generated on Thu May 2 15:03:26 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001