From 3e8efb0d65c32556d4a9cb603966beacfd61b29d Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 20 Mar 2026 16:35:46 +0100 Subject: kstd/format: add support for std::byte --- .../include/kstd/bits/format/formatter/byte.hpp | 23 ++++++++++++++++++++++ libs/kstd/include/kstd/format | 1 + 2 files changed, 24 insertions(+) create mode 100644 libs/kstd/include/kstd/bits/format/formatter/byte.hpp (limited to 'libs') diff --git a/libs/kstd/include/kstd/bits/format/formatter/byte.hpp b/libs/kstd/include/kstd/bits/format/formatter/byte.hpp new file mode 100644 index 0000000..70d98f4 --- /dev/null +++ b/libs/kstd/include/kstd/bits/format/formatter/byte.hpp @@ -0,0 +1,23 @@ +#ifndef KSTD_BITS_FORMAT_FORMATTER_BYTE_HPP +#define KSTD_BITS_FORMAT_FORMATTER_BYTE_HPP + +#include "../context.hpp" +#include "../formatter.hpp" +#include "integral.hpp" + +#include + +namespace kstd +{ + + template<> + struct formatter : formatter + { + auto format(std::byte value, format_context & context) const -> void + { + formatter::format(static_cast(value), context); + } + }; + +} // namespace kstd +#endif \ No newline at end of file diff --git a/libs/kstd/include/kstd/format b/libs/kstd/include/kstd/format index 946ed69..adee5f8 100644 --- a/libs/kstd/include/kstd/format +++ b/libs/kstd/include/kstd/format @@ -6,6 +6,7 @@ #include "bits/format/context.hpp" // IWYU pragma: export #include "bits/format/formatter.hpp" // IWYU pragma: export #include "bits/format/formatter/bool.hpp" // IWYU pragma: export +#include "bits/format/formatter/byte.hpp" // IWYU pragma: export #include "bits/format/formatter/cstring.hpp" // IWYU pragma: export #include "bits/format/formatter/integral.hpp" // IWYU pragma: export #include "bits/format/formatter/ordering.hpp" // IWYU pragma: export -- cgit v1.2.3