如何声明模板的模板(类的模板)
How to declare foward a template of template (of a class)
对不起,我是模板新手,我搜索了很多,但我找不到一个解决方案,如何声明转发模板的模板(类的)。
下面是我的代码:
#ifndef CMAP_H
#define CMAP_H
#include "qvector.h"
class CMap
{
public:
CMap(const unsigned int & width, const unsigned int & height, const unsigned int & hexagonRadius);
CMap(const unsigned int & width, const unsigned int & height, const unsigned int & hexagonRadius, const QVector<QVector<unsigned int> > & landType);
~CMap();
private:
class Pimple;
Pimple * d;
};
#endif // CMAP_H
我只是想让#include "qvector.h"过时。
这样做
template <typename T> class QVector;
参见codepad:
#ifndef CMAP_H
#define CMAP_H
template <typename T> class QVector;
class CMap
{
public:
CMap(const unsigned int & width, const unsigned int & height, const unsigned int & hexagonRadius);
CMap(const unsigned int & width, const unsigned int & height, const unsigned int & hexagonRadius, const QVector<QVector<unsigned int> > & landType);
~CMap();
private:
class Pimple;
Pimple * d;
};
#endif // CMAP_H
相关文章:
- .cpp和.h文件中的模板专用化声明
- 在函数声明之后声明整数有什么用?
- 工会成员中的模板 - 声明没有声明任何内容
- 你能在函数声明中声明一个固定长度的数组吗?
- 外部模板:声明不声明任何内容
- 单个CPP文件中多次声明函数声明可以吗?
- 恒定声明全局或在使用它的函数中声明恒定声明之间有什么区别?
- 在C++中声明可见性/访问权限的方法有何不同
- 我们可以在类声明中声明类类型的指针吗?
- 关于全局变量的外部声明"C"外部声明
- 声明不声明任何[-fpermission]错误
- Cygwin g++和声明不声明任何内容
- 错误:声明不声明
- 使用声明是否仅导入在使用声明上方声明的重载
- Cython 错误:声明不声明任何内容
- clang与gcc在查找声明方面有何不同
- 在类声明中声明指向类对象的指针
- 基于范围的循环声明必须声明变量
- 如何使用ADT和链表声明未声明的标识符
- 初始化const类成员,错误:声明没有声明任何内容