Topic: forward declaration of typedef


Author: girod@dshp01.trs.ntc.nokia.com (Marc Girod)
Date: 14 Oct 1994 09:48:30 GMT
Raw View
...is not supported. One attempt results in:

--------------------------------
class Y;

void foo(Y*);

class X {};

typedef X Y;

// CC: "tdd.C", line 7: error:  Y redefined: class Y and typedef X (1696)

--------------------------------

But, if the reason for typedef'ing is that the actual class name would
be 'inconvenient', it would be very useful.

E.g.:

--------------------------------
template <class T> class AppObj;
template <class T, class U> class Fetcher;
template <class T> class IO;
class Customer;
typedef AppObj<Fetcher<Customer, IO<Customer> > > AppFetchCust;

--------------------------------

...is heavy as a forward declaration, necessary to declare the
prototype:

void foo(AppFetchCust*);

Are there hidden problems that would make it non-advisable?
--
+-----------------------------------------------------------------------------+
| Marc Girod - Nokia Telecommunications       Phone: +358-0-511 7703          |
| TL4E - P.O. Box 12                            Fax: +358-0-511 7432          |
| SF-02611 Espoo 61 - Finland              Internet: marc.girod@ntc.nokia.com |
|    X.400: C=FI, A=Elisa, P=Nokia Telecom, UNIT=TRS, SUR=Girod, GIV=Marc     |
+-----------------------------------------------------------------------------+