108 lines · c
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#ifndef _LIBCPP___FWD_STRING_H10#define _LIBCPP___FWD_STRING_H11 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_header18#endif19 20_LIBCPP_BEGIN_NAMESPACE_STD21 22template <class _CharT>23struct char_traits;24template <>25struct char_traits<char>;26 27#if _LIBCPP_HAS_CHAR8_T28template <>29struct char_traits<char8_t>;30#endif31 32template <>33struct char_traits<char16_t>;34template <>35struct char_traits<char32_t>;36 37#if _LIBCPP_HAS_WIDE_CHARACTERS38template <>39struct char_traits<wchar_t>;40#endif41 42template <class _CharT, class _Traits = char_traits<_CharT>, class _Allocator = allocator<_CharT> >43class basic_string;44 45using string = basic_string<char>;46 47#if _LIBCPP_HAS_WIDE_CHARACTERS48using wstring = basic_string<wchar_t>;49#endif50 51#if _LIBCPP_HAS_CHAR8_T52using u8string = basic_string<char8_t>;53#endif54 55using u16string = basic_string<char16_t>;56using u32string = basic_string<char32_t>;57 58#if _LIBCPP_STD_VER >= 1759 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# if _LIBCPP_HAS_WIDE_CHARACTERS67using wstring _LIBCPP_AVAILABILITY_PMR = basic_string<wchar_t>;68# endif69 70# if _LIBCPP_HAS_CHAR8_T71using u8string _LIBCPP_AVAILABILITY_PMR = basic_string<char8_t>;72# endif73 74using u16string _LIBCPP_AVAILABILITY_PMR = basic_string<char16_t>;75using u32string _LIBCPP_AVAILABILITY_PMR = basic_string<char32_t>;76} // namespace pmr77 78#endif // _LIBCPP_STD_VER >= 1779 80// clang-format off81template <class _CharT, class _Traits, class _Allocator>82class _LIBCPP_PREFERRED_NAME(string)83#if _LIBCPP_HAS_WIDE_CHARACTERS84 _LIBCPP_PREFERRED_NAME(wstring)85#endif86#if _LIBCPP_HAS_CHAR8_T87 _LIBCPP_PREFERRED_NAME(u8string)88#endif89 _LIBCPP_PREFERRED_NAME(u16string)90 _LIBCPP_PREFERRED_NAME(u32string)91#if _LIBCPP_STD_VER >= 1792 _LIBCPP_PREFERRED_NAME(pmr::string)93# if _LIBCPP_HAS_WIDE_CHARACTERS94 _LIBCPP_PREFERRED_NAME(pmr::wstring)95# endif96# if _LIBCPP_HAS_CHAR8_T97 _LIBCPP_PREFERRED_NAME(pmr::u8string)98# endif99 _LIBCPP_PREFERRED_NAME(pmr::u16string)100 _LIBCPP_PREFERRED_NAME(pmr::u32string)101#endif102 basic_string;103// clang-format on104 105_LIBCPP_END_NAMESPACE_STD106 107#endif // _LIBCPP___FWD_STRING_H108