Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
February 09, 2004 what do you think of | ||||
---|---|---|---|---|
| ||||
ok i didnt like any of the List classes that i found, so i made my own. what do you think: List!(int) myList = new List!(int); list.append(9); list.prepend(4); for(List!(int).Node node = myList.first; node; node = node.next) { printf("%u", node());//overloaded opCall printf("%u", node.t);//not quite as elegant, but required sometimes } what do you guys think? |
February 09, 2004 Re: what do you think of | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | 'overload' foreach.. that'll be most fun:D and opRange should be doable, too, rather simple.. (even for placing into foreach..) "imr1984" <imr1984_member@pathlink.com> schrieb im Newsbeitrag news:c07ic9$1dje$1@digitaldaemon.com... > ok i didnt like any of the List classes that i found, so i made my own. what do > you think: > > List!(int) myList = new List!(int); > > list.append(9); > list.prepend(4); > > for(List!(int).Node node = myList.first; node; node = node.next) > { > printf("%u", node());//overloaded opCall > printf("%u", node.t);//not quite as elegant, but required sometimes > } > > what do you guys think? > > |
February 09, 2004 Re: what do you think of | ||||
---|---|---|---|---|
| ||||
Posted in reply to davepermen | is that possible? how do i do that? In article <c07p50$1p0t$1@digitaldaemon.com>, davepermen says... > >'overload' foreach.. that'll be most fun:D > >and opRange should be doable, too, rather simple.. (even for placing into >foreach..) > >"imr1984" <imr1984_member@pathlink.com> schrieb im Newsbeitrag news:c07ic9$1dje$1@digitaldaemon.com... >> ok i didnt like any of the List classes that i found, so i made my own. >what do >> you think: >> >> List!(int) myList = new List!(int); >> >> list.append(9); >> list.prepend(4); >> >> for(List!(int).Node node = myList.first; node; node = node.next) >> { >> printf("%u", node());//overloaded opCall >> printf("%u", node.t);//not quite as elegant, but required sometimes >> } >> >> what do you guys think? >> >> > > |
February 09, 2004 Re: what do you think of | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | its all in the manuals.. "imr1984" <imr1984_member@pathlink.com> schrieb im Newsbeitrag news:c085vu$2dtc$1@digitaldaemon.com... > is that possible? how do i do that? > > In article <c07p50$1p0t$1@digitaldaemon.com>, davepermen says... > > > >'overload' foreach.. that'll be most fun:D > > > >and opRange should be doable, too, rather simple.. (even for placing into > >foreach..) > > > >"imr1984" <imr1984_member@pathlink.com> schrieb im Newsbeitrag news:c07ic9$1dje$1@digitaldaemon.com... > >> ok i didnt like any of the List classes that i found, so i made my own. > >what do > >> you think: > >> > >> List!(int) myList = new List!(int); > >> > >> list.append(9); > >> list.prepend(4); > >> > >> for(List!(int).Node node = myList.first; node; node = node.next) > >> { > >> printf("%u", node());//overloaded opCall > >> printf("%u", node.t);//not quite as elegant, but required sometimes > >> } > >> > >> what do you guys think? > >> > >> > > > > > > |
February 09, 2004 Re: what do you think of | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | imr1984 wrote:
> ok i didnt like any of the List classes that i found, so i made my own. what do
> you think:
>
> List!(int) myList = new List!(int);
>
> list.append(9);
> list.prepend(4);
>
> for(List!(int).Node node = myList.first; node; node = node.next)
> {
> printf("%u", node());//overloaded opCall
> printf("%u", node.t);//not quite as elegant, but required sometimes
> }
>
> what do you guys think?
>
>
Nice! I still think List should be an interface a la Java though, with linked and array based implementations. Implementing foreach and indexing would be nice.
Sam
|
Copyright © 1999-2021 by the D Language Foundation