Hi
I am using Boost 1.40.0 and stlport 5.0 on Visual Studio 2008.
The Bimap deserialization succeeds for 24 elements but starts failing after
that.
Here is the file with all the code
#include "stdafx.h"
#include
#include
#include
#include
#include <fstream>
#include <exception>
#include <iostream>
using namespace boost;
using namespace boost::bimaps;
typedef unsigned int uint;
struct GeoNode
{
public:
GeoNode(){}
GeoNode(uint x, uint y ): x_geocode(x), y_geocode(y) {}
friend bool operator==(GeoNode const& a, GeoNode const& b)
{
return a.x_geocode == b.x_geocode && a.y_geocode == b.y_geocode;
}
friend std::size_t hash_value(GeoNode const& g)
{
std::size_t seed = 0;
boost::hash_combine(seed, g.x_geocode);
boost::hash_combine(seed, g.y_geocode);
return seed;
}
friend bool operator < (GeoNode const& a, GeoNode const& b)
{
if (a.x_geocode != b.x_geocode)
return a.x_geocode < b.x_geocode;
return a.y_geocode < b.y_geocode;
}
friend std::ostream& operator << (std::ostream& os, const GeoNode& g)
{
os<<"X: "<
void print_map(const MapType & m)
{
typedef typename MapType::const_iterator const_iterator;
for( const_iterator iter = m.begin(), iend = m.end(); iter != iend;
++iter )
{
std::cout << iter->first << "-->" << iter->second << std::endl;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
typedef bimap Store_type;
const char* fileName = "Nodes.dat";
Store_type storeToWrite;
Store_type storeThatsRead;
int countThatWorks = 24;
int countThatFails = 25;
//insert Data
for ( int i =0;i (storeToWrite);
}
//read from File
{
std::ifstream ifs(fileName);
boost::archive::binary_iarchive ia(ifs);
ia >> storeThatsRead;
}
print_map(storeThatsRead.left);
}
catch (std::exception e)
{
std::cout<http://old.nabble.com/Strange-issue-with-Serialization-of-BiMaps-tp26983930p...
Sent from the Boost - Users mailing list archive at Nabble.com.