Sorry I'm new to templates and I searched a lot, but I can't find a solution how to declare forward a template of template (of a class).
Here my code:
#ifndef CMAP_H
#define CMAP_H
#include "qvector.h"
cla开发者_C百科ss 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
All I want is to make the #include "qvector.h" obsolent.
This will do
template <typename T> class QVector;
See on 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
精彩评论