🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Herb Sutter Thu, 24 Aug 1995 03:56
Re: Is this valid?
#1832
Author: 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. ]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads