Why is D slower than LuaJIT?
spir
denis.spir at gmail.com
Thu Dec 23 06:04:18 PST 2010
On Thu, 23 Dec 2010 14:40:13 +0100
"Simen kjaeraas" <simen.kjaras at gmail.com> wrote:
> > What kind of thingie does "i..j" actually construct as of now?
>
> Nothing. The syntax only works in foreach and opSlice.
>
> However, this works:
>
> final abstract class Intervals {
> struct Interval( T ) {
> T start, end;
> }
> static Interval!T opSlice( T )( T start, T end ) {
> return Interval!T( start, end );
> }
> }
>
> auto intInterval = Intervals[1..2];
> auto stringInterval = Intervals["foo".."bar"];
Nice! (even impressive :-)
Denis
-- -- -- -- -- -- --
vit esse estrany ☣
spir.wikidot.com
More information about the Digitalmars-d
mailing list