This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15469] New: Unable to compile valid code including transform() algorithm
- From: "relf at os2 dot ru" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 May 2004 21:01:37 -0000
- Subject: [Bug c++/15469] New: Unable to compile valid code including transform() algorithm
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
While compiling the code below, gcc 3.3.3 reports the error:
bug2.cpp:21: error: no matching function for call to `transform(
std::_Rb_tree_iterator<std::pair<const int, int>, std::pair<const int,
int>&, std::pair<const int, int>*>, std::_Rb_tree_iterator<std::pair<const
int, int>, std::pair<const int, int>&, std::pair<const int, int>*>,
__gnu_cxx::__normal_iterator<int*, std::vector<int, std::allocator<int> > >,
<unknown type>)'
The code looks correct, not much different from the C++ Standard section 18.6.2
examples.
secondof() function by itself works fine - i've included a line into the code to
demonstrate that.
==============================
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
template <class cl1, class cl2>
const cl2& secondof(const pair<cl1,cl2>& p) {
return p.second;
}
int main() {
map<int,int> M;
M[1] = 10;
M[4] = 50;
cout << "secondof() works as expected: " << secondof(*M.begin()) << endl;
vector<int> V(M.size());
transform(M.begin(),M.end(),V.begin(),secondof);
}
--
Summary: Unable to compile valid code including transform()
algorithm
Product: gcc
Version: 3.3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: relf at os2 dot ru
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15469