mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 02:17:16 +02:00
docs: Documentation updated for the latest unknown_coherent_unit
changes
This commit is contained in:
@ -258,14 +258,14 @@ Even though the base dimension of ``si::fps`` is defined in terms of
|
||||
``si::metre`` foot is preserved as the base unit of length in both systems::
|
||||
|
||||
constexpr auto fps_yard = fps::length<fps::yard>(1.);
|
||||
constexpr auto fps_area = quantity_cast<unknown_coherent_unit>(fps_yard * fps_yard);
|
||||
std::cout << fps_yard << "\n"; // 1 yd
|
||||
std::cout << fps_area << "\n"; // 9 ft²
|
||||
constexpr auto fps_area = fps_yard * fps_yard;
|
||||
std::cout << fps_yard << "\n"; // 1 yd
|
||||
std::cout << quantity_cast<decltype(fps_area)::dimension::coherent_unit>(fps_area) << "\n"; // 9 ft²
|
||||
|
||||
constexpr auto si_fps_yard = si::fps::length<si::fps::yard>(1.);
|
||||
constexpr auto si_fps_area = quantity_cast<unknown_coherent_unit>(si_fps_yard * si_fps_yard);
|
||||
std::cout << si_fps_yard << "\n"; // 1 yd
|
||||
std::cout << si_fps_area << "\n"; // 9 ft²
|
||||
constexpr auto si_fps_area = si_fps_yard * si_fps_yard;
|
||||
std::cout << si_fps_yard << "\n"; // 1 yd
|
||||
std::cout << quantity_cast<decltype(si_fps_area)::dimension::coherent_unit>(si_fps_area) << "\n"; // 9 ft²
|
||||
|
||||
In most cases we want conversions between systems and that is why nearly all
|
||||
systems provided with this library are implemented in terms on the :term:`SI`
|
||||
|
@ -52,7 +52,7 @@ dimensions used in the division operation:
|
||||
static_assert(std::is_same_v<decltype(result)::dimension,
|
||||
unknown_dimension<exponent<dim_length, 1>, exponent<dim_time, -1>>>);
|
||||
static_assert(std::is_same_v<decltype(result)::unit,
|
||||
scaled_unit<ratio(1, 36, 1), unknown_coherent_unit>>);
|
||||
scaled_unit<ratio(1, 36, 1), unknown_coherent_unit<exponent<dim_length, 1>, exponent<dim_time, -1>>>>>);
|
||||
|
||||
.. important::
|
||||
|
||||
@ -81,7 +81,7 @@ this particular unknown derived dimension.
|
||||
In case we would like to print the result in terms of base units we can simply do the
|
||||
following::
|
||||
|
||||
auto s = quantity_cast<unknown_coherent_unit>(result);
|
||||
auto s = quantity_cast<decltype(result)::dimension::coherent_unit>(result);
|
||||
std::cout << "Speed: " << s << '\n'; // prints 'Speed: 20 m/s'
|
||||
|
||||
.. seealso::
|
||||
|
Reference in New Issue
Block a user