Suppose that I myself define the implicit conversion function:
#include <iostream> class Foo { public: operator Foo() { std::cout << "wha??\n"; return Foo(); } }; void f(Foo f) {} int main() { Foo foo; f(foo); }
Why should I determine this? Well, I would never write it directly, but this could happen with a template instance in the template class that I am writing. If this happens, I hope that the definition of the transform function does not work effectively and that it is actually impossible to call.
The above program doesn't print anything (that's great). Are there any circumstances under which this conversion function will actually be called?
c ++
Josh haberman
source share