As far as I know, mutable is fairly universally supported as it's a long-standing feature of c++. I don't have much experience beyond the common compilers myself though.

If bHasChanged is just used to mark whether the cache is dirty then that would also be marked as mutable. However, changes should not be made to functions that affect the external interface. So if there is also a public hasChanged() function then maybe it would be better to create a separate mutable bool bIsCacheDirty that is set whenever changes are made and unset when the cache is updated. I would guess that caching values should be completely transparent to any clients/users.

Tim

On 21 May 2013, at 11:31 am, Memo Akten wrote:

> In libs/openFrameworks/graphics/ofPolyline.h:
> 
> > @@ -124,22 +127,70 @@ class ofPolyline {
> >  
> >  	vector<ofPoint> & getVertices();
> >  
> > -	float getPerimeter() const;
> > +	float getPerimeter();
> I like this mutable keyword. Only the cache is updated for better performance next time round, so perfect use case I think. I'm happy to do this, but how does it sit with OF convention? Does it work on all OF compilers? Also, the bHasChanged flag will be inevitably cleared (because the cache is updated), could that cause complications?
> —
> Reply to this email directly or view it on GitHub.
>