Boost logo

Boost :

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2001-12-12 11:02:11


When I have a numerics::matrix< std::complex< double > > for instance, I
would e.g. like to create a matrix_range with value_type double instead
of std::complex< double >.

This is a feasible extension I guess of the current submatrix-handling.
The main changes I guess involve :

member to create submatrix becomes template member.

indexing functions (operator(i,j)) needs static_cast<>

alignment difference of original value_type and requested value_type
should be taken into account for calculating location of (i,j) in
storage array.

iterators need to convert between the two types on the fly (there
recently was a thread on real iterator on containers complex'es and
vice-versa.

The main structural change would be that the non-const indexing operator
(operator()(size_type,size_type)) would need to return a proxy object
(because you can't create a non-const complex reference to a double).

The question now is, should this functionality be migrated into the
current matrix_range or would it be best to define another one (the
latter will thus only be able to convert between value_type's and the
former would stay as it is) ?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk