Templated Lists

Ali Çehreli via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 16 16:38:46 PDT 2017


On 06/16/2017 04:08 PM, Jolly James wrote:
> On Friday, 16 June 2017 at 19:42:44 UTC, Cym13 wrote:
>> I'm unclear about your intent: do you want a compile-time list
>
> I am looking for something similar to C#'s generic list.

std.variant.Variant perhaps?

   https://dlang.org/phobos/std_variant.html

import std.variant;

void main() {
     Variant[] arr;
     arr ~= Variant(42);
     arr ~= Variant("hello");
}

Also consider Algebraic in that module.

Ali



More information about the Digitalmars-d mailing list