[C++-sig] same to_python_converter in multiple modules?

Ralf W. Grosse-Kunstleve rwgk at yahoo.com
Thu May 30 10:22:06 CEST 2002


Here is less contrived example for doc/v2/to_python_converter.html:

  template <typename ElementType, std::size_t N>
  struct boost_array_to_tuple
  {
    static PyObject* convert(boost::array<ElementType, N> const& a)
    {
      boost::python::tuple result(a.size());
      for(std::size_t i=0;i<a.size();i++) {
        result.set_item(i, boost::python::make_ref(a[i]));
      }
      return result.reference().release();
    }
  };

  boost::python::to_python_converter<
    boost::array<int, 3>, boost_array_to_tuple<int, 3> >();

If I have two independent modules that both need this converter,
where would I put the last statement. In both modules? What happens
if both modules are loaded at the same time? What if I have 30 modules
that need this converter (this will happen in our application)?

Thanks,
        Ralf


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com





More information about the Cplusplus-sig mailing list