Officially, what is typename for?

后端 未结 8 1645
野的像风
野的像风 2020-11-22 15:07

On occasion I\'ve seen some really indecipherable error messages spit out by gcc when using templates... Specifically, I\'ve had problems where seemingly correc

8条回答
  •  一个人的身影
    2020-11-22 15:41

    Two uses:

    1. As a template argument keyword (instead of class)
    2. A typename keyword tells the compiler that an identifier is a type (rather than a static member variable)
    template  class X  // [1]
    {
        typename T::Y _member;  // [2] 
    }
    

提交回复
热议问题