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 #ifndef _LIBCPP___FWD_STRING_H
10 #define _LIBCPP___FWD_STRING_H
11 
12 #include <__config>
13 #include <__fwd/memory_resource.h>
14 
15 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
16 #  pragma GCC system_header
17 #endif
18 
19 _LIBCPP_BEGIN_NAMESPACE_STD
20 
21 template <class _CharT>
22 struct _LIBCPP_TEMPLATE_VIS char_traits;
23 template <>
24 struct char_traits<char>;
25 
26 #ifndef _LIBCPP_HAS_NO_CHAR8_T
27 template <>
28 struct char_traits<char8_t>;
29 #endif
30 
31 template <>
32 struct char_traits<char16_t>;
33 template <>
34 struct char_traits<char32_t>;
35 
36 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
37 template <>
38 struct char_traits<wchar_t>;
39 #endif
40 
41 template <class _Tp>
42 class _LIBCPP_TEMPLATE_VIS allocator;
43 
44 template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >
45 class _LIBCPP_TEMPLATE_VIS basic_string;
46 
47 using string = basic_string<char>;
48 
49 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
50 using wstring = basic_string<wchar_t>;
51 #endif
52 
53 #ifndef _LIBCPP_HAS_NO_CHAR8_T
54 using u8string = basic_string<char8_t>;
55 #endif
56 
57 using u16string = basic_string<char16_t>;
58 using u32string = basic_string<char32_t>;
59 
60 #if _LIBCPP_STD_VER >= 17
61 
62 namespace pmr {
63 template <class _CharT, class _Traits = char_traits<_CharT>>
64 using basic_string = std::basic_string<_CharT, _Traits, polymorphic_allocator<_CharT>>;
65 
66 using string = basic_string<char>;
67 
68 #  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
69 using wstring = basic_string<wchar_t>;
70 #  endif
71 
72 #  ifndef _LIBCPP_HAS_NO_CHAR8_T
73 using u8string = basic_string<char8_t>;
74 #  endif
75 
76 using u16string = basic_string<char16_t>;
77 using u32string = basic_string<char32_t>;
78 
79 } // namespace pmr
80 
81 #endif // _LIBCPP_STD_VER >= 17
82 
83 // clang-format off
84 template <class _CharT, class _Traits, class _Allocator>
85 class _LIBCPP_PREFERRED_NAME(string)
86 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
87       _LIBCPP_PREFERRED_NAME(wstring)
88 #endif
89 #ifndef _LIBCPP_HAS_NO_CHAR8_T
90       _LIBCPP_PREFERRED_NAME(u8string)
91 #endif
92       _LIBCPP_PREFERRED_NAME(u16string)
93       _LIBCPP_PREFERRED_NAME(u32string)
94 #if _LIBCPP_STD_VER >= 17
95       _LIBCPP_PREFERRED_NAME(pmr::string)
96 #  ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
97       _LIBCPP_PREFERRED_NAME(pmr::wstring)
98 #  endif
99 #  ifndef _LIBCPP_HAS_NO_CHAR8_T
100       _LIBCPP_PREFERRED_NAME(pmr::u8string)
101 #  endif
102       _LIBCPP_PREFERRED_NAME(pmr::u16string)
103       _LIBCPP_PREFERRED_NAME(pmr::u32string)
104 #endif
105       basic_string;
106 // clang-format on
107 
108 _LIBCPP_END_NAMESPACE_STD
109 
110 #endif // _LIBCPP___FWD_STRING_H
111