With boost python tuple, how to loop over tuple items? In dummy.cpp
attached, I'd like to get line 8 to work. Afterwards, I noticed line 7 does
not even compile. How to get the length of a tuple (line 8), and, why there
could be some ambiguity (line 7). Any help / clue is appreciated.
Franck

Attachment: Makefile
Description: Binary data

#include <iostream>

#include <boost/python.hpp>

void doStuffs(boost::python::tuple & t) {
  std::cout << "tuple " << std::endl;
  //std::cout << t[0] << std::endl; // does NOT compile => warning: ISO C++ says that these are ambiguous
  //for (auto i : t) std::cout << i << std::endl; // does NOT compile => error: ‘begin’ was not declared in this scope
}

BOOST_PYTHON_MODULE(dummy) {
  Py_Initialize();

  def("doStuffs", doStuffs);
}
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to