Vector: Fix try_append (hopefully)
Still doesn't work with OwnedStringViews inside of structs.
This commit is contained in:
parent
7f1884213a
commit
ec146caeea
@ -78,7 +78,7 @@ template <typename T> class Vector
|
||||
resize(capacity).release_value();
|
||||
}
|
||||
|
||||
Result<void> try_append(T item)
|
||||
Result<void> try_append(T&& item)
|
||||
{
|
||||
if (m_capacity == m_size) TRY(resize(m_capacity + 8));
|
||||
|
||||
@ -89,6 +89,11 @@ template <typename T> class Vector
|
||||
return {};
|
||||
}
|
||||
|
||||
Result<void> try_append(const T& item)
|
||||
{
|
||||
return try_append(T(item));
|
||||
}
|
||||
|
||||
Option<T> try_pop()
|
||||
{
|
||||
if (m_size == 0) return {};
|
||||
|
Loading…
Reference in New Issue
Block a user