Macros to disallow class copy and assignment. Google -vs- Qt

前端 未结 11 1269
伪装坚强ぢ
伪装坚强ぢ 2020-12-13 06:22

To disallow copying or assigning a class it\'s common practice to make the copy constructor and assignment operator private. Both Google and Qt have macros to make this eas

11条回答
  •  抹茶落季
    2020-12-13 07:14

    Incidentally, if you have access to the Boost libraries (You don't? Why the heck not??), The Utility library has had the noncopyable class for a long time:

    class YourNonCopyableClass : boost::noncopyable {
    

    Clearer IMHO.

提交回复
热议问题