[C++-sig] weave plus boost?
David Abrahams
david.abrahams at rcn.com
Mon Jan 21 15:53:03 CET 2002
----- Original Message -----
From: "Martin Casado" <casado2 at llnl.gov>
> Hi Eric,
>
> Here is an idea I toyed around with last summer. One of the
> challenges with making extension types that represent C++ classes is
> trying to come up with adequate ways to support templated classes. Pretty
> much all packages I've looked at to automate the wrapping process require
you
> to create a seperate class for each template instantiation... which makes
> sense
> since template instantion is done at compile time. However, if I have a
> templated class, vector<typename>, I would really like to construct an
> instance
> of vector in python, like.
>
> myVector = vector("std::string")
>
> It is impossible to know which instances of vector are going to be needed
> before runtime with this method, so one option is to have vector(..)
generate
> an
> instance of vector<string> on the fly, compile it and load it in. Each
> instance extension
> would proabaly be cached, keyed by the type so subsequent requests for
> vector("std::string") wouldn't have to redo the process.
>
> I'm not sure how practical this would be, but at one time I had a sloppy
but
> working prototype and it was.. if nothing else.. neat.
Sounds cool, but if you're working from the Python side anyway, wouldn't you
want std::vector<generalized_python_object> so you didn't have to pay to
convert std::string to/from Python strings at ever access?
-Dave
More information about the Cplusplus-sig
mailing list