PT replaced with PF for PrefixFamily

This commit is contained in:
Mateusz Pusz
2020-05-09 09:22:16 +02:00
parent 4fa0f90a4e
commit e5b7487066
3 changed files with 23 additions and 23 deletions

View File

@@ -134,8 +134,8 @@ struct no_prefix : prefix_family {};
Concrete prefix derives from a `prefix` class template: Concrete prefix derives from a `prefix` class template:
```cpp ```cpp
template<typename Child, PrefixFamily PT, basic_fixed_string Symbol, Ratio R> template<typename Child, PrefixFamily PF, basic_fixed_string Symbol, Ratio R>
requires (!std::same_as<PT, no_prefix>) requires (!std::same_as<PF, no_prefix>)
struct prefix; struct prefix;
``` ```

View File

@@ -45,9 +45,9 @@ struct no_prefix : prefix_family {};
namespace detail { namespace detail {
template<PrefixFamily PT, Ratio R> template<PrefixFamily PF, Ratio R>
struct prefix_base : downcast_base<prefix_base<PT, R>> { struct prefix_base : downcast_base<prefix_base<PF, R>> {
using prefix_family = PT; using prefix_family = PF;
using ratio = R; using ratio = R;
}; };
@@ -64,13 +64,13 @@ struct prefix_base : downcast_base<prefix_base<PT, R>> {
* prepended to the symbol of the unit * prepended to the symbol of the unit
* *
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom) * @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
* @tparam PT a type of prefix family * @tparam PF a type of prefix family
* @tparam Symbol a text representation of the prefix * @tparam Symbol a text representation of the prefix
* @tparam R factor to be used to scale a unit * @tparam R factor to be used to scale a unit
*/ */
template<typename Child, PrefixFamily PT, basic_symbol_text Symbol, Ratio R> template<typename Child, PrefixFamily PF, basic_symbol_text Symbol, Ratio R>
requires (!std::same_as<PT, no_prefix>) requires (!std::same_as<PF, no_prefix>)
struct prefix : downcast_child<Child, detail::prefix_base<PT, R>> { struct prefix : downcast_child<Child, detail::prefix_base<PF, R>> {
static constexpr auto symbol = Symbol; static constexpr auto symbol = Symbol;
}; };

View File

@@ -88,39 +88,39 @@ struct unknown_coherent_unit : unit<unknown_coherent_unit> {};
* *
* Defines a named (in most cases coherent) unit that is then passed to a dimension definition. * Defines a named (in most cases coherent) unit that is then passed to a dimension definition.
* A named unit may be used by other units defined with the prefix of the same type, unless * A named unit may be used by other units defined with the prefix of the same type, unless
* no_prefix is provided for PT template parameter (in such a case it is impossible to define * no_prefix is provided for PF template parameter (in such a case it is impossible to define
* a prefix unit based on this one). * a prefix unit based on this one).
* *
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom) * @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
* @tparam Symbol a short text representation of the unit * @tparam Symbol a short text representation of the unit
* @tparam PT no_prefix or a type of prefix family * @tparam PF no_prefix or a type of prefix family
*/ */
template<typename Child, basic_symbol_text Symbol, PrefixFamily PT> template<typename Child, basic_symbol_text Symbol, PrefixFamily PF>
struct named_unit : downcast_child<Child, scaled_unit<ratio<1>, Child>> { struct named_unit : downcast_child<Child, scaled_unit<ratio<1>, Child>> {
static constexpr bool is_named = true; static constexpr bool is_named = true;
static constexpr auto symbol = Symbol; static constexpr auto symbol = Symbol;
using prefix_family = PT; using prefix_family = PF;
}; };
/** /**
* @brief A scaled unit * @brief A scaled unit
* *
* Defines a new named unit that is a scaled version of another unit. Such unit can be used by * Defines a new named unit that is a scaled version of another unit. Such unit can be used by
* other units defined with the prefix of the same type, unless no_prefix is provided for PT * other units defined with the prefix of the same type, unless no_prefix is provided for PF
* template parameter (in such a case it is impossible to define a prefix unit based on this * template parameter (in such a case it is impossible to define a prefix unit based on this
* one). * one).
* *
* @tparam Child inherited class type used by the downcasting facility (CRTP Idiom) * @tparam Child inherited class type used by the downcasting facility (CRTP Idiom)
* @tparam Symbol a short text representation of the unit * @tparam Symbol a short text representation of the unit
* @tparam PT no_prefix or a type of prefix family * @tparam PF no_prefix or a type of prefix family
* @tparam R a scale to apply to U * @tparam R a scale to apply to U
* @tparam U a reference unit to scale * @tparam U a reference unit to scale
*/ */
template<typename Child, basic_symbol_text Symbol, PrefixFamily PT, UnitRatio R, Unit U> template<typename Child, basic_symbol_text Symbol, PrefixFamily PF, UnitRatio R, Unit U>
struct named_scaled_unit : downcast_child<Child, scaled_unit<ratio_multiply<R, typename U::ratio>, typename U::reference>> { struct named_scaled_unit : downcast_child<Child, scaled_unit<ratio_multiply<R, typename U::ratio>, typename U::reference>> {
static constexpr bool is_named = true; static constexpr bool is_named = true;
static constexpr auto symbol = Symbol; static constexpr auto symbol = Symbol;
using prefix_family = PT; using prefix_family = PF;
}; };
/** /**
@@ -165,11 +165,11 @@ struct deduced_unit : downcast_child<Child, detail::deduced_unit<Dim, U, URest..
using prefix_family = no_prefix; using prefix_family = no_prefix;
}; };
// template<typename Child, Dimension Dim, basic_fixed_string Symbol, PrefixFamily PT, Unit U, Unit... Us> // template<typename Child, Dimension Dim, basic_fixed_string Symbol, PrefixFamily PF, Unit U, Unit... Us>
// struct named_deduced_derived_unit : downcast_child<Child, detail::deduced_derived_unit<Dim, U, Us...>> { // struct named_deduced_derived_unit : downcast_child<Child, detail::deduced_derived_unit<Dim, U, Us...>> {
// static constexpr bool is_named = true; // static constexpr bool is_named = true;
// static constexpr auto symbol = Symbol; // static constexpr auto symbol = Symbol;
// using prefix_family = PT; // using prefix_family = PF;
// }; // };
/** /**
@@ -178,18 +178,18 @@ struct deduced_unit : downcast_child<Child, detail::deduced_unit<Dim, U, URest..
* Defines a named alias for another unit. It is useful to assign alternative names and symbols * Defines a named alias for another unit. It is useful to assign alternative names and symbols
* to the already predefined units (i.e. "tonne" for "megagram"). * to the already predefined units (i.e. "tonne" for "megagram").
* An alias unit may be used by other units defined with the prefix of the same type, unless * An alias unit may be used by other units defined with the prefix of the same type, unless
* no_prefix is provided for PT template parameter (in such a case it is impossible to define * no_prefix is provided for PF template parameter (in such a case it is impossible to define
* a prefix unit based on this one). * a prefix unit based on this one).
* *
* @tparam U Unit for which an alias is defined * @tparam U Unit for which an alias is defined
* @tparam Symbol a short text representation of the unit * @tparam Symbol a short text representation of the unit
* @tparam PT no_prefix or a type of prefix family * @tparam PF no_prefix or a type of prefix family
*/ */
template<Unit U, basic_symbol_text Symbol, PrefixFamily PT> template<Unit U, basic_symbol_text Symbol, PrefixFamily PF>
struct alias_unit : U { struct alias_unit : U {
static constexpr bool is_named = true; static constexpr bool is_named = true;
static constexpr auto symbol = Symbol; static constexpr auto symbol = Symbol;
using prefix_family = PT; using prefix_family = PF;
}; };
/** /**