Skip to content

Commit

Permalink
fix bitset constructor (#367)
Browse files Browse the repository at this point in the history
  • Loading branch information
asolwa authored Jul 19, 2024
1 parent 664ee62 commit 9a9308f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions include/magic_enum/magic_enum_containers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,14 +621,14 @@ class bitset {
constexpr explicit bitset(string_view sv, Cmp&& cmp = {}, char_type sep = static_cast<char_type>('|')) {
for (std::size_t to = 0; (to = magic_enum::detail::find(sv, sep)) != string_view::npos; sv.remove_prefix(to + 1)) {
if (auto v = enum_cast<E>(sv.substr(0, to), cmp)) {
set(v);
set(*v);
} else {
MAGIC_ENUM_THROW(std::invalid_argument("magic_enum::containers::bitset::constructor: Unrecognized enum value in string"));
}
}
if (!sv.empty()) {
if (auto v = enum_cast<E>(sv, cmp)) {
set(v);
set(*v);
} else {
MAGIC_ENUM_THROW(std::invalid_argument("magic_enum::containers::bitset::constructor: Unrecognized enum value in string"));
}
Expand Down

0 comments on commit 9a9308f

Please sign in to comment.