September 14, 2014
Am 14.09.2014 16:19, schrieb po:
> ...
>
>> 6. string::c_str() (let char* botch string internals)
>
> It returns a const char* so you would have to cast const away to do that--

Which everyone does all the time, because the main reason c_str() exists is to interface with C style APIs, most of them taking only char* strings.
September 14, 2014
On 9/14/14, 1:27 AM, Kagamin wrote:
> On Saturday, 13 September 2014 at 21:46:45 UTC, Andrei Alexandrescu wrote:
>> No, it's all eager copy. std::string is thoroughly botched. A good
>> inexpensive lesson for us. -- Andrei
>
> I mean possible lifetime management options are:
> 1. string&
> 2. string*
> 3. shared_ptr<string>
> 4. weak_ptr<string>
> 5. unshared_ptr<string> (not interlocked; does something like this exist?)
>
> This way string is just like any other object. It's C++ after all, the
> foot must be shot.

Oh I see. (3 and 4 are infrequent, 5 doesn't exist). -- Andrei

1 2 3 4 5 6 7
Next ›   Last »