delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/04/02:09:38

From: edkiser AT jaxnet DOT com (M. Edward Kiser)
Newsgroups: comp.os.msdos.djgpp
Subject: C++ STL Question: priority_queue<...>
Date: Tue, 03 Dec 1996 01:38:16 GMT
Organization: Southeast Network Services, Inc.
Lines: 47
Message-ID: <5800rr$5jp@ns2.southeast.net>
Reply-To: edkiser AT jaxnet DOT com
NNTP-Posting-Host: ts10-010.southeast.net
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have a program that won't compile. As usual, the error is coming
from deep inside the STL header files and I don't have a CLUE what's
going on. If I wasn't listening to a Hearts of Space CD I'd get so mad
I'd quit -- but it has a great calming influence on me. :-)

Here's the shortest program that generates the problem:

-----BEGIN C++ EXCERPT-----
#include <vector>
#include <stack>

typedef priority_queue<vector<float>, greater<float> > pqueue;
-----END C++ EXCERPT-----

These are the errors produced: (I've tried to neaten the formatting a
little to make the errors more readable...)

e:/djgpp/lang/cxx/heap.h:
In function
 `void __push_heap_aux(float *, float *,
    struct greater<float>, float *)':
e:/djgpp/lang/cxx/heap.h:57:
type unification failed for function template
  `template <class RandomAccessIterator, class Distance, class T>
   void __push_heap(RandomAccessIterator, Distance, Distance, T)'

I looked at the code there, and I can't really tell what it's trying
to do or why type unification should fail. Is this a bug in the GCC
STL implementation? Or did I do something wrong with the parameters?
I've also had problems with

  typedef priority_queue<vector<float> > pqueue;

which gcc claims does not have enough parameters, even though my STL
manual says the second should default in this case to
less<vector<float>::value_type>, and

  typedef priority_queue<vector<float>, less<float> > pqueue;

gives the same error as with "greater".

I'm temporarily stuck without them... can anybody help?
--------
Ed Kiser (edkiser AT jaxnet DOT com)
"The great epochs of our lives are at the points where
 we rebaptize our badness as the best in us." -- Nietzsche

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019