Proposal for a set handling library
Martin Nowak
code at dawg.eu
Thu Jan 2 11:36:35 PST 2014
On 01/02/2014 09:09 AM, Raphaël Jakse wrote:
> I'm going to add this.
> Two questions:
> - By default, should set be typed or untyped?
> I would go for typed set, but what about people's expectations?
> - What is preferable: first version or second version of the proposed
> set factory function? (imho both cannot co-exist because of sets of
> arrays handling)
> * The first version allows creation of a set from a array. That is
> already possible with the constructor, but then you have to pass the
> type template, this is not beautiful.
> * The second version is more pretty. But then, we'll need a
> setFromArray function which makes a set from a list.
> I prefer the second option, but then, set([1, 2, 3, 4]) would make a
> set containing on element: an array of four ints. Could this be misleading?
Use a typesafe variadic function.
http://dlang.org/function.html#variadic
https://d.puremagic.com/issues/show_bug.cgi?id=11657
More information about the Digitalmars-d
mailing list