It is my understanding that decltype is used to query the type of an objects/variables and so on.
From the examples present on wikipedia, such as the following:
int i;
decltype(i) x3; // type is int
I assumed I could do something like this:
class A
{
public:
int a, b;
};
template<typename T>
struct IsClass
{
enum { Yes = std::is_class<T>::value };
enum { No = !Yes };
};
std::vector<A> v;
auto it = v.begin();
IsClass<decltype(it)::value_type>::Yes
Because after all this line is legal:
IsClass<std::vector<A>::iterator::value_type>::Yes
Alas it wouldn't compile, citing the following: error C2039: 'value_type' : is not a member of '
global namespace''`
Any ideas as to why scope resolution was made to behave this way in presence of decltype?
P.S: If it makes any difference I'm using MSVC2012 (without the Nov CTP)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…