bearophile , dans le message (digitalmars.D.learn:29532), a écrit :
Well, I don't understand the error it gives :-) Are you able to explain it to
me?
import std.stdio;
void main() {
int i = 1;
switch(i) {
case 0:
writeln(case 0);
goto
When porting c-code to D, I come consitently to the problem,
how to convert such a c-macro:
#define V(a,b,c) glVertex3d( a size, b size, c size );
#define N(a,b,c) glNormal3d( a, b, c );
N( 1.0, 0.0, 0.0); V(+,-,+); V(+,-,-); V(+,+,-); V(+,+,+);
...
Ok, I could just write it out, but that's not
Am 15.09.2011, 13:37 Uhr, schrieb Matthias Pleh u...@example.net:
When porting c-code to D, I come consitently to the problem,
how to convert such a c-macro:
#define V(a,b,c) glVertex3d( a size, b size, c size );
#define N(a,b,c) glNormal3d( a, b, c );
N( 1.0, 0.0, 0.0); V(+,-,+); V(+,-,-);
On 15.09.2011 13:48, Trass3r wrote:
If you are willing to write V(+1,-1,+1) instead you can just turn them
into functions.
really a good point! :)
Also by static function you probably mean private in D.
No, I meant for mixin I nead static functions, but I just realized,
it also works without
struct Foo(T = int) {}
void main()
{
Foo foo; // fail
Foo!() bar; // ok
}
It would be very convenient to be able to default to one type like this.
For example, in CairoD there's a Point structure which takes doubles
as its storage type, and then there's PointInt that takes ints. The
On Thu, 15 Sep 2011 16:46:24 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
struct Foo(T = int) {}
void main()
{
Foo foo; // fail
Foo!() bar; // ok
}
It would be very convenient to be able to default to one type like this.
For example, in CairoD there's a Point
Simen Kjaeraas , dans le message (digitalmars.D.learn:29539), a
écrit :
On Thu, 15 Sep 2011 16:46:24 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
struct Foo(T = int) {}
void main()
{
Foo foo; // fail
Foo!() bar; // ok
}
It would be very convenient to be able
On Thursday, September 15, 2011 16:46:24 Andrej Mitrovic wrote:
struct Foo(T = int) {}
void main()
{
Foo foo; // fail
Foo!() bar; // ok
}
It would be very convenient to be able to default to one type like this.
For example, in CairoD there's a Point structure which takes
On Thu, 15 Sep 2011 10:46:24 -0400, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
struct Foo(T = int) {}
void main()
{
Foo foo; // fail
Foo!() bar; // ok
}
It would be very convenient to be able to default to one type like this.
For example, in CairoD there's a Point
On 2011-09-15 16:46, Andrej Mitrovic wrote:
struct Foo(T = int) {}
void main()
{
Foo foo; // fail
Foo!() bar; // ok
}
It would be very convenient to be able to default to one type like this.
For example, in CairoD there's a Point structure which takes doubles
as its storage type,
On Thu, 15 Sep 2011 17:54:19 +0200, Christophe
trav...@phare.normalesup.org wrote:
Simen Kjaeraas , dans le message (digitalmars.D.learn:29539), a
écrit :
On Thu, 15 Sep 2011 16:46:24 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
struct Foo(T = int) {}
void main()
{
Foo
Also by static function you probably mean private in D.
No, I meant for mixin I nead static functions, but I just realized,
it also works without the static keyword.
I think static has no meaning in global scope, only in function scope
where it tells the compiler you don't want a closure.
On Thursday, September 15, 2011 10:48 Steve Teale wrote:
Looking at the documentation makes my head hurt, especially if I have
consumed some beer, when I am not pure and immutable.
For an overview, check out http://d-programming-language.org/intro-to-
datetime.html
I'd _love_ to fix the links
Oh, so it is difficult after all! I thought it was just me.
So I am probably going to have to ask. Then the interesting question will be
which
way around will offend fewest people.
I have installed it as ISO, then have to ask US users if they would prefer
Letter
Size, or the other way round
On Thursday, September 15, 2011 19:30:24 Steve Teale wrote:
Oh, so it is difficult after all! I thought it was just me.
No. It's hard. The best that you can get by asking Posix functions is the std
and DST abbreviations for the current time zone - and those are non-unique.
You'd have to do
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
Otherwise I'm currently having to hardcode via:
template bar(T) if (isOneOf!(T, Foo!int,
On Thu, 15 Sep 2011 22:24:50 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
On 09/15/2011 10:24 PM, Andrej Mitrovic wrote:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
Otherwise I'm currently having to hardcode
Cool, that works, thanks. Is this in Phobos by any chance? Otherwise
I'll just use a more flexible version of that.
On Thursday, September 15, 2011 13:24 Andrej Mitrovic wrote:
I can do this:
struct Foo(T) { }
template bar(T : Foo!int) { }
I can check if T is a specific instantiation of Foo. But I want to
check whether T is *any* instantiation of Foo. Is this possible to do?
Otherwise I'm currently
On 9/15/11, Timon Gehr timon.g...@gmx.ch wrote:
template bar(T : Foo!S,S){ }
Yeah, that should do it too. Thanks.
On Thursday, September 15, 2011 13:45 Andrej Mitrovic wrote:
Cool, that works, thanks. Is this in Phobos by any chance?
How could it be? It's specific to the template that you're testing.
- Jonathan M Davis
On 09/15/2011 07:48 PM, Steve Teale wrote:
Alternatively, let me explain my desire. When my program first runs, I want to
hazard a guess as to what size of paper the user is likely to use - US Letter
Size, or A4/inches or metric. GTK does not seem to want to tell me about the
default printer
On 9/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Every template instantiation is a new set of code with _zero_ assocation
with
any other template instantation.
Yeah, I know. But I don't think this has to be set in stone. Having
some specific compile-time type information about a
On Thu, 15 Sep 2011 22:45:21 +0200, Andrej Mitrovic
andrej.mitrov...@gmail.com wrote:
Cool, that works, thanks. Is this in Phobos by any chance? Otherwise
I'll just use a more flexible version of that.
No more flexible version available, sadly. I wish this worked (I think
it's in Bugzilla
On Thursday, September 15, 2011 14:17 Andrej Mitrovic wrote:
On 9/15/11, Jonathan M Davis jmdavisp...@gmx.com wrote:
Every template instantiation is a new set of code with _zero_ assocation
with
any other template instantation.
Yeah, I know. But I don't think this has to be set in stone.
The standard library std.algorithm is based on Range. So if
a = [1, 2, 3, 4];
auto r = filter!(a 2)(a);
Here, r is a range.
How about I want an new array? Is there any easy way to convert the
result to array?
If we have to do like:
int[] b;
for (v; r) {
b ~= v;
}
Then maybe it is easier to
Sorry, the 'for' should be 'foreach'.
On Friday, September 16, 2011 04:04:39 Cheng Wei wrote:
The standard library std.algorithm is based on Range. So if
a = [1, 2, 3, 4];
auto r = filter!(a 2)(a);
Here, r is a range.
How about I want an new array? Is there any easy way to convert the
result to array?
If we have to do
29 matches
Mail list logo