Boost logo

Boost :

From: Michael Glassford (glassfordm_at_[hidden])
Date: 2004-07-08 09:35:01


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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk