3 ms·
Note that this is heavily dependent on C++20. I'm not even caught up on C++17, so I was thrown off by statements like this: quantity q1 = 42 * J; where q
by SloopJon 3y ago
Note that this is heavily dependent on C++20. I'm not even caught up on C++17, so I was thrown off by statements like this:
quantity q1 = 42 * J;
where quantity is a class template:
template<Reference auto R,
RepresentationOf<get_quantity_spec(R).character> Rep = double>
class quantity;
I didn't know you could use auto in a template parameter. I gather that Reference is a concept, something else I've yet to explore. Just when I thought I'd gotten the hang of "modern" C++.
- muraiki 3y agoOne option for C++14 is the Au units library. Here's a comparison to other unit libraries, including mp-units: https://aurora-opensource.github.io/au/main/alternatives/ https://aurora-opensource.github.io/au/main/alternatives/
- hn_go_brrrrr 3y agoauto in this context creates a non-type template parameter (NTTP). They've been in the language since C++11 (std::array<int, 3>).
- ynik 3y agoNon-type template parameters (NTTP) were already in the original standard, they've existed since C++ had templates. Being able to use "auto" for the type of the NTTP was new in C++17; and using class types like std::array for NTTPs was only added in C++20.