Subject: Re: [boost] [Fit] formal review ends 20th March.
From: Paul Fultz II (pfultz2_at_[hidden])
Date: 2016-03-21 14:04:49
On Sunday, March 20, 2016 at 9:07:53 PM UTC-5, Gavin Lambert wrote:
> 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.
However, with lambdas it is the opposite. Lambdas default to const and then
explicit mutable keyword is needed for a mutable function object.
> While it's
> likely that some of these could be made const with a little
Just like lambdas, mutability is not prohibited in Fit, just explicit.
> 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.)
I would like to note, that the const requirement only applies to function
objects. You can pass member function pointers to member functions that are
> Unsubscribe & other changes:
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk