C++ 11, Example of auto for function declaration

less than 1 minute read

1
2
template <class T>
auto add(T t, U u) -> decltype(t + u)

is equal to

1
2
template <class T>
decltype((*(T*)0) + (*(U*)0)) add(T t, U u);