From 4001956292993585519
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,b43d17d27e7171b0
X-Google-Attributes: gidf78e5,public
From: Ron Natalie <ron@sensor.com>
Subject: Re: explicit operator T()
Date: 2000/12/06
Message-ID: <3A2EA5ED.7CD79422@sensor.com>#1/1
X-Deja-AN: 701901272
Content-Transfer-Encoding: 7bit
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
References: <3A2D10EE.35544D0A@aixigo.de> <3a2d965b.14703165@news.csrlink.net> <90m70n$ebt$1@news-int.gatech.edu>
X-Accept-Language: en
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Trace: mail2news.demon.co.uk 976136094 mail2news:12043 mail2news mail2news.demon.co.uk
Organization: Sensor Systems
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
MIME-Version: 1.0
NNTP-Posting-Date: Wed, 06 Dec 2000 15:50:28 EST
Newsgroups: comp.std.c++



"Brian McNamara!" wrote:

> 
> >There is quite a history available on deja for this.  The basic result.
> >   explicit operator int () const;
> >is spelled
> >   int as_int () const;
> >or whatever other naming convention you may like.
> 
> ...thus making it impossible to write template code that does explicit
> conversions.
> 

Not impossible at all.

You don't need the typename in template.

	T convert() const;

works just fine and is less cumbersome that C++ style cast notation on
the callers part.

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




