Skip to content

Instantly share code, notes, and snippets.

@Kaali
Created December 5, 2014 11:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kaali/febdfd7670b681d21097 to your computer and use it in GitHub Desktop.
Save Kaali/febdfd7670b681d21097 to your computer and use it in GitHub Desktop.
w00t
typedef unsigned char TYPE;
struct Foo {
TYPE p, a, i, r, s;
Foo() {}
Foo(TYPE p, TYPE a, TYPE i, TYPE r, TYPE s) : p(p), a(a), i(i), r(r), s(s) {}
Foo operator+(Foo const& x) {
return Foo(p + x.p, a + x.a, i + x.i, r + x.r, s + x.s);
}
};
int main(int argc, char** argv) {
Foo a(argc, argc, argc, argc, argc);
Foo b(10, 20, 30, 40, 50);
int p;
for (int i = 0; i < 1000; i++) {
p += (a + b).p;
a.p++;
}
return p;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment