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 // <streambuf> 10 11 // template <class charT, class traits = char_traits<charT> > 12 // class basic_streambuf; 13 14 // void setp(char_type* pbeg, char_type* pend); 15 16 #include <streambuf> 17 #include <cassert> 18 19 template <class CharT> 20 struct test 21 : public std::basic_streambuf<CharT> 22 { 23 typedef std::basic_streambuf<CharT> base; 24 25 test() {} 26 27 void setp(CharT* pbeg, CharT* pend) 28 { 29 base::setp(pbeg, pend); 30 assert(base::pbase() == pbeg); 31 assert(base::pptr() == pbeg); 32 assert(base::epptr() == pend); 33 } 34 }; 35 36 int main(int, char**) 37 { 38 { 39 test<char> t; 40 char in[] = "ABC"; 41 t.setp(in, in+sizeof(in)/sizeof(in[0])); 42 } 43 { 44 test<wchar_t> t; 45 wchar_t in[] = L"ABC"; 46 t.setp(in, in+sizeof(in)/sizeof(in[0])); 47 } 48 49 return 0; 50 } 51