
Lassi Tuura wrote:
Hi,
Libraries that produce needless copies are simply ill-designed, and thus it is true great parts of the standard library are),
Well... Having had to recent pleasure to find code like this:
bool foo::check(T *obj) const { std::string name = obj->name(); bool value = (name == "foo"); value = value || (name == "bar"); value = value || (name == "foobar"); value = value || (name == "zoinc"); value = value || (name == "barfy"); value = value || (name == "zoobie"); value = value || (name == "ayeyei"); return value; }
That was one of the contributors to ~800'000 memory allocation calls per second. It was called... often.
I'd say there's something a bit more fundamental going on here than _just_ a library design issue :-) No class can be all things to all users.
This isn't even a design issue. Your standard library is just being stupid (or overly pedantic) in its handling of operator==(string const&, char const*). Let them know how you feel.