Why is typename _not_ needed here in Visual Studio 2008/2010?

前端 未结 2 676
抹茶落季
抹茶落季 2020-12-19 08:45

In this question, the asker has the following function:

template
bool nextPermutation(ITER start, ITER end)
{
    return nextPermutation         


        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-19 09:11

    Visual C++ is well-known not to (fully) support two-phase lookup, which is the underlying reason for why typename is required in the first place. If the compiler doesn't fully support this, it might not fully parse a template before it is instantiated, by which time it "knows" that std::iterator_traits::iterator_category is a type. Obviously, this deficiency extends to VC10.

    When it comes to typename, I'd trust GCC over VC any day.

提交回复
热议问题