|
Boost : |
From: klaus triendl (klaus_at_[hidden])
Date: 2008-04-02 16:50:27
Frank Mori Hess schrieb:
> Incidentally, I find the example usage of lock acquirers in the
> thread_lockable examples a bit verbose and dangerous. That is stuff like:
>
> mbox::writelock_acquirer<mutexlockable_int> int_lock(*pLockableInt);
> int& i = access_acquiree(int_lock);
> i = 5;
>
> Why not just support operator* (and operator-> for calling class methods) on
> the lock_acquirer class? Then you could do something like:
I like the less verbose method with operator*... the intent is to force
a named lvalue lock_acquirer object.
> mbox::writelock_acquirer<mutexlockable_int> int_lock(*pLockableInt);
> *int_lock = 5;
But what prevents me from writing:
int& i = *int_lock;
Klaus
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk