forked from mpusz/mp-units
See if passing by const& will satisfy all compilers
The only reason we had the `is_magnitude_integral` type members before is because the compiler complained about incomplete types. Passing by `const&` might eliminate this need.
This commit is contained in:
@@ -327,12 +327,10 @@ template<BasePower auto... BPs>
|
|||||||
requires (detail::is_base_power_pack_valid<BPs...>)
|
requires (detail::is_base_power_pack_valid<BPs...>)
|
||||||
struct magnitude {
|
struct magnitude {
|
||||||
// Whether this magnitude represents an integer.
|
// Whether this magnitude represents an integer.
|
||||||
static constexpr bool is_magnitude_integral = (detail::is_integral(BPs) && ...);
|
friend constexpr bool is_integral(const magnitude&) { return (detail::is_integral(BPs) && ...); }
|
||||||
friend constexpr bool is_integral(magnitude) { return is_magnitude_integral; }
|
|
||||||
|
|
||||||
// Whether this magnitude represents a rational number.
|
// Whether this magnitude represents a rational number.
|
||||||
static constexpr bool is_magnitude_rational = (detail::is_rational(BPs) && ...);
|
friend constexpr bool is_rational(const magnitude&) { return (detail::is_rational(BPs) && ...); }
|
||||||
friend constexpr bool is_rational(magnitude) { return is_magnitude_rational; }
|
|
||||||
|
|
||||||
// The value of this magnitude, expressed in a given type.
|
// The value of this magnitude, expressed in a given type.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
@@ -363,7 +361,7 @@ concept Magnitude = detail::is_magnitude<T>;
|
|||||||
* Can avoid the need for an unsightly `.template` keyword.
|
* Can avoid the need for an unsightly `.template` keyword.
|
||||||
*/
|
*/
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T get_value(Magnitude auto m) { return decltype(m)::template value<T>; }
|
constexpr T get_value(Magnitude auto m) { return decltype(m)::template value<T>; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A base to represent pi.
|
* @brief A base to represent pi.
|
||||||
|
Reference in New Issue
Block a user