Templated Lists

Jolly James via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 16 17:02:05 PDT 2017


On Friday, 16 June 2017 at 23:38:46 UTC, Ali Çehreli wrote:
> 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

Thx, but I do not need to mix different types (using variant). 
Assuming I use simply an dynamic array, how does one remove an 
specific item?


More information about the Digitalmars-d mailing list