diff --git a/Utils/convertstream.h b/Utils/convertstream.h index 1a0484d7..4c4bec18 100644 --- a/Utils/convertstream.h +++ b/Utils/convertstream.h @@ -55,11 +55,14 @@ public: typedef std::basic_string fromStringT; explicit basic_iconvertstream(ios_base::openmode mode = in) - : std::basic_istream(&stringbuf_), stringbuf_(mode | in) - {} - explicit basic_iconvertstream(const stringT& str, ios_base::openmode mode = in) - : std::basic_istream(&stringbuf_), stringbuf_(mode | in) + : std::basic_istream(0), stringbuf_(mode | in) { + istreamT::rdbuf(&stringbuf_); + } + explicit basic_iconvertstream(const stringT& str, ios_base::openmode mode = in) + : std::basic_istream(0), stringbuf_(mode | in) + { + istreamT::rdbuf(&stringbuf_); str(str); } virtual ~basic_iconvertstream() @@ -145,11 +148,15 @@ public: typedef std::basic_string toStringT; explicit basic_oconvertstream(ios_base::openmode mode = out) - : std::basic_ostream(&stringbuf_), stringbuf_(mode | out) - {} + : std::basic_ostream(0), stringbuf_(mode | out) + { + ostreamT::rdbuf(&stringbuf_); + } explicit basic_oconvertstream(const stringT& str, ios_base::openmode mode = out) - : std::basic_ostream(&stringbuf_), stringbuf_(str, mode | out) - {} + : std::basic_ostream(0), stringbuf_(str, mode | out) + { + ostreamT::rdbuf(&stringbuf_); + } virtual ~basic_oconvertstream() {}