
8 Jul
2004
8 Jul
'04
2:35 p.m.
Eric Niebler wrote:
Michael Glassford wrote:
Eric Niebler wrote:
[snip]
Interesting idea. I suppose you could even do this:
if (ScopedLock l(m, locker())) { }
where locker() is a function object that defines
operator()(LockType& l)
which the lock calls in the constructor, passing *this. You could have locker(), try_locker(), timed_locker(t), etc.
Not quite. In order to declare and initialize a variable in an "if" statement, you need to use the "if( type var = fun() )" form, where the "=" is necessary.
Sorry, it was too late at night and I missed that. I suggest an alternate implementation in another message. Mike