isocpp / isocpp/CppCoreGuidelines
F.16 what exactly is cheap to copy for the purposes of passing "by value"?
Open
@cubbimew is already working on this.
Since May 9, 2019.
- Dominant language
- CSS
- Stars
- 45.3k
- Forks
- 5.6k
- PR merge metrics
- No merged PRs in 30d
Description
What is “cheap to copy” depends on the machine architecture, but two or three words (doubles, pointers, references) are usually best passed by value.
I need clarification on what the guidelines mean by "two or three words". I have two conflicting interpretations:
1 word==sizeofone double, pointer or reference and thus objects two or three times this size should generally be passed by value (such asstring_vieworshared_ptr)- "two or three words" is the
sizeofone double, pointer or reference and thus anything larger than that should be passed by reference.
I find the first interpretation more logical. Can the text be clarified? Do you accept PRs for fixing this and clarifying that the first interpretation is correct?
Contributor guide
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.
Assessment
This issue has not been assessed yet.