On Tuesday, March 22, 2016 at 3:52:23 AM UTC-5, Bjorn Reese wrote:
On 03/21/2016 07:04 PM, Paul Fultz II wrote:
However, with lambdas it is the opposite. Lambdas default to const and then an explicit mutable keyword is needed for a mutable function object.
The const-by-default lambdas are the black swans of C++.
Other than working around bugs in MSVC, I have never used a mutable lambda in any of the codebases I have worked on. I find it quite surprising that const lambdas are considered a "black swan".
The fit documentation should at least provide a design rationale for its const-by-default decision which is addressed at those who are unfamiliar with the virtues of immutability.
Another concern with fit::mutable_ is its name. As you have already gone down the type-traits naming path with fit::decay, it may be an idea to rename fit::mutable_ to fit::remove_const.
No, fit::decay works something like this(ignoring unwrapping references):
template<class T>
std::decay_t<T> decay(T&& x)
{
return std::forward<T>(x);
}
It simply transforms the type according to the rules of the type trait
std::decay. So, fit::remove_const would imply the same:
template<class T>
remove_const_t<T> decay(T&& x)
{
return const_cast
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost