Hi,

I'm back on indirect_array and would need some clarification about it.
Here is my problem (some machine learnin stuffs):

I need to access to subvectors and submatrices that are not regularly defined but depends on test. Therefore, range and slice are not an option.
So I use vector_indirect, matrix_vector_indirect and matrix_indirect. They require an indirect_array of some sort.
In my case, constructing the indirect_array is even more important than simply accessing the matrix or vector. In order to simplify my code,
I changed for std::vector<size_t> for the indirect_array and use heavily the function push_back because I never know in advance what will be the size of my indirect vector (or matrix). That's make very simple code to write.

BUT and this is the problem: this cannot work because vector_indirect and its cousins, when constructed with a vector and my Instances type (that is my indirect_array which is in fact a std::vector), they expect a function preprocess to be present.

So I found this bizarre solution:

typedef std::vector<size_t> _Instances;
class Instances;

class Instances : public _Instances
{
     public:
           Instances preprocess(Instances::size_type size) cons {return *this;}
};

In fact, I have no use of making a set of instances that contains all of them, hence my stupid preprocess function. This compile and work.
But that's HUGLY !

Any suggestions ?

Cheers,
David





--
David Bellot, PhD
david.bellot@gmail.com
http://david.bellot.free.fr