Repository navigation
construct forward_list copies and moves directly from source - #72
Merged
teor2345 merged 1 commit intoNov 10, 2026
Merged
Conversation
Signed-off-by: Siddhi sahu <himanisahu739@gmail.com>
Contributor
Author
thank you for reviewing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working on my stack pr, I noticed something in forward_list.rs. the
move_fromdidnot actually call the move constructor. it moved list into other_ , and then built the new list from it. other_ has a name, sp cpp treats it as lvalue, so the the 2 line calls the copy constructor, and the &mut (move) overload is returning the new list, that is built by a copy.same for
copy_from, it has the same 2 steps : it basically copied into a aconstlocal and copied it again, so it used the right constructor but made 2 copies .Now: both, constructs the new list directly from
*other, std::move(*other) , in one step, in forward_list.rs. Like in #62 .Also, as @teor2345 guided, to look through Other merged classes, on main. I did that . But the unordered_map, unordered_multiset, time_point, already constructs directly.