Closed k-nero closed 7 months ago
Version of Boost 1.84.0
Code:
class X { public: X() : x(false) {} X(bool x) : x(x) {} protected: bool x; BOOST_DESCRIBE_CLASS(X, (), (), (x), ()) }; int main() { try { boost::json::value jv = { { "x", 0 } }; auto a = boost::json::value_to<X>(jv); } catch (std::exception const& e) { std::cerr << "Error: " << e.what() << std::endl; } }
This would faild and throw an exception: Error: value is not boolean
Yes. This is by design. 0 is not a boolean value.
Version of Boost 1.84.0
Code:
This would faild and throw an exception: Error: value is not boolean