Поскольку вы, очевидно, не будете публиковать полный, компилируемый кусок кода, чтобы продемонстрировать проблему, вот короткая демонстрация того, как она может работать:
#include <map>
#include <iostream>
#include <string>
#include <iterator>
class City {
unsigned int population;
// probably more stuff here, but this should be enough for now.
public:
City(int pop=0) : population(pop) {}
friend std::ostream &operator<<(std::ostream &os, City const &c) {
return os << c.population;
}
};
std::ostream &operator<<(std::ostream &os,
std::pair<std::string, City> const &d)
{
return os << d.first << ": " << d.second;
}
int main() {
std::map<std::string, City> cities;
typedef std::pair<std::string, City> ct;
cities["Chicago"] = City(3456789);
cities["New York"] = City(8765432);
std::copy(cities.begin(), cities.end(),
std::ostream_iterator<ct>(std::cout, "\n"));
return 0;
}
Я скомпилировал и протестировал это на 64Windows, и, кажется, работает нормально.Казалось бы (по крайней мере мне), что map
работает на 64-битной Windows без проблем.Трудно догадаться, что именно вы сделали, что нарушает, но может быть проще расширить рабочий код, чтобы делать то, что вы хотите, чем выяснить, что сломано в коде, который не работает.