Meta

Jan 10, 2008 08:15

It's really dumb, but it's my most proud hack:

// meta.C

#include

template <>
inline printN<1>(const char * msg) {
printf("%s", msg);
}

template
inline printN(const char * msg) {
printN<1>(msg);
printN(msg);
}

int main() {
printN<3>("Hello World!\n");
return 0;
}

Points for figuring out what it does; double-plus points for knowing why it's dumb.

Edit: HTML and <> signs don't play well together. Should be fixed now, I hope. (Change highlighted.)
Previous post
Up