1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 #ifndef _LIBCPP___FWD_STRING_H
10 #define _LIBCPP___FWD_STRING_H
12 #include <__availability>
14 #include <__fwd/memory_resource.h>
16 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
17 # pragma GCC system_header
20 _LIBCPP_BEGIN_NAMESPACE_STD
22 template <class _CharT
>
23 struct _LIBCPP_TEMPLATE_VIS char_traits
;
25 struct char_traits
<char>;
27 #ifndef _LIBCPP_HAS_NO_CHAR8_T
29 struct char_traits
<char8_t
>;
33 struct char_traits
<char16_t
>;
35 struct char_traits
<char32_t
>;
37 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
39 struct char_traits
<wchar_t>;
43 class _LIBCPP_TEMPLATE_VIS allocator
;
45 template <class _CharT
, class _Traits
= char_traits
<_CharT
>, class _Allocator
= allocator
<_CharT
> >
46 class _LIBCPP_TEMPLATE_VIS basic_string
;
48 using string
= basic_string
<char>;
50 #ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
51 using wstring
= basic_string
<wchar_t>;
54 #ifndef _LIBCPP_HAS_NO_CHAR8_T
55 using u8string
= basic_string
<char8_t
>;
58 using u16string
= basic_string
<char16_t
>;
59 using u32string
= basic_string
<char32_t
>;
61 #if _LIBCPP_STD_VER >= 17
64 template <class _CharT
, class _Traits
= char_traits
<_CharT
>>
65 using basic_string _LIBCPP_AVAILABILITY_PMR
= std::basic_string
<_CharT
, _Traits
, polymorphic_allocator
<_CharT
>>;
67 using string _LIBCPP_AVAILABILITY_PMR
= basic_string
<char>;
69 # ifndef _LIBCPP_HAS_NO_WIDE_CHARACTERS
70 using wstring _LIBCPP_AVAILABILITY_PMR
= basic_string
<wchar_t>;
73 # ifndef _LIBCPP_HAS_NO_CHAR8_T
74 using u8string _LIBCPP_AVAILABILITY_PMR
= basic_string
<char8_t
>;
77 using u16string _LIBCPP_AVAILABILITY_PMR
= basic_string
<char16_t
>;
78 using u32string _LIBCPP_AVAILABILITY_PMR
= basic_string
<char32_t
>;
81 #endif // _LIBCPP_STD_VER >= 17
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
)
89 #ifndef _LIBCPP_HAS_NO_CHAR8_T
90 _LIBCPP_PREFERRED_NAME(u8string
)
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
)
99 # ifndef _LIBCPP_HAS_NO_CHAR8_T
100 _LIBCPP_PREFERRED_NAME(pmr::u8string
)
102 _LIBCPP_PREFERRED_NAME(pmr::u16string
)
103 _LIBCPP_PREFERRED_NAME(pmr::u32string
)
108 _LIBCPP_END_NAMESPACE_STD
110 #endif // _LIBCPP___FWD_STRING_H