[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: New public API
On Tue, 2006-02-21 at 11:51 +1100, Alexey Parshin wrote:
> Yeah, that's a pre-requirement. But in that case, returning just const char
> * is more appropriate..
>
There will be places where const char* is appropriate and where
std::string is, thus resulting in an inconsistent API.
And if the API is to be implementation independent then it will be
impossible to tell where const char* should be and were std::string
should.
The other point is that the C++ Standard's specification of class
std::string is formulated to allow a reference counted implementation.
It seems that the libstdc++'s implementation is quite smart about the
copy constructor (http://gcc.gnu.org/onlinedocs/libstdc
++/latest-doxygen/basic__string_8tcc-source.html#l00182)
Chris