Concepts usage added to example

This commit is contained in:
Mateusz Pusz
2018-10-16 15:41:00 +02:00
parent 4796d777b9
commit e0511669cf

View File

@ -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";
}