# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CSTLBlockAllocator Class Template Reference

#include <stl_block_allocator.h>

List of all members.

Public Methods

 CSTLBlockAllocator (CBlockMemory< T, false > *bm)
 Constructor. Must gives a blockMemory to ctor. NB: must gives a CBlockMemory<T, false> !!! More...

 CSTLBlockAllocator (const CSTLBlockAllocator< T > &other)
 copy ctor. More...

 ~CSTLBlockAllocator ()
 dtor. More...


Detailed Description

template<class T>
class NLMISC::CSTLBlockAllocator< T >

see CBlockMemory for description of block memory management/advantages.

This class works with STLPort. It implements __stl_alloc_rebind() (not C++ standard??) to work properly with list<>/set<> etc... node allocations.

NB: if used with a vector<> or a deque<> (ie if allocate(..,n) is called with n>1), it's still work, but it's use malloc()/free() instead, so it is fully unusefull in this case :)

CSTLBlockAllocator use a pointer on a CBlockMemory, so multiple containers can share the same blockMemory, for maximum space/speed efficiency.

Because of CBlockMemory allocation scheme, only same containers of same types can share the same CBlockMemory instance (eg: "list<uint, &myBlockMemory>; vector<uint, &myBlockMemory>;" is invalid and will assert when allocations will occur).

To construct a container which use this allocator, do like this: list<uint, CSTLBlockAllocator<uint>> myList( ptrOnBlockMemory );

But see CSTLBlockList for easier list instanciation, because using it, you'll do like this: CSTLBlockList<uint> myList(ptrOnBlockMemory);

Note: CSTLBlockAllocator take only 4 bytes in memory (a ptr on a CBlockMemory)

Author:
Lionel Berenguier , Nevrax France
Date:
2001
Todo:
yoyo: make it work under linux. For now, use std allocator instead...

Definition at line 192 of file stl_block_allocator.h.


Constructor & Destructor Documentation

template<class T>
NLMISC::CSTLBlockAllocator< T >::CSTLBlockAllocator CBlockMemory< T, false > *    bm [inline]
 

Constructor. Must gives a blockMemory to ctor. NB: must gives a CBlockMemory<T, false> !!!

Definition at line 197 of file stl_block_allocator.h.

template<class T>
NLMISC::CSTLBlockAllocator< T >::CSTLBlockAllocator const CSTLBlockAllocator< T > &    other [inline]
 

copy ctor.

Definition at line 201 of file stl_block_allocator.h.

template<class T>
NLMISC::CSTLBlockAllocator< T >::~CSTLBlockAllocator   [inline]
 

dtor.

Definition at line 205 of file stl_block_allocator.h.


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