mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 10:27:16 +02:00
Concepts usage added to example
This commit is contained in:
@ -25,11 +25,10 @@
|
||||
|
||||
using namespace units;
|
||||
|
||||
template<typename V, typename T>
|
||||
requires Velocity<V> && Time<T>
|
||||
template<Velocity V, Time 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 "
|
||||
<< quantity_cast<length<meter, int>>(distance).count() << " meters.\n";
|
||||
}
|
||||
|
Reference in New Issue
Block a user