From 7e31dfe37eae98a219578af35c30e64a1c575ea8 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Tue, 15 Oct 2019 11:47:36 +0200 Subject: [PATCH] Name renamed to symbol in a derived_unit --- doc/DESIGN.md | 22 +++++------ src/include/units/unit.h | 52 +++++++++++++------------- test/unit_test/runtime/print_helpers.h | 2 +- 3 files changed, 38 insertions(+), 38 deletions(-) diff --git a/doc/DESIGN.md b/doc/DESIGN.md index 3dd57110..ae57e620 100644 --- a/doc/DESIGN.md +++ b/doc/DESIGN.md @@ -242,7 +242,7 @@ struct unit : downcast_base> { All units are created with a `derived_unit` helper: ```cpp -template +template struct derived_unit; ``` @@ -259,8 +259,8 @@ to provide downcasting facility (described below). - helper to create a base unit of a specified dimension ```cpp -template -struct derived_unit; +template +struct derived_unit; ``` ```cpp @@ -270,8 +270,8 @@ struct metre : derived_unit {}; - helper to create other units for a specified dimension ```cpp -template -struct derived_unit; +template +struct derived_unit; ``` ```cpp @@ -281,8 +281,8 @@ struct yard : derived_unit> {}; - helper to create a unit with a SI prefix ```cpp -template -struct derived_unit; +template +struct derived_unit; ``` ```cpp @@ -293,8 +293,8 @@ struct kilometre : derived_unit> {}; of units of base dimensions ```cpp -template -struct derived_unit; +template +struct derived_unit; ``` ```cpp @@ -554,8 +554,8 @@ struct derived_dimension : downcast_helper -struct derived_unit : downcast_helper>> {}; +template +struct derived_unit : downcast_helper>> {}; ``` With such CRTP types the only thing the user has to do to register a new type to the downcasting diff --git a/src/include/units/unit.h b/src/include/units/unit.h index 4eda4538..356be1ac 100644 --- a/src/include/units/unit.h +++ b/src/include/units/unit.h @@ -119,50 +119,50 @@ namespace units { // TODO gcc:92101 // Gated by the following gcc bug // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92101 - // template +// template // struct derived_unit; - // template - // struct derived_unit : downcast_helper>> { - // static constexpr auto name = Name; + // template + // struct derived_unit : downcast_helper>> { + // static constexpr auto symbol = Symbol; // }; - // template - // struct derived_unit : downcast_helper> { - // static constexpr auto name = Name; + // template + // struct derived_unit : downcast_helper> { + // static constexpr auto symbol = Symbol; // }; - // template - // struct derived_unit : downcast_helper { - // static constexpr auto name = Name; + // template + // struct derived_unit : downcast_helper { + // static constexpr auto symbol = Symbol; // }; - // template - // struct derived_unit : downcast_helper> { - // static constexpr auto name = Name; + // template + // struct derived_unit : downcast_helper> { + // static constexpr auto symbol = Symbol; // }; - template + template struct derived_unit; - template - struct derived_unit : downcast_helper>> { - static constexpr auto name = Name::c_str(); + template + struct derived_unit : downcast_helper>> { + static constexpr auto symbol = Symbol::c_str(); }; - template - struct derived_unit : downcast_helper> { - static constexpr auto name = Name::c_str(); + template + struct derived_unit : downcast_helper> { + static constexpr auto symbol = Symbol::c_str(); }; - template - struct derived_unit : downcast_helper { - static constexpr auto name = Name::c_str(); + template + struct derived_unit : downcast_helper { + static constexpr auto symbol = Symbol::c_str(); }; - template - struct derived_unit : downcast_helper> { - static constexpr auto name = Name::c_str(); + template + struct derived_unit : downcast_helper> { + static constexpr auto symbol = Symbol::c_str(); }; // SI prefixes diff --git a/test/unit_test/runtime/print_helpers.h b/test/unit_test/runtime/print_helpers.h index 8d664129..96088485 100644 --- a/test/unit_test/runtime/print_helpers.h +++ b/test/unit_test/runtime/print_helpers.h @@ -30,7 +30,7 @@ namespace units { template std::ostream& operator<<(std::ostream& os, const quantity& value) { - return os << value.count() << Unit::name; + return os << value.count() << Unit::symbol; } }