codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
template RetriveFields(T, char[] name, int u) { static if (is(T == struct) || is(T == class)) { static if (u < T.tupleof.length) { static if (is(typeof(T.tupleof[u]) == struct)) { const char[] RetriveFields = RetriveFields!(typeof(T.tupleof[u]), (name~ (T.tupleof[u].stringof[T.stringof.length+2 .. $])), 0) ~ RetriveFields!(T, name, u+1); } else static if (isArray!(typeof(T.tupleof[u]))) { const char[] RetriveFields = RetriveFields!(typeof(T.tupleof[u]), (name~ (T.tupleof[u].stringof[T.stringof.length+2 .. $])), 0) ~ RetriveFields!(T, name, u+1); } else static if (T.tupleof[u].stringof[T.stringof.length+2 .. $] == ".this") { const char[] RetriveFields = RetriveFields!(T, name, u+1); } else { const char[] RetriveFields = "(" ~ name ~ T.tupleof[u].stringof[T.stringof.length+2 .. $] ~ ") " ~ RetriveFields!(T, name, u+1); } } else const char[] RetriveFields = ""; } else static if (isArray!(T)) { static if (u < T.length) { static if (is(typeof(T[0]) == struct)) { const char[] RetriveFields = RetriveFields!(typeof(T[0]), name~"[0x"~tohex(u)~"]", 0) ~ RetriveFields!(T, name, u+1); } else static if (isArray!(T)) { const char[] RetriveFields = RetriveFields!(typeof(T[0]), name~"[0x"~tohex(u)~"]", 0) ~ RetriveFields!(T, name, u+1); } else { const char[] RetriveFields = name~"[0x" ~ tohex(u) ~ "]" ~ RetriveFields!(T, name, u+1); } } else { const char[] RetriveFields = ""; } } else { const char[] RetriveFields = "(" ~ name ~ ")"; } }
Private
[
?
]
Run code
Submit