diff --git a/libluna/include/luna/Option.h b/libluna/include/luna/Option.h index 70266c0f..40307203 100644 --- a/libluna/include/luna/Option.h +++ b/libluna/include/luna/Option.h @@ -109,6 +109,13 @@ template class Option return true; } + // NOTE: This should also exist in Result. + T* operator->() + { + expect(has_value(), "Option::operator-> called on an empty Option"); + return &m_storage.fetch_reference(); + } + ~Option() { if (has_value()) m_storage.destroy();