mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-06 05:34:27 +02:00
refactor: dimensionless refactored to V2
This commit is contained in:
@@ -22,29 +22,17 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
// IWYU pragma: begin_exports
|
#include <units/dimension.h>
|
||||||
#include <units/symbol_text.h>
|
#include <units/unit.h>
|
||||||
// IWYU pragma: end_exports
|
|
||||||
|
|
||||||
#include <units/quantity_cast.h>
|
|
||||||
|
|
||||||
namespace units {
|
namespace units {
|
||||||
|
|
||||||
struct one : derived_unit<one> {};
|
struct dimension_one; // defined in <units/dimension.h>
|
||||||
struct percent : named_scaled_unit<percent, "%", mag<ratio(1, 100)>(), one> {};
|
struct one; // defined in <units/unit.h>
|
||||||
|
|
||||||
/**
|
// clang-format off
|
||||||
* @brief Dimension one
|
inline constexpr struct percent : named_unit<"%", mag<ratio(1, 100)> * one> {} percent;
|
||||||
*
|
inline constexpr struct per_mille : named_unit<basic_symbol_text{"\u2030", "%o"}, mag<ratio(1, 1000)> * one> {} per_mille;
|
||||||
* Dimension for which all the exponents of the factors corresponding to the base
|
// clang-format on
|
||||||
* dimensions are zero. Also commonly named as "dimensionless".
|
|
||||||
*/
|
|
||||||
struct dim_one : derived_dimension<dim_one, one> {};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
concept Dimensionless = QuantityOf<T, dim_one>;
|
|
||||||
|
|
||||||
template<UnitOf<dim_one> U, Representation Rep = double>
|
|
||||||
using dimensionless = quantity<dim_one, U, Rep>;
|
|
||||||
|
|
||||||
} // namespace units
|
} // namespace units
|
||||||
|
Reference in New Issue
Block a user