Skip to content

Commit

Permalink
Fix gcc compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
bindreams committed May 4, 2024
1 parent e96de23 commit 3157324
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/zint/src/enum_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ struct EnumInfo {
// if same size as holder type and unsigned (does not fit)
.needs_reinterpretation_as_unsigned =
std::is_unsigned_v<underlying_type> && sizeof(underlying_type) == sizeof(Value::value_type),
.name{name},
.py_base{py_base},
.docstring{docstring}
.name = std::string{name},
.py_base = std::string{py_base},
.docstring = std::string{docstring}
};
}

template<typename T>
EnumInfo& add(std::string_view name, T value, std::string_view docstring = "") {
static_assert(std::is_enum_v<T> || std::is_integral_v<T>, "Can only add integral values");

items.push_back(Value{.name{name}, .value = static_cast<Value::value_type>(value), .docstring{docstring}});
items.push_back(Value{
.name = std::string{name},
.value = static_cast<Value::value_type>(value),
.docstring = std::string{docstring}
});
return *this;
}

Expand Down

0 comments on commit 3157324

Please sign in to comment.