Topic: Elaborated Type Specifiers


Author: "Neal G." <ngr@bagit.synnet.com>
Date: 1998/03/10
Raw View
--------------B702B25DB2B5A755E1BCB149
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Referring to Section 3.4.4 in Draft: 2 December 1996
    Elaborated Type Specifiers

if one was to define a nested class such as:

// In    file_A.h
struct Outer {

    struct Inner {
        int a;
    };

    int b;
};


If in another translation unit such as foo.cc, it was undesirable to
include the entire header file "fille_A.h" but I wanted to make
reference to class Inner for the purposes of declaring either a pointer
or reference such as:

Outer::Inner *ptr;

how would one go about generating a forward declaration for this
construct?



Author: Jens Kilian <Jens_Kilian@bbn.hp.com>
Date: 1998/03/11
Raw View
"Neal G." <ngr@bagit.synnet.com> writes:
> From reading the Draft it appears that a forward declaration such as:
>
> struct Outer::Inner;    // "error cannot introduce a qualified type"
>
> is illegal!

Without seeing the declaration of struct Outer, the compiler cannot tell
if you are even allowed to use Outer::Inner (it might be private).

Bye,
 Jens.
--
mailto:jjk@acm.org                 phone:+49-7031-14-7698 (HP TELNET 778-7698)
  http://www.bawue.de/~jjk/          fax:+49-7031-14-7351
PGP:       06 04 1C 35 7B DC 1F 26 As the air to a bird, or the sea to a fish,
0x555DA8B5 BB A2 F0 66 77 75 E1 08 so is contempt to the contemptible. [Blake]
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]