27template <
typename CharType>
66 return Chars ?
reinterpret_cast<const int32*
>(Chars)[-1] : 0;
72 return Chars ? Chars : &NullChar;
104 static inline void AddRef(CharType* Chars);
105 static inline void Release(CharType* Chars);
107 CharType* Chars =
nullptr;
109 static constexpr inline CharType NullChar{};
112template <
typename CharType>
115template <
typename CharType>
122template <
typename CharType>
129template <
typename CharType>
141template <
typename CharType>
152template <
typename CharType>
158 static_assert(
alignof(
int32) >=
alignof(CharType));
159 static_assert(
sizeof(
int32) ==
sizeof(std::atomic<int32>));
162 new((
void*)&
Header[0]) std::atomic<int32>(1);
164 Chars =
reinterpret_cast<CharType*
>(&
Header[2]);
166 Chars[
Length] = CharType(0);
170template <
typename CharType>
176template <
typename CharType>
181 static_assert(
sizeof(
int32) ==
sizeof(std::atomic<int32>));
183 std::atomic<int32>& RefCount =
reinterpret_cast<std::atomic<int32>&
>(
Header[0]);
184 RefCount.fetch_add(1, std::memory_order_relaxed);
188template <
typename CharType>
189void TSharedString<CharType>::Release(CharType*
const MaybeNullChars)
193 static_assert(
sizeof(
int32) ==
sizeof(std::atomic<int32>));
195 std::atomic<int32>& RefCount =
reinterpret_cast<std::atomic<int32>&
>(
Header[0]);
196 if (RefCount.fetch_sub(1, std::memory_order_acq_rel) == 1)
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ MIN_ALIGNMENT
Definition MemoryBase.h:27
constexpr auto MakeStringView(const CharPtrOrRangeType &CharPtrOrRange UE_LIFETIMEBOUND) -> decltype(TStringView(CharPtrOrRange))
Definition StringView.h:508
uint32 Size
Definition VulkanMemory.cpp:4034
Definition StringView.h:107
Definition SharedString.h:29
TSharedString & operator=(TStringView< CharType > String)
Definition SharedString.h:171
friend bool operator<(const TSharedString &Lhs, const TSharedString &Rhs)
Definition SharedString.h:99
TSharedString & operator=(const TSharedString &String)
Definition SharedString.h:142
static const TSharedString Empty
Definition SharedString.h:76
TSharedString & operator=(TSharedString &&String)
Definition SharedString.h:130
friend uint32 GetTypeHash(const TSharedString &String)
Definition SharedString.h:89
TSharedString(TSharedString &&String)
Definition SharedString.h:116
TSharedString(TStringView< CharType > String)
Definition SharedString.h:153
int32 Len() const
Definition SharedString.h:64
friend constexpr const CharType * GetData(const TSharedString String)
Definition SharedString.h:79
friend bool operator==(const TSharedString &Lhs, const TSharedString &Rhs)
Definition SharedString.h:94
TSharedString(const TSharedString &String)
Definition SharedString.h:123
bool IsEmpty() const
Definition SharedString.h:58
~TSharedString()
Definition SharedString.h:45
void Reset()
Definition SharedString.h:51
friend constexpr auto GetNum(const TSharedString String)
Definition SharedString.h:84
CharType ElementType
Definition SharedString.h:31
const CharType * operator*() const
Definition SharedString.h:70
@ IgnoreCase
Definition CString.h:26
Definition AdvancedWidgetsModule.cpp:13
static FORCENOINLINE CORE_API void Free(void *Original)
Definition UnrealMemory.cpp:685