RE: Convert VisualC++ template to gcc

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

 



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 
______________________________________________________________________


[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