mirror of
https://github.com/Neargye/magic_enum.git
synced 2026-01-09 23:34:23 +00:00
fix bitset constructor (#367)
This commit is contained in:
parent
664ee62c12
commit
9a9308fd54
1 changed files with 2 additions and 2 deletions
|
|
@ -621,14 +621,14 @@ class bitset {
|
||||||
constexpr explicit bitset(string_view sv, Cmp&& cmp = {}, char_type sep = static_cast<char_type>('|')) {
|
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)) {
|
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)) {
|
if (auto v = enum_cast<E>(sv.substr(0, to), cmp)) {
|
||||||
set(v);
|
set(*v);
|
||||||
} else {
|
} else {
|
||||||
MAGIC_ENUM_THROW(std::invalid_argument("magic_enum::containers::bitset::constructor: Unrecognized enum value in string"));
|
MAGIC_ENUM_THROW(std::invalid_argument("magic_enum::containers::bitset::constructor: Unrecognized enum value in string"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!sv.empty()) {
|
if (!sv.empty()) {
|
||||||
if (auto v = enum_cast<E>(sv, cmp)) {
|
if (auto v = enum_cast<E>(sv, cmp)) {
|
||||||
set(v);
|
set(*v);
|
||||||
} else {
|
} else {
|
||||||
MAGIC_ENUM_THROW(std::invalid_argument("magic_enum::containers::bitset::constructor: Unrecognized enum value in string"));
|
MAGIC_ENUM_THROW(std::invalid_argument("magic_enum::containers::bitset::constructor: Unrecognized enum value in string"));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue