This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8279: REGRESSION: failure to find a matching function in ostream_iterator expansion
- From: paolo at gcc dot gnu dot org
- To: gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jbuck at synopsys dot com, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org
- Date: 19 Oct 2002 10:58:16 -0000
- Subject: Re: c++/8279: REGRESSION: failure to find a matching function in ostream_iterator expansion
- Reply-to: paolo at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, jbuck at synopsys dot com, nobody at gcc dot gnu dot org, paolo at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: REGRESSION: failure to find a matching function in ostream_iterator expansion
Responsible-Changed-From-To: unassigned->paolo
Responsible-Changed-By: paolo
Responsible-Changed-When: Sat Oct 19 03:58:15 2002
Responsible-Changed-Why:
.
State-Changed-From-To: open->feedback
State-Changed-By: paolo
State-Changed-When: Sat Oct 19 03:58:15 2002
State-Changed-Why:
The testcase doesn't compile with 3.0.4/3.1.1/Icc6 either.
I'm not a language lawyer but what about putting the
operator<< inside namespace std:: ??
The following works for me (and all the compilers above):
#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
typedef std::pair<int,int> Pairtype;
namespace std {
inline std::ostream& operator<<(std::ostream& o, const Pairtype& a) {
o << a.first << ": " << a.second;
return o;
}
}
int main()
{
std::vector<Pairtype> data;
std::copy(data.begin(), data.end(),
std::ostream_iterator<Pairtype>(std::cout, "\n"));
}
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8279