Reputation: 3543
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
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