K
Klaas Vantournhout
Hi all,
I was wondering if it is possible if you can check in a function if one
of the arguments is temporary.
What I mean is the following. A is a class, foo is a function returning
a class and bar is a function using A is an argument returning something
else
class A;
A foo(void);
int bar(const A&);
int main(void) {
std::cout << bar(foo());
return 0;
}
In the above piece of code, the object returned by foo is temporary and
destroyed after bar is finished with it.
The question is, is it possible to distinguish in bar if its argument is
such a temporary object or not?
Regards
Klaas
I was wondering if it is possible if you can check in a function if one
of the arguments is temporary.
What I mean is the following. A is a class, foo is a function returning
a class and bar is a function using A is an argument returning something
else
class A;
A foo(void);
int bar(const A&);
int main(void) {
std::cout << bar(foo());
return 0;
}
In the above piece of code, the object returned by foo is temporary and
destroyed after bar is finished with it.
The question is, is it possible to distinguish in bar if its argument is
such a temporary object or not?
Regards
Klaas