This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/8279: REGRESSION: failure to find a matching function in ostream_iterator expansion


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]