From 7522b8a9fd20bf45f76abc320d17b1a8b193bc5d Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Mon, 30 Sep 2019 11:08:52 +0200 Subject: [PATCH] Minor design documentation changes --- doc/DESIGN.md | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/doc/DESIGN.md b/doc/DESIGN.md index a448a7db..774c1995 100644 --- a/doc/DESIGN.md +++ b/doc/DESIGN.md @@ -513,9 +513,10 @@ struct downcast_base { `units::downcast_base` is a class that implements CRTP idiom, marks the base of downcasting facility with a `base_type` member type, and provides a declaration of downcasting ADL friendly -(Hidden Friend) entry point member function `downcast_guide` that here does not return any specific -type. This non-member function is going to be defined in a child class template `downcast_helper` -and will return a target type of the downcasting operation. +(Hidden Friend) entry point member function `downcast_guide`. An important design point is that +this function does not return any specific type in its declaration. This non-member function +is going to be defined in a child class template `downcast_helper` and will return a target +type of the downcasting operation there. ```cpp template @@ -538,7 +539,7 @@ struct downcast_helper : T { `units::downcast_helper` is another CRTP class template that provides the implementation of a non-member friend function of the `downcast_base` class template which defines the target -type of downcasting operation. It is used in the following way to define `dimension` and +type of a downcasting operation. It is used in the following way to define `dimension` and `unit` types in the library: ```cpp @@ -551,7 +552,7 @@ template struct derived_unit : downcast_helper>> {}; ``` -With such CRTP types the only thing the user has to do to register a new type to a downcasting +With such CRTP types the only thing the user has to do to register a new type to the downcasting facility is to publicly derive from one of those CRTP types and provide its new child type as the first template parameter of the CRTP type. @@ -578,8 +579,8 @@ using common_rep = decltype(lhs.count() * rhs.count()); using ret = quantity>>, common_rep>; ``` -`detail::downcast_target_impl` checks if downcasting target is registered for the specific base class. -If yes, it returns the registered type. Otherwise, it works like a regular identity type returning +`detail::downcast_target_impl` checks if a downcasting target is registered for the specific base class. +If yes, it returns the registered type, otherwise it works like a regular identity type returning a provided base class. ```cpp