回答編集履歴
1
newは不適当でした
test
CHANGED
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
```C++
|
6
6
|
|
7
|
-
_equipmentList.push_back(
|
7
|
+
_equipmentList.push_back(Equipment(&tmp));
|
8
8
|
|
9
9
|
```
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
下手にポインタを介するから煩雑になるわけで、`push_back`は`const T&`からのコピー、あるいは`T&&`からのムーブで格納されるので([cpprefjp](https://cpprefjp.github.io/reference/vector/vector/push_back.html))、そのまま
|
13
|
+
下手にポインタを介するから煩雑になるわけで、`push_back`は`const T&`からのコピー、あるいは`T&&`からのムーブで格納されるので([cpprefjp](https://cpprefjp.github.io/reference/vector/vector/push_back.html))、そのまま一時オブジェクトを渡して問題ありません。
|