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