Frequently Asked Questions

Why is data I've written to a filtering_stream not reaching the Sink at the end of the chain?
Why does my filter chain work with cout but not with another ostream?
How do I write to several ostreams at once?
Why do I get errors stating that operator| is ambiguous?
Why do I get errors when compiling the finite_state_filter examples?

Why is data I've written to a filtering_stream not reaching the Sink at the end of the chain?

You may need to flush the stream. Note, however, that there is no guarantee that all data written to a filtering_stream will be forwarded to the final Sink until the stream is closed, unless all the Filters in the underlying chain are Closable.

It's also possible that a buggy Filter is modifying data in a way you don't expect.

Why does my filter chain work with cout but not with another ostream?

The Iostreams library stores streams and stream buffers by reference; consequently, streams and stream buffers must outlive any filter chain to which they are added. This is not a problem for std::cout, since it is guaranteed to live until the end of the program.

Check to make sure that the ostream is not being destroyed before the filtering_stream. If both objects are constructed on the stack within the same block, make sure that the ostream is constructed first.

How do I write to several ostreams at once?

Use a tee_filter or tee_device. See tee.

Why do I get errors stating that operator| is ambiguous?

During overload resolution for an expression involving operator|, your compiler could be considering an implicit conversion from an intergral type to a Pipable Filter. Make sure that all your Pipable Filters have explicit constructors. See Pipelines.

Why do I get errors when compiling the finite_state_filter examples?

The template finite_state_filter requires a highly standard-conforming compiler. See Portability and the Compiler Status Tables for details.