Boost logo

Boost :

From: Philip Miller (pwmiller_at_[hidden])
Date: 2003-09-02 12:20:22

My primary question, however, is how can I share a contiguous block of
memory with a ublas vector or matrix? For example, I would like to do
something like:

double* p = new double[16];
ublas::vector<double> v(p, 16, SHARE);
ublas::matrix<double> v( p, 4, 4, SHARE);

where the ublas vector object, v, and matrix object, m, share the memory
pointed to by p. Of course there may be other semantics (where another
ublas type such as vector_proxy is used and maybe a different ownership
flag such as ASSUME_OWNERSHIP are used), but this is the gist of what I
am looking for. boost::multi_array has such constructs, but I could not
see how to do this with ublas::vector/matrix.

Also, the ublas documentation mentions in passing that ublas optionally
uses SmartPointer, but I found no detailed mention of how. Of course a
more general question is: where can I find more information on memory
management issues within ublas vector/matrix classes?


P.S. This is a specific question to the ublas library and is only a
conincidence that I am posting it in the midst of the current boost
allocator discussion.

Boost list run by bdawes at, gregod at, cpdaniel at, john at