Boost logo

Boost :

From: Arkadiy Vertleyb (vertleyb_at_[hidden])
Date: 2005-12-21 10:19:14


"Andy Little" <andy_at_[hidden]> wrote

> Regarding using Typeof with compile time libraries such as mpl. mpl doesnt
> actually deal in types so when I operate on a mpl vector I might get back
a
> mpl::vector7 or something else. Similarly with mpl::math::rational I might
get
> back a mpl::math::rational or a mpl::math::simplified_rational.
>
> That makes for a very flakey quantities library unfortunately, because in
> compliant mode Typeof is totally dependent on implementation changes in
these
> other libraries, and when the compiler crashes because of unregistered
types it
> does so in a huge fashion.
>
> Not sure what if anything can be done about it but I'm wondering whether
it is
> worth asking library authors now to provide a mechanism so that user can
> register their libraries types (that would be eg a mpl::vector +++
anything it
> might turn into... is that possible or impractical? )without hassle. That
would
> solve my problem I think, but maybe would result in a type registration
> explosion?

Registering MPL types is a little less trivial than usual, because MPL
generates these types. Accordingly, registrations should also be generated,
but then we'd run into the problem with the __LINE__ usage. So, I think
this should utilize lower-level typeof macros, which do not use __LINE__,
but instead allow for Id to be specified directly.

> Any mechanism that allows use of Typeof without dependencies on
implementation
> details of other libraries would be appreciated!

I will try to implement such registrations for mpl::vector[n], as an
example. However, I think it's ultimately up to the library authors do
decide whether or not to make their libraries typeof-enabled (I would be
happy to provide any help on the subject).

Regards,
Arkadiy


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk