SWIG: operator const char*() const

Helmut Zeisel helmut.zeisel at aon.at
Fri Mar 8 03:57:45 EST 2002


I have a class, say myString, with an operator const char*() const
for which I want to create Python
shadow classes (swig -c++ -shadow -python)

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

Using this code, I get the warning:

       "Can't wrap operator const char* unless renamed to a valid identifier."

So I tried to rename:

       %rename(c_str) myString::operator const char*() const;

This gives the error message

       "Syntax error in input"

What is the correct syntax to rename?

Helmut



More information about the Python-list mailing list