Skip to content

Instantly share code, notes, and snippets.

@motonacciu
Created July 26, 2012 16:14
Show Gist options
  • Select an option

  • Save motonacciu/3182980 to your computer and use it in GitHub Desktop.

Select an option

Save motonacciu/3182980 to your computer and use it in GitHub Desktop.
#include <iostream>
namespace std {
template <typename T1, typename T2>
ostream& operator<<(ostream& out, const pair<T1,T2>& p) {
return out << "(" << p.first << "," << p.second << ")";
}
} // end std namespace
int main(int argc, char* argv[]) {
std::cout << makeTree(10,3.4f) << std::endl; // => (10,3.4)
std::cout << makeTree("hello", "20", "world") << std::endl; // => (hello,(20,world))
std::cout << makeTree(10,20,30,40) << std::endl; // COMPILER ERROR :(
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment