refactor: QuantityValue concept renamed to Representation
This commit is contained in:
1 parent
67b2ad5d05
commit
88e642ec74
97 files changed
+197
-197
No files matched your search
@@ -93,14 +93,14 @@ static_assert(UnitOf<si::kilometre, si::dim_length>);
|
||||
static_assert(UnitOf<si::fps::mile, si::dim_length>);
|
||||
static_assert(!UnitOf<si::second, si::dim_length>);
|
||||
|
||||
// QuantityValue
|
||||
// Representation
|
||||
|
||||
static_assert(QuantityValue<int>);
|
||||
static_assert(QuantityValue<std::complex<double>>);
|
||||
static_assert(!QuantityValue<si::length<si::metre>>);
|
||||
static_assert(!QuantityValue<std::optional<si::length<si::metre>>>);
|
||||
static_assert(!QuantityValue<std::mutex>);
|
||||
static_assert(!QuantityValue<std::string>);
|
||||
static_assert(Representation<int>);
|
||||
static_assert(Representation<std::complex<double>>);
|
||||
static_assert(!Representation<si::length<si::metre>>);
|
||||
static_assert(!Representation<std::optional<si::length<si::metre>>>);
|
||||
static_assert(!Representation<std::mutex>);
|
||||
static_assert(!Representation<std::string>);
|
||||
|
||||
// Quantity
|
||||
|
||||
|
||||
@@ -29,10 +29,10 @@ namespace {
|
||||
* @brief Representation type meeting minimum requirements
|
||||
*
|
||||
* This type with a default Mode = 0 provides the minimum set of requirements to
|
||||
* satisfy @c QuantityValue concept which is used for quantity's representation type.
|
||||
* satisfy @c Representation concept which is used for quantity's representation type.
|
||||
*
|
||||
* In case of Mode != 0 only one of mandatory operation is removed which should
|
||||
* result in @c QuantityValue concept not being satisfied.
|
||||
* result in @c Representation concept not being satisfied.
|
||||
*
|
||||
* @tparam Mode a flag to disable specific type's operations
|
||||
*/
|
||||
@@ -140,20 +140,20 @@ static_assert(!std::constructible_from<length<metre, int>, dimensionless<one, mi
|
||||
static_assert(!std::convertible_to<dimensionless<one, min_expl<>>, length<metre, int>>);
|
||||
|
||||
// all operations needed to satisfy concept
|
||||
static_assert(QuantityValue<min_expl<>>);
|
||||
static_assert(!QuantityValue<min_expl<1>>);
|
||||
static_assert(!QuantityValue<min_expl<2>>);
|
||||
static_assert(!QuantityValue<min_expl<3>>);
|
||||
static_assert(Representation<min_expl<>>);
|
||||
static_assert(!Representation<min_expl<1>>);
|
||||
static_assert(!Representation<min_expl<2>>);
|
||||
static_assert(!Representation<min_expl<3>>);
|
||||
#if !defined(UNITS_COMP_GCC) || UNITS_COMP_GCC > 10 || UNITS_COMP_GCC_MINOR > 1
|
||||
static_assert(!QuantityValue<min_expl<4>>);
|
||||
static_assert(!Representation<min_expl<4>>);
|
||||
#endif
|
||||
static_assert(!QuantityValue<min_expl<5>>);
|
||||
static_assert(!Representation<min_expl<5>>);
|
||||
#if !defined(UNITS_COMP_GCC) || UNITS_COMP_GCC > 10 || UNITS_COMP_GCC_MINOR > 1
|
||||
static_assert(!QuantityValue<min_expl<6>>);
|
||||
static_assert(!Representation<min_expl<6>>);
|
||||
#endif
|
||||
static_assert(!QuantityValue<min_expl<7>>);
|
||||
static_assert(!QuantityValue<min_expl<8>>);
|
||||
static_assert(!QuantityValue<min_expl<9>>);
|
||||
static_assert(!Representation<min_expl<7>>);
|
||||
static_assert(!Representation<min_expl<8>>);
|
||||
static_assert(!Representation<min_expl<9>>);
|
||||
|
||||
// quantity's operators should mirror the representation type capabilities
|
||||
template<typename Rep>
|
||||
|
||||
@@ -62,8 +62,8 @@ namespace {
|
||||
using namespace units;
|
||||
using namespace units::isq::si;
|
||||
|
||||
static_assert(QuantityValue<min_impl<int>>);
|
||||
static_assert(QuantityValue<min_impl<double>>);
|
||||
static_assert(Representation<min_impl<int>>);
|
||||
static_assert(Representation<min_impl<double>>);
|
||||
|
||||
// construction from a value
|
||||
static_assert(std::constructible_from<length<metre, min_impl<int>>, min_impl<int>>);
|
||||
|
||||
@@ -36,14 +36,14 @@ using namespace units::isq::si;
|
||||
struct sq_volt_per_hertz : unit<sq_volt_per_hertz> {};
|
||||
struct dim_power_spectral_density : derived_dimension<dim_power_spectral_density, sq_volt_per_hertz, units::exponent<dim_voltage, 2>, units::exponent<dim_frequency, -1>> {};
|
||||
|
||||
template<UnitOf<dim_power_spectral_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_power_spectral_density> U, Representation Rep = double>
|
||||
using power_spectral_density = quantity<dim_power_spectral_density, U, Rep>;
|
||||
|
||||
// amplitude spectral density
|
||||
struct volt_per_sqrt_hertz : unit<volt_per_sqrt_hertz> {};
|
||||
struct dim_amplitude_spectral_density : derived_dimension<dim_amplitude_spectral_density, volt_per_sqrt_hertz, units::exponent<dim_voltage, 1>, units::exponent<dim_frequency, -1, 2>> {};
|
||||
|
||||
template<UnitOf<dim_amplitude_spectral_density> U, QuantityValue Rep = double>
|
||||
template<UnitOf<dim_amplitude_spectral_density> U, Representation Rep = double>
|
||||
using amplitude_spectral_density = quantity<dim_amplitude_spectral_density, U, Rep>;
|
||||
|
||||
}
|
||||
|
||||
@@ -58,17 +58,17 @@ struct time_kind : kind<time_kind, dim_time> {};
|
||||
|
||||
struct cgs_width_kind : kind<cgs_width_kind, cgs::dim_length> {};
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using radius = quantity_kind<radius_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using radius = quantity_kind<radius_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using horizontal_area = quantity_kind<horizontal_area_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
|
||||
template <Unit U = one, QuantityValue Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
|
||||
/////////////
|
||||
// concepts
|
||||
|
||||
@@ -64,21 +64,21 @@ struct nth_orange_kind : point_kind<nth_orange_kind, orange> {};
|
||||
struct time_kind : kind<time_kind, dim_time> {};
|
||||
struct time_point_kind : point_kind<time_point_kind, time_kind> {};
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using abscissa = quantity_point_kind<abscissa_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using ordinate = quantity_point_kind<ordinate_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using width = quantity_kind<width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using height = quantity_kind<height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using abscissa = quantity_point_kind<abscissa_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using ordinate = quantity_point_kind<ordinate_kind, U, Rep>;
|
||||
|
||||
template <Unit U, QuantityValue Rep = double> using distance = quantity_kind<distance_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using cgs_height = quantity_kind<cgs_height_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, QuantityValue Rep = double> using altitude = quantity_point_kind<altitude_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using distance = quantity_kind<distance_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using cgs_width = quantity_kind<cgs_width_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using cgs_height = quantity_kind<cgs_height_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using rate_of_climb = quantity_kind<rate_of_climb_kind, U, Rep>;
|
||||
template <Unit U, Representation Rep = double> using altitude = quantity_point_kind<altitude_kind, U, Rep>;
|
||||
|
||||
template <Unit U = one, QuantityValue Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using nth_apple = quantity_point_kind<nth_apple_kind, U, Rep>;
|
||||
template <Unit U = one, QuantityValue Rep = double> using nth_orange = quantity_point_kind<nth_orange_kind, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using apples = quantity_kind<apple, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using oranges = quantity_kind<orange, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using nth_apple = quantity_point_kind<nth_apple_kind, U, Rep>;
|
||||
template <Unit U = one, Representation Rep = double> using nth_orange = quantity_point_kind<nth_orange_kind, U, Rep>;
|
||||
|
||||
/////////////
|
||||
// concepts
|
||||
|
||||
Reference in new issue
Block a user