forked from natto1784/ooplab
15 lines
238 B
C++
15 lines
238 B
C++
#include <iostream>
|
|
|
|
template <typename T>
|
|
std::enable_if_t<std::is_arithmetic<T>::value, T> sq(T x) {
|
|
return x * x;
|
|
}
|
|
|
|
int main() {
|
|
float x = 4.4;
|
|
|
|
std::cout << "double: " << sq((double)5.3) << "\nlong: " << sq(4l);
|
|
|
|
return 0;
|
|
}
|