Convert VisualC++ template to gcc

efgee efgee2003@yahoo.com
Thu Oct 4 15:12:00 GMT 2007


Rupert,
thank you very much for your help.

At least this template works now...

Best Regards
efgee 

-the c++ newbie-



Rupert Wood wrote:
> 
> efgee wrote:
> 
>> template <class T>
>> T table<T>::operator[] (const string& key)
>> {
>>	for (reverse_iterator i = rbegin(); i != rend(); i++)
> 
> I think this needs to be:
> 
>     for (typename table<T>::reverse_iterator i = table<T>::rbegin();
>              i != table<T>::rend(); i++)
> 
> and as a style point I'd use '++i' not 'i++'. For the versions of g++ I'm
> trying you also need to explicitly #include <stdexcept> to use
> out_of_range.
> 
> It's possible you could get away with adding less - I'm not a guru on this
> - but this now compiles fine on g++ 3.4.6, g++ 4.3 and VC++ 6.
> 
> Rup.
> 
> 
> 
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email 
> ______________________________________________________________________
> 
> 

-- 
View this message in context: http://www.nabble.com/Convert-VisualC%2B%2B-template-to-gcc-tf4563603.html#a13042060
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list