如何为没有成员的对象执行复制构造函数

时间:2014-07-09 14:14:10

标签: c++ copy-constructor

我有一个没有成员的对象(2 enums除外):

class Displayer
{
public:
  Displayer();
  ~Displayer();

  enum FlagShowRF { NONE, RCTS, CNTRS, BOTH };
  enum FlagDisplay { NOT_DISPLAY, DISPLAY };

  void displayImg(const cv::Mat& image, const std::string& name, FlagDisplay flg);
  void displayImg(const cv::Size& sz, const RegFil& rf,
                  const std::string& name, FlagShowRF flg);
  void displayImg(const KeyPointVector& kpts, const cv::Mat& image,
                  const std::string& name, FlagDisplay flg);
  void displayImg(const std::vector<KeyPointVector>& kptsGroups,
                 const cv::Mat& img, const std::string& name, FlagDisplay flg);

  void closeAllWindows();
};

是否可以使用复制构造函数?如果是的话,会是怎样的?我想到了:

  Displayer(const Displayer& displayer) { *this = displayer; }

或者我该怎么做?

0 个答案:

没有答案
相关问题