Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: parent parser and value semantics #50

Closed
zhihaoy opened this issue Nov 14, 2019 · 0 comments · Fixed by #51
Closed

Question: parent parser and value semantics #50

zhihaoy opened this issue Nov 14, 2019 · 0 comments · Fixed by #51

Comments

@zhihaoy
Copy link
Contributor

zhihaoy commented Nov 14, 2019

The mParentParsers member is currently unused. add_parents's semantics is only merging options. But consider the following: if there is only one parent parser, copy construct from an existing parser has the same effect. We only need a way to change the new instance's mProgramName.

Does ArgumentParser has value semantics? ArgumentParser is copy cunstructible, but a copy of ArgumentParser is not a distinct copy because shared_ptr are used without special handling. Parsing in the new parser will affect the old parser. But parent parser also has the "problem," unless this is by design.

If this is not by design, then we'd better to support value semantics in full in both copy-constructor and add_parents.

lichray added a commit to lichray/argparse that referenced this issue Nov 16, 2019
lichray added a commit to lichray/argparse that referenced this issue Nov 16, 2019
lichray added a commit to lichray/argparse that referenced this issue Nov 16, 2019
@lichray lichray mentioned this issue Nov 16, 2019
lichray added a commit to lichray/argparse that referenced this issue Nov 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant