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 ostreambuf_iterator
12
13// ostreambuf_iterator<charT,traits>&
14// operator=(charT c);
15
16#include <iterator>
17#include <sstream>
18#include <cassert>
19
20#include "test_macros.h"
21
22int main(int, char**)
23{
24 {
25 std::ostringstream outf;
26 std::ostreambuf_iterator<char> i(outf);
27 i = 'a';
28 assert(outf.str() == "a");
29 i = 'b';
30 assert(outf.str() == "ab");
31 }
32#ifndef TEST_HAS_NO_WIDE_CHARACTERS
33 {
34 std::wostringstream outf;
35 std::ostreambuf_iterator<wchar_t> i(outf);
36 i = L'a';
37 assert(outf.str() == L"a");
38 i = L'b';
39 assert(outf.str() == L"ab");
40 }
41#endif
42
43 return 0;
44}
45

source code of libcxx/test/std/iterators/stream.iterators/ostreambuf.iterator/ostreambuf.iter.ops/assign_c.pass.cpp