cheshirekow  v0.1.0
mpblocks::clarkson93::ExampleTraits::SimplexFactory Struct Reference

template for allocators & memory managers More...

#include <mpblocks/clarkson93/ExampleTraits.h>

Inheritance diagram for mpblocks::clarkson93::ExampleTraits::SimplexFactory:

Public Types

typedef std::vector< SimplexBase
 

Public Member Functions

Simplexcreate ()
 construct an object of type T using the next available memory More...
 

Detailed Description

template for allocators & memory managers

The triangulation doesn't support removal of points. Thus simplices are never deleted individually (rather, all at once when the triangulation is cleared). Thus we divert memory management to the user of the libary. The allocator is responsible for keeping track of every object it allocates an be delete them all when cleared

This example preallocates a fixed size array of storage for objects. When create() is called it takes the next unused pointers, calls in-place operator new() and then returns the pointer. When it is reset, it goes through the list of allocated pointers and calls the destructor (ptr)->~T() on each of them.

For the most part, Alloc<T> is only used to construct POD types so this is a bit of a moot point.

Note
: Alloc must be default constructable. It will be passed to setup.prepare( Alloc<T> ) so if you need to do any allocator initialization you must do it in Setup

Definition at line 155 of file ExampleTraits.h.

Member Typedef Documentation

Member Function Documentation

Simplex* mpblocks::clarkson93::ExampleTraits::SimplexFactory::create ( void  )
inline

construct an object of type T using the next available memory

Definition at line 162 of file ExampleTraits.h.


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