forked from mpusz/mp-units
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>
|
template<typename Child, typename Symbol, Dimension D>
|
||||||
struct derived_unit<Child, Symbol, D> : downcast_helper<Child, unit<D, ratio<1>>> {
|
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>
|
template<typename Child, typename Symbol, Dimension D, Ratio R>
|
||||||
struct derived_unit<Child, Symbol, D, R> : downcast_helper<Child, unit<D, 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>
|
template<typename Child, typename Symbol, Unit U>
|
||||||
struct derived_unit<Child, Symbol, U> : downcast_helper<Child, 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>
|
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...>> {
|
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
|
// SI prefixes
|
||||||
|
@@ -30,7 +30,7 @@ namespace units {
|
|||||||
template<typename Unit, typename Rep>
|
template<typename Unit, typename Rep>
|
||||||
std::ostream& operator<<(std::ostream& os, const quantity<Unit, Rep>& value)
|
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