Filling a Tuple-like struct in variadic member

2011-11-08 Thread RivenTheMage
Is it possible to do such thing without using string mixin? import std.stdio; import std.metastrings; struct Key(T...) { static string declareFields() // compile-time { string declaration; foreach (index, type; T)

Re: Filling a Tuple-like struct in variadic member

2011-11-08 Thread RivenTheMage
> Or do you really need assignField to work with runtime values ? Yes, that's the problem.

Minimal D executable on Windows x32

2014-02-12 Thread RivenTheMage
Did it just for fun, maybe it will help someone :) Requires UniLink: ftp://ftp.styx.cabel.net/pub/UniLink main.d extern(C) void _acrtused_con() { mainFunc(); } extern(Windows) { int MessageBoxA(uint hWnd, char* lpText, char* lpCaption, uint uType); void ExitPro

Nested struct member has no access to the enclosing class data

2012-08-06 Thread RivenTheMage
Is it bug or feature? :) class Foo { int i; struct Bar { int j; int foobar() { return i + j; } } } main.d(ХХ): Error: this for i needs to be type Foo not type Bar

Re: Nested struct member has no access to the enclosing class data

2012-08-06 Thread RivenTheMage
On Monday, 6 August 2012 at 21:51:24 UTC, Andrej Mitrovic wrote: There is no "outer". A nested struct has the same access as a nested static class, meaning no access to any outer members unless they're static. Is there somewhere I can read the rationale behind that decision?

Re: Nested struct member has no access to the enclosing class data

2012-08-07 Thread RivenTheMage
On Monday, 6 August 2012 at 23:42:45 UTC, Era Scarecrow wrote: On Monday, 6 August 2012 at 22:28:40 UTC, RivenTheMage wrote: On Monday, 6 August 2012 at 21:51:24 UTC, Andrej Mitrovic wrote: There is no "outer". A nested struct has the same access as a nested static class, meaning

"For" infinite loop

2012-08-11 Thread RivenTheMage
This is infinite loop: for (ubyte i=0; i<=255; i++) { ... } I guess it's a bug?

Re: "For" infinite loop

2012-08-11 Thread RivenTheMage
On Saturday, 11 August 2012 at 18:37:18 UTC, Adam D. Ruppe wrote: A ubyte is ALWAYS <=255, since ubyte 255 + 1 == 0. Isn't both "i" and "255" should be propagated to int before comparison?

Re: "For" infinite loop

2012-08-11 Thread RivenTheMage
On Saturday, 11 August 2012 at 19:18:14 UTC, RivenTheMage wrote: On Saturday, 11 August 2012 at 18:37:18 UTC, Adam D. Ruppe wrote: A ubyte is ALWAYS <=255, since ubyte 255 + 1 == 0. Isn't both "i" and "255" should be propagated to int before comparison? Implicitly propagated, I mean.

Re: "For" infinite loop

2012-08-11 Thread RivenTheMage
Okay, thanks for helping!