-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for std::byte to fmt::join #1981
Comments
#include <fmt/core.h>
int main() {
fmt::print("{}", std::byte(42));
} prints |
My bad: #include <cstddef>
#include <vector>
#include <fmt/core.h>
#include <fmt/format.h>
int main() {
std::vector<std::byte> vv;
fmt::print("{}", fmt::join(vv, ","));
} doesn't work, so this is an issue |
Could this be related to #2014? Btw.: I'd find it much more reasonable, if std::byte got formatted as hex by default (ideally with leading zeros if necessary) - it is supposed to represent raw memory after all, not an integral number. |
@MikeGitb it was an example to get it working for me. You can of course use |
@hellow554 : That was more meant for @vitaut, referring to the result of |
Try to apply the same rules for iterator value type (join) as for regular types. Try to convert iterator value type to a formattable one. For instance if the join operation refers to an enum class iterator (such as std::byte) then try to use the enum class underlying type. Also try to use a fallback formatter if available.
Try to apply the same rules for iterator value type (join) as for regular types. Try to convert iterator value type to a formattable one. For instance if the join operation refers to an enum class iterator (such as std::byte) then try to use the enum class underlying type. Also try to use a fallback formatter if available.
Try to apply the same rules for iterator value type (join) as for regular types. Try to convert iterator value type to a formattable one. For instance if the join operation refers to an enum class iterator (such as std::byte) then try to use the enum class underlying type. Also try to use a fallback formatter if available.
Added a |
Without a
|
There is the
std::byte
type since C++17.It would be nice to have a built-in way to format them properly.
My current ad-hoc solution is
The text was updated successfully, but these errors were encountered: