xo-unit: + .is_natural() method in natural_unit, scaled_unit
This commit is contained in:
parent
ad6bc34d62
commit
1a2023a9a2
3 changed files with 8 additions and 1 deletions
|
|
@ -70,6 +70,9 @@ namespace xo {
|
|||
return detail::nu_maker<Int>::make_nu(bpu<Int>(bu, power));
|
||||
}
|
||||
|
||||
/** always true. @see scaled_unit::is_natural **/
|
||||
constexpr bool is_natural() const { return true; }
|
||||
|
||||
constexpr std::size_t n_bpu() const { return n_bpu_; }
|
||||
constexpr bool is_dimensionless() const { return n_bpu_ == 0; }
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ namespace xo {
|
|||
template <
|
||||
auto NaturalUnit,
|
||||
typename Repr = double>
|
||||
requires (NaturalUnit.is_natural())
|
||||
class quantity {
|
||||
public:
|
||||
/** @defgroup quantity-type-traits quantity type traits **/
|
||||
|
|
|
|||
|
|
@ -29,7 +29,10 @@ namespace xo {
|
|||
1.0 / outer_scale_sq_);
|
||||
}
|
||||
|
||||
/** @brief true iff scaled unit can be faithfully represented by a @ref natural_unit **/
|
||||
/** @brief true iff scaled unit can be faithfully represented by a @ref natural_unit
|
||||
*
|
||||
* @see natural_unit::is_natural
|
||||
**/
|
||||
constexpr bool is_natural() const {
|
||||
return (outer_scale_factor_ == OuterScale(1) && (outer_scale_sq_ == 1.0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue