mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
AK: Add stream operators for Optional.
This commit is contained in:
parent
e3bfe0b509
commit
18b3de7555
Notes:
sideshowbarker
2024-07-19 03:07:16 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/18b3de75555 Pull-request: https://github.com/SerenityOS/serenity/pull/3309 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/stelar7
1 changed files with 10 additions and 0 deletions
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
|
||||
|
|
Loading…
Reference in a new issue