#pragma once #include #include #include namespace NPrivateStringBuilder { class TStringBuilder: public TString { public: inline TStringBuilder() : Out(*this) { } TStringBuilder(TStringBuilder&& rhs) noexcept : TString(std::move(rhs)) , Out(*this) { } TStringOutput Out; }; template static inline TStringBuilder& operator<<(TStringBuilder& builder Y_LIFETIME_BOUND, const T& t) { builder.Out << t; return builder; } template static inline TStringBuilder&& operator<<(TStringBuilder&& builder Y_LIFETIME_BOUND, const T& t) { builder.Out << t; return std::move(builder); } } using TStringBuilder = NPrivateStringBuilder::TStringBuilder;