Object-oriented Scientific Computing Library: Version 0.910
Public Member Functions | Protected Attributes
pointer_alloc< base_t > Class Template Reference

A simple class to provide an allocate() function for pointers. More...

#include <array.h>


Detailed Description

template<class base_t>
class pointer_alloc< base_t >

This class uses new and delete and may throw a C++ exception in the usual way. It contains a simple garbage collection mechanism to assist in exception safety.

This class is used in tensor_grid .

Idea for Future:
There may be a slight issue here if the pointer allocation succeeds and the list insertion fails, and the user catches the exception thrown by the list insertion failure, then a memory leak will ensue. This might be partially ameliorated by counting allocations and insertions. This failure mechanism is rarely encountered in practice.

Definition at line 145 of file array.h.

Public Member Functions

void allocate (base_t *&v, size_t i)
 Allocate v for i elements.
void free (base_t *&v)
 Free memory.

Protected Attributes

std::vector< base_t * > list
 Store allocated pointers.

The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.