g wrote:
At what point structs are supported in CTFE.
Cause this fails in dmd 2.036:
import std.metastrings;
pragma(msg,toStringNow!(A.init.a));
struct A{
uint a;
}
with this message (note that the end seems truncated):
g...@g-desktop:~/Documentos/NCHESS$ dmd oh
oh.d(3): Error: no property 'a' for type 'A'
toStringNow!(__error)
g...@g-desktop:~/Documentos/NCHESS$
also, ¿Is there any way to generate structs with ctfe or it is obligatory to
use templates?
You can create them without templates. std.metastrings was created
before CTFE existed, it's rather outdated. It's intended for use with
template metaprogramming, not for use with CTFE.
You can do stuff like:
struct Foo {
int x;
}
enum Foo b = Foo(56);