emscripten-core / emscripten-core/emscripten

The optimized way for passing multidimensional numeric arrays from/to cpp

Open
#19,162 3 comments 0 reactions 0 assignees View on GitHub
embind
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

Hi,
I have a general question for passing multidimensional arrays to and from c++ code. Imagine we have the following array.

```
[[[long,long],[long,long],[long,long],[long,long],[long,long],[long,long]],[[long,long],[long,long],[long,long],[long,long],[long,long],[long,long]]]
```

What is the best approach to pass them between js and cpp? I can define a `vector>` object, but I need to define its js class each time, and I feel it can be memory-consuming for large arrays. Is there any better ways to manage numeric multi-dimensional arrays using `val` helper functions?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.