A
Aaron Carroll
Consider the following:
#include <map>
template <class T>
void f()
{
typedef std::map<T, int> Mymap;
Mymap::iterator iter;
}
Compiling with both GCC and Comeau gives an error along the lines of
`expected a ";" before "iter".' The same code with the map parameter
T replaced with a concrete type compiles just fine. Instantiating a
"Mymap" seems to work.
Why can I create a "Mymap" object, but not a "Mymap::iterator" object?
Cheers,
-- Aaron
#include <map>
template <class T>
void f()
{
typedef std::map<T, int> Mymap;
Mymap::iterator iter;
}
Compiling with both GCC and Comeau gives an error along the lines of
`expected a ";" before "iter".' The same code with the map parameter
T replaced with a concrete type compiles just fine. Instantiating a
"Mymap" seems to work.
Why can I create a "Mymap" object, but not a "Mymap::iterator" object?
Cheers,
-- Aaron