Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pointer to one operator*

0 views
Skip to first unread message

io_x

unread,
Jun 27, 2009, 2:06:47 PM6/27/09
to
Exist in C++ one pointer to one operator?

if it is possible a pointer to
X& operator*(unsigned b, const X& a){}

will be

X& (*operator*)(unsigned b, const X& a);

right?

Sam

unread,
Jun 27, 2009, 2:53:27 PM6/27/09
to
io_x writes:

No. An operator is just a function, no different than any other function.
Consider how you would go about using a function pointer. Same thing.


Alf P. Steinbach

unread,
Jun 27, 2009, 4:22:26 PM6/27/09
to
* io_x:

No.

The last declaration attempts to declare a variable that is a pointer to
routine, and name that variable 'operator*'.

You can't use that special name for variables.

But as to the question you probably meant to ask, no, the built-in operators do
not exist as routines you can take the address of.

It is however a simple matter to define routines that wrap the use of built-in
operators, and the standard library even offers some such routines.


Cheers & hth.,

- Alf

--
Due to hosting requirements I need visits to <url: http://alfps.izfree.com/>.
No ads, and there is some C++ stuff! :-) Just going there is good. Linking
to it is even better! Thanks in advance!

0 new messages