Use User-defined literals#2235
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2235 +/- ##
===========================================
+ Coverage 86.81% 86.83% +0.01%
===========================================
Files 1330 1330
Lines 42019 42020 +1
Branches 12950 12950
===========================================
+ Hits 36480 36486 +6
+ Misses 4335 4332 -3
+ Partials 1204 1202 -2
🚀 New features to boost your workflow:
|
Test summary 5 893 files 9 431 suites 18m 31s ⏱️ Results for commit 3aefebf. ♻️ This comment has been updated with latest results. |
sethrj
left a comment
There was a problem hiding this comment.
Copilot's work needs some checking 🙃
| { | ||
| return native_value_to<units::MevMomentum>(2 * units::femtometer | ||
| / constants::hbar_planck) | ||
| using celeritas::units::literals::operator""_fm; |
There was a problem hiding this comment.
This construction is pretty awkward... what about using namespace celeritas::units::literals? That seems to be the standard paradigm for literals.
| CELER_CONSTEXPR_FUNCTION Constant operator""_##NAME( \ | ||
| unsigned long long int v) \ | ||
| { \ | ||
| return v * units::NAME; \ |
There was a problem hiding this comment.
We have to return double (or long double if we care about it?) which matches the Constant interface returning the literal type, and not real_type
Use User-defined literals instead of units multiplication. This update straight-forward cases only.
Credits to Copilot.