forked from natto1784/ooplab
20 lines
279 B
C++
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;
|
|
}
|