Skip to content

Instantly share code, notes, and snippets.

@gabrielschulhof
Created June 6, 2019 00:06
Show Gist options
  • Save gabrielschulhof/339051cc41716c532c05fce8326cbf59 to your computer and use it in GitHub Desktop.
Save gabrielschulhof/339051cc41716c532c05fce8326cbf59 to your computer and use it in GitHub Desktop.
#include <stdio.h>
template <int x_init, int y_init>
class HasStructures {
public:
struct InnerStruct {
InnerStruct(): x(x_init), y(y_init) {}
int x;
int y;
};
static InnerStruct item;
};
template <int x_init, int y_init>
HasStructures<x_init, y_init>::InnerStruct HasStructures::item;
int main() {
printf("%d, %d\n", HasStructures<5, 6>::item.x, HasStructures<5, 6>::item.y);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment