I'm getting inconsistent behaviour trying to format a vector of bools across different environments:
#include <vector>
#include <fmt/core.h>
#include <fmt/ranges.h>
int main() {
std::vector<bool> vec = {true, false, true};
fmt::print("Vector contents: {}\n", vec);
return 0;
}
This works fine in several environments:
But fails on:
clang++ -std=c++23 -I libraries/fmt/include
With this error:
error: implicit instantiation of undefined template 'fmt::detail::type_is_unformattable_for<std::vector<bool>, char>'
All tests use fmt from trunk and c++23. What's causing this inconsistency and how can I fix it?
Adding the fmt/std.h
resolved the issue as it provides the formatter for the proxy type used by vector<bool>
.
#include <fmt/std.h>
More details: https://github.com/fmtlib/fmt/issues/4026