Per #140. We should add a C++ wrapper around the Python Array type. This allows users to use the Python objects directly from C++, avoiding copies like in the type caster, or wrapping/unwrapping in the binding case; which is useful if the use of these values is limited. But it's rarely all that useful.
We should create a new type coconext_nb::pyArray which is a C++ wrapper around cocotb.types.Array. It's interface should mimic DynArray or Array if possible.
coconext_nb::pyArray double_it(nb::pyArray l) {
nb::pyArray result;
for (nb::handle h: l)
result.append(h * nb::int_(2));
return result;
}
NB_MODULE(my_ext, m) {
m.def("double_it", &double_it);
}
Per #140. We should add a C++ wrapper around the Python Array type. This allows users to use the Python objects directly from C++, avoiding copies like in the type caster, or wrapping/unwrapping in the binding case; which is useful if the use of these values is limited. But it's rarely all that useful.
We should create a new type
coconext_nb::pyArraywhich is a C++ wrapper aroundcocotb.types.Array. It's interface should mimicDynArrayorArrayif possible.