Boost logo

Boost :

Subject: Re: [boost] [Fit] formal review ends 20th March.
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-03-20 22:07:28


On 21/03/2016 14:20, rstewart wrote:
> You state that the function call operator is always declared const.
> On what basis do you make that claim? It may be a reasonable, even
> common thing to do, but you should justify your assertion.

On a related note, at least in the codebases I tend to work with, const
function objects are the exception rather than the rule. While it's
likely that some of these could be made const with a little
restructuring, I think it's still true that mutable functions are useful
in more cases -- despite being vulnerable to surprise copies and
thread-safety issues.

(Having said that, this may be because boost::bind is used in most cases
where const function objects would otherwise be used, so that custom
function objects are typically only created where they need to be
mutable; the code does not yet make extensive use of lambdas. But I
don't think my experience is unique.)


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