What are the advantages of boost::noncopyable

前端 未结 11 1222
野性不改
野性不改 2020-11-27 14:10

To prevent copying a class, you can very easily declare a private copy constructor / assignment operators. But you can also inherit boost::noncopyable.

11条回答
  •  猫巷女王i
    2020-11-27 14:33

    The advantage is that you don't have to write a private copy constructor and a private copy operator yourself and it expresses clearly your intention without writing additional documentation.

提交回复
热议问题