C + + writes a non-replicable class
Flyfish
Effective C + +: clause 06
If you do not want to use a function generated automatically by the compiler, you should explicitly reject it.
Explicitly disallow the use of complier-generated functions you does not want.
Old-fashioned C + + notation
Class Noncopyable{protected:noncopyable () {}~noncopyable () {}private:noncopyable (const noncopyable&); noncopyable& operator= (const noncopyable&);};
the writing of C++11
Class noncopyable{protected:constexpr noncopyable () = default;~noncopyable () = default;noncopyable (const noncopyable& Amp ) = delete;noncopyable& operator= (const noncopyable&) = delete;};
the implementation of boost
Boost does not combine the two methods and also prevents the unconscious ADL (protection from unintended ADL)
ADL (Argument Dependent Lookup)
C + + writes a non-replicable class