Topic: Why no implict user-define conversion on left of . operator?


Author: ron@sensor.com ("Ron Natalie")
Date: Wed, 4 Dec 2002 20:07:31 +0000 (UTC)
Raw View
<thp@cs.ucr.edu> wrote in message news:aro2sc$btp$1@glue.ucr.edu...
> According to page 272 of The C++ Programming Language, no implicit
> user-defined conversions are performed on the left-hand side of a .
> (or a ->).  I've heard lots of reasons why implicit conversions are "a
> bad thing" in general, but I don't see why they would be worse on the
> left side of a . than on the left side of other operations.

The big question is what would it be converted to?  Since member access
(.) can't be overloaded and (->) has an implicit meaning even if not overloaded,
and nothing on the right side of these implies a type, what would this mean?



---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: thp@cs.ucr.edu
Date: Sun, 24 Nov 2002 00:12:42 +0000 (UTC)
Raw View
According to page 272 of The C++ Programming Language, no implicit
user-defined conversions are performed on the left-hand side of a .
(or a ->).  I've heard lots of reasons why implicit conversions are "a
bad thing" in general, but I don't see why they would be worse on the
left side of a . than on the left side of other operations.

Tom Payne

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]





Author: francis.glassborow@ntlworld.com (Francis Glassborow)
Date: Mon, 25 Nov 2002 19:10:02 +0000 (UTC)
Raw View
In article <aro2sc$btp$1@glue.ucr.edu>, thp@cs.ucr.edu writes
>According to page 272 of The C++ Programming Language, no implicit
>user-defined conversions are performed on the left-hand side of a .
>(or a ->).  I've heard lots of reasons why implicit conversions are "a
>bad thing" in general, but I don't see why they would be worse on the
>left side of a . than on the left side of other operations.

In general the left operand of the dot and the arrow operator is an
lvalue. The result of an implicit conversion is an rvalue. If you want
the implicit conversion you can always use the explicit function call
syntax and then the problem will be more visible (the left operand is
almost always a plain reference, not a const reference.

--
Francis Glassborow      ACCU
64 Southfield Rd
Oxford OX4 1PA          +44(0)1865 246490
All opinions are mine and do not represent those of any organisation

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]