On Wed, Sep 17, 2003 at 10:36:08AM +0100, Angus Leeming wrote:
> Andre Poenitz wrote:
> > It is not legal to instantiate a template on an incomplete type,
> > i.e. this
> > 
> > #ifndef PARAGRAPH_LIST_FWD_H
> > #define PARAGRAPH_LIST_FWD_H
> > 
> > #include <list>
> > #include <utility>
> > 
> > class Paragraph;
> > 
> > typedef std::list<Paragraph> ParagraphList;
> > 
> > typedef std::pair<ParagraphList::iterator, int> PitPosPair;
> > 
> > #endif
> > 
> > is bad.
> > 
> > Andre'
> 
> And where, exactly, is the instantiation?

Good point.

I have a bad feeling nevertheless, but I'll go ask the gurus as I don't
find something explicitly forbidding it.

> I see none... Moreover, you'll find that any place ParagraphList is
> actually instantiated (in the .C files) there is a #include
> "paragraph.h" as well as a #include "ParagraphList_fwd.h".

But it doesn't work with 'class Paragraph;' removed. So this means usage
is something like

 #include <list>
 
 class Paragraph;

 typedef std::list<Paragraph> ParagraphList;
 
 class Paragraph {
 ...
 };


Well, I go and ask.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security, will not have,
nor do they deserve, either one.     (T. Jefferson or B. Franklin or both...)

Reply via email to