Hi,

Is there any guarantee about contiguous storage of ublas vectors (or matrices for what matters)?

The specific case I'm thinking about is the following:

double SomeFunction( const vector<double>& v )
{
    double* ptr = &(v.data()[0]);
    ...
    (do something with ptr)
}

When is it the case that *(ptr+i) is equal to v(i)?

This seems to work fine when called on a declared variable of vector type, but fails for slices of matrices (as it should since the data is not contiguous).

Is there any way of knowing whether the storage of v in the function above is contiguous or not?


Thanks,

Tiago