diff options
Diffstat (limited to 'core/vector.h')
-rw-r--r-- | core/vector.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/vector.h b/core/vector.h index b2133f800b..74e0ab91c0 100644 --- a/core/vector.h +++ b/core/vector.h @@ -39,6 +39,7 @@ #include "core/cowdata.h" #include "core/error_macros.h" +#include "core/os/copymem.h" #include "core/os/memory.h" #include "core/sort_array.h" @@ -125,6 +126,13 @@ public: return *this; } + Vector<uint8_t> to_byte_array() const { + Vector<uint8_t> ret; + ret.resize(size() * sizeof(T)); + copymem(ret.ptrw(), ptr(), sizeof(T) * size()); + return ret; + } + Vector<T> subarray(int p_from, int p_to) const { if (p_from < 0) { |