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& operator++(); 14 // ostream_iterator& operator++(int); 15 16 #include <iterator> 17 #include <sstream> 18 #include <cassert> 19 20 #include "test_macros.h" 21 main(int,char **)22int main(int, char**) 23 { 24 std::ostringstream os; 25 std::ostream_iterator<int> i(os); 26 std::ostream_iterator<int>& iref1 = ++i; 27 assert(&iref1 == &i); 28 std::ostream_iterator<int>& iref2 = i++; 29 assert(&iref2 == &i); 30 31 return 0; 32 } 33