
24 Aug
2007
24 Aug
'07
5:39 p.m.
Ion GaztaƱaga wrote:
Peter Dimov wrote:
the author of X may have accidentally omitted the initialization of cn_. Without a default constructor, this doesn't compile and one needs to explicitly choose between
X(): cn_( &mx_ ) {}
and
X(): cn_( 0 ) {} // no checking
What about...
template<Mutex> class condition { condition(); explicit condition(any_mutex_type); explicit condition(mutex_type& m); //... };
This is possible, but the default constructor still allows you to forget to associate the condition with a mutex: X() {} any_mutex vs 0 is a style issue; I prefer to use an old-fashioned way if it does the job as this is what the majority of the audience expects and understands, as un-Boost-y this may sound. :-) Not a big deal though.