Boost logo

Boost Users :

From: Sean Kelly (sean.kelly_at_[hidden])
Date: 2005-05-12 11:20:57


Dear All,

I'm trying to figure out if something like the below is possible with
the serialization library. The
idea is to serialize a heterogeneous sequence using shared_pointer<void>.

thanks for any help

          Sean

void
hetero_sequence()
{
     // create and open a character archive for output
    std::ofstream ofs("dictionary.pickle");
    boost::archive::text_oarchive oa(ofs);

    std::deque<boost::shared_ptr<void> > sequence;
    sequence.push_back(boost::shared_ptr<string>(new string("random
string")));
    sequence.push_back(boost::shared_ptr<double>(new double(3.1415627)));
    sequence.push_back(boost::shared_ptr<bool>(new bool(false)));
    
    // write class instance to archive
    oa << sequence;
    // close archive
    ofs.close();
}


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