Files
modern-cpp-tutorial/code/2/2.14.default.template.param.cpp
2019-07-16 09:26:31 +02:00

19 lines
366 B
C++

//
// 2.4.default.template.param.cpp
// chapter 2 language usability
// modern cpp tutorial
//
// created by changkun at changkun.de
// https://github.com/changkun/modern-cpp-tutorial
//
#include <iostream>
template<typename T = int, typename U = int>
auto add(T x, U y) -> decltype(x+y) {
return x+y;
}
int main() {
std::cout << add(1, 2) << std::endl;
}