Re: what does g++ want from my code

2010-08-25 Thread Elazar Leibovich
For further explanation about the need for typename look at http://www.parashift.com/c++-faq-lite/templates.html#35.18 Item 35.18 On Wed, Aug 25, 2010 at 12:33 PM, Erez D wrote: > > > On Wed, Aug 25, 2010 at 12:08 PM, Elazar Leibovich w

Re: what does g++ want from my code

2010-08-25 Thread Erez D
On Wed, Aug 25, 2010 at 1:53 PM, Oleg Goldshmidt wrote: > 2010/8/25 Erez D : > > > > > > On Wed, Aug 25, 2010 at 12:08 PM, Elazar Leibovich > > wrote: > >> > >> template > >> > >> class c > >> > >> { > >> > >> private: > >> > >> b defaultVal; > >> > >> public: > >> > >

Re: what does g++ want from my code

2010-08-25 Thread Oleg Goldshmidt
2010/8/25 Erez D : > > > On Wed, Aug 25, 2010 at 12:08 PM, Elazar Leibovich > wrote: >> >> template >> >> class c >> >> { >> >> private: >> >> b defaultVal; >> >> public: >> >> std::map mymap; >> >> >> const b &func(a idx) >> >> { >> >>

Re: what does g++ want from my code

2010-08-25 Thread Dov Grobgeld
The following works at least in g++ 4.4.4: #include template class c { private: b defaultVal; public: std::map mymap; const b &func(a idx) { *auto* it=mymap.find(idx); if (it!=mymap.end()) return it->second; else ret

Re: what does g++ want from my code

2010-08-25 Thread Erez D
On Wed, Aug 25, 2010 at 12:08 PM, Elazar Leibovich wrote: > template > > class c > > { > > private: > > b defaultVal; > > public: > > std::map mymap; > > const b &func(a idx) > > { > > typename std::map::iterator i

Re: what does g++ want from my code

2010-08-25 Thread Elazar Leibovich
template class c { private: b defaultVal; public: std::map mymap; const b &func(a idx) { typename std::map::iterator it(mymap.find(idx)); if (it!=mymap.end())