1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
#include <iostream> template<typename S, typename T> void swap(S& a, T& b) { S tmp = a; a = b; b = tmp; } int main() { int x = 3; std::string y = "1.0"; swap(x, y); std::cout << "x: " << x << std::endl; std::cout << "y: " << y << std::endl; }
Generated with cgit - Back to sebastiano.tronto.net