1 parent
f3bcdc4ad2
commit
bbbb77286c
304 files changed
+1354
-1354
No files matched your search
@@ -57,7 +57,7 @@ Enabling a Unit for Prefixing
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
In case I decide it is reasonable to express my desks with SI prefixes the only thing I have
|
||||
to change in the above code is to replace `no_prefix` with `physical::si::prefix`::
|
||||
to change in the above code is to replace `no_prefix` with `isq::si::prefix`::
|
||||
|
||||
struct desk : named_scaled_unit<desk, "desk", si::prefix, ratio(3, 10), si::square_metre> {};
|
||||
|
||||
@@ -231,8 +231,8 @@ different systems:
|
||||
|
||||
namespace si {
|
||||
|
||||
struct metre : named_unit<metre, "m", units::physical::si::prefix> {};
|
||||
struct kilometre : prefixed_unit<kilometre, units::physical::si::kilo, metre> {};
|
||||
struct metre : named_unit<metre, "m", units::isq::si::prefix> {};
|
||||
struct kilometre : prefixed_unit<kilometre, units::isq::si::kilo, metre> {};
|
||||
|
||||
struct dim_length : base_dimension<"L", metre> {};
|
||||
|
||||
|
||||
@@ -16,14 +16,14 @@ provide the following:
|
||||
For example, to provide support for the ``std::chrono::duration`` it is enough to define::
|
||||
|
||||
#include <units/customization_points.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/isq/si/time.h>
|
||||
#include <chrono>
|
||||
|
||||
namespace units {
|
||||
|
||||
template<typename Rep, typename Period>
|
||||
struct quantity_like_traits<std::chrono::duration<Rep, Period>> {
|
||||
using dimension = physical::si::dim_time;
|
||||
using dimension = isq::si::dim_time;
|
||||
using unit = downcast_unit<dimension, ratio(Period::num, Period::den)>;
|
||||
using rep = Rep;
|
||||
[[nodiscard]] static constexpr rep count(const std::chrono::duration<Rep, Period>& q) { return q.count(); }
|
||||
|
||||
@@ -25,10 +25,10 @@ and pass it to the library's output:
|
||||
.. code-block::
|
||||
|
||||
#include "legacy.h"
|
||||
#include <units/physical/si/si.h>
|
||||
#include <units/isq/si/si.h>
|
||||
#include <units/quantity_point.h>
|
||||
|
||||
using namespace units::physical;
|
||||
using namespace units::isq;
|
||||
|
||||
constexpr Speed auto avg_speed(Length auto d, Time auto t)
|
||||
{
|
||||
|
||||
@@ -22,9 +22,9 @@ The same applies to the resulting unit. For example:
|
||||
.. code-block::
|
||||
:emphasize-lines: 1,7,9
|
||||
|
||||
#include <units/physical/si/si.h>
|
||||
#include <units/isq/si/si.h>
|
||||
|
||||
using namespace units::physical::si;
|
||||
using namespace units::isq::si;
|
||||
|
||||
constexpr auto result = 144_q_km / 2_q_h;
|
||||
static_assert(std::is_same_v<decltype(result)::dimension,
|
||||
@@ -41,10 +41,10 @@ dimensions used in the division operation:
|
||||
.. code-block::
|
||||
:emphasize-lines: 1-2,8,10
|
||||
|
||||
#include <units/physical/si/length.h>
|
||||
#include <units/physical/si/time.h>
|
||||
#include <units/isq/si/length.h>
|
||||
#include <units/isq/si/time.h>
|
||||
|
||||
using namespace units::physical::si;
|
||||
using namespace units::isq::si;
|
||||
|
||||
constexpr auto result = 144_q_km / 2_q_h;
|
||||
static_assert(std::is_same_v<decltype(result)::dimension,
|
||||
@@ -55,7 +55,7 @@ dimensions used in the division operation:
|
||||
.. important::
|
||||
|
||||
To limit the possibility of an ODR violation please always include a header file
|
||||
with all the definitions for the current system (e.g. *units/physical/si/si.h*).
|
||||
with all the definitions for the current system (e.g. *units/isq/si/si.h*).
|
||||
|
||||
|
||||
Operations On Unknown Dimensions And Their Units
|
||||
|
||||
Reference in new issue
Block a user