ylliX - Online Advertising Network

Binding a ref-qualified function with nanobind

What is the appropriate nanobind syntax to expose the instance method below? struct Foo { int &value() & { return v; }; int v; }; With pybind, one could use static_cast with Foo::* syntax to cast the function pointer to the appropriate type, like so: nb::class_<Foo>(m, “Foo”).def(“value”, static_cast<int &(Foo::*)() &>(&Foo::value)); but with nanobind, I get […]