Skip to content

Commit cf9270b

Browse files
Merge pull request #1439 from Gumichocopengin8/fix/unnecessary-move-in-forwared_list-splice
fix: remove unnecessary `std::move` in splice of `std::forward_list`
2 parents 20a8d5e + 614432a commit cf9270b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

reference/forward_list/forward_list/splice_after.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ void splice_after(const_iterator position, forward_list&& x,
6767
```cpp example
6868
#include <iostream>
6969
#include <forward_list>
70-
#include <utility>
7170
#include <iterator>
7271
7372
template <class T>
@@ -84,7 +83,7 @@ int main()
8483
std::forward_list<int> xs = {1, 5, 6};
8584
std::forward_list<int> ys = {2, 3, 4};
8685
87-
xs.splice_after(xs.begin(), std::move(ys));
86+
xs.splice_after(xs.begin(), ys);
8887
8988
print(xs);
9089
}
@@ -93,7 +92,7 @@ int main()
9392
std::forward_list<int> xs = {1, 5, 6};
9493
std::forward_list<int> ys = {2, 3, 4};
9594
96-
xs.splice_after(xs.begin(), std::move(ys), ys.begin());
95+
xs.splice_after(xs.begin(), ys, ys.begin());
9796
9897
print(xs);
9998
}
@@ -102,15 +101,14 @@ int main()
102101
std::forward_list<int> xs = {1, 5, 6};
103102
std::forward_list<int> ys = {2, 3, 4};
104103
105-
xs.splice_after(xs.begin(), std::move(ys), ys.before_begin(), std::next(ys.begin(), 2));
104+
xs.splice_after(xs.begin(), ys, ys.before_begin(), std::next(ys.begin(), 2));
106105
107106
print(xs);
108107
}
109108
}
110109
```
111110
* splice_after[color ff0000]
112111
* begin()[link begin.md]
113-
* std::move[link /reference/utility/move.md]
114112
* std::next[link /reference/iterator/next.md]
115113

116114
### 出力

0 commit comments

Comments
 (0)