Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2005-09-05 23:42:19


Below are the changes I made in order for this compile:

a) pass a const reference to ar <<
b) include headers for serialized types.

Robert Ramey

#include <boost/serialization/vector.hpp> // include serialization
for vector
#include <boost/serialization/shared_ptr.hpp> // include serialization for
shared_ptr

void save_data(const std::vector<Builder> & data){
std::ofstream fout("file");
boost::archive::text_oarchive fout_ar(fout);
fout_ar << data;
}
int main()
{
std::vector<Builder> data;
Builder *builder = new Builder[10];
for(int i = 0; i < 10; i++)
{
builder[i].type = i;
switch(i)
{
case 0:
builder[i].program->sources = "bshfdvhjvcds";
break;
case 1:
builder[i].object->sources = "bshfdvhjvcds";
break;
case 2:
builder[i].java->srcDir = "bshfdvhjvcds";
break;
case 3:
builder[i].comment->content = "bshfdvhjvcds";
break;
case 4:
builder[i].print->content = "bshfdvhjvcds";
break;
case 5:
builder[i].variable->content = "bshfdvhjvcds";
break;
case 6:
builder[i].library->sources = "bshfdvhjvcds";
break;
case 7:
builder[i].sharedLibrary->sources = "bshfdvhjvcds";
break;
case 8:
builder[i].node->content = "bshfdvhjvcds";
break;
case 9:
builder[i].import->import = "bshfdvhjvcds";
break;
case 10:
builder[i].code->code = "bshfdvhjvcds";
break;
case 11:
builder[i].sourceSignatures->type = "jsdbifbviugvdbuyvf";
break;
case 12:
builder[i].targetSignatures->type = "jsdbifbviugvdbuyvf";
break;
case 13:
builder[i].setOption->option = "jsdbifbviugvdbuyvf";
break;
case 14:
builder[i].ignore->target = "jsdbifbviugvdbuyvf";
break;
case 15:
builder[i].depend->target = "jsdbifbviugvdbuyvf";
break;
case 16:
builder[i].environmentVariable->name = "vhdbfubvugvsdfuvy";
break;
}
}
for(int i = 0; i < 10; i++)
{
data.push_back(builder[i]);
}
save_data(data);
}


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