RE: Convert VisualC++ template to gcc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux