回答編集履歴

1

追記

2020/02/23 00:00

投稿

hoshi-takanori
hoshi-takanori

スコア7895

test CHANGED
@@ -1,8 +1,14 @@
1
- C++20 仕様書ドラフト [https://github.com/cplusplus/draft/blob/master/source/classes.tex#L1786](https://github.com/cplusplus/draft/blob/master/source/classes.tex#L1786) に、
1
+ C++20 仕様書ドラフト [https://github.com/cplusplus/draft/blob/master/source/classes.tex#L1783](https://github.com/cplusplus/draft/blob/master/source/classes.tex#L1783) に、
2
2
 
3
3
 
4
4
 
5
+ > A user-declared __copy__ assignment operator `X::operator=` is a
6
+
7
+ > non-static **non-template** member function of class `X` with(略)
8
+
9
+
10
+
5
- > Because a template assignment operator or an assignment operator
11
+ > Because a **template** assignment operator or an assignment operator
6
12
 
7
13
  > taking an rvalue reference parameter is never a copy assignment operator,
8
14
 
@@ -12,7 +18,7 @@
12
18
 
13
19
 
14
20
 
15
- とありますので、
21
+ とあります(太字は回答者。ちなみに 1998 版にも同様記述があります)ので、
16
22
 
17
23
 
18
24
 
@@ -27,3 +33,5 @@
27
33
 
28
34
 
29
35
  は copy assignment operator とは認められず、デフォルトのコピー代入演算子が使われるのでしょう。
36
+
37
+ なお、代入演算子の戻り値は、無駄なコピーを防ぐために参照(Foo<T> &)にした方が良いと思われます。