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

add_subcommand exception safety #204

Merged
merged 1 commit into from
Jan 25, 2019

Conversation

phlptp
Copy link
Collaborator

@phlptp phlptp commented Jan 25, 2019

The add subcommand function was not exception safe. It added the subcommand to the vector before checking the already added option. This would result in duplicate subcommands being in place in the subcommands_ vector if the error were thrown. The modifications make it exception safe and remove what I think was an unnecessary check for pointer duplication, that as far as I can tell was always true since it was comparing a newly created pointer directly to previously created ones.

…ommand to the vector before checking the already added option. This would result in duplicate subcommands being in place in the subcommands_ vector. The modifications make it exception safe and remove what I think was an unnecessary check for pointer duplication, that as far as I can tell was always false since it was comparing a newly created pointer directly to previously created ones.
@codecov
Copy link

codecov bot commented Jan 25, 2019

Codecov Report

Merging #204 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #204   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1908   1908           
=====================================
  Hits         1908   1908
Impacted Files Coverage Δ
include/CLI/App.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 478f582...9347ac4. Read the comment docs.

1 similar comment
@codecov
Copy link

codecov bot commented Jan 25, 2019

Codecov Report

Merging #204 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #204   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1908   1908           
=====================================
  Hits         1908   1908
Impacted Files Coverage Δ
include/CLI/App.hpp 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 478f582...9347ac4. Read the comment docs.

@henryiii
Copy link
Collaborator

Good point, thanks.

@henryiii henryiii merged commit 45496a8 into CLIUtils:master Jan 25, 2019
@phlptp phlptp deleted the add_subcommand_exception_safety branch January 31, 2019 23:06
@henryiii henryiii added this to the v1.7.1 milestone Feb 9, 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 this pull request may close these issues.

2 participants