Documentation updated
This commit is contained in:
1 parent
134f137a2f
commit
f16d619d30
3 files changed
+54
-49
No files matched your search
+11
-4
@@ -9,14 +9,21 @@ analysis and unit/quantity manipulation. The basic idea and design heavily bases
|
||||
Here is a small example of possible operations:
|
||||
|
||||
```cpp
|
||||
static_assert(1000 / 1_s == 1_kHz);
|
||||
// simple numeric operations
|
||||
static_assert(10_km / 2 == 5_km);
|
||||
|
||||
// unit conversions
|
||||
static_assert(1_h == 3600_s);
|
||||
static_assert(1_km + 1_m == 1001_m);
|
||||
static_assert(10_km / 5_km == 2);
|
||||
static_assert(10_km / 2 == 5_km);
|
||||
|
||||
// dimension conversions
|
||||
static_assert(1_km / 1_s == 1000_mps);
|
||||
static_assert(2_kmph * 2_h == 4_km);
|
||||
static_assert(2_km / 2_kmph == 1_h);
|
||||
|
||||
static_assert(1000 / 1_s == 1_kHz);
|
||||
|
||||
static_assert(10_km / 5_km == 2);
|
||||
```
|
||||
|
||||
|
||||
@@ -399,7 +406,7 @@ concept Velocity = Quantity<T> && Same<typename T::dimension, dimension_velocity
|
||||
4. Provide user-defined literals for the most important units:
|
||||
|
||||
```cpp
|
||||
namespace literals {
|
||||
inline namespace literals {
|
||||
constexpr auto operator""_mps(unsigned long long l) { return velocity<meter_per_second, std::int64_t>(l); }
|
||||
constexpr auto operator""_mps(long double l) { return velocity<meter_per_second, long double>(l); }
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user