typedef legal?

  • Thread starter =?iso-8859-1?Q?Andr=E9_P=F6nitz?=
  • Start date
?

=?iso-8859-1?Q?Andr=E9_P=F6nitz?=

Is the following conforming?

#include <list>

class Foo;

typedef std::list<Foo> FooList;

class Foo {};

int main()
{
FooList dummy;
}


Note the 'typedef' comes before the definition of class Foo.

Andre'
 
R

Rob Williscroft

André Pönitz wrote in
Is the following conforming?

#include <list>

class Foo;

typedef std::list<Foo> FooList;

class Foo {};

int main()
{
FooList dummy;
}


Note the 'typedef' comes before the definition of class Foo.

The compiler shouldn't attempt to instantial std::list< T > in
a typedef, this is standard conforming, however the are probably
some older compilers out there that wouldn't compile your code.

Further all that should be instantiated by you programme, other
than the layout/size info for std::list< Foo > is:

std::list< Foo >::list(); and
std::list< Foo >::~list();

HTH

Rob.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top