From: Gavin Collings (gcollings_at_[hidden])
Date: 2000-02-08 05:40:16
beman dawes <bema-_at_[hidden]> wrote:
> At 05:29 PM 2/6/00 -0500, Dave Abrahams wrote:
> >Do we really have a function called boost::implicit_cast<>? That's
> >oxymoron if I've ever met one!
> Well, we have one, but I think its days are numbered. I have an
> action item to review a long thread from a couple of months ago;
> seems like it has so many problems we may well just remove it.
There is a good reason for its existance. As I remember, it was based
on an example in C++PL (3rd Ed) whereby it is sometimes useful to
explicitly evoke an implicit type conversion from the compiler, for
example to direct template argument deduction. I would contend that
explicit_cast<>() would be a better name for that.
The boost implementation, however, disables compiler warnings in cases
where it is used for narrowing conversions on arithmetic types (not
what the above usage requires). Further, the documentation suggests a
usage as a kind of numeric_cast that is not checked at run time.
For me, we need to distinguish between these two usages, so I would
1) Optionally change the name to explicit_cast.
2) Re-enable compiler warnings (this was suggested in a previous
thread, but doesn't seem to have made it into the library)
3) Correct the documentation.
4) Optionally provide another cast (unchecked_numeric_cast ?) or advise
people to use the existing run time checked numeric_cast, or just rely
on a function style cast, or static_cast.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk