blob: 932ef25b784c5caaa1d8471dbd4f46e9ee1a5712 [file] [log] [blame]
Dan Albert287553d2017-02-16 10:47:51 -08001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <iterator>
11
12// class ostream_iterator
13
14// ostream_iterator& operator=(const T& value);
15
16#include <iterator>
17#include <sstream>
18#include <cassert>
19
20#if defined(__clang__)
21#pragma clang diagnostic ignored "-Wliteral-conversion"
22#endif
23
24int main()
25{
26 {
27 std::ostringstream outf;
28 std::ostream_iterator<int> i(outf);
29 i = 2.4;
30 assert(outf.str() == "2");
31 }
32 {
33 std::ostringstream outf;
34 std::ostream_iterator<int> i(outf, ", ");
35 i = 2.4;
36 assert(outf.str() == "2, ");
37 }
38 {
39 std::wostringstream outf;
40 std::ostream_iterator<int, wchar_t> i(outf);
41 i = 2.4;
42 assert(outf.str() == L"2");
43 }
44 {
45 std::wostringstream outf;
46 std::ostream_iterator<int, wchar_t> i(outf, L", ");
47 i = 2.4;
48 assert(outf.str() == L"2, ");
49 }
50}