mirror of
https://github.com/mpusz/mp-units.git
synced 2025-08-04 12:54:25 +02:00
derived_units now stores a type provided as a template parameter rather than its value
This commit is contained in:
@@ -147,22 +147,22 @@ namespace units {
|
||||
|
||||
template<typename Child, typename Symbol, Dimension D>
|
||||
struct derived_unit<Child, Symbol, D> : downcast_helper<Child, unit<D, ratio<1>>> {
|
||||
static constexpr auto symbol = Symbol::c_str();
|
||||
using symbol = Symbol;
|
||||
};
|
||||
|
||||
template<typename Child, typename Symbol, Dimension D, Ratio R>
|
||||
struct derived_unit<Child, Symbol, D, R> : downcast_helper<Child, unit<D, R>> {
|
||||
static constexpr auto symbol = Symbol::c_str();
|
||||
using symbol = Symbol;
|
||||
};
|
||||
|
||||
template<typename Child, typename Symbol, Unit U>
|
||||
struct derived_unit<Child, Symbol, U> : downcast_helper<Child, U> {
|
||||
static constexpr auto symbol = Symbol::c_str();
|
||||
using symbol = Symbol;
|
||||
};
|
||||
|
||||
template<typename Child, typename Symbol, Dimension D, Unit U, Unit... Us>
|
||||
struct derived_unit<Child, Symbol, D, U, Us...> : downcast_helper<Child, detail::make_derived_unit<D, U, Us...>> {
|
||||
static constexpr auto symbol = Symbol::c_str();
|
||||
using symbol = Symbol;
|
||||
};
|
||||
|
||||
// SI prefixes
|
||||
|
@@ -30,7 +30,7 @@ namespace units {
|
||||
template<typename Unit, typename Rep>
|
||||
std::ostream& operator<<(std::ostream& os, const quantity<Unit, Rep>& value)
|
||||
{
|
||||
return os << value.count() << Unit::symbol;
|
||||
return os << value.count() << Unit::symbol::c_str();
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user