D.J. Klomp
D.J. Klomp

Reputation: 2659

Using a boost::numeric::ublas::vector directly as function argument without initialization

I am trying something which I would think is relatively simple but am at a loss how to do it. I have a function which as an argument takes a boost::numeric::ublas::vector, instead of having to declare the vector beforehand I want to be able to just declare it inside the function as rvalue, is this possible with boost::numeric::ublas::vector?

Now I do it like this

 boost::numeric::ublas::vector<double> point(3);
 point <<= 1, 2, 3;
 test(point);

I would like to do it something like this, which is possible for normal std::vectors with list initialization.

 test( {1,2,3} )

Is this possible or can't you do it with boost::numeric::ublas::vector this way?

Upvotes: 0

Views: 320

Answers (1)

chtz
chtz

Reputation: 18807

Quoting from the uBLAS FAQ:

uBLAS is more than 10 years old and missed all new stuff from C++11.

So it seems unlikely that list initialization will be added.

If you need to use uBLAS and want list-initialization, I suggest implementing a helper function for that.

Upvotes: 1

Related Questions