[C++-sig] implicitly_convertible / virtual base class

David Abrahams david.abrahams at rcn.com
Tue Jun 4 00:14:36 CEST 2002


From: "Achim Domma" <achim.domma at syynx.de>

> I realized this solution some minutes after sending the mail. First I
> thought I would have to write an implicitly_convertible for each class,
> derived from DrawableBase. But with 'bases<DrawableBase> defined and a
> conversion from DrawableBase to Drawable it works fine now. This solves
most
> of my problems.
>
> > Or, we could define
> >
> >     template <class T>
> >     def_implicit(args<T>);
>
> I would prefer this one.

Why?

So far I am leaning towards an interface that works more like C++ (implicit
is the default, "explicit_" is explicitly specified). I think people
writing wrappers will typically be looking over their C++ interface, so it
would be most natural to write:

    def_init(args<...>, explicit_)

> I have no problem writing down that the ctor should
> be available for implicit conversion, but it would be much more intuitive
to
> do it directly on the class, than to specify it somewhere else via
> implicitly_convertible.
>
> > Oh, BTW, patches to implement this would be welcome ;-)
>
> I'm developing in C++ for some years now, but I fear it's not good enough
> for boost. Anyway, if you think it's not to hard to do, I would try it at
> least. Could you give me a starting point?

It would be faster to implement it myself. However, the documentation will
be a PITA as usual. Would you like to contribute a doc patch?

-Dave







More information about the Cplusplus-sig mailing list