How to fix compile error: non-template 'iterator1' used as template

c++, metaprogramming, templates

Solution

You'll need to tell the compiler that `iterator1` is a template with:

typedef typename utf_t::template iterator1< typename impl_t::iterator > iterator2;

Problem

i have some problem with a nested template class. The code compiles fine within VS2012, but fails in VS2013 and gcc 4.2.x: ``` #include <string> namespace utf { class klar{ //my test class public: template <typename octet_iterator > class iterator1 { int n; }; }; template< typename impl_t, typename utf_t > class tanga { int b; public: typedef typename utf_t::iterator1< typename impl_t::iterator > iterator2; tanga() { iterator2 i; } }; } typedef utf::tanga< std::string, utf::klar > Hugo; static const Hugo h; ``` Any idea how to fix this problem? The error is: ``` error: non-template 'iterator1' used as template typedef typename utf_t::iterator1< typename impl_t::iterator > iterator2; ^ ```

Original source

Related problems