Kinds of containers

Timon Gehr via Digitalmars-d digitalmars-d at puremagic.com
Sat Oct 24 02:12:47 PDT 2015


On 10/24/2015 01:36 AM, bitwise wrote:
> On Friday, 23 October 2015 at 23:21:31 UTC, bigsandwich wrote:
>> On Friday, 23 October 2015 at 17:44:55 UTC, deadalnix wrote:
>>> On Friday, 23 October 2015 at 11:03:37 UTC, Andrei Alexandrescu wrote:
>>>> [...]
>>>
>>> Sure. We have a problem when it come to collection in the fact that
>>> type qualifier do not turtle down as one would expect.
>>>
>>> [...]
>>
>> Its not just type qualifiers. Containers of derived types have the
>> same problem.  This is also a problem in C++.
>
> Thinking deeper about this, it _should_ be the case that deadalnix's
> example doesn't compile.
>
> struct Container(T) {
>      static if(is(T == const))
>           int changesLayout; // etc...
>      int stuff;
> }
>
>      Bit
>

One could introduce a way to indicate that const-conversions should be 
performed for instantiations of a given templated aggregate with 
identical layouts.


More information about the Digitalmars-d mailing list