🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1832

Re: Is this valid?

#1832
From: Herb Sutter
Date: Thu, 24 Aug 1995 03:56
38 lines
1762 bytes
va@styx.org.chemie.uni-frankfurt.de (Volker Apelt) wrote:
>
>Is the declaration of two member functions which differ only in their
>ctor-qualifiers valid c++?
>eg.
>
>class A {
>public:
>   T& elem(int n)const;
>   T& elem(int n);
>};

Not only is it valid, it is extremely useful.  See Scott Meyers' book 
"Effective C++" (and the sequel, "More Effective C++", due out this fall) for 
very readable and accessible treatments of this and many other issues.

>The April Working Paper says 
>8.4 [dcl.fct.def]
>5 A  cv-qualifier-seq can be part of a non-static member function decla
>  ration, non-static member function definition, or  pointer  to  member
>  function only; see _class.this_.  It is part of the function type.
>				    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>Thanks in advance

I think you just quoted your own answer. :-)

Regards,

Herb


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Herb Sutter                 2228 Urwin, Ste 102         voice (416) 618-0184
Connected Object Solutions  Oakville ON Canada L6L 2T2    fax (905) 847-6019

[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <41gt92$1g@engnews2.Eng.Sun.COM>
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engnews2.Eng.Sun.COM!taumet!clamage
From: herbs@interlog.com (Herb Sutter)
Newsgroups: comp.std.c++
Subject: Re: Is this valid?
Date: 24 Aug 1995 03:56:18 GMT
Organization: Daystar Software Systems Design Inc.
Approved: clamage@eng.sun.com (comp.std.c++)
Message-ID: <41gt92$1g@engnews2.Eng.Sun.COM>
NNTP-Posting-Host: taumet.eng.sun.com
Content-Type: text
Content-Length: 1081
Originator: clamage@taumet