Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-21 07:38:58


From: "Peter Dimov" <pdimov_at_[hidden]>

> Functional style casts ("Target(src)") are evil. They look like a
> constructor call, but are actually C-style casts in disguise. Even
> static_cast<Target>(src) is better than that.

...which means that constructing temporaries of dependent type in generic
code is usually also evil.
Damn, I knew there was a lesson in here somewhere!

> > Hmm, maybe the key here *is* to change my requirements from:
> >
> > "Target(src)" is valid
> >
> > to
> > "new Target(src)" is valid
>
> Or "Target t(src)" is valid. See
>
> http://std.dkuug.dk/jtc1/sc22/wg21/docs/lwg-active.html#362
>
> for another example of the same problem.

Oh, and there's an example of my lesson!
Now, why did we have to go and define the language that way?
Function-style casts weren't part of 'C', were they?

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com


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