refactor(example): glide computer refactored for V2

This commit is contained in:
Mateusz Pusz
2022-12-23 19:24:56 +01:00
parent 278dbace98
commit fd26f8cdff
5 changed files with 258 additions and 68 deletions
+4
View File
@@ -24,6 +24,7 @@
#include "validated_type.h"
#include <units/bits/external/hacks.h>
#include <units/customization_points.h>
#include <algorithm>
#include <type_traits>
@@ -42,6 +43,9 @@ public:
[[nodiscard]] constexpr ranged_representation operator-() const { return ranged_representation(-this->value()); }
};
template<typename T, auto Min, auto Max>
inline constexpr bool units::is_scalar<ranged_representation<T, Min, Max>> = units::is_scalar<T>;
template<typename T, auto Min, auto Max>
struct std::common_type<std::intmax_t, ranged_representation<T, Min, Max>> :
std::type_identity<ranged_representation<std::common_type_t<std::intmax_t, T>, Min, Max>> {};