Kinds of containers

TheFlyingFiddle via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 24 09:16:42 PDT 2015


On Saturday, 24 October 2015 at 09:22:37 UTC, Jacob Carlborg 
wrote:
> Can these be implemented by the user just declaring a regular 
> container as immutable? The implement will recognize if it's 
> declared as immutable and adapt.

How can a type know it's qualifier?

struct Container(T)
{
    //.... access qualifier somehow do stuff with it
}

alias SM  = Container!int;
alias SIM = immutable Container!int;

It was my understanding that S!int only gets instantiated one 
time here? Or does the compiler instantiate (immutable S!int) and 
(S!int)? Or were you thinking of something else?




More information about the Digitalmars-d mailing list