[C++-sig] conversion of std::list<...> parameters in function call
Ralf W. Grosse-Kunstleve
rwgk at yahoo.com
Thu Jun 20 15:09:50 CEST 2002
--- David Abrahams <david.abrahams at rcn.com> wrote:
> From: "Achim Domma" <achim.domma at syynx.de>
> > once again a conversion question:
> > I want to call a ctor which expects a 'const std::list<Magick::VPath>&'.
> > python I build a list like this:
> > path =
> > ]
> > All three PathXXX classes are derived from VPathBase and their
> > wrappers are defined with bases<VPathBase>. VPathBase is declared as
> > implicit convertible to VPath.
> > Is it already possible to do such a conversion at the moment? Should I
> > my own converter or is there a better way?
> I think Ralf has done something like this. Ralf?
The code that David is eluding to is here:
The interesting bit is struct register_container_from_python_list_or_tuple.
This code has a flaw (marked with XXX) and will not compile with the latest
CVS. Replacing "ref" by "handle<>" and "make_ref" by "object" is the minimum
that has to be done, but more adjustment might be necessary. A week ago it
worked with std::vector and boost::array. I have not tested it with std::list.
Another adaptor might be required (see struct
Sorry for all the vagueness. I would not normally have advertised the code, but
who am I to resist David's challenges?
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
More information about the Cplusplus-sig