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 // include serialization
for vector
#include // 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);
}