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
> 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] *

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