Currently, in my code I have
vector_2 v1(1.0,2.0);
Frame.Draw( v1(2.0f,1.0f) );
where vector_2 is a struct with a constructor that takes 2 doubles (coordinates). Frame is an instance of some class with a function that takes a vector_2 as a parameter. This compiles just fine and the way I want.
However, when I directly try without initializing a vector prior to the function call, e.g.:
Frame.Draw( vector_2 v1(2.0f,1.0f) );
The compiler fails with the error message: expected primary-expression before v1. I was hoping to directly initialize within the function call.
I wonder if this is possible in C++, I may not know the proper syntax.
Aucun commentaire:
Enregistrer un commentaire