In C++ when you have an object that is passed to a function by value the copy constructor is invoked. Such as in this function signature:
void foo(Object o);
A couple years ago someone told me that you can pass arguments that fit the constructor of an object that is an argument to a function. So, using the above function signature foo, let's say Object has the constructor:
Object(int a, int b);
we would be able to call the function foo like this:
foo(1,2);
I haven't been able to find any information about this and I think that I either misinterpreted what I heard years ago or that the person was just wrong. Is there any way to do this other than:
foo(Object(1,2));
and if not, is there a reason that this constructor can not be implicitly invoked during a function call?