Fix compile error for vector<bool> format by including fmt/std.h - #302
Open
themightyoarfish wants to merge 1 commit into
Open
Fix compile error for vector<bool> format by including fmt/std.h#302themightyoarfish wants to merge 1 commit into
themightyoarfish wants to merge 1 commit into
Conversation
The codebase is trying to format bool vectors, which used to fail with fmt (fmtlib/fmt#3567) but is supported nowadays, but it requires including this header. Otherwise we get something like this ``` /opt/homebrew/include/fmt/base.h:2310:45: error: implicit instantiation of undefined template 'fmt::detail::type_is_unformattable_for<std::__bit_const_reference<std::vector<bool>>, char>' 2310 | type_is_unformattable_for<T, char_type> _; | ^ /opt/homebrew/include/fmt/base.h:2283:44: note: in instantiation of function template specialization 'fmt::detail::value<fmt::context>::value<std::__bit_const_reference<std::vector<bool>>, 0>' requested here 2283 | FMT_CONSTEXPR20 FMT_INLINE value(T& x) : value(x, custom_tag()) {} | ^ /opt/homebrew/include/fmt/format.h:4349:40: note: in instantiation of function template specialization 'fmt::detail::value<fmt::context>::value<const std::__bit_const_reference<std::vector<bool>>, 0>' requested here 4349 | return vformat(fmt.str, vargs<T...>{{args...}}); | ^ /Users/rasmus/Downloads/source_builds/glim/include/glim/util/convert_to_string.hpp:15:15: note: in instantiation of function template specialization 'fmt::format<const std::__bit_const_reference<std::vector<bool>> &>' requested here 15 | return fmt::format("{}", value); | ^ /Users/rasmus/Downloads/source_builds/glim/include/glim/util/convert_to_string.hpp:26:12: note: in instantiation of function template specialization 'glim::convert_to_string<std::__bit_const_reference<std::vector<bool>>>' requested here 26 | sst << convert_to_string(values[i]); | ^ /Users/rasmus/Downloads/source_builds/glim/include/glim/util/config_impl.hpp:152:42: note: in instantiation of function template specialization 'glim::convert_to_string<bool>' requested here 152 | spdlog::warn("use default_value={}", convert_to_string(default_value)); | ^ /opt/homebrew/include/fmt/base.h:2150:45: note: template is declared here 2150 | template <typename T, typename Char> struct type_is_unformattable_for; … ``` at least on macos with current homebrew fmt and spdlog.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The codebase is trying to format bool vectors, which used to fail with fmt (fmtlib/fmt#3567) but is supported nowadays, but it requires including this header. Otherwise we get something like this
at least on macos with current homebrew fmt and spdlog.