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