[C++-sig] weave plus boost?

Martin Casado casado2 at llnl.gov
Sun Jan 20 23:53:42 CET 2002


On Saturday 19 January 2002 18:28, you wrote:
> Hey group,
>
> I've just signed up to listen in on the group.  I haven't followed boost to
> closely, but am interested in catching up with what this community is
> doing.
>
> My main interest here is to see if there is anyway that weave can benefit
> from the boost effort -- I'm almost sure there is.  weave
> (www.scipy.org/site_content/weave) is a tool for, among other things,
> inlining C/C++ within Python.  It also has a module called ext_tools that
> allows you to build C/C++ extension modules using Python.  Currently,
> ext_tools only supports building modules that contain functions.  I'd like
> to eventually extend it so that it handles extension classes as well.  It
> looks like it won't be to bad, but boost might make some aspects of this
> more elegant and easier for the end user.

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.


                        Cheers,
                        ~~m




More information about the Cplusplus-sig mailing list