[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
How to copy map to ostream_iterator?
From: |
Siegfried |
Subject: |
How to copy map to ostream_iterator? |
Date: |
3 May 2006 11:55:30 -0700 |
User-agent: |
G2/0.2 |
I know I have done this before successfully on some compiler -- maybe
it was MSVC 7 or g++ 2.95.
Presently, the g++ 3.2 compiler is complaining that it cannot find
operator<<(ostream, std::pair<string,string>). However, it is present
and I can call it. So why does not g++ see it when compiling std::copy?
Thanks,
Siegfried
ostream operator<<(ostream os, const std::pair<string,string>& x){
return os << x.first<<x.second; }
std::map<string,string>m; m[(string)"hello"] = (string)"there";
std::copy(m.begin(), m.end(), ostream_iterator<std::pair<string,string>
>(cout));
- How to copy map to ostream_iterator?,
Siegfried <=