开发者

How to declare foward a template of template (of a class)

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜