mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 02:17:16 +02:00
Unit specific concepts introduced
This commit is contained in:
@ -25,11 +25,11 @@
|
||||
|
||||
using namespace units;
|
||||
|
||||
template<Unit U1, typename Rep1, Unit U2, typename Rep2>
|
||||
void foo(velocity<U1, Rep1> v, time<U2, Rep2> t)
|
||||
template<typename V, typename T>
|
||||
requires Velocity<V> && Time<T>
|
||||
void foo(V v, T t)
|
||||
{
|
||||
const auto distance = v * t;
|
||||
|
||||
std::cout << "A car driving " << v.count() << " km/h in a time of " << t.count() << " minutes will pass "
|
||||
<< quantity_cast<length<meter, int>>(distance).count() << " meters.\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user