Re: -nan problem???

2008-12-11 Thread Sheridan
Ok, I try to post a small code. But I have about 40 files and they are not public. But i will make a small piece of the code to reproduce the problem.

Re: Why is my structure template does not compile?

2008-12-11 Thread Denis Koroskin
On Fri, 12 Dec 2008 02:47:42 +0300, BCS wrote: Reply to Denis, On Fri, 12 Dec 2008 02:21:11 +0300, BCS wrote: Reply to Weed, invariant() { // If I comment out next line compilation goes smoothly: assert( Element.sizeof > 0 ); } OTOH that assert is wrong. Element.sizeof will always retur

Re: Why is my structure template does not compile?

2008-12-11 Thread Weed
BCS пишет: Reply to Denis, On Fri, 12 Dec 2008 02:21:11 +0300, BCS wrote: Reply to Weed, invariant() { // If I comment out next line compilation goes smoothly: assert( Element.sizeof > 0 ); } OTOH that assert is wrong. Element.sizeof will always return 8, the size of an array reference.

Re: Why is my structure template does not compile?

2008-12-11 Thread BCS
Reply to Denis, On Fri, 12 Dec 2008 02:21:11 +0300, BCS wrote: Reply to Weed, invariant() { // If I comment out next line compilation goes smoothly: assert( Element.sizeof > 0 ); } OTOH that assert is wrong. Element.sizeof will always return 8, the size of an array reference. What you wan

Re: Why is my structure template does not compile?

2008-12-11 Thread Weed
ref Element opIndexAssign( in Element a, in uint n ) { data[n] += a; return data[n]; } I'm guessing as I don't use 2.0 but I think that this is a bug. DMD is trying to say that the above returns are trying to return something that can't be referenced (like a math expression result). It is

Re: -nan problem???

2008-12-11 Thread Denis Koroskin
On Fri, 12 Dec 2008 02:26:55 +0300, Sheridan wrote: Hi! I am new in D language. I implement a little 2D/3D engine, and during the development I faced an interesting problem. I have this function: void addBackgroundToLayer2(char[] textureName, float posx, float posy) { CTextur

Re: Why is my structure template does not compile?

2008-12-11 Thread Denis Koroskin
On Fri, 12 Dec 2008 02:21:11 +0300, BCS wrote: Reply to Weed, ref Element opIndex( in uint n ) { return data[n]; } ref Element opIndexAssign( in Element a, in uint n ) { data[n] += a; return data[n]; } I'm guessing as I don't use 2.0 but I think that this is a bug. DMD is trying to sa

-nan problem???

2008-12-11 Thread Sheridan
Hi! I am new in D language. I implement a little 2D/3D engine, and during the development I faced an interesting problem. I have this function: void addBackgroundToLayer2(char[] textureName, float posx, float posy) { CTexture tex = new CTexture(textureName); //create the texture

Re: Why is my structure template does not compile?

2008-12-11 Thread BCS
Reply to Weed, ref Element opIndex( in uint n ) { return data[n]; } ref Element opIndexAssign( in Element a, in uint n ) { data[n] += a; return data[n]; } I'm guessing as I don't use 2.0 but I think that this is a bug. DMD is trying to say that the above returns are trying to return somet

Why is my structure template does not compile?

2008-12-11 Thread Weed
struct S( Element ) { Element[] data; this( in uint len ) { data.length = len; } ref Element opIndex( in uint n ) { return data[n]; } ref Element opIndexAssign( in Element a, in uint n ) { data[n] += a; return data[n]; }

Re: Comparable Type

2008-12-11 Thread Jarrett Billingsley
On Thu, Dec 11, 2008 at 4:05 PM, saotome wrote: > Hi, > > can someone tell me how can i check whether a type is comparable ? Is there > something like "IComparable" in C# ? It's not entirely a replacement, but you can use some static checking to make sure that comparison between two types makes

Re: Comparable Type

2008-12-11 Thread Lars Ivar Igesund
saotome wrote: > Hi, > > can someone tell me how can i check whether a type is comparable ? Is > there something like "IComparable" in C# ? Unfortunately not - the relevant operators are defined in opCmp, so they will always be implemented, even if the implementation may not be sane. -- Lars

Comparable Type

2008-12-11 Thread saotome
Hi, can someone tell me how can i check whether a type is comparable ? Is there something like "IComparable" in C# ?