[Feature Request] Adding to D lang "set" built-in

Gor Gyolchanyan gor.f.gyolchanyan at gmail.com
Sat May 5 10:24:34 PDT 2012


I think a much more realistic suggestion would be to add it to phobos
as a struct, which wraps this no-value AA solution.

On Sat, May 5, 2012 at 9:14 PM, bioinfornatics
<bioinfornatics at fedoraproject.org> wrote:
> Dear, i hope i will got some answer from druntime/phobos dev .
> A set is an array of unique element:
>>>> set( 1, 5, 7, 1, 7)
> give this array => [1, 5, 7]
>
> Currently in D the hack it is to use an associative array with any
> value.
> byte[size_t] a = [ 1:0, 5:0, 7:0, 1:0, 7:0 ];
>
> then it is easy to have a set in D just add a syntax or a built-in where
> use associative array without using value.
>
> I hope really this little feature and seem really easy to add
>
>
> thanks a lot for your great works
>



-- 
Bye,
Gor Gyolchanyan.


More information about the Digitalmars-d mailing list