Files
ooplab/lab8/22.cpp
Amneesh Singh 4824ab9855 labs 8: init
Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
2022-12-26 17:30:37 +05:30

20 lines
279 B
C++

#include <iostream>
template <typename T, std::enable_if_t<std::is_arithmetic<T>::value, T> = 0>
void swap(T &x, T &y) {
x += y;
y = x - y;
x -= y;
}
int main() {
char x = '[';
char y = 'w';
swap(x, y);
std::cout << "x = " << x << ", y = " << y;
return 0;
}