Friday, 23 August 2013

decltype and member type

decltype and member type

I am trying to get the member type after decltype and define a variable y.
struct s
{
typedef int val_type;
};
int main()
{
s x;
decltype(x)::val_type y;
}
In the above program, the compiler complains:
'val_type' : is not a member of '`global namespace''
However, decltype(x) does get type s. Why couldn't I follow val_type after
it to get the member type?

No comments:

Post a Comment