未验证 提交 e5a0365b 编写于 作者: Z zyfncg 提交者: GitHub

Add move construct for KernelSignature (#42253)

* add move construct for KernelSignature

* add noexcept
上级 a6794926
...@@ -63,6 +63,13 @@ struct KernelSignature { ...@@ -63,6 +63,13 @@ struct KernelSignature {
input_names(other.input_names), input_names(other.input_names),
attr_names(other.attr_names), attr_names(other.attr_names),
output_names(other.output_names) {} output_names(other.output_names) {}
KernelSignature(KernelSignature&& other) noexcept
: name(other.name),
input_names(std::move(other.input_names)),
attr_names(std::move(other.attr_names)),
output_names(std::move(other.output_names)) {}
KernelSignature& operator=(const KernelSignature& other) { KernelSignature& operator=(const KernelSignature& other) {
name = other.name; name = other.name;
input_names = other.input_names; input_names = other.input_names;
...@@ -70,6 +77,14 @@ struct KernelSignature { ...@@ -70,6 +77,14 @@ struct KernelSignature {
output_names = other.output_names; output_names = other.output_names;
return *this; return *this;
} }
KernelSignature& operator=(KernelSignature&& other) noexcept {
name = other.name;
input_names.swap(other.input_names);
attr_names.swap(other.attr_names);
output_names.swap(other.output_names);
return *this;
}
}; };
std::ostream& operator<<(std::ostream& os, KernelSignature signature); std::ostream& operator<<(std::ostream& os, KernelSignature signature);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册