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