diff options
| author | Felix Morgner <felix.morgner@ost.ch> | 2026-03-20 16:35:46 +0100 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@ost.ch> | 2026-03-20 16:35:46 +0100 |
| commit | 3e8efb0d65c32556d4a9cb603966beacfd61b29d (patch) | |
| tree | bc951720c49da759453db414f68fd35b30027142 | |
| parent | f59a839ad60e941697797a9e3a81a5098b2b945f (diff) | |
| download | teachos-3e8efb0d65c32556d4a9cb603966beacfd61b29d.tar.xz teachos-3e8efb0d65c32556d4a9cb603966beacfd61b29d.zip | |
kstd/format: add support for std::byte
| -rw-r--r-- | libs/kstd/include/kstd/bits/format/formatter/byte.hpp | 23 | ||||
| -rw-r--r-- | libs/kstd/include/kstd/format | 1 |
2 files changed, 24 insertions, 0 deletions
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 <cstddef> + +namespace kstd +{ + + template<> + struct formatter<std::byte> : formatter<int> + { + auto format(std::byte value, format_context & context) const -> void + { + formatter<int>::format(static_cast<int>(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 |
