derived_units now stores a type provided as a template parameter rather than its value

This commit is contained in:
Mateusz Pusz
2019-10-15 15:20:37 +02:00
parent 7e31dfe37e
commit c3c5a740d9
2 changed files with 6 additions and 6 deletions

View File

@@ -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

View File

@@ -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();
}
}