Skip to content

Instantly share code, notes, and snippets.

@bholt
Created September 12, 2014 19:45
Show Gist options
  • Save bholt/42a4895c159623d9ef66 to your computer and use it in GitHub Desktop.
Save bholt/42a4895c159623d9ef66 to your computer and use it in GitHub Desktop.
template< typename T >
void work(T t) {
try { throw t; }
catch (int x) { printf("int\n"); }
catch (std::string x) { printf("string\n"); }
}
int main(int argc, char *argv[]) {
work(0);
work(std::string("foo"));
return 0;
}
/////////////////////////////////////////////////////////////
//> int
//> string
/////////////////////////////////////////////////////////////
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment