From 7b0b554cd5866c35987d3b239fecf145edddc092 Mon Sep 17 00:00:00 2001 From: wh201906 Date: Thu, 9 Apr 2026 01:17:47 +0800 Subject: [PATCH] Add doc for `ArrayBuffer::move()` --- docs/docs/types/array-buffers.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/docs/types/array-buffers.md b/docs/docs/types/array-buffers.md index 5bfdb868f..afa8bfd73 100644 --- a/docs/docs/types/array-buffers.md +++ b/docs/docs/types/array-buffers.md @@ -198,12 +198,17 @@ ArrayBuffers also provide helper and conversion methods for the language-native ``` - C++ often uses [`std::vector`](https://en.cppreference.com/w/cpp/container/vector) to represent Data. + C++ often uses [`std::vector`](https://en.cppreference.com/w/cpp/container/vector) to represent Data. Use `copy()` to duplicate the bytes into a new owning `ArrayBuffer`. ```cpp std::vector data; auto buffer = ArrayBuffer::copy(data); /* convert back to vector would be a copy. */ ``` + Use `move()` to transfer a vector's storage without an extra copy. + ```cpp + std::vector data; + auto buffer = ArrayBuffer::move(std::move(data)); + ```