[Click] Can't use String::c_str on const String
Matt Seitz
seitz at metadata-systems.com
Mon Oct 13 17:56:36 EDT 2003
If I declare a variable as type "String const", GCC will not let me use the
"c_str" member function:
"passing `const String' as `this' argument
of `const char *String::c_str ()' discards qualifiers"
I believe this can be fixed by declaring "String::c_str" as a "const" member
function. That is how "std::string:c_str" is declared:
const char *cc() const; // pointer returned is semi-transient
const char *c_str() const { return cc(); }
More information about the click
mailing list