|
Boost : |
Subject: Re: [boost] [Fit] formal review ends 20th March.
From: Paul Fultz II (pfultz2_at_[hidden])
Date: 2016-03-21 18:07:01
On Monday, March 21, 2016 at 4:53:58 PM UTC-5, Edward Diener wrote:
>
> On 3/21/2016 2:04 PM, Paul Fultz II wrote:
> >
> >
> > On Sunday, March 20, 2016 at 9:07:53 PM UTC-5, Gavin Lambert wrote:
> ... snipped
> >> 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
> > mutable.
>
> You probably meant to say "You can pass member function pointers for
> mutable member functions". I would also strongly suggest you use the
> terms 'const' and 'non-const' when referring to member functions rather
> than 'const' and 'mutable' in your documentation. The reason I believe
> this is less confusing is because 'mutable' is a C++ keyword and as a
> keyword means something entirely different from how you are using it in
> your documentation.
How is it different? The mutable keyword is used to signify the function as
non-const. That is when I write:
auto f = [] mutable {};
It is the equivalent of writing a class with a "non-const" call operator
like
this:
struct local_f{ void operator()() {} // No const here };
auto f = local_f{};
> So I think what you really meant to say above would
> be better expressed as "You can pass member function pointers for
> non-const member functions".
>
>
>
> _______________________________________________
> Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk