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

@@ -119,7 +119,7 @@ namespace units {
// TODO gcc:92101 // TODO gcc:92101
// Gated by the following gcc bug // Gated by the following gcc bug
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92101 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92101
// template<typename Child, fixed_string Symbol, typename...> // template<typename Child, fixed_string Symbol, typename...>
// struct derived_unit; // struct derived_unit;
// template<typename Child, fixed_string Symbol, Dimension D> // template<typename Child, fixed_string Symbol, Dimension D>
@@ -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

View File

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