Boost logo

Boost :

From: David Abrahams (abrahams_at_[hidden])
Date: 2000-06-28 21:59:13

----- Original Message -----
From: "Kevlin Henney" <kevlin_at_[hidden]>

> (1) I originally named the cast interpret_cast, and after some
> discussion with Beman and Greg, IIRC, changed it to stream_cast.
> However, I am drawn back to interpret_cast as this seems not only to
> capture the spirit (if not the mechanism), but also allows some
> latitude, namely the use of specialisation to optimise certain cases, eg
> to use strtol for const char * -> long or string -> long. What do others
> think of (a) the name, and (b) offering some optimised cases?

I still favor my own suggestion - lexical_cast. interpret_cast is spelled
way too much like reinterpret_cast, with which it has little in common.
Also, lexical_cast is shorter ;)

> (2) For distinguishing between throwing and nonthrowing versions, I
> tried out a few syntax forms, and found the following style one of most
> convenient and "in the spirit":
> a = interpret_cast<A>(b);
> a = interpret_cast<A>(nonthrowing(b));
> Whichever way we go, I would prefer to keep both forms as cast-like as
> possible. Feelings on this?

I don't see any advantage to this nonthrowing form over using std::nothrow
as suggested in other posts.

> If they are casts, which I would maintain they are, then I guess they go
> with the other casts. Maybe it's just me, but I'm always faintly
> suspicious of headers/directories/libraries that are called util or
> utility: whilst not intrinsically a problem, they can end up as
> repositories for almost anything that didn't fit any other
> classification!

Hear here!


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