Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion docs/docs/types/array-buffers.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,17 @@ ArrayBuffers also provide helper and conversion methods for the language-native
```
</TabItem>
<TabItem value="cpp" label="C++">
C++ often uses [`std::vector<uint8_t>`](https://en.cppreference.com/w/cpp/container/vector) to represent Data.
C++ often uses [`std::vector<uint8_t>`](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<uint8_t> 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<uint8_t> data;
auto buffer = ArrayBuffer::move(std::move(data));
```
</TabItem>
</Tabs>

Expand Down