I’m experimenting with CxxWrap, and within my C++ code, I’m defining a class called Point2D. One of the things I want to do is to wrap a std::vector and then iterate over it on the Julia side. In my C++, I’ve got code that looks like:
JLCXX_MODULE define_point2d_module(jlcxx::Module& types) {
.
.
.
types.add_type("PointVec")
.method("length", &PointVec::size)
.method("getindex", [][const PointVec& vec, size_t index) {
return vec.at(index);
});
.
.
.
}
What is mysterious to me is how to implement a Julia iterator over my PointVec type. I’ve looked at descriptions of how to write Julia iterators, but it’s not at all clear how I’d connect my PointVec methods.