Reference counted containers prototype
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Tue Dec 27 07:00:22 PST 2011
On 12/27/11 6:15 AM, Froglegs wrote:
> When I go to that link it just says
>
> Unknown Paste ID!
>
> Don't see any code anywhere.. hum
>
>
>
>
> What is wrong with value containers? They work great in C++, a container
> is such a basic thing that ref counting and whatnot is rarely if ever
> needed, and in the unlikely event you need to share a container,
> wrapping it with a smart pointer of some sort is easy enough in C++, let
> alone D with its better support for type aliasing.
Value containers are almost never used as values. Code that does
manipulate them as values, e.g.
void fun(vector<int> v);
is technically correct but automatically suspicious and raises
questions. (It only passes a code review at Facebook if the
implementation of fun does need in fact a mutable temporary vector
inside, which is rare.)
There is only one place where C++ value containers work well, and that's
as members inside value objects. But then those objects in turn must be
effectively manipulated as references...
Andrei
More information about the Digitalmars-d
mailing list