s*******u 发帖数: 35 | |
P********e 发帖数: 2610 | |
z****e 发帖数: 2024 | 3 see: template specialization. |
t****t 发帖数: 6806 | 4 yes you can. but not like in your example.
non-type parameter must be integral constant, or object (address) with
external linkage (which implies it is an integral constant again), or pointer-to-member (which implies it is an integral costant again).
【在 s*******u 的大作中提到】 : 自己定义的class 的object可以作为template的参数? : class A; : class B; : template : class C { : void f( ) {/* some action*/ } : }; : Class D : {private: : A a;
|
t****t 发帖数: 6806 | 5 that's not the correct chapter to refer to. check [14.3.2 Template non-type
arguments].
【在 z****e 的大作中提到】 : see: template specialization.
|
z****e 发帖数: 2024 | 6 是,还是master shifu看得清,lz问的是object作参数,不是自定义类型,理应是 non
-type arg.
type
【在 t****t 的大作中提到】 : that's not the correct chapter to refer to. check [14.3.2 Template non-type : arguments].
|