首页 > TAG信息列表 > deleted-functions

c-将删除的函数声明为noexcept有什么意义吗?

考虑一个类的以下两个可能的定义: 展览A: struct A { A() = delete; }; 展览A’: struct A { A() noexcept = delete; } 将删除的函数声明为noexcept有什么意义吗?解决方法:(最初将其发布为评论,但鼓励将其发布为答案.) 简单地说,不.不能调用被删除的函数(或者在构造函数的

c – 删除复制和复制 – 公共,私人或受保护?

为了使对象不可复制,我们可以显式删除其copy-constructor和copy-assignment操作符. 我的问题是:在这个类的公共,私人或受保护的部分,正确的地方是什么?而且 – 这个选择有什么不同吗?解决方法: what is the right place to do it – in the public, private or protected section of

c – 默认移动构造函数/赋值和已删除的复制构造函数/赋值

根据标准, If the definition of a class X does not explicitly declare a move constructor, one will be implicitly declared as defaulted if and only if — X does not have a user-declared copy constructor, — X does not have a user-declared copy assignment opera