45 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++1710// UNSUPPORTED: no-localization11// UNSUPPORTED: libcpp-has-no-experimental-syncstream12 13// <syncstream>14 15// template <class charT, class traits, class Allocator>16// class basic_syncbuf;17 18// streambuf_type* get_wrapped() const noexcept;19 20#include <syncstream>21#include <concepts>22#include <cassert>23 24#include "../helpers.h"25#include "test_macros.h"26 27template <class T>28void test() {29 test_buf<T> base(42);30 const std::allocator<T> alloc;31 const test_syncbuf<T> buff(&base, alloc);32 std::same_as<std::basic_streambuf<T>*> auto wrapped = buff.get_wrapped();33 assert(static_cast<test_buf<T>*>(wrapped)->id == 42);34 ASSERT_NOEXCEPT(buff.get_wrapped());35}36 37int main(int, char**) {38 test<char>();39#ifndef TEST_HAS_NO_WIDE_CHARACTERS40 test<wchar_t>();41#endif42 43 return 0;44}45