LibIPC+IPCCompiler: Templatize encoding/decoding of Optional<T>

This was the last one! IPCCompiler no longer has any type-specific
encoding/decoding logic! :^)
This commit is contained in:
Andreas Kling 2020-05-12 19:02:44 +02:00
commit 413ab652c8
Notes: sideshowbarker 2024-07-19 06:42:11 +09:00
3 changed files with 29 additions and 21 deletions

View file

@ -76,6 +76,15 @@ public:
return *this;
}
template<typename T>
Encoder& operator<<(const Optional<T>& optional)
{
*this << optional.has_value();
if (optional.has_value())
*this << optional.value();
return *this;
}
template<typename T>
void encode(const T& value)
{