boost::python, returning new PyObject references
Arnaldur Gylfason
arnaldur at decode.is
Mon Jan 7 19:39:53 CET 2002
Dave,
It would be great if you could give an example (maybe something that can
solve object<sequence,mapping>) so I can see the way.
I have only taken a brief look at 2 files in boost::mpl but am interested
in exploring this kind of programming.
Regarding virtual/non-virtual, I guess I agree that ovirriding non-virtual
functions is ok as long as the semantics are the same, i.e. no
side-effects.
(When using the object through a base class &/* the effects are the same
even though a different method is called since there is no polymorphism).
I am beginning to form the design in my head but using mpl wil mean a steep
learning curve in the beginning.
Cheers
Arnaldur
----- Original Message -----
From: "Arnaldur Gylfason" <arnaldur at decode.is>
> I came up with a similar idea some weeks ago (i.e.
> object<number,sequence,mapping,...> ).
Silly me for not seeing the wisdom of your idea :(
> You mentioned the Andrei's GenScatterHierarchy .
>
> I've looked into this and I don't think GenScatterHierarchy is the way to
> go. Maybe something similar.
Hmm. It's hard to say. Something like GenScatterHierarchy could be useful
for generating all of the appropriate interface elements (e.g. operator[],
operator+=, ...)
> We can use the same design as in boost::function to have variable number
of
> parameters.
Yes, or in mpl::type_list.
> Problem is some interfaces intersect (e.g. += for number and sequence
> etc.).
That's why the concept tags should only be high-level objects. At a lower
level
> I was wondering if it was possible to define a INTERSECT macro that can
> handle this but am way out of my league here.
> It is possible to pull this off using template specialization but the
> number of specializations would be high
> (exponential explosion).
That's easy with mpl. You can use copy_if to build a type_list that
consists
of all elements of A that are also in B.
I can help with some of the metaprogramming infrastructure.
-Dave
More information about the Cplusplus-sig
mailing list