I'm trying to change the constructor behaviour of a BOOST uBLAS vector and was wondering what the best way to do this is. I want to initialise the components (co-ordinates) of a 2D vector using the constructor, for example:
Instead of:
typedef boost::ublas::vector BoostVector;
double x=1;
double y=0.7;
BoostVector<double> v(2);
v(1) = x; v(2) = y; //x and y are vector components/co-ordinates
I want to be able to specify x and y in the constructor.
BoostVector<double> v(x,y);
I'm thinking I could create a new class that provides an interface for doing this, either by containing or inheriting from the boost vector class, but I'm fairly new to C++ and I'm not sure of the best way to retain the functionality of the boost vector. Especially as I don't want to interfere with the template expression optimisation used by the uBLAS vector class. Any advice on this would be very appreciated. Thanks, Kieran