diff options
author | Karol Kosek <krkk@serenityos.org> | 2023-01-21 15:45:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-22 20:58:42 +0100 |
commit | 2d976ab2a64612e4f3e39723db4a1d6c7ce5d07b (patch) | |
tree | fdc3976a92bbf5f2f392d7146af3c1710db6edf9 /AK/Endian.h | |
parent | c39d3c30b75067a249a2b56bb8e914a023ae9668 (diff) | |
download | serenity-2d976ab2a64612e4f3e39723db4a1d6c7ce5d07b.zip |
AK: Define is_trivially_serializable trait for Little and BigEndian<>
This will allow us get LittleEndian<> and BigEndian<> wrapped types
directly from Stream::read_value<>().
Diffstat (limited to 'AK/Endian.h')
-rw-r--r-- | AK/Endian.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/AK/Endian.h b/AK/Endian.h index 060f78dc9b..bfa64b9777 100644 --- a/AK/Endian.h +++ b/AK/Endian.h @@ -151,6 +151,16 @@ template<typename T> requires(HasFormatter<T>) struct Formatter<BigEndian<T>> : Formatter<T> { }; +template<typename T> +struct Traits<LittleEndian<T>> : public GenericTraits<LittleEndian<T>> { + static constexpr bool is_trivially_serializable() { return Traits<T>::is_trivially_serializable(); } +}; + +template<typename T> +struct Traits<BigEndian<T>> : public GenericTraits<BigEndian<T>> { + static constexpr bool is_trivially_serializable() { return Traits<T>::is_trivially_serializable(); } +}; + } #if USING_AK_GLOBALLY |