On Wednesday, 16 July 2014 at 18:27:31 UTC, Klb wrote:
On Wednesday, 16 July 2014 at 18:09:10 UTC, Adam D. Ruppe wrote:
On Wednesday, 16 July 2014 at 17:43:03 UTC, Klb wrote:
auto names = __traits(allMembers, S);
Error: static variable _names_field_0 cannot be read at
compile time.
The
On Wednesday, 16 July 2014 at 18:09:10 UTC, Adam D. Ruppe wrote:
On Wednesday, 16 July 2014 at 17:43:03 UTC, Klb wrote:
auto names = __traits(allMembers, S);
Error: static variable _names_field_0 cannot be read at
compile time.
The problem there is names is a regular runtime variable an
On Wednesday, 16 July 2014 at 18:09:10 UTC, Adam D. Ruppe wrote:
On Wednesday, 16 July 2014 at 17:43:03 UTC, Klb wrote:
auto names = __traits(allMembers, S);
Error: static variable _names_field_0 cannot be read at
compile time.
The problem there is names is a regular runtime variable an
On Wed, Jul 16, 2014 at 06:07:32PM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
> Not a direct answer, but the way I'd do this is to just use
> composition:
>
> class Foo {
>YourStruct _this;
>alias _this this;
> }
>
>
> boom, it'd work pretty well just like that...
+1, simple a
Not a direct answer, but the way I'd do this is to just use
composition:
class Foo {
YourStruct _this;
alias _this this;
}
boom, it'd work pretty well just like that...
On Wednesday, 16 July 2014 at 17:43:03 UTC, Klb wrote:
auto names = __traits(allMembers, S);
Error: static variable _names_field_0 cannot be read at compile
time.
The problem there is names is a regular runtime variable and
mixins need to use compile time stuff. If you make that enum
Klb:
Hello, I'd like to know if it's possible, using CTFE, mixin etc
to convert a POD struct to a class at compile time.
I remember Andrei planned to add this small thingie to Phobos,
but it's still missing.
Bye,
bearophile
Hello, I'd like to know if it's possible, using CTFE, mixin etc
to convert a POD struct to a class at compile time.
I've reached the step where the string to mix-in is generated but
I cant mix it:
-
import std.stdio;
import std.trait