We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8531217 commit b194fd7Copy full SHA for b194fd7
Src/Base/AMReX_Enum.H
@@ -42,11 +42,12 @@ namespace detail
42
T this_value;
43
if (it != r.end()) {
44
this_value = it->second;
45
- } else { // v is an int
+ } else { // v is an int literal
46
// Note that if value_string is not a valid string for int,
47
// it will fail at compile time, because the compiler
48
// will not allow something like `enum FOO : int { x = 3% }`.
49
- this_value = static_cast<T>(std::stoi(value_string));
+ // The base of the integer is auto detected, so 0x/0 prefixes work.
50
+ this_value = static_cast<T>(std::stoi(value_string, nullptr, 0));
51
}
52
r.emplace_back(amrex::trim(kv[0]), this_value);
53
next_value = static_cast<int>(this_value) + 1;
0 commit comments