AK: Add stream operators for Optional.

This commit is contained in:
asynts 2020-08-25 15:18:54 +02:00 committed by Andreas Kling
parent e3bfe0b509
commit 18b3de7555
Notes: sideshowbarker 2024-07-19 03:07:16 +09:00

View file

@ -31,6 +31,7 @@
#include <AK/Endian.h>
#include <AK/Forward.h>
#include <AK/MemMem.h>
#include <AK/Optional.h>
#include <AK/Span.h>
#include <AK/StdLibExtras.h>
#include <AK/Vector.h>
@ -104,6 +105,15 @@ InputStream& operator<<(InputStream& stream, BigEndian<T> value)
return stream;
}
template<typename T>
InputStream& operator>>(InputStream& stream, Optional<T>& value)
{
T temporary;
stream >> temporary;
value = temporary;
return stream;
}
#if defined(__cpp_concepts) && !defined(__COVERITY__)
template<Concepts::Integral Integral>
#else