[ProfileData] Avoid repeated hash lookups (NFC) (#125464)
[llvm-project.git] / libcxx / test / std / input.output / string.streams / istringstream / istringstream.members / str.string-alloc.pass.cpp
blobd8b03f6b86a382ad812ae88071a7370cffbb51dd
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 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17
11 // <sstream>
13 // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>>
14 // class basic_istringstream
16 // template <class SAlloc>
17 // void str(const basic_string<charT, traits, SAlloc>& s);
19 #include <sstream>
20 #include <cassert>
22 #include "make_string.h"
23 #include "test_allocator.h"
24 #include "test_macros.h"
26 #define STR(S) MAKE_STRING(CharT, S)
28 template <class CharT>
29 static void test() {
31 const test_allocator<CharT> a(6);
32 const std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s(STR("testing"), a);
33 std::basic_istringstream<CharT> ss;
34 ss.str(s);
35 assert(ss.str() == STR("testing"));
39 int main(int, char**) {
40 test<char>();
41 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
42 test<wchar_t>();
43 #endif
44 return 0;