From: Bill Wade (bill.wade_at_[hidden])
Date: 1999-12-01 10:10:44
> Dave wrote
> 2. The problem you describe is no worse than many other pitfalls in the
> language; you have to know the language rules.
> class mutex;
> void foo()
> mutex(); // Oops; does nothing!
A trick to consider (I've never actually used this) is to require a mutex&
as an unused argument in all constructors. So
mutex(); // Compiler error
mutex m = m; // Ok
foo(args); // Compiler error
foo f = foo(args, f); // Ok
The only way to create a temporary is with the help of some non-temporary
that happens to be available. It doesn't seem like a likely mistake for
classes like require and mutex.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk