Re: Templated Lists

2017-06-16 Thread Jolly James via Digitalmars-d
On Saturday, 17 June 2017 at 00:28:50 UTC, Ali Çehreli wrote: On 06/16/2017 05:02 PM, Jolly James wrote: If I did well on my quick research, C#'s generic lists are exactly that. :) C#'s generics allow to specify one datatype T that is used, some kind of similar to a template. So, a generic

Re: Templated Lists

2017-06-16 Thread Ali Çehreli via Digitalmars-d
On 06/16/2017 05:02 PM, Jolly James wrote: >>> I am looking for something similar to C#'s generic list. > Thx, but I do not need to mix different types (using variant). If I did well on my quick research, C#'s generic lists are exactly that. :) > Assuming I use simply an dynamic array, how doe

Re: Templated Lists

2017-06-16 Thread Jonathan M Davis via Digitalmars-d
On Friday, June 16, 2017 23:08:58 Jolly James via Digitalmars-d 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. > > >>> interface IList > >>> { > >>> > >>>

Re: Templated Lists

2017-06-16 Thread Jolly James via Digitalmars-d
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.Va

Re: Templated Lists

2017-06-16 Thread Ali Çehreli via Digitalmars-d
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

Re: Templated Lists

2017-06-16 Thread Stefan Koch via Digitalmars-d
On Friday, 16 June 2017 at 23:08:58 UTC, 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. interface IList { int Count { get; } void Add(T i

Re: Templated Lists

2017-06-16 Thread Jolly James via Digitalmars-d
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. interface IList { int Count { get; } void Add(T item); void Remove(T item); T this[int index]; /

Re: Templated Lists

2017-06-16 Thread Cym13 via Digitalmars-d
On Friday, 16 June 2017 at 19:07:49 UTC, Jolly James wrote: I know that there are arrays, some strange container classes and so on. But how does one create and use a templated list in D that supports adding, removing and sorting items? One that can be used for structs and for classes? I'm u

Re: Templated Lists

2017-06-16 Thread Jonathan M Davis via Digitalmars-d
On Friday, June 16, 2017 19:07:49 Jolly James via Digitalmars-d wrote: > I know that there are arrays, some strange container classes and > so on. > > But how does one create and use a templated list in D that > supports adding, removing and sorting items? One that can be used > for structs and for

Templated Lists

2017-06-16 Thread Jolly James via Digitalmars-d
I know that there are arrays, some strange container classes and so on. But how does one create and use a templated list in D that supports adding, removing and sorting items? One that can be used for structs and for classes?