This question is related to : Dependent scope and nested templates, Why do I need to use typedef typename in g++ but not VS? and Nested templates with dependent scope
According to this answer https://stackoverflow.com/a/3311640/1559666 I should add typename to typedef.
The question is - why I getting error?
#include <iostream>
#include <vector>
#include <iterator>
template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
class PtrVector
{
private:
typedef std::vector<_Tp, _Alloc> VectrorT;
typedef typename std::vector<_Tp, _Alloc> VT;
public:
typename std::vector<_Tp, _Alloc>::const_iterator test(){}
VT::const_iterator test2(){} // why there is an error here?
};
int main() {
return 0;
}