Kinds of containers

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 21 08:58:45 PDT 2015


On 10/21/2015 01:05 PM, Andrei Alexandrescu wrote:
> 2. Reference containers.
>
> These have classic reference semantics (à la Java). Internally, they may
> be implemented either as class objects or as reference counted structs.
>
> They're by default mutable. Qualifiers should apply to them gracefully.
>
> 3. Eager value containers.
>
> These are STL-style. Somewhat surprisingly I think these are the worst
> of the pack; they expensively duplicate at the drop of a hat and need to
> be carefully passed around by reference lest performance silently drops.
> Nevertheless, when used as members inside other data structures value
> semantics might be the appropriate choice. Also, thinking of them as
> values often makes code simpler.
>
> By default eager value containers are mutable. They should support
> immutable and const meaningfully.

For which containers we want to support is "2." not a (wrapper around a) 
pointer to "3."?


More information about the Digitalmars-d mailing list