2010/8/25 Erez D <erez0...@gmail.com>: > > > On Wed, Aug 25, 2010 at 12:08 PM, Elazar Leibovich <elaz...@gmail.com> > wrote: >> >> template <class a, class b> >> >> class c >> >> { >> >> private: >> >> b defaultVal; >> >> public: >> >> std::map<a,b> mymap; >> >> >> const b &func(a idx) >> >> { >> >> typename std::map<a,b>::iterator it(mymap.find(idx)); >> >> if (it!=mymap.end()) >> >> return it->second; >> >> else >> >> return defaultVal; >> >> } >> >> }; >> >> The compiler is not sure std::map<a,b>::iterator is a typename or a value. > > how do i sove that ? can you give a solution ?
I think you missed the fact that Elazar gave a solution - the above is NOT identical to what you sent: 1. uses the proper argument (idx, not a) to find() 2. adds typename -- Oleg Goldshmidt | p...@goldshmidt.org _______________________________________________ Linux-il mailing list Linux-il@cs.huji.ac.il http://mailman.cs.huji.ac.il/mailman/listinfo/linux-il