Joy of c++
2015-03-06
#include <type_traits>
decltype(auto) foo1() {
int x;
return x;
}
decltype(auto) foo2() {
int x;
return (x);
}
int main() {
static_assert(std::is_same<decltype(foo1()),int>::value, "");
static_assert(std::is_same<decltype(foo2()),int&>::value, "");
}