From -4342517269903613519
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f78e5,b43d17d27e7171b0
X-Google-Attributes: gidf78e5,public
From: "Gene Bushuyev" <gbush@deja.com>
Subject: Re: explicit operator T()
Date: 2000/12/05
Message-ID: <t2qout2pnv435b@corp.supernews.com>#1/1
X-Deja-AN: 701544793
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <3A2D10EE.35544D0A@aixigo.de>
X-Priority: 3
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 976057126 mail2news:23562 mail2news mail2news.demon.co.uk
Organization: Posted via Supernews, http://www.supernews.com
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-MSMail-Priority: Normal
Newsgroups: comp.std.c++

If you don't want your user-defined operator to be called in implicit
conversions (as you call it accidentally) then probably you don't need
operator at all. Create a function for conversion purposes and call it
explicitly.

-------------------------
Gene Bushuyev                         Sr. R&D Eng.
Organ transplants are best left to the professionals (Bart Simpson)

"Daniel Frey" <d.frey@aixigo.de> wrote in message
news:3A2D10EE.35544D0A@aixigo.de...
Hi,

sorry if this was suggested / discussed before, but would it make sense
to allow declaring a cast-operator as 'explicit'? I guess the normal way
would be to declare an explicit constructor in the other class but when
you don't have access to it (e.g. in a library), it would help to add
'explicit' to the operator. Maybe it also makes sense to think of other
operators to be declared 'explicit', to make sure they are not called
accidentially... what do you think?

Regards, Daniel

--
Daniel Frey

aixigo AG - Financial Research and Education
Schlo�-Rahe-Str. 15, 52072 Aachen, Germany
Tel: +49 (0)241 936737-00, Fax: +49 (0)241 936737-99
EMail: D.Frey@aixigo.de

"Operator.. give me the number for 911" (Homer Simpson)

---
[ 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.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]



---
[ 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.research.att.com/~austern/csc/faq.html                ]
[ Note that the FAQ URL has changed!  Please update your bookmarks.     ]




