On 09/05/2011 16:36, Don wrote:
Robert Clipsham wrote:
Hey all,
I was wondering if anyone could enlighten me as to why the following
code does not compile (dmd2, latest release or the beta):
Added as bug 5969.
Thanks for this, I wasn't sure if it was a bug or not :)
--
Robert
http://octari
Robert Clipsham wrote:
Hey all,
I was wondering if anyone could enlighten me as to why the following
code does not compile (dmd2, latest release or the beta):
Added as bug 5969.
On 08/05/2011 19:19, Lutger Blijdestijn wrote:
test also doesn't compile normally on my box, dmd errors on Foo.tupleof. Not
sure if this is illegal or not. I think you want the allMembers trait or
something similar. Something like this:
import std.traits;
string test(T)()
{
string str = "s
Robert Clipsham wrote:
> Hey all,
>
> I was wondering if anyone could enlighten me as to why the following
> code does not compile (dmd2, latest release or the beta):
>
> struct Foo
> {
> int a;
> }
>
> string test()
> {
> string str = "struct " ~ Foo.stringof ~ "_{";
>
On 08/05/2011 00:39, Andrej Mitrovic wrote:
One simplistic solution is to use alias this to simulate the same type:
struct Foo
{
int x, y;
}
string structClone(T)()
{
return "struct " ~ T.stringof ~ "_ { "
~ T.stringof ~ " _inner;
alias _inner this;
this(T..
One simplistic solution is to use alias this to simulate the same type:
struct Foo
{
int x, y;
}
string structClone(T)()
{
return "struct " ~ T.stringof ~ "_ { "
~ T.stringof ~ " _inner;
alias _inner this;
this(T...)(T t) { _inner = typeof(_inner)(t); } };";
}
vo
On 07/05/2011 23:36, Andrej Mitrovic wrote:
Not too sure, CTFE is a pain in the ass sometimes. What exactly are
you trying to do, print field names in a custom way?
No, I have a struct that I don't have access to in the scope I'm in, I
do however have its type - by using the above, I can creat
Not too sure, CTFE is a pain in the ass sometimes. What exactly are
you trying to do, print field names in a custom way?
I have this piece of code I use for printing values, maybe you can
customize it for own your needs:
import std.stdio;
import std.conv;
import std.algorithm;
struct Foo
{
i
Hey all,
I was wondering if anyone could enlighten me as to why the following
code does not compile (dmd2, latest release or the beta):
struct Foo
{
int a;
}
string test()
{
string str = "struct " ~ Foo.stringof ~ "_{";
foreach (j, f; Foo.tupleof)
{