From: Gregory Colvin (gregory.colvin_at_[hidden])
Date: 2003-07-21 23:54:29
I'm generally less afraid of automatic conversions than many others, and
dropped them from auto_ptr, and later from shared_ptr, only under
I like them for wrapper classes because they make it possible to drop
wrappers directly into existing code that uses the wrapped types. I
the terseness too, but then I am perverse enough to prefer &*p to
On Monday, Jul 21, 2003, at 22:27 America/Denver, John Madsen wrote:
> "Eugene Lazutkin" <eugene_lazutkin_at_[hidden]> wrote:
>> "John Madsen" <johnmadsen_usenet_at_[hidden]> wrote in message
>>> If you can convince most of the people on this list to provide an
>>> conversion, more power to you. I still maintain that avoiding hard
>>> errors is worth much more than saving 6 characters of typing.
>> I am not trying to convince anybody in overall goodness of automatic
>> conversion. :-) I am asking question, which is still ignored: what
>> "hard to
>> diagnose errors" do you envision for smart handles??? Reference to
>> dogma would suffice too. ;-)
>>> For a discussion of why user defined conversions are a bad idea (not
>>> but most of the time), see More Effective C++, Item 5.
>> I've read it when it was printed. I know author's reasons. And I
>> agree with
>> most of them. The question is: how do they apply in _this particular
> I am not ignoring the question. The point is that it is hard to guess
> errors might occur. I did reference some dogma as well. I take
> Meyers' point
> to be that automatic conversions can sometimes produce surprising
> Those effects may result in code that does something other than what
> it appears
> to do. Thus, *unless there is a very good reason*, avoid automatic
> conversions. That is what I did. Your reason for including them,
> avoiding typing, does not strike me as a good one.
> P.S. Of course, if you want Scott Meyers on your side in this one,
> just look
> at Item 9 in the same book, where he does exactly what you're
> suggesting :-).
> Against his own better judgment IMHO.
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk