fix conflict with EMPTY macro in zephyr (#6679)

This commit is contained in:
tomaszduda23 2024-05-06 21:20:01 +02:00 committed by GitHub
parent d1758a46bd
commit 8463f897e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -24,7 +24,7 @@ template<int... S> struct gens<0, S...> { using type = seq<S...>; }; // NOLINT
template<typename T, typename... X> class TemplatableValue {
public:
TemplatableValue() : type_(EMPTY) {}
TemplatableValue() : type_(NONE) {}
template<typename F, enable_if_t<!is_invocable<F, X...>::value, int> = 0>
TemplatableValue(F value) : type_(VALUE), value_(value) {}
@ -32,13 +32,13 @@ template<typename T, typename... X> class TemplatableValue {
template<typename F, enable_if_t<is_invocable<F, X...>::value, int> = 0>
TemplatableValue(F f) : type_(LAMBDA), f_(f) {}
bool has_value() { return this->type_ != EMPTY; }
bool has_value() { return this->type_ != NONE; }
T value(X... x) {
if (this->type_ == LAMBDA) {
return this->f_(x...);
}
// return value also when empty
// return value also when none
return this->value_;
}
@ -58,7 +58,7 @@ template<typename T, typename... X> class TemplatableValue {
protected:
enum {
EMPTY,
NONE,
VALUE,
LAMBDA,
} type_;