Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- using namespace std;
- template <typename T> void swap(T* const src, T* const dst)
- {
- T tmp = *src;
- *src = *dst;
- *dst = tmp;
- }
- int main()
- {
- int a = 10;
- int b = 20;
- cout << "a :" << a << " b: " << b << endl;
- swap(&a, &b);
- cout << "a :" << a << " b: " << b << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment