mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:57:46 +00:00
AK: Make HashMap::get(Key) return an Optional<Value>.
This allows HashMap::get() to be used for value types that cannot be default constructed (e.g NonnullOwnPtr.)
This commit is contained in:
parent
e2798d6208
commit
1d0b464618
10 changed files with 27 additions and 17 deletions
|
@ -103,7 +103,9 @@ public:
|
|||
return fallback;
|
||||
}
|
||||
|
||||
operator bool() const { return has_value(); }
|
||||
|
||||
private:
|
||||
char m_storage[sizeof(T)] __attribute__((aligned(sizeof(T))));
|
||||
char m_storage[sizeof(T)];
|
||||
bool m_has_value { false };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue