Something I have recently seen is people removing const from read only functions due to adding a mutex to control access and of course mutex changes state when used.
Example:
// rvo will use the vector move constructor...
std::vector<widget> get() const
{
std::unique_lock<std::mutex> lk(cs_);
std::vector<widget> copy(widgets_);
return copy;
}
// in class definition
mutable std::mutex cs_;
std::vector<widget>widgets_;
Something I have recently seen is people removing
constfrom read only functions due to adding a mutex to control access and of course mutex changes state when used.Example: