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. 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".