We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c6b3542 commit 4742c46Copy full SHA for 4742c46
1 file changed
include/rfl/xml/Reader.hpp
@@ -85,7 +85,14 @@ struct Reader {
85
return std::visit(get_value, _var.node_or_attribute_);
86
87
} else if constexpr (std::is_same<std::remove_cvref_t<T>, bool>()) {
88
- return std::visit(get_value, _var.node_or_attribute_) == "true";
+ const auto val = std::visit(get_value, _var.node_or_attribute_);
89
+ if (val == "true" || val == "1") {
90
+ return true;
91
+ } else if (val == "false" || val == "0") {
92
+ return false;
93
+ } else {
94
+ return error("Could not cast '" + val + "' to boolean.");
95
+ }
96
97
} else if constexpr (std::is_floating_point<std::remove_cvref_t<T>>()) {
98
const auto str = std::visit(get_value, _var.node_or_attribute_);
0 commit comments