From 632f682292fd19fb0873dfc58af0d1af96c03a10 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 16 Jul 2003 14:30:47 +0000 Subject: [PATCH] Satisfy assignable requirement for output iterators. [SVN r19150] --- fun_out_iter_example.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/fun_out_iter_example.cpp b/fun_out_iter_example.cpp index dc84d39..ff3e0a2 100644 --- a/fun_out_iter_example.cpp +++ b/fun_out_iter_example.cpp @@ -15,12 +15,18 @@ #include -struct string_appender { - string_appender(std::string& s) : m_str(s) { } - void operator()(const std::string& x) const { - m_str += x; - } - std::string& m_str; +struct string_appender +{ + string_appender(std::string& s) + : m_str(&s) + {} + + void operator()(const std::string& x) const + { + *m_str += x; + } + + std::string* m_str; }; int main(int, char*[])