
On Wed, 19 Jan 2011 19:27:05 -0800 Mostafa <mostafa_working_away@yahoo.com> wrote:
Can we stick to std::string conventions as closely as possible? It makes using whatever new string library that much easier, and clearer, and maintainable.
Is there a conventional way to get the data stored in an std::string? ;-)
std::string::c_str, or am I missing something? (BTW, that's why I suggested utf8_t::cu_str, sounds similar.)
Ah, I hadn't considered that.
I'm a big fan of conveying your intent in code. For the same reason I strong disagree with utf8_t::str. utf8_t is already a string class, and a generic sounding "str" method off it doesn't convey what kind of string it returns.
While that's true (and I'm not a fan of str() in this context either), it does have the advantage of implying that it returns an std::string, based on the conventions of std::stringstream.
I would argue utf8_t is analagous to std::string, not std::stringstream. Ones in the storage category, the others in the streaming category.
But both, as prominent members of the STL, are standards that developers are likely to recognize. -- Chad Nelson Oak Circle Software, Inc. * * *