mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-31 10:57:16 +02:00
Concepts usage added to example
This commit is contained in:
@ -25,11 +25,10 @@
|
|||||||
|
|
||||||
using namespace units;
|
using namespace units;
|
||||||
|
|
||||||
template<typename V, typename T>
|
template<Velocity V, Time T>
|
||||||
requires Velocity<V> && Time<T>
|
|
||||||
void foo(V v, T t)
|
void foo(V v, T t)
|
||||||
{
|
{
|
||||||
const auto distance = v * t;
|
const Length distance = v * t;
|
||||||
std::cout << "A car driving " << v.count() << " km/h in a time of " << t.count() << " minutes will pass "
|
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";
|
<< quantity_cast<length<meter, int>>(distance).count() << " meters.\n";
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user