refactor: ♻️ unitless renamed to one

Resolves #27
This commit is contained in:
Mateusz Pusz committed 2020-09-09 11:20:55 +02:00
1 parent dba2b7f44f
commit 3e9d5ca189
11 files changed
+47 -48

No files matched your search

+3 -3
View File
@@ -26,8 +26,8 @@
namespace units {
struct unitless : named_unit<unitless, "", no_prefix> {};
struct percent : named_scaled_unit<percent, "%", no_prefix, ratio(1, 100), unitless> {};
struct one : named_unit<one, "", no_prefix> {};
struct percent : named_scaled_unit<percent, "%", no_prefix, ratio(1, 100), one> {};
/**
* @brief Dimension one
@@ -35,7 +35,7 @@ struct percent : named_scaled_unit<percent, "%", no_prefix, ratio(1, 100), unitl
* Dimension for which all the exponents of the factors corresponding to the base
* dimensions are zero. Also commonly named as "dimensionless".
*/
struct dim_one : derived_dimension<dim_one, unitless> {};
struct dim_one : derived_dimension<dim_one, one> {};
template<typename T>
concept Dimensionless = QuantityOf<T, dim_one>;
@@ -27,6 +27,6 @@
namespace units::physical::natural {
template<ScalableNumber Rep = double>
inline constexpr auto speed_of_light = speed<unitless, Rep>(1);
inline constexpr auto speed_of_light = speed<one, Rep>(1);
} // namespace units::physical::natural
@@ -40,7 +40,7 @@ struct dim_mass : physical::dim_mass<gigaelectronvolt> {};
template<Unit U, ScalableNumber Rep = double>
using mass = quantity<dim_mass, U, Rep>;
struct dim_speed : physical::dim_speed<dim_speed, unitless, dim_length, dim_time> {};
struct dim_speed : physical::dim_speed<dim_speed, one, dim_length, dim_time> {};
template<Unit U, ScalableNumber Rep = double>
using speed = quantity<dim_speed, U, Rep>;
@@ -27,7 +27,6 @@
namespace units::physical::natural {
struct unitless : named_unit<unitless, "", no_prefix> {};
struct electronvolt : named_unit<electronvolt, "eV", si::prefix> {};
struct gigaelectronvolt : prefixed_unit<gigaelectronvolt, si::giga, electronvolt> {};
struct inverted_gigaelectronvolt : named_unit<inverted_gigaelectronvolt, basic_symbol_text{"GeV⁻¹", "GeV^-1"}, no_prefix> {};
+1 -1
View File
@@ -73,7 +73,7 @@ public:
template<ScalableNumber Value>
requires detail::safe_convertible<Value, rep>
constexpr explicit(!(std::is_same_v<dimension, dim_one> && std::is_same_v<unit, unitless>)) quantity(const Value& v) : value_{static_cast<rep>(v)} {}
constexpr explicit(!(std::is_same_v<dimension, dim_one> && std::is_same_v<unit, one>)) quantity(const Value& v) : value_{static_cast<rep>(v)} {}
template<Quantity Q2>
requires equivalent_dim<D, typename Q2::dimension> &&