I expose the return type of a C++ function that is a pair of strings with
the following snippet:

to_python_converter<
    std::pair<std::string, std::string>,
    Converter>();

Later, I have a unrelated C++ range type:

typedef std::pair<const std::string*,const std::string*> range_t;

which I export as:

class_<range_t>("range")
    .def("__iter__" , range(..., ...));
scope().attr("allitems") = object(ptr(&R));

where R is of type range_t

in python, allitems can be iterated over.

The only issue is I get the following warning:

/usr/lib64/python3.4/importlib/_bootstrap.py:321: RuntimeWarning:
to-Python converter for std::pair<std::string const*, std::string
const*> already registered; second conversion method ignored.

Is there a way to avoid this warning?

MM
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
https://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to