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 // istreambuf_iterator 12 13 // istreambuf_iterator<charT,traits>& 14 // istreambuf_iterator<charT,traits>::operator++(); 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 { 25 std::istringstream inf("abc"); 26 std::istreambuf_iterator<char> i(inf); 27 assert(*i == 'a'); 28 assert(*++i == 'b'); 29 assert(*++i == 'c'); 30 assert(++i == std::istreambuf_iterator<char>()); 31 } 32 #ifndef TEST_HAS_NO_WIDE_CHARACTERS 33 { 34 std::wistringstream inf(L"abc"); 35 std::istreambuf_iterator<wchar_t> i(inf); 36 assert(*i == L'a'); 37 assert(*++i == L'b'); 38 assert(*++i == L'c'); 39 assert(++i == std::istreambuf_iterator<wchar_t>()); 40 } 41 #endif 42 43 return 0; 44 } 45