Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the boost vec(x,y,z) function defined

Tags:

c++

boost

I have seen this function vec(....) in many boost libraries. It constructs a vector with the values you place in it using some template meta-magic to do the type inference. So for example:

vec(1,2) returns vector<int> filled with 1,2

vec(1.1,2.2,3.3) returns vector<float> filled with 1.1,2.2,3.3

Its really useful for testing as well as for passing vectors valued parameters. But I can;t find which header file it is defined in, and Googling Boost vec is completely useless because obviously you get a million results about the vector class.

Does any know where it is defined?

like image 367
JHSaunders Avatar asked Aug 23 '26 15:08

JHSaunders


2 Answers

Are you you are referring to the boost::assign library?

It not the construction you mention but it is similar.

like image 77
Tom Avatar answered Aug 26 '26 04:08

Tom


Is Boost.Assign what you're looking for ?

like image 40
Benoît Avatar answered Aug 26 '26 06:08

Benoît