删除复制构造函数或复制赋值运算符计数为“用户声明”? [英] Does deleting a copy constructor or copy assignment operator count as "user declared"?

查看:146
本文介绍了删除复制构造函数或复制赋值运算符计数为“用户声明”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据此演示文稿,如果复制构造函数或复制分配运算符为用户声明,则不会生成隐式移动操作。 是否将删除复制构造函数或复制赋值运算符计数作为用户声明?

Per this presentation, if either the copy constructor or copy assignment operator is "user declared", then no implicit move operations will be generated. Does deleteing the copy constructor or copy assignment operator count as "user declared"?

struct NoCopy {
    NoCopy(NoCopy&) = delete;
    NoCopy& operator=(const NoCopy&) = delete;
};

将为 NoCopy 类?或者删除相关的复制操作计数为用户声明,从而禁止隐式移动生成?

Will implicit move operations be generated for the NoCopy class? Or does deleting the relevant copy operations count as "user declared" and thus inhibit implicit move generation?

如果可能,我更喜欢一个引用相关部分的标准。

If possible, I'd prefer an answer referencing the relevant parts of the standard.

推荐答案

根据演示文稿的幻灯片14,删除的副本构造函数是用户声明,因此禁止移动生成。

According to slide 14 of your presentation, a deleted copy constructor is "user declared" thus inhibiting the move generation.

这篇关于删除复制构造函数或复制赋值运算符计数为“用户声明”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆