From: Doug Gregor (gregod_at_[hidden])
Date: 2001-05-01 17:14:51
On Tuesday 01 May 2001 12:02, you wrote:
> On Monday 30 April 2001 05:34, you wrote:
> > i have a question about the just uploaded function
> > Callback/function-04-29.zip by Doug Gregor (great stuff btw):
> > is it possible to make the operator () methods const? or is/was there
> > a good reason for making them non-const?
> > (saves me lots of mutable's if they're const;-)
> I see two options for making it const, each with its semantic problems:
> 1) Just make function::operator() const, but constness won't be passed
> through to underlying function objects, so we're dealing with a semantic
> grey area.
> 2) Have both a const and a non-const version, and pass an "is_const" flag
> so that function objects will be invoked as const or non-const and the
> constness will be passed through. However, this requires a const version of
> operator() to be defined for any function object regardless of whether it
> is used or not.
I went with option #2 because it is much less surprising for the user. The
updated archive is at:
- const & non-const operator()
- make_function to build a function object from a function pointer.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk