xref: /llvm-project/libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/mode.alloc.pass.cpp (revision 81ad5a5cb87740c62b30a4f8232770bd5eb7fc45)
1*81ad5a5cSPiotr Fusik //===----------------------------------------------------------------------===//
2*81ad5a5cSPiotr Fusik //
3*81ad5a5cSPiotr Fusik // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4*81ad5a5cSPiotr Fusik // See https://llvm.org/LICENSE.txt for license information.
5*81ad5a5cSPiotr Fusik // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6*81ad5a5cSPiotr Fusik //
7*81ad5a5cSPiotr Fusik //===----------------------------------------------------------------------===//
8*81ad5a5cSPiotr Fusik 
9*81ad5a5cSPiotr Fusik // UNSUPPORTED: c++03, c++11, c++14, c++17
10*81ad5a5cSPiotr Fusik 
11*81ad5a5cSPiotr Fusik // <sstream>
12*81ad5a5cSPiotr Fusik 
13*81ad5a5cSPiotr Fusik // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
14*81ad5a5cSPiotr Fusik // class basic_stringbuf
15*81ad5a5cSPiotr Fusik 
16*81ad5a5cSPiotr Fusik // basic_stringbuf(ios_base::openmode which, const Allocator& a);
17*81ad5a5cSPiotr Fusik 
18*81ad5a5cSPiotr Fusik #include <sstream>
19*81ad5a5cSPiotr Fusik #include <cassert>
20*81ad5a5cSPiotr Fusik 
21*81ad5a5cSPiotr Fusik #include "test_allocator.h"
22*81ad5a5cSPiotr Fusik #include "test_macros.h"
23*81ad5a5cSPiotr Fusik 
24*81ad5a5cSPiotr Fusik template <class CharT>
test()25*81ad5a5cSPiotr Fusik static void test() {
26*81ad5a5cSPiotr Fusik   const test_allocator<CharT> a(2);
27*81ad5a5cSPiotr Fusik   const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(std::ios_base::in, a);
28*81ad5a5cSPiotr Fusik   assert(buf.get_allocator() == a);
29*81ad5a5cSPiotr Fusik   assert(buf.view().empty());
30*81ad5a5cSPiotr Fusik }
31*81ad5a5cSPiotr Fusik 
main(int,char **)32*81ad5a5cSPiotr Fusik int main(int, char**) {
33*81ad5a5cSPiotr Fusik   test<char>();
34*81ad5a5cSPiotr Fusik #ifndef TEST_HAS_NO_WIDE_CHARACTERS
35*81ad5a5cSPiotr Fusik   test<wchar_t>();
36*81ad5a5cSPiotr Fusik #endif
37*81ad5a5cSPiotr Fusik   return 0;
38*81ad5a5cSPiotr Fusik }
39