Map with maintained insertion order

Andrej Mitrovic andrej.mitrovich at gmail.com
Fri Mar 23 18:52:04 PDT 2012


On 3/24/12, Andrej Mitrovic <andrej.mitrovich at gmail.com> wrote:
> static if (isArray!Value)
> {
>     template isValue(T)
>     {
>        enum bool isValue = is(typeof( { Value v; T t; v = t; } )) ||
> is(BaseElement!Value == T);
>     }
> }

Correction, it's:
template isValue(T)
{
    enum bool isValue = is(typeof( { Value v; T t; v = t; } ))
    || is(typeof( { BaseElement!Value v; T t; v = t; } ))
    || is(BaseElement!Value == T);
}

Complicated beast, but I have to take into acount both 'alias this'
tricks and the fact that ~= works when RHS is either an element type
or an array.


More information about the Digitalmars-d-learn mailing list