3

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;
                             ^
muffmolch
  • 113
  • 9

1 Answers1

5

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

typedef typename utf_t::template iterator1< typename impl_t::iterator > iterator2;
Joseph Mansfield
  • 108,238
  • 20
  • 242
  • 324