次のコードを見ました。
class NullClass {
public:
template<class T> operator T*() const { return 0; }
};
const NullClass NULL;
void f(int x);
void f(string *p);
f(NULL); // converts NULL to string*, then calls f(string*)
Q1> 次の文が理解できません
template<class T> operator T*() const { return 0; }
特に、 とはどういう意味operator T*()
ですか?
Q2>f(NULL)
最終的に がトリガーされるのはなぜf(string*)
ですか?
ありがとうございました