Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The following sample works in Visual C++ .NET 2003 as specified in the standard:
// operator_that_is_pointer_to_function.cpp
// function style call on object will invoke user-defined conversion
// if there is one. See secion 13.3.1.1.2
typedef void(*ptf)();
void func()
{
}
struct S
{
operator ptf()
{
return func;
}
};
int main()
{
S s;
s();//operates as s.operator ptf()()
}