[comp.lang.c++] ::& like ::* ??

mat@mole-end.UUCP (Mark A Terribile) (05/18/89)

First, since we allow pointer-to-member, is there any possibility that we
will see a reference-to-member?

Second ...

In the absence of reference-to-member, I wish to declare a constant pointer-to-
member-function.  In the absence of the const, I would write

	ostream& (My_junk::*out_op)( ostream& );

I want  out_op  itself to be a const.  If I were simply declaring a pointer-
to-ostream, I would use

	ostream* const osp;

I would expect that a constant pointer-to-function would have to be written as

	ostream& (* const osrfp)( ostream& );

(cfront 1.2.1 accepts this, and I *think* it means what I've described.

Then I would expect that if, instead of a pointer (``*'') I wanted to specify
a pointer-to-member-of-My_junk (``My_junk::*''), I would write

	ostream& (My_junk::* const out_op)( ostream& );

1.2.1 doesn't like this; instead it accepts

	ostream& const (My_junk::*out_op)( ostream& );

I presume and hope that this means that out_op is a constant-pointer-to-member-
of-My_junk-returning-reference-to-ostream ...

In what may be an analagous way, cfront 1.2.1 accepts

	ostream& const (* osfrp)( ostream& );

Is this the same as when the ``const'' is stuffed after the ``*'' ?

Or am I caught in a rundown halfway between second and third?


Yes, C's ``declare-by-example'' *was* an ingenous idea that smelled bad ...
-- 

 (This man's opinions are his own.)
 From mole-end				Mark Terribile