Skip to content

Instantly share code, notes, and snippets.

@UplinkCoder
Created October 30, 2021 21:13
Show Gist options
  • Select an option

  • Save UplinkCoder/55a27c607ec1c2fb34ee0e0514ff52fc to your computer and use it in GitHub Desktop.

Select an option

Save UplinkCoder/55a27c607ec1c2fb34ee0e0514ff52fc to your computer and use it in GitHub Desktop.
static assert(Foo.tupleof.length == 1);
struct Foo {
int a;
static if(Foo.tupleof.length == 1) {
int b;
static assert(Foo.tupleof.length == 3); // ok
}
static if(Foo.tupleof.length == 1) {
int c;
}
static assert(Foo.tupleof.length == 3); // ok
static if(Foo.tupleof.length == 3) {
int d;
static assert(0); // never run
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment