LibIPC: Remove requirement that Variant types must begin with Empty

This is no longer required by the decoder.
This commit is contained in:
Timothy Flynn
2022-12-22 21:29:36 -05:00
committed by Andreas Kling
parent 9b483625e6
commit 4abafbbe3c

View File

@@ -89,12 +89,9 @@ public:
return *this;
}
// Note: We require any encodeable variant to have Empty as its first variant, as only possibly-empty variants can be default constructed.
// The default constructability is required by generated IPC message marshalling code.
template<typename... VariantTypes>
Encoder& operator<<(AK::Variant<AK::Empty, VariantTypes...> const& variant)
Encoder& operator<<(AK::Variant<VariantTypes...> const& variant)
{
// Note: This might be either u8 or size_t depending on the size of the variant; both are encodeable.
*this << variant.index();
variant.visit([this](auto const& underlying_value) { *this << underlying_value; });
return *this;