is there a way, in C++, to force the assignation of the returned value of a function? i.e. if I have a member function foo
class myClass{
...
public:
T1 foo(T2 x){T1 y; /*something*/ return y;};
}
which I can call in the main() as
myClass obj;
T1 a = obj.foo(x); //<--
can I make the simpler call
myClass obj;
obj.foo(x); //<--
(that does not store the returned value) somehow "illegal"?
Alternatively, can I distinguish the definitions of
T1 a = obj.foo(x);
obj.foo(x);
thank you for your time and sorry for my ignorance