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

前端 未结 11 1244
伪装坚强ぢ
伪装坚强ぢ 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:09

    Qt version is backward compatible, while google's is not.

    If you develop your library and deprecate the use of assignment before you completely remove it, in Qt it will most likely retain the signature it originally had. In this case older application will continue to run with new version of library (however, they won't compile with the newer version).

    Google's macro doesn't have such a property.

提交回复
热议问题