On Friday, August 16, 2013 14:35:53 Ali Çehreli wrote: > On 08/16/2013 02:18 PM, Carl Sturtivant wrote: > > The operator overloading page in the Language Reference and the operator > > overloading discussion in TDLP say different things about > > > > T opCast(bool)() if(is(T==bool)) > > The current syntax is the following: > > bool opCast(T : bool)() const
I'd advise against that, as what that's doing is overloading opCast for any type which implicitly converts to bool rather than just bool. Depending on the situation, that might be fine, but in general, you need to be very careful with implicit conversions - especially when generic code is involved. It's far too easy to end up with templated code that tries to instantiate with types that it doesn't work with. - Jonathan M Davis
