General Category > General Discussion about just::thread

Serialization of jss::concurrent_map

(1/1)

sodapop:
Is there anyone on the forums who knows how to serialize a jss::concurrent_map? Are there any built in functions to do this?

Anthony Williams:

--- Quote from: sodapop on March 04, 2014, 05:34:47 PM ---Is there anyone on the forums who knows how to serialize a jss::concurrent_map? Are there any built in functions to do this?

--- End quote ---

By "serialize", I assume you mean write out to a stream. No, there are no functions supplied to do this. You could use the iteration interface:


--- Code: ---jss::concurrent_map<int,unsigned> map;
for(jss::concurrent_map<int,unsigned>::iterator it=map.begin(),end=map.end();it!=end;++it){
    std::cout<<it->first<<":"<<it->second<<std::endl;
}

--- End code ---

Of course, if another thread modifies the map in the mean time then you may or may not see their modifications.

Navigation

[0] Message Index

Go to full version