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// UNSUPPORTED: c++03, c++11, c++14, c++17
10
11// <sstream>
12
13// template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
14// class basic_stringbuf
15
16// explicit basic_stringbuf(const Allocator& a)
17// : basic_stringbuf(ios_base::in | ios_base::out, a) {}
18
19#include <sstream>
20#include <cassert>
21
22#include "test_allocator.h"
23#include "test_macros.h"
24
25template <class CharT>
26static void test() {
27 const test_allocator<CharT> a(1);
28 const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(a);
29 assert(buf.get_allocator() == a);
30 assert(buf.view().empty());
31}
32
33int main(int, char**) {
34 test<char>();
35#ifndef TEST_HAS_NO_WIDE_CHARACTERS
36 test<wchar_t>();
37#endif
38 return 0;
39}
40

source code of libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/alloc.pass.cpp