mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-01 11:57:19 +02:00
AK: Don't implicitly convert Optional<T&> to Optional<T>
C++ will jovially select the implicit conversion operator, even if it's complete bogus, such as for unknown-size types or non-destructible types. Therefore, all such conversions (which incur a copy) must (unfortunately) be explicit so that non-copyable types continue to work.
This commit is contained in:
committed by
Tim Schumacher
parent
dfe3cfa0ba
commit
a3077203fe
@@ -41,7 +41,7 @@ bool ModuleMap::is(URL::URL const& url, ByteString const& type, EntryType entry_
|
||||
|
||||
Optional<ModuleMap::Entry> ModuleMap::get(URL::URL const& url, ByteString const& type) const
|
||||
{
|
||||
return m_values.get({ url, type });
|
||||
return m_values.get({ url, type }).copy();
|
||||
}
|
||||
|
||||
AK::HashSetResult ModuleMap::set(URL::URL const& url, ByteString const& type, Entry entry)
|
||||
|
||||
Reference in New Issue
Block a user