Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-10-06 15:13:39


From: "David Abrahams" <david.abrahams_at_[hidden]>
> You're right. What's your opinion of my dangling-reference killer?

It doesn't work as is, but the idea is sound; here's what I came up with:

int f();

template<class T> T & no_values_please(T & t);

int const & g()
{
    sizeof(no_values_please(f())); // #1
    return f(); // #2
}

It seems to work. Borland accepts #1 with a warning, but gives an error on
#2, so all is well. :-)

--
Peter Dimov
Multi Media Ltd.

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