Problem with iterator, map, shared_ptr and templated class

Hello all, I am a bit stumped by a compile fault.. This is a fragment of the code template<typename T> void LCLogSource<T>::SetLoggers(std::map<T, boost::shared_ptr<LCLogHandler<T> > > &LogMap) { typedef std::map<T, boost::shared_ptr<LCLogHandler<T> > > handlerMap ; for (handlerMap::iterator pos = LogMap.begin(); pos != LogMap.end(); ++pos) // **** compile error here { yada yada I get a compile fault on the for line, 'expected ; before pos'. Now this fault has only started happening since I decided to template this class. It appears that the combination of the template, and the complexity of the map declaration is causing things to go awry, and I don't know why. I have tried a few alternatives but always get a problem of some description. Is there some reason I cannot use iterators on a stl::map where the map key defn. depends on the template parameter? In case this is nothing to do with the shared_ptr in the map, does anyone have a list where templates programming is discussed so I can post there? James

James Hughes ha escrito:
[...]
for (handlerMap::iterator pos = LogMap.begin(); pos != LogMap.end();
I think this has to be for (typename handlerMap::iterator pos = LogMap.begin(); pos != LogMap.end(); HTH, Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
participants (2)
-
James Hughes
-
Joaquín Mª López Muñoz