Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2004-02-26 19:53:42


Kevlin Henney <kevlin_at_[hidden]> writes:

> I have yet to see a convincing reason to make it explicit. Autoboxing
> has been a part of boost::any's design from day 1, which existed before
> Boost -- and, indeed, the "autoboxing" terminology. Supporting such
> conversions was intentional. There is no more reason to make the
> converting constructor of boost::any explicit than there is to make the
> converting constructor of std::string explicit, or the conversion from
> int to long explicit, or the conversion from T * to void *, or indeed
> any other widening conversion.

The conversion to boost::any isn't a widening conversion in the usual
sense, though, is it? Normally, a widening conversion preserves not
only the information but the *interface* of the original data -- you
wouldn't consider an implicit conversion from int to string a widening
conversion, would you? Similar to boost::any, you *can* go through a
set of gyrations to extract the integer -- I bet that if boost::any
could preserve the interface of the boxed type, Vladimir's bug
wouldn't have come up.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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