forked from mpusz/mp-units
refactor: Repetitive inline constexpr removed as no longer needed
Not needed anymore as stated in cplusplus/draft#4601
This commit is contained in:
@@ -40,22 +40,22 @@ import mp_units.core;
|
||||
using namespace mp_units;
|
||||
|
||||
// clang-format off
|
||||
inline constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency;
|
||||
constexpr struct dim_currency final : base_dimension<"$"> {} dim_currency;
|
||||
|
||||
QUANTITY_SPEC(currency, dim_currency);
|
||||
|
||||
inline constexpr struct euro final : named_unit<"EUR", kind_of<currency>> {} euro;
|
||||
inline constexpr struct us_dollar final : named_unit<"USD", kind_of<currency>> {} us_dollar;
|
||||
inline constexpr struct great_british_pound final : named_unit<"GBP", kind_of<currency>> {} great_british_pound;
|
||||
inline constexpr struct japanese_jen final : named_unit<"JPY", kind_of<currency>> {} japanese_jen;
|
||||
constexpr struct euro final : named_unit<"EUR", kind_of<currency>> {} euro;
|
||||
constexpr struct us_dollar final : named_unit<"USD", kind_of<currency>> {} us_dollar;
|
||||
constexpr struct great_british_pound final : named_unit<"GBP", kind_of<currency>> {} great_british_pound;
|
||||
constexpr struct japanese_jen final : named_unit<"JPY", kind_of<currency>> {} japanese_jen;
|
||||
// clang-format on
|
||||
|
||||
namespace unit_symbols {
|
||||
|
||||
inline constexpr auto EUR = euro;
|
||||
inline constexpr auto USD = us_dollar;
|
||||
inline constexpr auto GBP = great_british_pound;
|
||||
inline constexpr auto JPY = japanese_jen;
|
||||
constexpr auto EUR = euro;
|
||||
constexpr auto USD = us_dollar;
|
||||
constexpr auto GBP = great_british_pound;
|
||||
constexpr auto JPY = japanese_jen;
|
||||
|
||||
} // namespace unit_symbols
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ import mp_units;
|
||||
|
||||
namespace geographic {
|
||||
|
||||
inline constexpr struct mean_sea_level final : mp_units::absolute_point_origin<mp_units::isq::altitude> {
|
||||
constexpr struct mean_sea_level final : mp_units::absolute_point_origin<mp_units::isq::altitude> {
|
||||
} mean_sea_level;
|
||||
|
||||
using msl_altitude = mp_units::quantity_point<mp_units::isq::altitude[mp_units::si::metre], mean_sea_level>;
|
||||
@@ -72,9 +72,9 @@ struct MP_UNITS_STD_FMT::formatter<geographic::msl_altitude, Char> :
|
||||
|
||||
namespace geographic {
|
||||
|
||||
inline constexpr struct equator final : mp_units::absolute_point_origin<mp_units::isq::angular_measure> {
|
||||
constexpr struct equator final : mp_units::absolute_point_origin<mp_units::isq::angular_measure> {
|
||||
} equator;
|
||||
inline constexpr struct prime_meridian final : mp_units::absolute_point_origin<mp_units::isq::angular_measure> {
|
||||
constexpr struct prime_meridian final : mp_units::absolute_point_origin<mp_units::isq::angular_measure> {
|
||||
} prime_meridian;
|
||||
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ import mp_units.core;
|
||||
|
||||
template<std::movable T, MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(std::convertible_to<T>) auto Min,
|
||||
MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(std::convertible_to<T>) auto Max>
|
||||
inline constexpr auto is_in_range = [](const auto& v) { return std::clamp(v, T{Min}, T{Max}) == v; };
|
||||
constexpr auto is_in_range = [](const auto& v) { return std::clamp(v, T{Min}, T{Max}) == v; };
|
||||
|
||||
template<std::movable T, MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(std::convertible_to<T>) auto Min,
|
||||
MP_UNITS_CONSTRAINED_NTTP_WORKAROUND(std::convertible_to<T>) auto Max>
|
||||
@@ -63,10 +63,10 @@ public:
|
||||
};
|
||||
|
||||
template<typename T, auto Min, auto Max>
|
||||
inline constexpr bool mp_units::is_scalar<ranged_representation<T, Min, Max>> = mp_units::is_scalar<T>;
|
||||
constexpr bool mp_units::is_scalar<ranged_representation<T, Min, Max>> = mp_units::is_scalar<T>;
|
||||
|
||||
template<typename T, auto Min, auto Max>
|
||||
inline constexpr bool mp_units::treat_as_floating_point<ranged_representation<T, Min, Max>> =
|
||||
constexpr bool mp_units::treat_as_floating_point<ranged_representation<T, Min, Max>> =
|
||||
mp_units::treat_as_floating_point<T>;
|
||||
|
||||
template<typename T, auto Min, auto Max, typename Char>
|
||||
|
||||
@@ -40,7 +40,7 @@ import mp_units.core;
|
||||
#include <mp-units/framework/customization_points.h>
|
||||
#endif
|
||||
|
||||
inline constexpr struct validated_tag {
|
||||
constexpr struct validated_tag {
|
||||
} validated;
|
||||
|
||||
template<std::movable T, std::predicate<T> Validator>
|
||||
@@ -114,11 +114,10 @@ public:
|
||||
};
|
||||
|
||||
template<typename T, typename Validator>
|
||||
inline constexpr bool mp_units::is_scalar<validated_type<T, Validator>> = mp_units::is_scalar<T>;
|
||||
constexpr bool mp_units::is_scalar<validated_type<T, Validator>> = mp_units::is_scalar<T>;
|
||||
|
||||
template<typename T, typename Validator>
|
||||
inline constexpr bool mp_units::treat_as_floating_point<validated_type<T, Validator>> =
|
||||
mp_units::treat_as_floating_point<T>;
|
||||
constexpr bool mp_units::treat_as_floating_point<validated_type<T, Validator>> = mp_units::treat_as_floating_point<T>;
|
||||
|
||||
|
||||
template<typename CharT, typename Traits, typename T, typename Validator>
|
||||
|
||||
@@ -47,13 +47,13 @@ namespace kalman {
|
||||
namespace detail {
|
||||
|
||||
template<mp_units::Dimension auto... Ds>
|
||||
inline constexpr bool are_time_derivatives = false;
|
||||
constexpr bool are_time_derivatives = false;
|
||||
|
||||
template<mp_units::Dimension auto D>
|
||||
inline constexpr bool are_time_derivatives<D> = true;
|
||||
constexpr bool are_time_derivatives<D> = true;
|
||||
|
||||
template<mp_units::Dimension auto D1, mp_units::Dimension auto D2, mp_units::Dimension auto... Ds>
|
||||
inline constexpr bool are_time_derivatives<D1, D2, Ds...> =
|
||||
constexpr bool are_time_derivatives<D1, D2, Ds...> =
|
||||
(D1 / D2 == mp_units::isq::dim_time) && are_time_derivatives<D2, Ds...>;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
@@ -40,7 +40,7 @@ import mp_units;
|
||||
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
using namespace mp_units;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import mp_units;
|
||||
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
using namespace mp_units;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import mp_units;
|
||||
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
using namespace mp_units;
|
||||
|
||||
|
||||
@@ -132,12 +132,12 @@ private:
|
||||
} // namespace
|
||||
|
||||
template<class T>
|
||||
inline constexpr bool mp_units::treat_as_floating_point<measurement<T>> = mp_units::treat_as_floating_point<T>;
|
||||
constexpr bool mp_units::treat_as_floating_point<measurement<T>> = mp_units::treat_as_floating_point<T>;
|
||||
|
||||
template<class T>
|
||||
inline constexpr bool mp_units::is_scalar<measurement<T>> = true;
|
||||
constexpr bool mp_units::is_scalar<measurement<T>> = true;
|
||||
template<class T>
|
||||
inline constexpr bool mp_units::is_vector<measurement<T>> = true;
|
||||
constexpr bool mp_units::is_vector<measurement<T>> = true;
|
||||
|
||||
static_assert(mp_units::RepresentationOf<measurement<double>, mp_units::quantity_character::scalar>);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ import mp_units;
|
||||
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ import mp_units;
|
||||
// types instead of requiring the usage of Linear Algebra library for this simple example
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -58,8 +58,8 @@ QUANTITY_SPEC(horizontal_length, isq::length);
|
||||
// with a constrained quantity equation
|
||||
QUANTITY_SPEC(horizontal_area, isq::area, horizontal_length* isq::width);
|
||||
|
||||
inline constexpr auto g = 1 * si::standard_gravity;
|
||||
inline constexpr auto air_density = isq::mass_density(1.225 * kg / m3);
|
||||
constexpr auto g = 1 * si::standard_gravity;
|
||||
constexpr auto air_density = isq::mass_density(1.225 * kg / m3);
|
||||
|
||||
class StorageTank {
|
||||
quantity<horizontal_area[m2]> base_;
|
||||
|
||||
@@ -35,7 +35,7 @@ import mp_units;
|
||||
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ import mp_units;
|
||||
|
||||
template<class T>
|
||||
requires mp_units::is_scalar<T>
|
||||
inline constexpr bool mp_units::is_vector<T> = true;
|
||||
constexpr bool mp_units::is_vector<T> = true;
|
||||
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ struct height_above_ellipsoid_t final : absolute_point_origin<isq::altitude> {
|
||||
static constexpr earth_gravity_model egm = M;
|
||||
};
|
||||
template<earth_gravity_model M>
|
||||
inline constexpr height_above_ellipsoid_t<M> height_above_ellipsoid; // NOLINT(google-readability-casting)
|
||||
constexpr height_above_ellipsoid_t<M> height_above_ellipsoid; // NOLINT(google-readability-casting)
|
||||
|
||||
template<earth_gravity_model M>
|
||||
using hae_altitude = quantity_point<isq::altitude[si::metre], height_above_ellipsoid<M>>;
|
||||
@@ -119,7 +119,7 @@ hae_altitude<M> to_hae(msl_altitude msl, position<long double> pos)
|
||||
// **** HAL ****
|
||||
|
||||
// clang-format off
|
||||
inline constexpr struct height_above_launch final : absolute_point_origin<isq::altitude> {} height_above_launch;
|
||||
constexpr struct height_above_launch final : absolute_point_origin<isq::altitude> {} height_above_launch;
|
||||
// clang-format on
|
||||
|
||||
using hal_altitude = quantity_point<isq::altitude[si::metre], height_above_launch>;
|
||||
|
||||
Reference in New Issue
Block a user