Boost logo

Boost Users :

From: Christian Henning (chhenning_at_[hidden])
Date: 2006-05-24 14:54:16


Hi there, I was just toying around with the boost serialization lib.
Unfortunately I have a problem with serializing a map. Here is what I
did:

#include <map>
#include <string>
#include <iostream>
#include <algorithm>
#include <fstream>

#include <boost/archive/text_iarchive.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/map.hpp>

using namespace std;

struct Settings
{
   int Brightness;
   int Contrast;
};

// Table indexed by strings
typedef pair< string, string > Key;
typedef map< Key, Settings* > Table;

int _tmain(int argc, _TCHAR* argv[])
{
   Table aTable;

   aTable[ make_pair("Mueller","Meier") ] = new Settings();
   aTable[ make_pair("Meier","Mueller") ] = new Settings();
   aTable[ make_pair("Meier","Meier") ] = new Settings();

   Settings* pSettings = aTable[ make_pair("Mueller","Meier") ];
   pSettings->Brightness = 99;
   pSettings->Contrast = 8;

   ofstream ofs( "Settings.txt" );
   boost::archive::text_oarchive oa( ofs );
   oa << aTable;

   return 0;
}

I get an the following error:

error C2027: use of undefined type 'boost::STATIC_ASSERTION_FAILURE<x>'
....

I'm using MSVC 7.1 and boost 1.33.1 .

I believe there is something very basic wrong in my code. Any help?

Thanks ahead,
Christian Henning


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net