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 = char_traits<charT>, class Allocator = allocator<charT>>
16// class basic_syncbuf {
17//
18// public:
19// using char_type = charT;
20// using int_type = typename traits::int_type;
21// using pos_type = typename traits::pos_type;
22// using off_type = typename traits::off_type;
23// using traits_type = traits;
24// using allocator_type = Allocator;
25//
26// using streambuf_type = basic_streambuf<charT, traits>;
27//
28// ...
29
30#include <syncstream>
31#include <concepts>
32
33#include "test_macros.h"
34#include "constexpr_char_traits.h"
35#include "test_allocator.h"
36
37static_assert(
38 std::same_as<std::basic_syncbuf<char>, std::basic_syncbuf<char, std::char_traits<char>, std::allocator<char>>>);
39static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>>,
40 std::basic_syncbuf<char, constexpr_char_traits<char>, std::allocator<char>>>);
41
42static_assert(
43 std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::char_type, char>);
44static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::int_type,
45 constexpr_char_traits<char>::int_type>);
46static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::pos_type,
47 constexpr_char_traits<char>::pos_type>);
48static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::off_type,
49 constexpr_char_traits<char>::off_type>);
50static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::traits_type,
51 constexpr_char_traits<char>>);
52static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::allocator_type,
53 test_allocator<char>>);
54static_assert(std::same_as<std::basic_syncbuf<char, constexpr_char_traits<char>, test_allocator<char>>::streambuf_type,
55 std::basic_streambuf<char, constexpr_char_traits<char>>>);
56
57#ifndef TEST_HAS_NO_WIDE_CHARACTERS
58static_assert(std::same_as<std::basic_syncbuf<wchar_t>,
59 std::basic_syncbuf<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t>>>);
60static_assert(std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>>,
61 std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, std::allocator<wchar_t>>>);
62
63static_assert(
64 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::char_type,
65 wchar_t>);
66static_assert(
67 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::int_type,
68 constexpr_char_traits<wchar_t>::int_type>);
69static_assert(
70 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::pos_type,
71 constexpr_char_traits<wchar_t>::pos_type>);
72static_assert(
73 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::off_type,
74 constexpr_char_traits<wchar_t>::off_type>);
75static_assert(
76 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::traits_type,
77 constexpr_char_traits<wchar_t>>);
78static_assert(
79 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::allocator_type,
80 test_allocator<wchar_t>>);
81static_assert(
82 std::same_as<std::basic_syncbuf<wchar_t, constexpr_char_traits<wchar_t>, test_allocator<wchar_t>>::streambuf_type,
83 std::basic_streambuf<wchar_t, constexpr_char_traits<wchar_t>>>);
84#endif // TEST_HAS_NO_WIDE_CHARACTERS
85

source code of libcxx/test/std/input.output/syncstream/syncbuf/types.compile.pass.cpp