fix: inline restored for non-template constexpr global variables
This commit is contained in:
1 parent
2e840cfdb4
commit
45013f6752
63 files changed
+1591
-1589
No files matched your search
@@ -104,7 +104,7 @@ namespace std {
|
||||
struct from_range_t {
|
||||
explicit from_range_t() = default;
|
||||
};
|
||||
constexpr from_range_t from_range{};
|
||||
inline constexpr from_range_t from_range{};
|
||||
|
||||
} // namespace std
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ constexpr basic_fixed_string superscript_number<8> = u8"\u2078";
|
||||
template<>
|
||||
constexpr basic_fixed_string superscript_number<9> = u8"\u2079";
|
||||
|
||||
constexpr symbol_text superscript_minus(u8"\u207b", "-");
|
||||
inline constexpr symbol_text superscript_minus(u8"\u207b", "-");
|
||||
|
||||
constexpr symbol_text superscript_prefix(u8"", "^");
|
||||
inline constexpr symbol_text superscript_prefix(u8"", "^");
|
||||
|
||||
template<std::intmax_t Value>
|
||||
[[nodiscard]] consteval auto superscript_helper()
|
||||
|
||||
@@ -28,14 +28,14 @@
|
||||
|
||||
#if MP_UNITS_API_NO_CRTP
|
||||
|
||||
#define QUANTITY_SPEC(name, ...) \
|
||||
constexpr struct name final : ::mp_units::quantity_spec<__VA_ARGS__> { \
|
||||
#define QUANTITY_SPEC(name, ...) \
|
||||
inline constexpr struct name final : ::mp_units::quantity_spec<__VA_ARGS__> { \
|
||||
} name
|
||||
|
||||
#else
|
||||
|
||||
#define QUANTITY_SPEC(name, ...) \
|
||||
constexpr struct name final : ::mp_units::quantity_spec<name, __VA_ARGS__> { \
|
||||
#define QUANTITY_SPEC(name, ...) \
|
||||
inline constexpr struct name final : ::mp_units::quantity_spec<name, __VA_ARGS__> { \
|
||||
} name
|
||||
|
||||
#endif
|
||||
|
||||
@@ -115,9 +115,9 @@ struct dimension_interface {
|
||||
* For example:
|
||||
*
|
||||
* @code{.cpp}
|
||||
* constexpr struct dim_length final : base_dimension<"L"> {} dim_length;
|
||||
* constexpr struct dim_time final : base_dimension<"T"> {} dim_time;
|
||||
* constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass;
|
||||
* inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length;
|
||||
* inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time;
|
||||
* inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass;
|
||||
* @endcode
|
||||
*
|
||||
* @note A common convention in this library is to assign the same name for a type and an object of this type.
|
||||
@@ -184,7 +184,9 @@ struct derived_dimension final : detail::dimension_interface, detail::derived_di
|
||||
* dimensions are zero. It is a dimension of a quantity of dimension one also known as
|
||||
* "dimensionless".
|
||||
*/
|
||||
MP_UNITS_EXPORT constexpr struct dimension_one final : detail::dimension_interface, detail::derived_dimension_impl<> {
|
||||
MP_UNITS_EXPORT inline constexpr struct dimension_one final :
|
||||
detail::dimension_interface,
|
||||
detail::derived_dimension_impl<> {
|
||||
} dimension_one;
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -725,12 +725,12 @@ MP_UNITS_EXPORT_BEGIN
|
||||
*/
|
||||
#if MP_UNITS_COMP_CLANG
|
||||
|
||||
constexpr struct mag_pi : magnitude<mag_value{std::numbers::pi_v<long double>}> {
|
||||
inline constexpr struct mag_pi : magnitude<mag_value{std::numbers::pi_v<long double>}> {
|
||||
} mag_pi;
|
||||
|
||||
#else
|
||||
|
||||
constexpr struct mag_pi : magnitude<std::numbers::pi_v<long double>> {
|
||||
inline constexpr struct mag_pi : magnitude<std::numbers::pi_v<long double>> {
|
||||
} mag_pi;
|
||||
|
||||
#endif
|
||||
@@ -959,7 +959,7 @@ template<typename T, auto... Ms>
|
||||
return integer_part((detail::abs(power_of_2) < detail::abs(power_of_5)) ? power_of_2 : power_of_5);
|
||||
}
|
||||
|
||||
constexpr symbol_text base_multiplier(u8"× 10", "x 10");
|
||||
inline constexpr symbol_text base_multiplier(u8"× 10", "x 10");
|
||||
|
||||
template<Magnitude auto M>
|
||||
[[nodiscard]] consteval auto magnitude_text()
|
||||
|
||||
@@ -189,7 +189,7 @@ struct quantity_spec_interface : quantity_spec_interface_base {
|
||||
|
||||
MP_UNITS_EXPORT_BEGIN
|
||||
|
||||
constexpr struct is_kind {
|
||||
inline constexpr struct is_kind {
|
||||
} is_kind;
|
||||
|
||||
/**
|
||||
@@ -235,13 +235,13 @@ MP_UNITS_EXPORT_END
|
||||
* For example:
|
||||
*
|
||||
* @code{.cpp}
|
||||
* constexpr struct dim_length final : base_dimension<"L"> {} dim_length;
|
||||
* constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass;
|
||||
* constexpr struct dim_time final : base_dimension<"T"> {} dim_time;
|
||||
* inline constexpr struct dim_length final : base_dimension<"L"> {} dim_length;
|
||||
* inline constexpr struct dim_mass final : base_dimension<"M"> {} dim_mass;
|
||||
* inline constexpr struct dim_time final : base_dimension<"T"> {} dim_time;
|
||||
*
|
||||
* constexpr struct length final : quantity_spec<dim_length> {} length;
|
||||
* constexpr struct mass final : quantity_spec<dim_mass> {} mass;
|
||||
* constexpr struct time final : quantity_spec<dim_time> {} time;
|
||||
* inline constexpr struct length final : quantity_spec<dim_length> {} length;
|
||||
* inline constexpr struct mass final : quantity_spec<dim_mass> {} mass;
|
||||
* inline constexpr struct time final : quantity_spec<dim_time> {} time;
|
||||
* @endcode
|
||||
*
|
||||
* @note A common convention in this library is to assign the same name for a type and an object of this type.
|
||||
@@ -280,12 +280,12 @@ struct quantity_spec<Self, Dim, Args...> : detail::quantity_spec_interface<Self>
|
||||
* For example:
|
||||
*
|
||||
* @code{.cpp}
|
||||
* constexpr struct area final : quantity_spec<pow<2>(length)> {} area;
|
||||
* constexpr struct volume final : quantity_spec<pow<3>(length)> {} volume;
|
||||
* constexpr struct velocity final : quantity_spec<position_vector / duration> {} velocity;
|
||||
* constexpr struct speed final : quantity_spec<length / time> {} speed;
|
||||
* constexpr struct force final : quantity_spec<mass * acceleration, quantity_character::vector> {} force;
|
||||
* constexpr struct power final : quantity_spec<force * velocity, quantity_character::scalar> {} power;
|
||||
* inline constexpr struct area final : quantity_spec<pow<2>(length)> {} area;
|
||||
* inline constexpr struct volume final : quantity_spec<pow<3>(length)> {} volume;
|
||||
* inline constexpr struct velocity final : quantity_spec<position_vector / duration> {} velocity;
|
||||
* inline constexpr struct speed final : quantity_spec<length / time> {} speed;
|
||||
* inline constexpr struct force final : quantity_spec<mass * acceleration, quantity_character::vector> {} force;
|
||||
* inline constexpr struct power final : quantity_spec<force * velocity, quantity_character::scalar> {} power;
|
||||
* @endcode
|
||||
*
|
||||
* @note A common convention in this library is to assign the same name for a type and an object of this type.
|
||||
@@ -335,10 +335,10 @@ struct propagate_equation<Q, true> {
|
||||
* For example:
|
||||
*
|
||||
* @code{.cpp}
|
||||
* constexpr struct width final : quantity_spec<length> {} width;
|
||||
* constexpr struct height final : quantity_spec<length> {} height;
|
||||
* constexpr struct diameter final : quantity_spec<width> {} diameter;
|
||||
* constexpr struct position_vector final : quantity_spec<length, quantity_character::vector> {} position_vector;
|
||||
* inline constexpr struct width final : quantity_spec<length> {} width;
|
||||
* inline constexpr struct height final : quantity_spec<length> {} height;
|
||||
* inline constexpr struct diameter final : quantity_spec<width> {} diameter;
|
||||
* inline constexpr struct position_vector final : quantity_spec<length, quantity_character::vector> {} position_vector;
|
||||
* @endcode
|
||||
*
|
||||
* @note A common convention in this library is to assign the same name for a type and an object of this type.
|
||||
@@ -396,10 +396,10 @@ struct quantity_spec<Self, QS, Args...> : detail::propagate_equation<QS>, detail
|
||||
* For example:
|
||||
*
|
||||
* @code{.cpp}
|
||||
* constexpr struct angular_measure final : quantity_spec<dimensionless, arc_length / radius, is_kind> {} angular_measure;
|
||||
* constexpr struct velocity final : quantity_spec<speed, position_vector / duration> {} velocity;
|
||||
* constexpr struct weight final : quantity_spec<force, mass * acceleration_of_free_fall> {} weight;
|
||||
* constexpr struct kinetic_energy final : quantity_spec<mechanical_energy, mass * pow<2>(speed)> {} kinetic_energy;
|
||||
* inline constexpr struct angular_measure final : quantity_spec<dimensionless, arc_length / radius, is_kind> {} angular_measure;
|
||||
* inline constexpr struct velocity final : quantity_spec<speed, position_vector / duration> {} velocity;
|
||||
* inline constexpr struct weight final : quantity_spec<force, mass * acceleration_of_free_fall> {} weight;
|
||||
* inline constexpr struct kinetic_energy final : quantity_spec<mechanical_energy, mass * pow<2>(speed)> {} kinetic_energy;
|
||||
* @endcode
|
||||
*
|
||||
* @note A common convention in this library is to assign the same name for a type and an object of this type.
|
||||
|
||||
@@ -45,15 +45,15 @@ namespace mp_units {
|
||||
* @code{.cpp}
|
||||
* // hypothetical natural system of units for c=1
|
||||
*
|
||||
* constexpr struct second final : named_unit<"s"> {} second;
|
||||
* constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute;
|
||||
* constexpr struct gram final : named_unit<"g"> {} gram;
|
||||
* constexpr auto kilogram = si::kilo<gram>;
|
||||
* inline constexpr struct second final : named_unit<"s"> {} second;
|
||||
* inline constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute;
|
||||
* inline constexpr struct gram final : named_unit<"g"> {} gram;
|
||||
* inline constexpr auto kilogram = si::kilo<gram>;
|
||||
*
|
||||
* constexpr struct time : system_reference<isq::time, second> {} time;
|
||||
* constexpr struct length : system_reference<isq::length, second> {} length;
|
||||
* constexpr struct speed : system_reference<isq::speed, second / second> {} speed;
|
||||
* constexpr struct force : system_reference<isq::force, kilogram / second> {} force;
|
||||
* inline constexpr struct time : system_reference<isq::time, second> {} time;
|
||||
* inline constexpr struct length : system_reference<isq::length, second> {} length;
|
||||
* inline constexpr struct speed : system_reference<isq::speed, second / second> {} speed;
|
||||
* inline constexpr struct force : system_reference<isq::force, kilogram / second> {} force;
|
||||
* @endcode
|
||||
*
|
||||
* @tparam Q quantity for which a unit is being assigned
|
||||
|
||||
@@ -256,12 +256,12 @@ constexpr bool is_specialization_of_scaled_unit<scaled_unit<M, U>> = true;
|
||||
* For example:
|
||||
*
|
||||
* @code{.cpp}
|
||||
* constexpr struct second final : named_unit<"s", kind_of<time>> {} second;
|
||||
* constexpr struct metre final : named_unit<"m", kind_of<length> {} metre;
|
||||
* constexpr struct hertz final : named_unit<"Hz", inverse(second), kind_of<frequency>> {} hertz;
|
||||
* constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton;
|
||||
* constexpr struct degree_Celsius final : named_unit<{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {}
|
||||
* degree_Celsius; constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute;
|
||||
* inline constexpr struct second final : named_unit<"s", kind_of<time>> {} second;
|
||||
* inline constexpr struct metre final : named_unit<"m", kind_of<length> {} metre;
|
||||
* inline constexpr struct hertz final : named_unit<"Hz", inverse(second), kind_of<frequency>> {} hertz;
|
||||
* inline constexpr struct newton final : named_unit<"N", kilogram * metre / square(second)> {} newton;
|
||||
* inline constexpr struct degree_Celsius final : named_unit<{u8"℃", "`C"}, kelvin, zeroth_degree_Celsius> {}
|
||||
* degree_Celsius; inline constexpr struct minute final : named_unit<"min", mag<60> * second> {} minute;
|
||||
* @endcode
|
||||
*
|
||||
* @note A common convention in this library is to assign the same name for a type and an object of this type.
|
||||
@@ -388,7 +388,7 @@ struct named_unit<Symbol, U, QS, PO> : decltype(U)::_base_type_ {
|
||||
* template<PrefixableUnit auto U>
|
||||
* constexpr kilo_<U> kilo;
|
||||
*
|
||||
* constexpr auto kilogram = si::kilo<gram>;
|
||||
* inline constexpr auto kilogram = si::kilo<gram>;
|
||||
* @endcode
|
||||
*
|
||||
* @tparam Symbol a prefix text to prepend to a unit symbol
|
||||
@@ -468,7 +468,7 @@ struct derived_unit final : detail::derived_unit_impl<Expr...> {};
|
||||
* Unit of a dimensionless quantity.
|
||||
*/
|
||||
// clang-format off
|
||||
MP_UNITS_EXPORT constexpr struct one final : detail::derived_unit_impl<> {} one;
|
||||
MP_UNITS_EXPORT inline constexpr struct one final : detail::derived_unit_impl<> {} one;
|
||||
// clang-format on
|
||||
|
||||
namespace detail {
|
||||
@@ -611,10 +611,10 @@ template<std::intmax_t Num, std::intmax_t Den = 1, Unit U>
|
||||
|
||||
// common dimensionless units
|
||||
// clang-format off
|
||||
constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent;
|
||||
constexpr struct per_mille final : named_unit<symbol_text{u8"‰", "%o"}, mag_ratio<1, 1000> * one> {} per_mille;
|
||||
constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million;
|
||||
constexpr auto ppm = parts_per_million;
|
||||
inline constexpr struct percent final : named_unit<"%", mag_ratio<1, 100> * one> {} percent;
|
||||
inline constexpr struct per_mille final : named_unit<symbol_text{u8"‰", "%o"}, mag_ratio<1, 1000> * one> {} per_mille;
|
||||
inline constexpr struct parts_per_million final : named_unit<"ppm", mag_ratio<1, 1'000'000> * one> {} parts_per_million;
|
||||
inline constexpr auto ppm = parts_per_million;
|
||||
// clang-format on
|
||||
|
||||
|
||||
|
||||
@@ -184,7 +184,7 @@ template<Unit auto ToU, Representation ToRep, typename QP>
|
||||
* Implicit conversions between quantities of different types are allowed only for "safe"
|
||||
* (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
|
||||
*
|
||||
* constexpr struct A : absolute_point_origin<A, isq::distance> A;
|
||||
* inline constexpr struct A : absolute_point_origin<A, isq::distance> A;
|
||||
*
|
||||
* using ToQ = quantity<mm, int>;
|
||||
* auto qp = value_cast<ToQ>(quantity_point{1.23 * m});
|
||||
@@ -210,8 +210,8 @@ template<Quantity ToQ, typename QP>
|
||||
* Implicit conversions between quantities of different types are allowed only for "safe"
|
||||
* (e.g. non-truncating) conversion. In truncating cases an explicit cast have to be used.
|
||||
*
|
||||
* constexpr struct A : absolute_point_origin<A, isq::distance> A;
|
||||
* constexpr struct B : relative_point_origin<A + 1*m> B;
|
||||
* inline constexpr struct A : absolute_point_origin<A, isq::distance> A;
|
||||
* inline constexpr struct B : relative_point_origin<A + 1*m> B;
|
||||
*
|
||||
* using ToQP = quantity_point<mm, B, int>;
|
||||
* auto qp = value_cast<ToQP>(quantity_point{1.23 * m});
|
||||
|
||||
Reference in new issue
Block a user