Re: Semi-const methods?

2011-03-14 Thread Mafi
Am 13.03.2011 23:27, schrieb Magnus Lie Hetland: I have a data structure that's generally static (const, or even immutable), but it has some utility storage, which caches certain results during use. This caching etc. doesn't really affect the semantics of the main object, and are reset between

Re: Semi-const methods?

2011-03-14 Thread Magnus Lie Hetland
On 2011-03-14 00:17:18 +0100, Jonathan M Davis said: So, if you don't actually manage to _really_ be logically const, or if you do this with an immutable object (which would likely result in a segfault), you _are_ going to have incorrect code. On the whole, I'd advise just not using const when

Re: Semi-const methods?

2011-03-14 Thread Magnus Lie Hetland
On 2011-03-14 11:51:09 +0100, Mafi said: I found away which doesn't use casts or bugs. Just use delegates/closures. Nice :D -- Magnus Lie Hetland http://hetland.org

Semi-const methods?

2011-03-13 Thread Magnus Lie Hetland
I have a data structure that's generally static (const, or even immutable), but it has some utility storage, which caches certain results during use. This caching etc. doesn't really affect the semantics of the main object, and are reset between operations, so I think it still would be useful

Re: Semi-const methods?

2011-03-13 Thread Magnus Lie Hetland
On 2011-03-13 23:27:14 +0100, Magnus Lie Hetland said: Any other ideas on how to handle this sort of mostly const or const where it counts stuff? Perhaps my design intentions here are off to begin with?-) OK -- a *little* quick on the trigger there. My solution: Declare the method const,

Re: Semi-const methods?

2011-03-13 Thread Magnus Lie Hetland
On 2011-03-13 23:32:34 +0100, Magnus Lie Hetland said: (Still open to schooling on the design part of this, though. Perhaps declaring a method as const is no good when it's not *really* const? For now, I'm just doing it to check that I don't inadvertently change things I don't want to

Re: Semi-const methods?

2011-03-13 Thread Jonathan M Davis
On Sunday 13 March 2011 15:32:34 Magnus Lie Hetland wrote: On 2011-03-13 23:27:14 +0100, Magnus Lie Hetland said: Any other ideas on how to handle this sort of mostly const or const where it counts stuff? Perhaps my design intentions here are off to begin with?-) OK -- a *little* quick