Unable to compile map<string,...>

Amit Bansal abansal@jpmorgan.com
Fri Oct 1 00:00:00 GMT 1999


Hi,

Using map<string, string> or map<string, my_own_class> gives compilation
errors on the map::find, map::erase and other functions. Cases like
map<string, int(or long, or double, etc)> work.

I've tried it with gcc 2.8.1 and 2.9.5 on Solaris. My code is portable on
MSVC++(6.0) and Solaris 2.6. But I face problems only on the Solaris side. I
suspect compiler bugs.

The only solution I've found is to wrap all the constructors of string class
as

class _string_string:public string
{
public:
    explicit _string_string():string(){};
    _string_string(const char *s):string(s){};
    ....
}

Does anybody have a better solution.

Thanks




More information about the Gcc-help mailing list