#pragma once #include #include #include class IInputStream; class IOutputStream; namespace NPrivate { template ::value> struct TStreamBase { using TType = IInputStream; }; template struct TStreamBase { using TType = IOutputStream; }; } /** * An ownership-gaining wrapper for proxy streams. * * Example usage: * \code * TCountingInput* input = new THoldingStream(new TStringInput(s)); * \encode * * In this example, resulting counting input also owns a string input that it * was constructed on top of. */ template ::TType> class THoldingStream: private THolder, public Base { public: template inline THoldingStream(THolder stream, Args&&... args) : THolder(std::move(stream)) , Base(this->Get(), std::forward(args)...) { } };