title: How do you create a transactional stream in C++?
body: <p>I need to create "transactional stream" in C++. What I mean by "transactional stream" is a stream that will rewind if there is an error at some point in the processing. For example,
  if a stream's consumer somehow fails to process the stream's data, I want the stream to be reverted to its state before producing that data.</p>
  
  <p>Perhaps a lazy stream would achieve this? Is this a common situation with a common solution or am I bound to writing my own custom implementation for my specific problem?</p>