home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!Germany.EU.net!Urmel.Informatik.RWTH-Aachen.DE!dfv.rwth-aachen.de!sungate.fido.de!p1.hippo.fido.de!spam.fido.de!Gilles_Kohl
- Date: Sun, 15 Nov 92 09:01:00 +0100
- From: Gilles_Kohl@spam.fido.de (Gilles Kohl)
- Subject: Re: Operator -> cannot return non-class types?
- Message-ID: <a008546a@p3.f6.n249.z2.fidonet.org>
- References: <b5327e91@aut.abb.se>
- Newsgroups: comp.lang.c++
- X-Comment-To: (Daniel Larsson)
- Organization: This origin line is inoperative. Call support at
- Lines: 23
-
- > Yesterday, I tried HP's new C++ compiler (3.0) and templates for the
- > first time. To my surprise, I noticed that operator -> can only return the
- > following
- > three types:
- > - a pointer to a class,
- > - a class, or
- > - a reference to a class.
-
- > What is the rationale behind this restriction? I couldn't find anything
- > in C++PL 2nd ed. that mentions this restriction, although I didn't look too
- > hard.
- Daniel,
-
- I think the following on page 594 of C++PL2 applies:
-
- r.13.4.6 Class Member Access
-
- (...) An expression x->m is interpreted as (x.operator->())->m for a class
- object x. It follows that operator-> must return either a pointer to a class or
- an object of or a reference to a class for which operator->() is defined.
- operator->() must be a nonstatic member function.
-
- ---
-