Boost logo

Boost :

From: Falcon (boost_at_[hidden])
Date: 2005-06-24 21:25:17


There are two things I need for a project I'm currently doing. I'm
curious if anyone thinks this could be added to the package boost.any,
either in the class boost::any or as a separate class, as well as
whether it would be of use to anyone else. :)

1. Implicit conversions to/from pointers and references.
2. Support for user-defined conversion hooks when using any_cast. These
would be defined in terms of the contained type, not the converted-to type.

Both are possible (I've already done it), but will have a runtime
performance impact:
* Two additional [inline] function calls and two comparisons per
conversion, even if the types are the same.
* Additional memory overhead to store information about the type (about
sizeof(pointer)*6 per instance of boost::any).
* Storage of user-defined conversions (in function pointers or function
objects).

Comments appreciated,
Peregrine Falcon


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