摸板的一些内容

    技术2022-05-11  81

    1.   template<typename T>  

       template<class T >

    <c++程序设计>

    区别在于,typename 的概念比class更宽泛,不仅包括由类定义引进的类型的名字,还包括语言的内部类型,枚举,typedef引进的名字etc

    <MSDN>

    typename identifier;

    Use this keyword only in template definitions. This keyword tells the compiler that an unknown identifier is a type. For example:

    template<class T> class X { typename T::Y; // treat Y as a type Y m_y; };

    This keyword can also be used in place of class in template parameter lists. For example, the following statements are identical:

    template<class T1, class T2>... template<typename T1, typename T2>...

    最新回复(0)