Search code examples
c++boostboost-phoenix

Pointer to overloaded casting operator?


Suppose I have the following class:

class MyStringClass
{
public:
    operator const char*() const;
};

If possible, how do I create a function pointer to this overloaded casting operator?

Basically I'd like to use boost::phoenix to invoke this operator. I'm assuming I need to bind to it (hence why I need to create a function pointer to it), but if boost::phoenix has built in functionality to invoke this in a special way I'm open to that too.

I'm using Visual Studio 2008, C++03.


Solution

  • const char* (MyStringClass::*ptr)() const = &MyStringClass::operator const char*;