Getting completely (I mean ENTIRELY) rid off GC

Paulo Pinto via Digitalmars-d digitalmars-d at puremagic.com
Sun Sep 14 03:02:37 PDT 2014


Am 14.09.2014 10:27, schrieb Kagamin:
> 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.

You forgot a few other ones:

6. string::c_str() (let char* botch string internals)
7. shared_ptr<string>&
8. shared_ptr<string>*
9. weak_ptr<string>&
10. weak_ptr<string>*
11. unique_ptr<string>&
12. unique_ptr<string>*

Just because some one these don't make sense semantically, I am willing 
to bet someone out there is writing them now.

And I did leave out the move variations, as the list is already quite long.


--
Paulo




More information about the Digitalmars-d mailing list