Move constructor of list hook is missing
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by locating the list hook declarations and their existing copy-construction behavior. Review how hooks are linked and unlinked during object movement, then determine how an option could control deleted versus link-preserving move construction. Done means moved hooks preserve correct moved-from and moved-to linkage and remain safe for use in STL containers.
Written by the indexing model from the issue text.
Description
Currently, list hooks do not declare a move constructor. When moved, the copy constructor is called instead, resulting the moved-from hook still linked and the moved-to hook unlinked (https://godbolt.org/z/zKqqhbxz5). An consequence is that objects containing list hooks cannot be safely put inside some STL containers like std::vector (https://godbolt.org/z/vq765G5n5). Furthermore, it is not alway possible to implement a desired move constructor for the class containing list hooks, since link / unlink cannot be performed without the list object if the list has constant time size().
I think making the following changes to list hooks would make them safer and more broadly useful:
- declare the move constructor as deleted
- enabled with an option, add a move constructor that unlinks the moved-from hook and link the moved-to hook in its place
- Dominant language
- C++
- Stars
- 66
- Forks
- 74
- Avg merge
- 5h 22m
- Merged PRs (30d)
- 1
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from boostorg/intrusive
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in boostorg/intrusive
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
sandialabs/seacas#945 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ROCm/FastFlowLM#757 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
espressif/esp-matter#1867 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mltframework/shotcut#1920 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day