Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-11-01 01:31:36


--- In boost_at_y..., "Fernando Cacciola" <fcacciola_at_g...> wrote:
> ----- Original Message -----
> From: <helmut.zeisel_at_a...>
> To: <boost_at_y...>
> Sent: Wednesday, October 31, 2001 5:55 PM
> Subject: [boost] Re: numeric_cast, VC++ 6.0, specialization.
>
>

> >
> > As I understand, the basic interface of numeric_cast<>
> > remains the same; you provide, however,
> > much better possibilities for specialization.
> >
> Yes indeed.
> I'm not sure how to define support for user defined types exactly,
but in
> the worst case
> the user can specialize numeric_cast_traits<>.
>

This is exactly what I would like to do.

To give you some information what I want to do:

For my big_int class, it is the question how it should
be related to the floating point types.

Convert a big_int to a floating point is considered to be safe
(except of possible overflow - here numeric_cast can also help),
and can be done implicitely (by providing a conversion operator).

Converting a floating point to a big_int should be considered
to be unsafe (since you will loose precision)
and cannot be done implicitely.
So I need an explicit name for the unsafe conversion,
and this name should be the same for built-in types.
IMHO "numeric_cast" is the best candidate for that purpose.

Helmut


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