On 04/19/2011 03:14 PM, Georg Baum wrote:
Enrico Forestieri wrote:
Are you sure it is pointless? runparams is a reference and even if
it is constant, there are mutable members that could be changed.
The copy you removed maybe tries to protect against that.
If the mutable members really make a difference then they should not be
mutable IMHO. Making a member mutable just to be able to pass a const
refrence around does not look OK. A mutable member should only be used for
things like caching information that could always be recomputed, but might
be expensive to compute. I have no idea whether the mutable runparams
members fall into this category. If yes, the only drawback of Richards
change might be a performance penalty.
I agree that mutable members make sense only when used for caching, etc.
So I had a look at OutputParams and was astonished to see how many of
the members are mutable. It's just a guess, but I will nonetheless guess
that we were passing a const ref around earlier, and then people wanted
to add things that needed to be changed, so they made them mutable. The
one case that does make sense seems to be encoding, because that
actually should be passed back to the caller.
After 2.0, perhaps I'll have a look at changing this.
Richard