On 12/4/10 6:50 AM, so wrote:
I'm 99.99% certain that it's perfectly legal to pass a temporary to a
function
that takes a const T& and that it's in the standard
Oh that is right, but both are different things.
Say, when you have:
T fun() {...}
void bar(const T&) {...}
bar(fun()) // 1. this is perfectly legal.
const T& a = fun(); // 2. not legal, but still you can do it on some
compilers.
What Don's example is all about as far as i can tell is that D can't do
the first one, somehow.
Second line is legal too. Petru Marginean and I use it to good effect in
our ScopeGuard idiom (a precursor to D's scope guards).
http://www.drdobbs.com/184403758
Andrei