#include "vocabid.hh" void add_to_map(std::map *karta, StringPiece textin) { //Tokenize util::TokenIter it(textin, util::SingleCharacter(' ')); while(it) { karta->insert(std::pair(getHash(*it), it->as_string())); it++; } } void serialize_map(std::map *karta, const char* filename) { std::ofstream os (filename, std::ios::binary); boost::archive::text_oarchive oarch(os); oarch << *karta; //Serialise map os.close(); } void read_map(std::map *karta, const char* filename) { std::ifstream is (filename, std::ios::binary); boost::archive::text_iarchive iarch(is); iarch >> *karta; //Close the stream after we are done. is.close(); }