I am trying to use the decltype
keyword on an auto function:
struct Thing {
static auto foo() {
return 12;
}
using type_t =
It's because a using
inside a class or struct see the declaration but not the definition of members. So see auto
but doesn't see return 12;
.
If different, would be dangerous because the definition of members can use the defined (using
or typedef
) types.
Imagine something as follows
struct Thing {
static auto foo() {
return type_t{};
}
using type_t =
decltype(foo());
};