boost中的noncopyable

来源:互联网 发布:淘宝延期收货最多几天 编辑:程序博客网 时间:2024/04/20 23:07

继承noncopyable的类,不允许拷贝构造和赋值。省去了,每次手动把类的拷贝构造和赋值函数写在private下

头文件: #inlucde <boost/noncopyable.hpp>

class noncopyable  {   protected:      noncopyable() {}      ~noncopyable() {}   private:  // emphasize the following members are private      noncopyable( const noncopyable& );      const noncopyable& operator=( const noncopyable& );  };


0 0