AK: Add formatters for BigEndian and LittleEndian

This allows printing out BigEndian and LittleEndian values without
having to perform a static_cast first.
This commit is contained in:
sin-ack 2021-07-30 20:14:06 +00:00 committed by Andreas Kling
parent 0990c23fc3
commit 05c3755e62
Notes: sideshowbarker 2024-07-18 07:37:38 +09:00

View file

@ -6,6 +6,7 @@
#pragma once
#include <AK/Format.h>
#include <AK/Forward.h>
#include <AK/Platform.h>
@ -134,6 +135,14 @@ private:
template<typename T>
using NetworkOrdered = BigEndian<T>;
template<typename T>
requires(HasFormatter<T>) struct Formatter<LittleEndian<T>> : Formatter<T> {
};
template<typename T>
requires(HasFormatter<T>) struct Formatter<BigEndian<T>> : Formatter<T> {
};
}
using AK::BigEndian;