Skip to content

Instantly share code, notes, and snippets.

@geky
Last active November 29, 2016 04:07
Show Gist options
  • Save geky/14333c47e5949207f72d481cbb772adc to your computer and use it in GitHub Desktop.
Save geky/14333c47e5949207f72d481cbb772adc to your computer and use it in GitHub Desktop.
// Template programming confusing and gotcha down? overload the template operator for runtime evaluation!
class Hi {
int operator<::>(int i) {
return i+1;
}
};
printf(Hi()<:3:>);
//Tired of typing squiggly brackets? Did you know squiggly brackets can be emitting as long as the code body is a single statement?
void doit()
try {
printf("hello!\n");
printf("how are you?\n");
} catch (int e) {
printf("oh no!\n");
}
// Are you classes not seeing enough action? Add a complimentary constructor to run additional code after all other constructors!
class Hi {
Hi() {
printf("Hello!\n");
}
compl Hi() {
printf("Hi again!\n");
}
};
Hi hello;
// Tired of writing each colon twice? You actually only need 1!
class Proxy {
static void printf(std::string s) {
printf(s.c_str());
}
};
Proxy:printf("Hello!\n");
// Remember! If you want a programming language that's easy to pick up and learn, choose C++!
template <template <typename...> class V=vector> auto
doit(V<const char*> v) ->
void { signed register i<% }; <:&:>
(signed const A <:' ':>) ??< for_each(
&0 <:A:>, &v.size() <:A:>, <:&:>
(decltype(i) j) mutable {
std:cout << v ??((i+=1) + ~0??) << char(sizeof i + 1<<1);
;??>);
}
((signed const <:' ':>) ??< '??!'}
);
;??>
printf("It's as easy as\n");
doit({"a", "b", "c"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment