[C++-sig] python sequence to stl container

Martin Casado casado2 at llnl.gov
Fri Jun 28 20:19:58 CEST 2002


> ----- Original Message -----
> From: "Martin Casado" <casado2 at llnl.gov>
>
> > > Ralf's version is the one to use, for now. I'm still hoping to get him
>
> to
>
> > > build the one we really want to put in the library...
> >
> > If there is a description for the one you really want to put into the
> > library I can give it a stab..
>
> We've been discussing a version which converts any sequence without going
> through an intermediate tuple. Part of this requires changing the rvalue
> conversion protocol so that the convertible() function is able to do some
> or all of the conversion work, by giving it access to the
> rvalue_from_python_data. In the case of Python sequences, you really have
> to try to do all the conversion as part of the overload resolution step
> since you might not be able to make a second pass over some sequences (e.g.
> input streams).

  Is it not possible to change the rvalue conversion protocol so that
  the check to see if the object is convertible and the conversion
  happen within construct() since it already has access to the
  rvalue_from_python_data?  The problem I suppose is signifying that
  the object is not convertible, using exceptions would almost certainly
  be too slow.  Do you have some ideas about how you were going to go
  about this?

                        ~~m





More information about the Cplusplus-sig mailing list