mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
style: whitespaces fixed to make pre-commit happy
This commit is contained in:
@@ -157,7 +157,7 @@ This introduces an additional type-safety.
|
|||||||
using namespace mp_units;
|
using namespace mp_units;
|
||||||
using namespace mp_units::si::unit_symbols;
|
using namespace mp_units::si::unit_symbols;
|
||||||
using namespace mp_units::usc::unit_symbols;
|
using namespace mp_units::usc::unit_symbols;
|
||||||
|
|
||||||
quantity_point temp{20. * deg_C};
|
quantity_point temp{20. * deg_C};
|
||||||
std::println("Temperature: {} ({})",
|
std::println("Temperature: {} ({})",
|
||||||
temp.quantity_from_zero(),
|
temp.quantity_from_zero(),
|
||||||
@@ -172,13 +172,13 @@ This introduces an additional type-safety.
|
|||||||
#include <mp-units/systems/si/si.h>
|
#include <mp-units/systems/si/si.h>
|
||||||
#include <mp-units/systems/usc/usc.h>
|
#include <mp-units/systems/usc/usc.h>
|
||||||
#include <print>
|
#include <print>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
using namespace mp_units;
|
using namespace mp_units;
|
||||||
using namespace mp_units::si::unit_symbols;
|
using namespace mp_units::si::unit_symbols;
|
||||||
using namespace mp_units::usc::unit_symbols;
|
using namespace mp_units::usc::unit_symbols;
|
||||||
|
|
||||||
quantity_point temp{20. * deg_C};
|
quantity_point temp{20. * deg_C};
|
||||||
std::println("Temperature: {} ({})",
|
std::println("Temperature: {} ({})",
|
||||||
temp.quantity_from_zero(),
|
temp.quantity_from_zero(),
|
||||||
|
@@ -64,11 +64,11 @@ The library source code is hosted on [GitHub](https://github.com/mpusz/mp-units)
|
|||||||
#include <mp-units/systems/si/si.h>
|
#include <mp-units/systems/si/si.h>
|
||||||
#include <mp-units/systems/usc/usc.h>
|
#include <mp-units/systems/usc/usc.h>
|
||||||
#include <print>
|
#include <print>
|
||||||
|
|
||||||
using namespace mp_units;
|
using namespace mp_units;
|
||||||
|
|
||||||
inline constexpr struct smoot : named_unit<"smoot", mag<67> * usc::inch> {} smoot;
|
inline constexpr struct smoot : named_unit<"smoot", mag<67> * usc::inch> {} smoot;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
constexpr quantity dist = 364.4 * smoot;
|
constexpr quantity dist = 364.4 * smoot;
|
||||||
|
@@ -205,22 +205,22 @@ The previous example can be re-typed using typed quantities in the following way
|
|||||||
#include <mp-units/systems/isq/isq.h>
|
#include <mp-units/systems/isq/isq.h>
|
||||||
#include <mp-units/systems/si/si.h>
|
#include <mp-units/systems/si/si.h>
|
||||||
#include <print>
|
#include <print>
|
||||||
|
|
||||||
using namespace mp_units;
|
using namespace mp_units;
|
||||||
using namespace mp_units::si::unit_symbols;
|
using namespace mp_units::si::unit_symbols;
|
||||||
|
|
||||||
constexpr quantity<isq::speed[m / s]> avg_speed(quantity<isq::length[m]> dist,
|
constexpr quantity<isq::speed[m / s]> avg_speed(quantity<isq::length[m]> dist,
|
||||||
quantity<isq::time[s]> time)
|
quantity<isq::time[s]> time)
|
||||||
{
|
{
|
||||||
return dist / time;
|
return dist / time;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
const quantity distance = isq::distance(110 * km);
|
const quantity distance = isq::distance(110 * km);
|
||||||
const quantity duration = isq::time(2 * h);
|
const quantity duration = isq::time(2 * h);
|
||||||
const quantity speed = avg_speed(distance, duration);
|
const quantity speed = avg_speed(distance, duration);
|
||||||
|
|
||||||
std::println("A car driving {} in {} has an average speed of {:{%N:.4} %U} ({:{%N:.4} %U})",
|
std::println("A car driving {} in {} has an average speed of {:{%N:.4} %U} ({:{%N:.4} %U})",
|
||||||
distance, duration, speed, speed.in(km / h));
|
distance, duration, speed, speed.in(km / h));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user