c++/8279: REGRESSION: failure to find a matching function in ostream_iterator expansion
paolo@gcc.gnu.org
paolo@gcc.gnu.org
Sat Oct 19 03:58:00 GMT 2002
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
More information about the Gcc-bugs
mailing list