Skip to content

Instantly share code, notes, and snippets.

@Tristramg
Created January 5, 2011 13:12
Show Gist options
  • Save Tristramg/766290 to your computer and use it in GitHub Desktop.
Save Tristramg/766290 to your computer and use it in GitHub Desktop.
#include <vector>
class Foo {
template<class Type> std::vector<Type> get(){ throw "vtff";}
template<> std::vector<int> get(){std::vector<int> val; val.push_back(42); return val;}
}
void main(int, char**) {
Foo f;
std::cout << f.get<int>()[0] << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment