Boost logo

Boost :

Subject: Re: [boost] [numeric_cast] request for boost::numeric_downcast
From: Kim Barrett (kab.conundrums_at_[hidden])
Date: 2008-11-11 13:05:14


At 2:41 AM -0500 11/11/08, David Abrahams wrote:
>boost::polymorphic_downcast is meant to be used where you think you
>really know what derived type you've got, and you want an assertion to
>reinforce your reasoning with a runtime check. I suppose you can have a
>similar situation for numeric types (e.g. "I know this long int should
>fit in a short int").
>
>How about boost::checked_cast, or boost::checked_narrowing_cast or
>boost::narrow_cast?

Is this any different from boost::numeric_cast with an asserting rather
than throwing overflow handler, plus boost/numeric/conversion paying
attention to BOOST_NO_EXCEPTIONS, possibly by using boost::throw_exception?


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