From -4907756887138551802
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,5056bc953972b4f6
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-11-27 08:48:32 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: anthony.williamsNOSPAM@anthonyw.cjb.net (Anthony Williams)
Newsgroups: comp.std.c++
Subject: Re: Rationale for 7.1.2/6
Date: Wed, 27 Nov 2002 16:48:30 +0000 (UTC)
Organization: Customer of PlusNet
Lines: 47
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <smxnb83n.fsf@anthonyw.cjb.net>
References: <2ONE9.4412$sW.228339932@newssvr13.news.prodigy.com> <smxoi6iq.fsf@ender.evo6.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Trace: mail2news.demon.co.uk 1038415710 24147 10.0.0.1 (27 Nov 2002 16:48:30 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 27 Nov 2002 16:48:30 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18H5MS-0006HK-00
	for mail2news@news.news.demon.net; Wed, 27 Nov 2002 16:48:28 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id DAA06928; Thu, 28 Nov 2002 03:48:24 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Face: w~ml[K\+Z~(W,eDy5FNdP0]LBZRC}ek=-6H?eqAJ+tIz$#3Pl)L!'MGq!/|=MjW_f.'gL)=;-'HTa/zlF\rn$l>9Dx)<eXnFBh!';E`5sUiV7s@fBnH<dMkZX^xV<hWx<Q:(t,jBP|_S7Is=+tLX--6Y{qhqq!?"o.{\.UNVhH&n4h=rc1MqBV,#q9nGg[!8lu,<*;#QV0*"<HY9g?2?!b36KQE
X-User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.4 (Military Intelligence (Windows))
X-NNTP-Posting-Date: Wed, 27 Nov 2002 10:51:36 GMT
X-Spam-Status: No, hits=-13.4 required=5.0
	tests=EMAIL_ATTRIBUTION,NOSPAM_INC,QUOTED_EMAIL_TEXT,REFERENCES,
	      SIGNATURE_SHORT_DENSE,SPAM_PHRASE_03_05,USER_AGENT
	version=2.41
Xref: archiver1.google.com comp.std.c++:15530

Andy Sawyer <news@evo6.com> writes:

> In article <2ONE9.4412$sW.228339932@newssvr13.news.prodigy.com>,
>  on Tue, 26 Nov 2002 17:11:55 +0000 (UTC),
>  cpdaniel@mvps.org ("Carl Daniel") wrote:
> 
> > 7.1.2/6 says
> > 
> > "The explicit specifier shall be used only in declarations of constructors
> > within a class declaration; see
> > 12.3.1."
> > 
> > Why?  In particular, it seems to me that it'd be useful to be able to apply
> > 'explicit' to conversion operators (e.g. operator int()).
> 
> I'd have said that if you don't want implicit conversions to take
> place, you probably shouldn't write conversion operators. If you want
> explicit conversion operators, give them names like (e.g.) "as_int()"
> and call them explicitly.
> 
> > Is there some reason that explicit was so severely limited by definition?
> 
> I don't think you can reasonably claim that it's "severely limited" -
> it does exactly what it was intended to do. Of course, if your
> argument is persuasive enough, you may be able to encourage the
> commitee to embrace your suggestion in the next standard...

There was a long discussion either here or on comp.lang.c++.moderated about
this, recently. Basically, it comes down to this: if you're writing generic
code, how do you know how to spell "as_int()" without requiring the user of
the class to specialize a traits template? Bear in mind that this traits
template will end up being called different things for every different library
that uses it, and also different libraries will require "as_double()",
"as_string()" and "as_foo()".

Anthony
-- 
Anthony Williams
Senior Software Engineer, Beran Instruments Ltd.
Remove NOSPAM when replying, for timely response.

---
[ 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                       ]



