[C++-sig] generic object wrappers
arnaldur at ru.is
Mon Jan 21 23:55:23 CET 2002
Just letting you know I'm still alive.
I started teaching 2 weeks ago (on top of everything else (stupid me!))
and am a little stressed out these days.
Still I´ll find time for implementing the generic object wrappers,
hopefully soon. Have faith.
I've looked at mpl and am comfortable using it. I feel we should use it
while in development and not worry about rewriting stuff unless mpl will
not be officially in boost when the boost.python rewrite is ready.
I've been thinking about the interface for users.
Let's say someone need addable, callable and indexable,
the interface would be
If we would use 1 typelist as a template parameter to object<>, the
interface would be:
typedef mpl::typelist<addable,callable,indexable> my_capabilities;
Somewhat more cumbersome.
I feel the former (as we discussed) is better.
That means we offer a variable number of template parameters.
I've been looking at the boost.preprocessor library and the preprocessor
stuff in mpl, and I now understand how mpl uses macros to generate
struct declarations that allow a variable number of parameters. I think
we should opt for that approach.
I have to say though, that understanding this macro logic is much harder
than understanding template programming. Still it is a tool worth using
to avoid repetition.
We have discussed sets of capabilities like integral, etc. I was
wondering if we should pick a few concepts from boost.operators as sets
Enough said. I aim to begin by writing a core set of capabilities and
then writing the object<> wrapper.
As you mentioned, it is probably better to write the capabilities that
form the generic object interface and provide it before we turn to the
mete-programming approach. Let´s see. If I get enthusiastic I´ll
probably start experimenting with the meta-programming stuff.
More information about the Cplusplus-sig