在C++中使用两级模板时出现问题
Problem with using two-level template in C++
以下代码编译失败。为什么?
template<typename T, class C>
class ExPack_BASE_t
{
Ex::u32 packageDestination = Ex::command_registration;
Ex::u16 amoutOfParameters = (sizeof(C)/sizeof(T))-((sizeof(Ex::u32)+sizeof (Ex::u16)));
};
template<typename T>
class ExPack_registration_st : ExPack_BASE_t<T,ExPack_registration_st>
{
T *firstName;
T *secondName;
T *fatherName;
T *emil;
T *birthDate;
T *login;
T *password;
T *rePassword;
};
当我尝试编译它时,出现错误:
use of class template 'ExPack_registration_st' requires template arguments
使用ExPack_registration_st
时ExPack_BASE_t<T,ExPack_registration_st>
出现问题
您要传递的第二个模板参数是ExPack_registration_st,但这是模板的名称,而不是类型。尝试传递ExPack_registration_st作为第二个参数。- 比特维兹
相关文章:
- 关于比较两个无序数组并删除 a[] 中可以在 b[] 中找到的元素的问题
- C++ 关于两个类构造函数的问题
- 程序没有问 3 个问题,而是将我对第一个问题的回答用于其他两个问题
- 无法理解代码背后的逻辑,这是在两个给定数字之间生成素数的优化问题
- 关于标准::condition_variables的两个问题
- 关于C++容器的两个问题
- 库期望平面命名空间中的符号,尽管使用两级命名空间编译
- 我正在制作一个二十一点程序。我目前有两个问题
- 优化非常大的两级深度迭代
- 可修改的多集集:两级排序容器
- 在C++中使用两级模板时出现问题
- 关于我的解密程序,有两个问题,C++有问题
- 弹出窗口.如何显示全文内容和另外两个问题
- 关于在 cpp 中转换对象的两个问题
- 我想制作开机画面,现在我有两个问题
- 实行两级锁
- 关于下面的代码,我有两个问题
- 两级层次类中的C++多态性:不明白为什么它不起作用
- 我有两个问题
- c++语言中的两个问题