Anton Bachin wrote:
Well. <iosfwd> turned out to be not so useful in a header-only library. Including it allows you to declare overloads, but not to (easily) define them, because you need various iostreams definitions and additional declarations. I did timing tests on some headers, and including anything from iostreams except <iosfwd> carried a significant penalty, well within a factor of 2 of <iostream> itself.
I may have to move the operators to a separate file, but for now I put their definitions in enum.h, made them into templates, and hid the undefined iostreams types behind templates that depend on the overall template parameter.
Streams are already templated, so artificial templating shouldn't be necessary if you use basic_istream and basic_ostream.