Created
October 4, 2010 19:01
-
-
Save sinfu/610238 to your computer and use it in GitHub Desktop.
metaArray
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct MetaArray(seq...) | |
{ | |
alias seq Expand; | |
// CTFE-capable | |
bool opEquals(rhsSeq...)(MetaArray!rhsSeq ) | |
{ | |
return is(MetaArray!seq == MetaArray!rhsSeq); | |
} | |
} | |
template metaArray(seq...) | |
{ | |
enum metaArray = MetaArray!seq(); // compile-time constant | |
} | |
enum a = metaArray!(int, "x", 100); | |
enum b = metaArray!(double, "y", 200); | |
static assert(a == a); | |
static assert(a != b); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment