GCC vs MSVC the Rematch

If you remember from the GCC vs MSVC post, I had a problem with templates and GCC. I looked further in to the problem and I found this on some GCC release notes :

  • You must now use the typename and template keywords to disambiguate dependent names, as required by the C++ standard.

So the problem was the missing typename keyword to be compliant to the standard.

So this code :

template <class C>
void dostuff(C v){
    C::iterator i;

Must be turned into this code :

  void dostuff(C v){
      typename C::iterator i;

And GCC is happy as a puppy! I love happy ends…