Mail Archives: djgpp/1996/05/31/17:54:44
Xref: | news2.mv.net comp.os.msdos.djgpp:4417
|
From: | rsj AT metronet DOT com (Richard S. James Jr.)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Type unification failed... djgpp bug?
|
Date: | Fri, 31 May 1996 01:52:12 GMT
|
Organization: | Texas Metronet, Inc (login info (214/488-2590 - 817/571-0400))
|
Lines: | 50
|
Message-ID: | <4olje7$cbs@feenix.metronet.com>
|
NNTP-Posting-Host: | dal79.metronet.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I got the following error message when I tried to compile a particular
example program from the book "STL Tutorial and Reference Guide" by
Musser and Saini:
c:/djgpp/lang/cxx/algo.h: In function `int * search(int *, int *,
class deque<int>::iterator, class deque<int>::iterator)':
c:/djgpp/lang/cxx/algo.h:150: type unification failed for function
template `template <class T, class Distance> Distance *
distance_type(input_iterator<...> &)'
Here is the code that produced this error:
#include <algo.h>
#include <vector.h>
#include <deque.h>
#include <assert.h>
int main()
{
vector<int> vec(20);
deque<int> deq(5);
// Initialize vector with 0, 1, ..., 19:
for (int i = 0; i < 20; ++i)
vec[i] = i;
// Initialize deque deq with 5, 6, 7, 8, 9:
for (i = 0; i < 5; ++i)
deq[i] = i + 5;
// Search for first occurrence of the deque contents
// as a subsequence of the vector contents:
vector<int>::iterator viter =
search(vec.begin(), vec.end(), deq.begin(), deq.end());
for (i = 0; i < 5; ++i)
assert(*(viter + i) == i + 5);
}
I have since run into this same error message in another example from
the book, this time on a call to sort_stable (or was it stable_sort?).
Can anyone tell me if this is a bug in djgpp (v.2.7.2) or not? I
couldn't find any references to this in the FAQ or in the info
documentation.
Thanks for the help!
Rich.
- Raw text -