From -4933040235751183802 X-Google-Thread: f78e5,2a0144bbf1d6a893 X-Google-Attributes: gidf78e5,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!newsread.com!news-xfer.newsread.com!nntp.abs.net!news-FFM2.ecrc.net!newsfeed.vmunix.org!peer-uk.news.demon.net!kibo.news.demon.net!news.demon.co.uk!demon!stump.algebra.com!devnull From: Derek.Ledbetter@giganews.com Newsgroups: comp.std.c++ Subject: Re: Proposal: Allow member typedefs to be used in return types without qualification Date: Mon, 25 Apr 2005 15:19:19 GMT Lines: 59 Sender: mail2news@demon.net Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++) Message-ID: <2005042423560127590%@news.giganews.com> References: NNTP-Posting-Host: news.news.demon.net Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.demon.co.uk 1114442369 939 158.152.254.254 (25 Apr 2005 15:19:29 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 25 Apr 2005 15:19:29 +0000 (UTC) X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov) X-User-Agent: Unison/1.5.2 X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Virus-Scanned: by amavisd-new at cs.mu.OZ.AU X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Received: (from fjh@localhost) by mulga.cs.mu.OZ.AU (8.12.10+Sun/8.12.9/Submit) id j3PFJJ3D020969; Tue, 26 Apr 2005 01:19:19 +1000 (EST) X-Path: comp-std-cpp-robomod!not-for-mail X-NNTP-Posting-Date: Mon, 25 Apr 2005 01:55:58 -0500 X-Delivered-To: std-c++@ucar.edu X-TN-Interface: 209.99.127.20 X-Postfilter: 1.3.32 X-Authentication-Warning: serv2.gc.dca.giganews.com: news set sender to poster@giganews.com using -f X-Newsgroups: comp.std.c++ Xref: g2news1.google.com comp.std.c++:4597 On 2005-04-19 19:58:06 -0700, jfa1@cec.wustl.edu ("James Aguilar") said: > Currently, when writing a member function in a class definition, > typedefs that the programmer makes in the class allow member typedefs > to be used as a return type, thus: > > class Example > { > public: > typedef bool result_type; > typedef int input_type; > > result_type operator ()(input_type in1, input_type in2) > { > return in1 < in2; > } > }; > > However, when defining a member function outside of the class in which > it is declared, it looks more like this: > > Example::result_type Example::operator ()(input_type in1, input_type in2) > { > return in1 < in2; > } > > and > > result_type Example::operator ()(input_type in1, input_type in2) > { > return in1 < in2; > } > > is illegal. This should not be. If the parameter types can be assumed > to be members of the containing class, so should return types. The "class namespaces" proposal would solve this problem and more, in a simpler way. Here's how it would work: namespace class Example { result_type operator ()(input_type in1, input_type in2) { return in1 < in2; } } See http://www.open-std.org/jtc1/sc22/WG21/docs/papers/2003/n1420.pdf -- Derek Ledbetter derekl@serve.com --- [ 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 ]