// Copyright (c) 2009 Matthias Vallentin // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include #include #include #include #include struct foo : boost::noncopyable { foo() : str("foo") { } std::string str; }; template Stream& operator<<(Stream& out, const foo& f) { out << f.str; return out; } int main() { using namespace boost::spirit; typedef boost::shared_ptr foo_ptr; std::vector v; std::size_t i = 10; while (i--) v.push_back(boost::make_shared()); typedef boost::indirect_iterator::const_iterator> iterator_type; std::stringstream strm; strm << karma::format(stream % ',', boost::iterator_range( iterator_type(v.begin()), iterator_type(v.end()) ) ); BOOST_TEST(strm.str() == "foo,foo,foo,foo,foo,foo,foo,foo,foo,foo"); return boost::report_errors(); }