string producer/consumer in C++: std::deque<char> or std::stringstream?
问题 In our application we have a class that produces characters, and another that consumes them. The current implementation dynamically allocates characters as they are produced (using new ) and delete them (with delete ) as they are consumed. This is all terribly slow, and I am looking at ways to replace that implementation to improve its performance. The semantic I need is that of the standard class queue : push at the front, pop at the back. The default implementation uses a deque IIRC. deque