Skip to content

Commit

Permalink
Document jlcxx::Array
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWrigley authored and barche committed Jun 19, 2024
1 parent 51b6b1d commit 9b23b7f
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,20 @@ An extra file has to be included to have constant array functionality: `#include

Replacing `make_const_array` in the examples above by `make_julia_array` creates a mutable, regular Julia array with memory owned by C++.

### Returning a Julia array

A Julia-owned `Array` can be created and returned from C++ using the
`jlcxx::Array` class:
```c++
mymodule.method("array", [] () {
jlcxx::Array<int> data{ };
data.push_back(1);
data.push_back(2);
data.push_back(3);

return data;
});
```

## Calling Julia functions from C++

Expand Down

0 comments on commit 9b23b7f

Please sign in to comment.