• Oleg.Korshul's avatar
    сборка под линукс. странные правки (добавление this->) - не править. Это... · 746ccb42
    Oleg.Korshul authored
    сборка под линукс. странные правки (добавление this->) - не править. Это особенность компилятора gcc
    The problem is that templates are processed in two passes (according to the standard, VS does otherwise). In the first pass, before the type substitution, everything that does not depend on the template arguments is looked up and checked. Dependent names are then left to resolve in the second pass, once the type has been substituted. 
    
    Now, in the first pass there is nothing that indicates that next is dependent on template arguments, and thus it needs to resolve before type substitution. Now, because the base type is templated on the template argument of your current template, the compiler cannot look into it (it might be specialized for some types, and without knowing what type T we are instantiating the template with, we cannot know which specialization to use, i.e. the base depends on T and we are checking before knowing T).
    
    The trick of adding this-> turns next into a dependent name, and that in turn means that lookup is delayed until the second pass, where T is known, and because T is known, List<T> is also known and can be looked up into.
    
    
    git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63683 954022d7-b5bf-4e40-9824-e11837661b57
    746ccb42
GSmartPointer.h 17.4 KB