As per cppref, std::from_chars can convert a string to an integer. In C++, bool is an integral type. So I think the following code is intuitive and expressive:
auto const sv = "true"sv;
auto b = bool{};
std::from_chars(sv.data(), sv.data() + sv.size(), b); // compiler error
assert(b);
However, libc++ explicitly deleted the overloaded function:
from_chars_result from_chars(const char*, const char*, bool, int = 10) = delete;
I just wonder:
Why does the C++17 standard not allow converting a string to a bool?
This is LWG 3266 which points out that: