Boost logo

Boost :

From: Stephen Silver (boost_at_[hidden])
Date: 2001-01-13 06:46:41

Beman Dawes wrote:

>At 04:05 PM 1/12/2001 -0500, George A. Heintzelman wrote:

> >template <class T> rational(T n) :
> > num(boost::implicit_cast<IntType>(n)),
> > den(IntType(1)) {} // Or whatever you finally decide to use for 1.
> >
> >I seem to remember some discussion about exactly this sort of need, and
> >had thought that it was in the BCL, but it doesn't seem to be. Perhaps
> >this is an example which suggests it needs to be added?
>We removed implicit_cast<> because it had a number of problems. The
>comment in the header says:
>// Removed due to uncertain purpose. Use either numeric_cast (see below)
>// or static_cast according to the need.

This comment makes no sense to me. static_cast can make use of an
explicit constructor (ISO 5.2.9 / 2), so it can never be used in any
situation for which implicit_cast is intended. And numeric_cast is
something quite different.

In any case, neither static_cast nor numeric_cast is suitable in the
above situation, but implicit_cast is. What were the problems with


Boost list run by bdawes at, gregod at, cpdaniel at, john at