mirror of
https://github.com/mpusz/mp-units.git
synced 2025-07-30 10:27:16 +02:00
refactor: some TODO comments resolved
This commit is contained in:
@ -90,8 +90,6 @@ void print(const R& gliders)
|
|||||||
for (const auto& p : g.polar) {
|
for (const auto& p : g.polar) {
|
||||||
const auto ratio = glide_ratio(g.polar[0]).force_in(one);
|
const auto ratio = glide_ratio(g.polar[0]).force_in(one);
|
||||||
std::cout << MP_UNITS_STD_FMT::format(" * {::N[.4]} @ {::N[.1]} -> {::N[.1]} ({::N[.1]})\n", p.climb, p.v, ratio,
|
std::cout << MP_UNITS_STD_FMT::format(" * {::N[.4]} @ {::N[.1]} -> {::N[.1]} ({::N[.1]})\n", p.climb, p.v, ratio,
|
||||||
// TODO is it possible to make ADL work below (we need another set of trig
|
|
||||||
// functions for strong angle in a different namespace)
|
|
||||||
si::asin(1 / ratio).force_in(si::degree));
|
si::asin(1 / ratio).force_in(si::degree));
|
||||||
}
|
}
|
||||||
std::cout << "\n";
|
std::cout << "\n";
|
||||||
@ -168,8 +166,6 @@ void example()
|
|||||||
const auto weather_conditions = get_weather_conditions();
|
const auto weather_conditions = get_weather_conditions();
|
||||||
const task t = {waypoints[0], waypoints[1], waypoints[0]};
|
const task t = {waypoints[0], waypoints[1], waypoints[0]};
|
||||||
const aircraft_tow tow = {400 * m, 1.6 * m / s};
|
const aircraft_tow tow = {400 * m, 1.6 * m / s};
|
||||||
// TODO use C++20 date library when available
|
|
||||||
// set `start_time` to 11:00 am today
|
|
||||||
const timestamp start_time(std::chrono::system_clock::now());
|
const timestamp start_time(std::chrono::system_clock::now());
|
||||||
|
|
||||||
print(sfty);
|
print(sfty);
|
||||||
|
@ -87,14 +87,9 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// TODO revise the below when clang-18 is released
|
|
||||||
#if MP_UNITS_COMP_CLANG >= 18 && __cplusplus >= 202300L && !defined __cpp_explicit_this_parameter
|
|
||||||
|
|
||||||
#define __cpp_explicit_this_parameter 202110L
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined __cpp_lib_ranges_to_container
|
#if !defined __cpp_lib_ranges_to_container
|
||||||
|
|
||||||
namespace std {
|
namespace std {
|
||||||
|
@ -88,9 +88,8 @@ void to_base_specialization_of(const volatile Type<Params...>*);
|
|||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template<typename T, template<typename...> typename Type>
|
template<typename T, template<typename...> typename Type>
|
||||||
// inline constexpr bool // TODO: Replace with concept when it works with MSVC
|
inline constexpr bool is_derived_from_specialization_of =
|
||||||
concept is_derived_from_specialization_of = requires(T* t) { detail::to_base_specialization_of<Type>(t); };
|
requires(T* t) { detail::to_base_specialization_of<Type>(t); };
|
||||||
|
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
|
|
||||||
|
@ -406,9 +406,6 @@ static_assert((std::uint8_t{255}* m %= 257 * m).numerical_value_in(m) != [] {
|
|||||||
return ui %= 257;
|
return ui %= 257;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
// TODO ICE
|
|
||||||
// (https://developercommunity2.visualstudio.com/t/ICE-on-a-constexpr-operator-in-mp-unit/1302907)
|
|
||||||
#ifndef MP_UNITS_COMP_MSVC
|
|
||||||
// clang-17 with modules build on ignores disabling conversion warnings
|
// clang-17 with modules build on ignores disabling conversion warnings
|
||||||
#if !(defined MP_UNITS_COMP_CLANG && MP_UNITS_COMP_CLANG < 18 && defined MP_UNITS_MODULES)
|
#if !(defined MP_UNITS_COMP_CLANG && MP_UNITS_COMP_CLANG < 18 && defined MP_UNITS_MODULES)
|
||||||
// next two lines trigger conversions warnings
|
// next two lines trigger conversions warnings
|
||||||
@ -418,7 +415,6 @@ static_assert((22 * m /= 3.33).numerical_value_in(m) == 6);
|
|||||||
static_assert((22 * m *= 33.33 * one).numerical_value_in(m) == 733);
|
static_assert((22 * m *= 33.33 * one).numerical_value_in(m) == 733);
|
||||||
static_assert((22 * m /= 3.33 * one).numerical_value_in(m) == 6);
|
static_assert((22 * m /= 3.33 * one).numerical_value_in(m) == 6);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
|
|
||||||
template<template<auto, typename> typename Q>
|
template<template<auto, typename> typename Q>
|
||||||
concept invalid_compound_assignments = requires() {
|
concept invalid_compound_assignments = requires() {
|
||||||
@ -847,8 +843,8 @@ static_assert(10 * isq::mechanical_energy[J] == 5 * isq::force[N] * (2 * isq::le
|
|||||||
static_assert(1 * si::si2019::speed_of_light_in_vacuum == 299'792'458 * isq::speed[m / s]);
|
static_assert(1 * si::si2019::speed_of_light_in_vacuum == 299'792'458 * isq::speed[m / s]);
|
||||||
|
|
||||||
// Different named dimensions
|
// Different named dimensions
|
||||||
template</*Reference*/ auto R1, /*Reference*/ auto R2> // TODO Use `Reference` when Clang supports it.
|
template<Reference auto R1, Reference auto R2>
|
||||||
concept invalid_comparison = !requires { 2 * R1 == 2 * R2; } && !requires { 2 * R2 == 2 * R1; };
|
inline constexpr bool invalid_comparison = !requires { 2 * R1 == 2 * R2; } && !requires { 2 * R2 == 2 * R1; };
|
||||||
static_assert(invalid_comparison<isq::activity[Bq], isq::frequency[Hz]>);
|
static_assert(invalid_comparison<isq::activity[Bq], isq::frequency[Hz]>);
|
||||||
|
|
||||||
|
|
||||||
|
@ -210,7 +210,6 @@ static_assert(kilojoule.symbol == "kJ");
|
|||||||
static_assert(is_of_type<si::kilo<metre>, si::kilo_<metre_>>);
|
static_assert(is_of_type<si::kilo<metre>, si::kilo_<metre_>>);
|
||||||
static_assert(is_of_type<si::kilo<joule>, si::kilo_<joule_>>);
|
static_assert(is_of_type<si::kilo<joule>, si::kilo_<joule_>>);
|
||||||
|
|
||||||
// TODO Should the below be a scaled version of metre^2?
|
|
||||||
static_assert(is_of_type<kilometre * metre, derived_unit<kilometre_, metre_>>); // !!!
|
static_assert(is_of_type<kilometre * metre, derived_unit<kilometre_, metre_>>); // !!!
|
||||||
static_assert(is_of_type<kilometre / metre, derived_unit<kilometre_, per<metre_>>>); // !!!
|
static_assert(is_of_type<kilometre / metre, derived_unit<kilometre_, per<metre_>>>); // !!!
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user