Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-12-13 11:18:44


On Thu, 13 Dec 2001, Peter Dimov wrote:
pdimov> From: "Jeremy Siek" <jsiek_at_[hidden]>
pdimov>
pdimov> There are several "solutions" to this problem, each with
pdimov> its own drawbacks. I think I've chosen the least bad.

I'm sure you've already considered the following solution, but let me make
an argument for it anyways. The following solution makes it possible to
use bind with return-by-value iterators, but the disadvantage is that some
erroneous uses of bind no longer result in type errors. In my mind, this
is a good tradeoff; having bind work in situations when it "should" work
is more important than getting type errors in situations when it shouldn't
work.

The solution is simple. Make all the function object operator() parameters
const &'s and then cast away the const. I know this is sacrilegious, but
the C++ language has really backed us up into a corner.

pdimov> For the record, here's my suggestion for a core change:
pdimov>
pdimov> "For the purposes of reference binding, all rvalues are considered const."

Sounds good! Do you want to submit a DR or shall I?

Cheers,
Jeremy

----------------------------------------------------------------------
 Jeremy Siek http://php.indiana.edu/~jsiek/
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster (http://www.boost.org) office phone: (812) 855-3608
----------------------------------------------------------------------


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