Philipp Kraus ha scritto:
I had tried the std::pair<T,T>, but I can't compile it.
[...]
worker.hpp:134: note: say 'typename std::map<std::basic_string<char,
std::char_traits<char>, std::allocator<char>
,std::pair<_ForwardIterator,
_ForwardIterator>,std::less<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
,std::allocator<std::pair<const std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
std::pair<_ForwardIterator, _ForwardIterator> > > >::iterator' if a
type is meant
If you do what the error message suggests, then everything should be
OK. It's telling you to put a "typename" in front of the iterator
variable.
template <class T>
void f()
{
std::map<std::string, std::pair<T, T> > x;
for (typename std::map<std::string, std::pair<T, T> >::iterator it =
x.begin(); it != x.end(); ++it) ;
}