Is there a way to automatically convert to a certain type:
class A
{ public:
int f();
float g();
};
r(int x){}
t(float x){}
...
r(A) //automagically call r(A.f())
t(A) //automagically call t(A,t())
sort of like when toString is called for Java objects when you print them.
Yes, you can provide cast operators for
A.But you then call
randton an instance:Here’s the full code: http://ideone.com/Pfa4v