[bind10-dev] boost non-copyable

han benjamin ben.han.cn at gmail.com
Mon May 24 11:04:20 UTC 2010


Hi All,



I read some code in c++ that try to make the class non-copyable.  In boost
there is one utility class called noncopyable, which will make the code more
clean and easy to read.



Old way:

Class PleaseDonotCopyMe

{

Private:

         PleaseDonotCopyMe(const PleaseDonotCopyMe &);

         PleaseDonotCopyMe & operator=(const PleaseDonotCopyMe &);

};



Boost way:

#include <boost/utility.hpp>

Class PleaseDonotCopyMe : boost::noncopyable  // use private inheritance
just means that the relationship between PleaseDonotCopyMe and noncopyable
isn’t IS-A

{};





feng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.isc.org/pipermail/bind10-dev/attachments/20100524/92c466ab/attachment.html>


More information about the bind10-dev mailing list