Boost logo

Boost :

From: Fernando Cacciola (fcacciola_at_[hidden])
Date: 2001-10-31 18:39:21


----- Original Message -----
From: <helmut.zeisel_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Wednesday, October 31, 2001 5:55 PM
Subject: [boost] Re: numeric_cast, VC++ 6.0, specialization.

> --- In boost_at_y..., "Fernando Cacciola" <fcacciola_at_g...> wrote:
>
> >
> > Last week I presented an improved implementation of numeric_cast<>.
> > Though this discussion affects its interface, since you are using
> it, I'll
> > be glad if you take a look at:
> >
>
> 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<>.

However, I intentionally decoupled the range checking and conversion logic
from the traits class itself becuase I figured that this will allow the
design to be extended so that the user could customize parts of the
functionality without having to specialize the entire traits class.
I imagine that it is possible to add a mechanism to the traits class to let
the user supply the inner range checking and converting logic of each case.
That is, the traits class ends up selecting 1 out of 4 range checker objects
and 1 out of 3 converter objects, so the user could somehow supply the basic
set of objects to be selected.

For example, we can move the basic range checkers and converters to a
visible scope and add a visible, specializable traits class, which groups
those toghether and is used internally by numeric_cast_traits<>.
I figure that this would be a simple customization mechanism.

> This is definitely what I need.
>
> The current version, however, does not compile under
> Linux/GCC 3.0.1;

This is bad.
I thought that having made it to compile with BCB would spare me all these
portability problems, but I was wrong.

> I include the beginning of the list
> of error messages for compiling your numeric_cast_test.cpp below.
> I was not yet able to figure out what the problem is.
>
> Helmut

Thanks. I'll study these error messages to see if I can figure out the
problem.

Best regards,

Fernando Cacciola
Sierra s.r.l.
fcacciola_at_[hidden]
www.gosierra.com


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