xref: /llvm-project/libcxx/test/std/input.output/syncstream/osyncstream/members/get_wrapped.pass.cpp (revision 7cc72a0a2ec22855572d96411febd4f2c4ac5a49)
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 // UNSUPPORTED: no-localization
11 // UNSUPPORTED: libcpp-has-no-experimental-syncstream
12 
13 // <syncstream>
14 
15 // template <class charT, class traits, class Allocator>
16 // class basic_osyncstream;
17 
18 // streambuf_type* get_wrapped() const noexcept;
19 
20 #include <syncstream>
21 #include <sstream>
22 #include <cassert>
23 
24 #include "test_macros.h"
25 
26 template <class CharT>
test()27 void test() {
28   std::basic_stringbuf<CharT> base;
29   const std::basic_osyncstream<CharT> out{&base};
30   assert(out.get_wrapped() == &base);
31   ASSERT_NOEXCEPT(out.get_wrapped());
32 }
33 
main(int,char **)34 int main(int, char**) {
35   test<char>();
36 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
37   test<wchar_t>();
38 #endif
39 
40   return 0;
41 }
42