Debian Codegraph @

libcxx/test/std/iterators/stream.iterators/ostream.iterator/ostream.iterator.cons.des/ostream.pass.cpp

raw
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8
9 // <iterator>
10
11 // class ostream_iterator
12
13 // ostream_iterator(ostream_type& s);
14
15 #include <iterator>
16 #include <sstream>
17 #include <cassert>
18
19 #include "test_macros.h"
20
21 struct MyTraits : std::char_traits<char> {};
22
23 typedef std::basic_ostringstream<char, MyTraits> StringStream;
24 typedef std::basic_ostream<char, MyTraits> BasicStream;
25
26 void operator&(BasicStream const&) {}
27
28 int main(int, char**)
29 {
30 {
31 std::ostringstream outf;
32 std::ostream_iterator<int> i(outf);
33 assert(outf.good());
34 }
35 {
36 StringStream outf;
37 std::ostream_iterator<int, char, MyTraits> i(outf);
38 assert(outf.good());
39 }
40
41 return 0;
42 }