fix: ranged_representation fixed for clang-12

This commit is contained in:
Mateusz Pusz
2022-04-22 13:26:31 +02:00
parent c598201d11
commit 967c1c9ca9

View File

@@ -23,6 +23,7 @@
#pragma once #pragma once
#include "validated_type.h" #include "validated_type.h"
#include <units/bits/external/hacks.h>
#include <algorithm> #include <algorithm>
#include <type_traits> #include <type_traits>
@@ -30,11 +31,13 @@ template<typename T, auto Min, auto Max>
inline constexpr auto is_in_range = [](const auto& v) { return std::clamp(v, T{Min}, T{Max}) == v; }; inline constexpr auto is_in_range = [](const auto& v) { return std::clamp(v, T{Min}, T{Max}) == v; };
template<typename T, auto Min, auto Max> template<typename T, auto Min, auto Max>
class ranged_representation : public validated_type<T, decltype(is_in_range<T, Min, Max>)> { using is_in_range_t = decltype(is_in_range<T, Min, Max>);
template<typename T, auto Min, auto Max>
class ranged_representation : public validated_type<T, is_in_range_t<T, Min, Max>> {
public: public:
using base = validated_type<T, decltype(is_in_range<T, Min, Max>)>; using validated_type<T, is_in_range_t<T, Min, Max>>::validated_type;
using base::validated_type; constexpr ranged_representation() : validated_type<T, is_in_range_t<T, Min, Max>>(T{}) {}
constexpr ranged_representation() : base(T{}) {}
[[nodiscard]] constexpr ranged_representation operator-() const { return ranged_representation(-this->value()); } [[nodiscard]] constexpr ranged_representation operator-() const { return ranged_representation(-this->value()); }
}; };