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

Using ADL everywhere for lexical_cast #820

Merged
merged 9 commits into from
Jan 2, 2023

Conversation

captainurist
Copy link
Contributor

@captainurist captainurist commented Dec 25, 2022

Right now it's pretty much impossible to extend the library for custom template types because we can't have partial function template specializations in C++ (and thus cannot partially specialize CLI::detail::lexical_cast). Note that just throwing an overload into CLI::detail doesn't work because the overload should be visible at the call site, and to have that you'd have to first declare the overload, and only then include the CLI11 headers. Not very practical.

This PR fixes it by making sure all calls to lexical_cast are done via argument-dependent lookup.

@codecov
Copy link

codecov bot commented Dec 25, 2022

Codecov Report

Base: 99.44% // Head: 99.44% // Increases project coverage by +0.00% 🎉

Coverage data is based on head (6aeff92) compared to base (fbe1763).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #820   +/-   ##
=======================================
  Coverage   99.44%   99.44%           
=======================================
  Files          16       16           
  Lines        3950     3959    +9     
=======================================
+ Hits         3928     3937    +9     
  Misses         22       22           
Impacted Files Coverage Δ
include/CLI/App.hpp 100.00% <100.00%> (ø)
include/CLI/TypeTools.hpp 100.00% <100.00%> (ø)
include/CLI/Validators.hpp 99.30% <100.00%> (ø)
include/CLI/impl/App_inl.hpp 99.28% <100.00%> (ø)
include/CLI/impl/Config_inl.hpp 99.15% <100.00%> (ø)
include/CLI/impl/Validators_inl.hpp 99.50% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@phlptp
Copy link
Collaborator

phlptp commented Dec 27, 2022

Looks like one minor issue with clang tidy, then could be merged.
It looks good, and will hopefully simplify adding custom parsers.
Thank you!

@phlptp
Copy link
Collaborator

phlptp commented Dec 29, 2022

I don't think the CMAKE test issue is related to this PR. I will look into it more.

@phlptp phlptp merged commit 3897109 into CLIUtils:main Jan 2, 2023
@github-actions github-actions bot added the needs changelog Hasn't been added to the changelog yet label Jan 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs changelog Hasn't been added to the changelog yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants