user245019
user245019

Reputation:

Best way to store stream data

I'm making a game message system and using boost::serialize to convert message data into streams and sending it. This works fine for transmitting messages instantly as I can send off the reference to the stream.

However I would like to queue up messages as well in some circumstances. I am not sure what the best way to store the data would be.

I tried std::queue<std::stringstream> but that just errors lots.

std::bitset looks semi promising, but I'm not sure.

Or is this completely bonkers?

Upvotes: 2

Views: 375

Answers (1)

John Zwinck
John Zwinck

Reputation: 249394

Try std::queue<std::vector<char> >. The stringstream you tried before isn't copyable, so just copy the bytes. You could also use string as the value type in the queue, since that's probably what you'll be getting out of the stringstream.

Upvotes: 1

Related Questions