By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,116 Members | 1,319 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,116 IT Pros & Developers. It's quick & easy.

mutable

P: n/a
bob
Has anyone here actually used the mutable keyword in real life? If so,
when?

Apr 11 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
b...@coolgroups.com wrote:
Has anyone here actually used the mutable keyword in real life? If so,
when?


Yes. I have used it with a mutex that doesn't affect the logical state
of the object:

class C
{
mutable Mutex mutex_;
int i_;
public:
// ...

int Get() const
{
ScopedLock lock( mutex_ );
return i_;
}
};

Cheers! --M

Apr 11 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.