161d2a9b3SPiotr Fusik //===----------------------------------------------------------------------===// 261d2a9b3SPiotr Fusik // 361d2a9b3SPiotr Fusik // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 461d2a9b3SPiotr Fusik // See https://llvm.org/LICENSE.txt for license information. 561d2a9b3SPiotr Fusik // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 661d2a9b3SPiotr Fusik // 761d2a9b3SPiotr Fusik //===----------------------------------------------------------------------===// 861d2a9b3SPiotr Fusik 961d2a9b3SPiotr Fusik // UNSUPPORTED: c++03, c++11, c++14, c++17 1061d2a9b3SPiotr Fusik 1161d2a9b3SPiotr Fusik // <sstream> 1261d2a9b3SPiotr Fusik 1361d2a9b3SPiotr Fusik // template <class charT, class traits = char_traits<charT>, class Allocator = allocator<charT>> 1461d2a9b3SPiotr Fusik // class basic_istringstream 1561d2a9b3SPiotr Fusik 1661d2a9b3SPiotr Fusik // template <class SAlloc> 1761d2a9b3SPiotr Fusik // basic_istringstream(const basic_string<char_type, traits_type, SAlloc>& s, const Allocator& a) 1861d2a9b3SPiotr Fusik // : basic_istringstream(s, ios_base::in, a) {} 1961d2a9b3SPiotr Fusik 2061d2a9b3SPiotr Fusik #include <sstream> 2161d2a9b3SPiotr Fusik #include <cassert> 2261d2a9b3SPiotr Fusik 2361d2a9b3SPiotr Fusik #include "make_string.h" 2461d2a9b3SPiotr Fusik #include "test_allocator.h" 2561d2a9b3SPiotr Fusik #include "test_macros.h" 26*4dee6411SMark de Wever #include "operator_hijacker.h" 2761d2a9b3SPiotr Fusik 2861d2a9b3SPiotr Fusik #define STR(S) MAKE_STRING(CharT, S) 2961d2a9b3SPiotr Fusik #define SV(S) MAKE_STRING_VIEW(CharT, S) 3061d2a9b3SPiotr Fusik 31*4dee6411SMark de Wever template <class CharT, class Allocator> 32*4dee6411SMark de Wever static void test(const Allocator& a) { 3361d2a9b3SPiotr Fusik const std::basic_string<CharT> s(STR("testing")); 34*4dee6411SMark de Wever const std::basic_istringstream<CharT, std::char_traits<CharT>, Allocator> ss(s, a); 3561d2a9b3SPiotr Fusik assert(ss.rdbuf()->get_allocator() == a); 3661d2a9b3SPiotr Fusik assert(ss.view() == SV("testing")); 3761d2a9b3SPiotr Fusik } 3861d2a9b3SPiotr Fusik 3961d2a9b3SPiotr Fusik int main(int, char**) { 40*4dee6411SMark de Wever test<char>(test_allocator<char>(2)); 41*4dee6411SMark de Wever test<char>(operator_hijacker_allocator<char>()); 4261d2a9b3SPiotr Fusik #ifndef TEST_HAS_NO_WIDE_CHARACTERS 43*4dee6411SMark de Wever test<wchar_t>(test_allocator<wchar_t>(2)); 44*4dee6411SMark de Wever test<wchar_t>(operator_hijacker_allocator<wchar_t>()); 4561d2a9b3SPiotr Fusik #endif 4661d2a9b3SPiotr Fusik return 0; 4761d2a9b3SPiotr Fusik } 48