1// (C) Copyright 2008 CodeRage, LLC (turkanis at coderage dot com)
2// (C) Copyright 2005-2007 Jonathan Turkanis
3// Distributed under the Boost Software License, Version 1.0. (See accompanying
4// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt.)
5
6// See http://www.boost.org/libs/iostreams for documentation.
7
8#include <cassert>
9#include <string>
10#include <boost/iostreams/device/back_inserter.hpp>
11#include <boost/iostreams/filtering_stream.hpp>
12
13namespace io = boost::iostreams;
14
15int main()
16{
17 using namespace std;
18
19 string result;
20 io::filtering_ostream out(io::back_inserter(cnt&: result));
21 out << "Hello World!";
22 out.flush();
23 assert(result == "Hello World!");
24}
25

source code of boost/libs/iostreams/example/boost_back_inserter_example.cpp