Thread overview | ||||||
---|---|---|---|---|---|---|
|
April 21, 2003 Abstraction for primitive types? | ||||
---|---|---|---|---|
| ||||
Is there an abstraction planned for primitive types? Something that would allow to write generic interfaces like TypeToUnistring(type t) { TypeInfo *pti=t.info; char buf[40]; int n=(*pti.toMem)(&t,buf); return MemRetUnistring(buf,n); } or void ArrayRandomize(type [] ar) { .... algorithm using swap from typeinfo .... } ? -- Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com |
April 24, 2003 Re: Abstraction for primitive types? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Helmut Leitner | The t.info should work now. "Helmut Leitner" <helmut.leitner@chello.at> wrote in message news:3EA3B257.6974D98D@chello.at... > Is there an abstraction planned for primitive types? > > Something that would allow to write generic interfaces like > > TypeToUnistring(type t) { > TypeInfo *pti=t.info; > char buf[40]; > int n=(*pti.toMem)(&t,buf); > return MemRetUnistring(buf,n); > } > > or > > void ArrayRandomize(type [] ar) { > .... > algorithm using swap from typeinfo > .... > } > > ? > > -- > Helmut Leitner leitner@hls.via.at > Graz, Austria www.hls-software.com |
April 24, 2003 Re: Abstraction for primitive types? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote: > > The t.info should work now. What means "now"? In the next version DMD 0.62? > "Helmut Leitner" <helmut.leitner@chello.at> wrote in message news:3EA3B257.6974D98D@chello.at... > > Is there an abstraction planned for primitive types? > > > > Something that would allow to write generic interfaces like > > > > TypeToUnistring(type t) { > > TypeInfo *pti=t.info; > > char buf[40]; > > int n=(*pti.toMem)(&t,buf); > > return MemRetUnistring(buf,n); > > } > > > > or > > > > void ArrayRandomize(type [] ar) { > > .... > > algorithm using swap from typeinfo > > .... > > } > > > > ? > > > > -- > > Helmut Leitner leitner@hls.via.at > > Graz, Austria www.hls-software.com -- Helmut Leitner leitner@hls.via.at Graz, Austria www.hls-software.com |
April 24, 2003 Re: Abstraction for primitive types? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Helmut Leitner | "Helmut Leitner" <helmut.leitner@chello.at> wrote in message news:3EA8443F.165D429E@chello.at... > > > Walter wrote: > > > > The t.info should work now. > > What means "now"? In the next version DMD 0.62? Yes, unless I goofed it up <g>. |
Copyright © 1999-2021 by the D Language Foundation