Boost logo

Boost :

From: Eric Ford (eford_at_[hidden])
Date: 2001-09-28 20:15:18


> However, a user might have just *forgoten* to specialize cos, even
when a
> specific implementation exist in the UDNT package, so the asserting
default
> would trap his fault here.
>
> So I agree, an asserting default is safer, and we can provide the
macro you
> suggested to easliy introduce a specialization using double.
>...
> Therefore, I wouldn't use overloading. I think the best choice is to
use std
> functions with explicit signature (thus knowing exactly the type
used) in
> this way:
>
> return numeric_cast<TYPE>(::std::STDFUNC( numeric_cast<STDTYPE>(X)
) ) ;
>
> Notice that with a properly optimized numeric_cast<>, this has no
runtime
> overhead in the case were TYPE==STDTYPE.

I'm happy with both of these choices (assuming boost does adopt an
optimized numeric_cast for unnecessary conversions). I'll wait until
Kevin makes his changes. If he doesn't include these, I can.

Thanks,
E


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