mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
hello_units compilation on gcc-9 fixed
This commit is contained in:
10
README.md
10
README.md
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
using namespace units;
|
using namespace units;
|
||||||
|
|
||||||
constexpr Velocity AUTO avg_speed(Length auto d, Time auto t)
|
constexpr Velocity auto avg_speed(Length auto d, Time auto t)
|
||||||
{
|
{
|
||||||
return d / t;
|
return d / t;
|
||||||
}
|
}
|
||||||
@@ -22,10 +22,10 @@ constexpr Velocity AUTO avg_speed(Length auto d, Time auto t)
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
using namespace si::literals;
|
using namespace si::literals;
|
||||||
Velocity AUTO v1 = avg_speed(220km, 2h);
|
Velocity auto v1 = avg_speed(220km, 2h);
|
||||||
Velocity AUTO v2 = avg_speed(si::length<si::mile>(140), si::time<si::hour>(2));
|
Velocity auto v2 = avg_speed(si::length<si::mile>(140), si::time<si::hour>(2));
|
||||||
Velocity AUTO v3 = quantity_cast<si::metre_per_second>(v2);
|
Velocity auto v3 = quantity_cast<si::metre_per_second>(v2);
|
||||||
Velocity AUTO v4 = quantity_cast<int>(v3);
|
Velocity auto v4 = quantity_cast<int>(v3);
|
||||||
|
|
||||||
std::cout << v1 << '\n'; // 110 km/h
|
std::cout << v1 << '\n'; // 110 km/h
|
||||||
std::cout << fmt::format("{}", v2) << '\n'; // 70 mi/h
|
std::cout << fmt::format("{}", v2) << '\n'; // 70 mi/h
|
||||||
|
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
using namespace units;
|
using namespace units;
|
||||||
|
|
||||||
constexpr Velocity AUTO avg_speed(Length auto d, Time auto t)
|
constexpr Velocity AUTO avg_speed(Length AUTO d, Time AUTO t)
|
||||||
{
|
{
|
||||||
return d / t;
|
return d / t;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user