mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 20:54:28 +02:00
feat: operator[]
added for quantity
This commit is contained in:
@@ -176,6 +176,13 @@ public:
|
||||
[[nodiscard]] constexpr rep&& number() && noexcept { return std::move(number_); }
|
||||
[[nodiscard]] constexpr const rep&& number() const&& noexcept { return std::move(number_); }
|
||||
|
||||
template<Unit U>
|
||||
requires quantity_convertible_to_<quantity, quantity<::units::reference<dimension, U{}>{}, Rep>>
|
||||
[[nodiscard]] constexpr quantity<::units::reference<dimension, U{}>{}, Rep> operator[](U) const
|
||||
{
|
||||
return quantity<::units::reference<dimension, U{}>{}, Rep>{*this};
|
||||
}
|
||||
|
||||
// member unary operators
|
||||
[[nodiscard]] constexpr Quantity auto operator+() const
|
||||
requires requires(rep v) {
|
||||
|
Reference in New Issue
Block a user