How to wrap a vector<T> in nanobind?

162 views Asked by At

In boost::python, to wrap a vector<T> you would do something like this:

boost::python::class_< std::vector < T > >("T")
    .def(boost::python::vector_indexing_suite<std::vector< T > >());

How do I accomplish the same thing in nanobind?

1

There are 1 answers

0
got here On BEST ANSWER

Include the header <nanobind/stl/bind_vector.h> and then its just:

nb::bind_vector<std::vector<T> >(m, "T");