Kinds of containers

deadalnix via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 24 22:37:00 PDT 2015


On Saturday, 24 October 2015 at 19:33:03 UTC, David Nadlinger 
wrote:
> On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote:
>> Collection!T and Collection!const(T) are 2 completely 
>> different types.
>
> Isn't this also required anyway because of covariance vs. 
> contravariance considerations?
>
>  — David

It is close, but not exactly the same. Covariance/contravariance 
can be emutalted via alias this without too much trouble for a 
container (however, it is hard to ensure correctness, but I'd 
assume not too hard). On the other hand, the qualifier thing 
turtle from the collection to the element in the collection, 
which is not that easy to achieve.


More information about the Digitalmars-d mailing list