mercredi 2 mars 2016

Noncopyable and Nonmovable together?

I want to create a base class both noncopyable and nonmovable. Is that convenient? I named the class derived from noncopyable and nonmovable as non? Is there and better name for that?

class noncopyable {
protected:
  noncopyable() = default;
  ~noncopyable() = default;

  noncopyable(noncopyable const &) = delete;
  noncopyable &operator=(noncopyable const &) = delete;
};

class nonmovable {
protected:
  nonmovable() = default;
  ~nonmovable() = default;

  nonmovable(nonmovable const &) = delete;
  nonmovable &operator=(nonmovable const &) = delete;
};

class non : public noncopyable, public nonmovable {
}

Aucun commentaire:

Enregistrer un commentaire