Joy of c++
March 6, 2015
#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, "");
}
back