mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
AK: Add stream operators for Optional.
This commit is contained in:
10
AK/Stream.h
10
AK/Stream.h
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user