1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
13 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT> >
14 // class basic_stringbuf
16 // template <class SAlloc>
17 // basic_string<charT, traits, SAlloc> str(const SAlloc& sa) const;
22 #include "make_string.h"
23 #include "test_allocator.h"
24 #include "test_macros.h"
26 #define STR(S) MAKE_STRING(CharT, S)
27 #define SV(S) MAKE_STRING_VIEW(CharT, S)
29 template <class CharT
>
31 const std::basic_stringbuf
<CharT
> buf(STR("testing"));
32 const test_allocator
<CharT
> a(1);
33 const std::basic_string
<CharT
, std::char_traits
<CharT
>, test_allocator
<CharT
>> s
= buf
.str(a
);
34 assert(s
== SV("testing"));
35 assert(s
.get_allocator() == a
);
38 int main(int, char**) {
40 #ifndef TEST_HAS_NO_WIDE_CHARACTERS