[Repost from Blopig] Maps are useful. But first, you need to build, store and read a map.

Earlier I wrote a blog post for OPIG: https://www.blopig.com/blog/2018/07/maps-are-useful-but-first-you-need-to-build-store-and-read-a-map/

Here I’m attaching the codes that I used:

using namespace std;

void save(map const& obj, string const& fname) {
    std::ofstream ofs(fname, std::ios::binary);
        boost::iostreams::filtering_ostreambuf fos;

        // push the ofstream and the compressor


        // start the archive on the filtering buffer:
        boost::archive::binary_oarchive bo(fos);
        bo <> obj;
        return obj;

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s