Boost logo

Boost :

From: Kevin Atkinson (kevin_at_[hidden])
Date: 2003-03-01 17:29:12


On Sat, 1 Mar 2003, Thorsten Ottosen wrote:

> > > Is this the best way to enforce this? Why not just make lock objects
> > > noncopyable?
> >
> > Um, they are. This typedef are strictly for convenience and readability.
>
> what convenience and what readability? C++ programmers are use to const
> XX& parameters. Having four extra names makes the concept harder to
> understand.

The magic in these locks is via the type conversion. They are not really
used as variables. In fact these classes don't even have any public
members other than the constructor and destructor.
To me
  f(WillLock l)
says that the function will acquire the lock, while
  f(const Lock & l)
to me, isn't as straight forward. Also I made these typedefs to discourage
passing by non const reference ie
  f(Lock &)
as that will mess up the automatic type conversion when the lock is passed
around.

If you don't agree with me than don't use them.

---
http://kevin.atkinson.dhs.org


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