Mickey Tin
Mickey Tin

Reputation: 3543

template function in "Eclipse IDE" doesn't compile

I have such function :

template<template <class _Ty, class _A = allocator<_Ty> > class Container>
    static void FreeAttributesVS(const Container<int>& arra)
    {
        for(Container<int>::const_iterator iter = arra.begin();
            iter != arra.end(); ++iter)
        {
            //do smthng
        }
    }

It compiles in VisualStudio but in Eclipse compiler says "Invalid template argumetns", what should I do?

Upvotes: 0

Views: 102

Answers (1)

David G
David G

Reputation: 96845

You need typename before Container<int>::const_iterator since that is a dependent type:

static void FreeAttributesVS(const Container<int>& arra)
{
    for (typename Container<int>::const_iterator iter = arra.begin(); ...)
    //   ^^^^^^^

}

Upvotes: 2

Related Questions