mirror of
https://github.com/nlohmann/json.git
synced 2025-07-22 15:21:52 +03:00
✨ added overload for std::vector<bool> #494
Adds a to_json function for std::vector<bool> to allow implicit conversion from bit vectors to basic_json.
This commit is contained in:
@ -795,4 +795,13 @@ TEST_CASE("regression tests")
|
||||
std::string s2 = j2.dump();
|
||||
CHECK(s1 == s2);
|
||||
}
|
||||
|
||||
SECTION("issue #494 - conversion from vector<bool> to json fails to build")
|
||||
{
|
||||
std::vector<bool> boolVector = {false, true, false, false};
|
||||
json j;
|
||||
j["bool_vector"] = boolVector;
|
||||
|
||||
CHECK(j["bool_vector"].dump() == "[false,true,false,false]");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user