Skip to content

Commit 3fb56b8

Browse files
fix: remove unnecessary std::move in splice of std::list
Signed-off-by: Keita Nonaka <iKonnyaku40@gmail.com>
1 parent ba2b7c9 commit 3fb56b8

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

reference/list/list/splice.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ void splice(const_iterator position, list&& x,
7474
```cpp example
7575
#include <iostream>
7676
#include <list>
77-
#include <utility> // move
7877
7978
template <class T>
8079
void print(const std::list<T>& ls)
@@ -90,7 +89,7 @@ int main()
9089
std::list<int> xs = {4, 5, 6};
9190
std::list<int> ys = {1, 2, 3};
9291
93-
xs.splice(xs.begin(), std::move(ys));
92+
xs.splice(xs.begin(), ys);
9493
9594
print(xs);
9695
}
@@ -99,7 +98,7 @@ int main()
9998
std::list<int> xs = {4, 5, 6};
10099
std::list<int> ys = {1, 2, 3};
101100
102-
xs.splice(xs.begin(), std::move(ys), ys.begin());
101+
xs.splice(xs.begin(), ys, ys.begin());
103102
104103
print(xs);
105104
}
@@ -108,7 +107,7 @@ int main()
108107
std::list<int> xs = {4, 5, 6};
109108
std::list<int> ys = {1, 2, 3};
110109
111-
xs.splice(xs.begin(), std::move(ys), ys.begin(), std::next(ys.begin(), 2));
110+
xs.splice(xs.begin(), ys, ys.begin(), std::next(ys.begin(), 2));
112111
113112
print(xs);
114113
}
@@ -117,15 +116,14 @@ int main()
117116
std::list<int> xs = {1, 2, 3};
118117
std::list<int> ys = {4, 5, 6};
119118
120-
xs.splice(xs.end(), std::move(ys));
119+
xs.splice(xs.end(), ys);
121120
122121
print(xs);
123122
}
124123
}
125124
```
126125
* splice[color ff0000]
127126
* begin()[link begin.md]
128-
* std::move[link /reference/utility/move.md]
129127

130128
### 出力
131129
```

0 commit comments

Comments
 (0)