Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 0eed14e

Browse files
committed
[[ Script ]] Add 'Release' to MCAutoScriptObjectRefArrayBase
This patch adds a Release method to MCAutoScriptObjectRefArrayBase, returning the span and moving its ownership to the caller.
1 parent 174e61d commit 0eed14e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

libscript/include/libscript/script-auto.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ class MCAutoScriptObjectRefArrayBase
145145
return m_values[p_index];
146146
}
147147

148+
MCSpan<T> Release(void)
149+
{
150+
MCSpan<T> t_value = Span();
151+
m_values = nullptr;
152+
m_count = 0;
153+
return t_value;
154+
}
155+
148156
private:
149157
T *m_values;
150158
uindex_t m_count;

0 commit comments

Comments
 (0)