Topic: STL: derive from priority_queue


Author: Burkhard Koester <bkoester@fbwi.fh-wilhelmshaven.de>
Date: 1998/05/18
Raw View
Hi,

I have a problem when I try to derive a class from the STL priority_queue
class. Borland's C++ 5.01 compiler reports
a "type name expected" in theline containing the class
statement. Here is an abstract from my headerfile:
   #include <queue.h>
   #include <iostream.h>

   template <class T, class Container, class Compare>

   //         v---- this is the typename, isn't it???
   class MyQueue : public priority_queue
   {
      (...)

What's wrong? The following lines didn't match either:
1) class MyQueue : public priority_queue<T, Container, Compare> {...};
2) class MyQueue : public std::priority_queue {...};

Can anybody help :-)) ?


Best regards
Burkhard


-------------------------------------
Burkhard Koester
Wilhelmshaven University of applied science
- Dep. Computer Science in Business  Administration -
PO-Box 1465
D-26354 Wilhelmshaven, Germany
Fax : +49 4421 985-412
bkoester@fbwi.fh-wilhelmshaven.de
http://www.fh-wilhelmshaven.de
---
[ 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              ]





Author: Johann Klugsberger <klugsber@austria.ds.philips.com>
Date: 1998/05/19
Raw View
You need to provide the template parameters to std::priority_queue:

#include <queue>

template <class T, class Container, class Compare>
class MyQueue : public std::priority_queue<T, Container, Compare>
{
// ...
};

At least this compiles with MSVC5.0 SP3

Hans

Burkhard Koester wrote:

> Hi,
>
> I have a problem when I try to derive a class from the STL priority_queue
> class. Borland's C++ 5.01 compiler reports
> a "type name expected" in theline containing the class
> statement. Here is an abstract from my headerfile:
>    #include <queue.h>
>    #include <iostream.h>
>
>    template <class T, class Container, class Compare>
>
>    //         v---- this is the typename, isn't it???
>    class MyQueue : public priority_queue
>    {
>       (...)
>
> What's wrong? The following lines didn't match either:
> 1) class MyQueue : public priority_queue<T, Container, Compare> {...};
> 2) class MyQueue : public std::priority_queue {...};
>
> Can anybody help :-)) ?
>
> Best regards
> Burkhard
>
> -------------------------------------
> Burkhard Koester
> Wilhelmshaven University of applied science
> - Dep. Computer Science in Business  Administration -
> PO-Box 1465
> D-26354 Wilhelmshaven, Germany
> Fax : +49 4421 985-412
> bkoester@fbwi.fh-wilhelmshaven.de
> http://www.fh-wilhelmshaven.de
> ---
> [ 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              ]
---
[ 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              ]