C/C++|C++不可拷贝基类实现

#ifndef NONCOPYABLE_HPP #define NONCOPYABLE_HPP//Private copy constructor and copy assignment ensure classes derived from //class noncopyable cannot be copied.class noncopyable { protected: #if __cplusplus >= 201103L constexpr noncopyable() = default; ~noncopyable() = default; #else noncopyable() {} ~noncopyable() {} #endif #if __cplusplus >= 201103L noncopyable( const noncopyable& ) = delete; noncopyable& operator=( const noncopyable& ) = delete; #else private:// emphasize the following members are private noncopyable( const noncopyable& ); noncopyable& operator=( const noncopyable& ); #endif }; #endif//NONCOPYABLE_HPP

【C/C++|C++不可拷贝基类实现】C++不可拷贝基类的实现,学习自BOOST库

    推荐阅读