Subject: Re: [boost] [review] string convert
From: Vladimir Batov (vbatov_at_[hidden])
Date: 2011-05-06 18:49:03
> From: "Stewart, Robert" <Robert.Stewart_at_[hidden]>
> You have quite a mistaken notion about casts. static_cast<int>(1.235)
> returns an int.
> It does not return the double 1.235 retyped as int. lexical_cast is not
> pretending to be a cast. It *is* a cast.
> convert_cast does a proper cast. Conversion and casting are different
> shades of the same color. Consider static_cast<int>(1.235), which
> involves a conversion:
> "4.9 Floating-integral conversions
> 1 An rvalue of a floating point type can be converted to an rvalue of an
> integer type."
Yes, that's a fair point. I stand corrected. Thank you. I guess, my
interpretation of cast vs. conversion was based more on my expectations (the
word popping up quite a bit recently) due to my personal childhood
experiences deeply rooted in C with
void* voidp = ...
int* intp = (int*) voidp;
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk