10template <
typename TypeTraits>
21 explicit operator bool() {
return Element !=
nullptr; }
29template <
typename Type,
typename TypeTraits>
40 explicit operator bool() {
return Element !=
nullptr; }
50template <
typename Type>
66template <
typename TypeTraits>
84 Head = Tail = Element;
98 check(Element !=
nullptr && TypeTraits::GetNext(Element) ==
nullptr);
102 check(Head ==
nullptr);
107 TypeTraits::SetNext(Element, Head);
114 check(Element !=
nullptr && TypeTraits::GetNext(Element) ==
nullptr);
118 check(Head !=
nullptr);
119 TypeTraits::SetNext(Tail, Element);
124 check(Head ==
nullptr);
125 Head = Tail = Element;
136 check(Head !=
nullptr);
137 TypeTraits::SetNext(Tail,
First);
142 check(Head ==
nullptr);
150 if (!
Other.IsEmpty())
160 if (Element !=
nullptr)
162 Head = TypeTraits::GetNext(Element);
167 TypeTraits::SetNext(Element,
nullptr);
180 if (Element ==
nullptr ||
IsEmpty())
192 ElementType* NextElement = TypeTraits::GetNext(It);
193 while (NextElement !=
nullptr && NextElement != Element)
196 NextElement = TypeTraits::GetNext(It);
199 if (NextElement != Element)
204 It->Next = TypeTraits::GetNext(Element);
205 TypeTraits::SetNext(Element,
nullptr);
220 template<
typename PredicateType>
223 check(Element !=
nullptr && TypeTraits::GetNext(Element) ==
nullptr);
225 if (
IsEmpty() || Predicate(*Element, *Head))
232 ElementType* NextElement = TypeTraits::GetNext(It);
233 while (NextElement !=
nullptr)
235 if (Predicate(*Element, *NextElement))
237 TypeTraits::SetNext(It, Element);
238 TypeTraits::SetNext(Element, NextElement);
243 NextElement = TypeTraits::GetNext(It);
249 bool IsEmpty()
const {
return Head ==
nullptr; }
265template <
typename Type>
272 return Element->Next;
277 Element->Next =
Next;
282 return Element->Prev;
287 Element->Prev = Prev;
291template <
typename ElementType,
typename TypeTraits = TIntrusiveTwoWayListTraits<ElementType>>
309 Head = Tail = Element;
323 check(Element !=
nullptr && TypeTraits::GetNext(Element) ==
nullptr && TypeTraits::GetPrev(Element) ==
nullptr);
327 check(Head !=
nullptr);
328 TypeTraits::SetNext(Tail, Element);
329 TypeTraits::SetPrev(Element, Tail);
334 check(Head ==
nullptr);
335 Head = Tail = Element;
341 check(Element !=
nullptr && TypeTraits::GetNext(Element) ==
nullptr && TypeTraits::GetPrev(Element) ==
nullptr);
345 check(Tail !=
nullptr);
346 TypeTraits::SetNext(Element, Head);
347 TypeTraits::SetPrev(Head, Element);
352 check(Tail ==
nullptr);
353 Head = Tail = Element;
359 ElementType* Element = Head;
360 if (Element !=
nullptr)
362 Head = TypeTraits::GetNext(Element);
363 TypeTraits::SetNext(Element,
nullptr);
367 TypeTraits::SetPrev(Head,
nullptr);
383 bool IsEmpty()
const {
return Head ==
nullptr; }
385 const ElementType*
GetHead()
const {
return Head; }
387 const ElementType*
GetTail()
const {
return Tail; }
396 check(Element !=
nullptr);
398 if (Head == Element && Tail == Element)
400 check(TypeTraits::GetNext(Element) ==
nullptr);
401 check(TypeTraits::GetPrev(Element) ==
nullptr);
403 Head = Tail =
nullptr;
405 else if (Head == Element)
407 check(TypeTraits::GetPrev(Element) ==
nullptr);
409 Head = TypeTraits::GetNext(Element);
410 TypeTraits::SetPrev(Head,
nullptr);
411 TypeTraits::SetNext(Element,
nullptr);
413 else if (Tail == Element)
415 check(Element->Next ==
nullptr);
417 Tail = TypeTraits::GetPrev(Element);
418 TypeTraits::SetNext(Tail,
nullptr);
419 TypeTraits::SetPrev(Element,
nullptr);
423 ElementType* NextElement = TypeTraits::GetNext(Element);
424 ElementType*
PrevElement = TypeTraits::GetPrev(Element);
429 TypeTraits::SetNext(Element,
nullptr);
430 TypeTraits::SetPrev(Element,
nullptr);
435 ElementType* Head =
nullptr;
436 ElementType* Tail =
nullptr;
#define check(expr)
Definition AssertionMacros.h:314
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
const bool
Definition NetworkReplayStreaming.h:178
Definition IoContainers.h:68
ElementType * PopHead()
Definition IoContainers.h:157
UE::Private::TIntrusiveListIterator< TypeTraits > FIterator
Definition IoContainers.h:71
ElementType * GetTail()
Definition IoContainers.h:252
UE::Private::TIntrusiveListIterator< const TypeTraits > FConstIterator
Definition IoContainers.h:72
ElementType * GetHead()
Definition IoContainers.h:250
void AddHead(ElementType *Element)
Definition IoContainers.h:96
void AddTail(ElementType *Element)
Definition IoContainers.h:112
FIterator begin()
Definition IoContainers.h:255
FIterator end()
Definition IoContainers.h:257
const ElementType * GetTail() const
Definition IoContainers.h:253
FConstIterator begin() const
Definition IoContainers.h:256
TIntrusiveList(const TIntrusiveList &)=delete
FConstIterator end() const
Definition IoContainers.h:258
bool IsEmpty() const
Definition IoContainers.h:249
bool Remove(ElementType *Element)
Definition IoContainers.h:178
void AddTail(ElementType *First, ElementType *Last)
Definition IoContainers.h:129
TIntrusiveList(TIntrusiveList &&Other)
Definition IoContainers.h:76
void AddTail(TIntrusiveList &&Other)
Definition IoContainers.h:148
typename TypeTraits::ElementType ElementType
Definition IoContainers.h:70
ElementType * PeekHead()
Definition IoContainers.h:173
void AddOrInsertBefore(ElementType *Element, PredicateType Predicate)
Definition IoContainers.h:221
TIntrusiveList(ElementType *Element)
Definition IoContainers.h:82
TIntrusiveList & operator=(const TIntrusiveList &)=delete
TIntrusiveList & operator=(TIntrusiveList &&Other)
Definition IoContainers.h:88
const ElementType * GetHead() const
Definition IoContainers.h:251
Definition IoContainers.h:293
const ElementType * GetTail() const
Definition IoContainers.h:387
UE::Private::TIntrusiveTwoWayListIterator< ElementType, TypeTraits > FIterator
Definition IoContainers.h:296
FIterator end()
Definition IoContainers.h:391
TIntrusiveTwoWayList(TIntrusiveTwoWayList &&Other)
Definition IoContainers.h:301
TIntrusiveTwoWayList(ElementType *Element)
Definition IoContainers.h:307
FConstIterator end() const
Definition IoContainers.h:392
TIntrusiveTwoWayList()=default
void Remove(ElementType *Element)
Definition IoContainers.h:394
FConstIterator begin() const
Definition IoContainers.h:390
const ElementType * GetHead() const
Definition IoContainers.h:385
void AddTail(ElementType *Element)
Definition IoContainers.h:321
ElementType * GetTail()
Definition IoContainers.h:386
FIterator begin()
Definition IoContainers.h:389
ElementType * PopHead()
Definition IoContainers.h:357
TIntrusiveTwoWayList & operator=(const TIntrusiveTwoWayList &)=delete
void AddHead(ElementType *Element)
Definition IoContainers.h:339
ElementType * GetHead()
Definition IoContainers.h:384
bool IsEmpty() const
Definition IoContainers.h:383
ElementType * PeekHead()
Definition IoContainers.h:378
TIntrusiveTwoWayList(const TIntrusiveTwoWayList &)=delete
UE::Private::TIntrusiveTwoWayListIterator< ElementType, const TypeTraits > FConstIterator
Definition IoContainers.h:297
TIntrusiveTwoWayList & operator=(TIntrusiveTwoWayList &&Other)
Definition IoContainers.h:313
Definition IoContainers.h:12
TIntrusiveListIterator(ElementType *InElement)
Definition IoContainers.h:16
ElementType & operator*() const
Definition IoContainers.h:20
void operator++()
Definition IoContainers.h:22
bool operator!=(const TIntrusiveListIterator &Other) const
Definition IoContainers.h:23
typename TypeTraits::ElementType ElementType
Definition IoContainers.h:14
Definition IoContainers.h:31
ElementType & operator*() const
Definition IoContainers.h:39
TIntrusiveTwoWayListIterator(ElementType *InElement)
Definition IoContainers.h:35
void operator++()
Definition IoContainers.h:41
Type ElementType
Definition IoContainers.h:33
bool operator!=(const TIntrusiveTwoWayListIterator &Other) const
Definition IoContainers.h:42
Definition PackageReader.cpp:44
Definition IoContainers.h:52
Type ElementType
Definition IoContainers.h:53
static void SetNext(ElementType *Element, ElementType *Next)
Definition IoContainers.h:60
static Type * GetNext(const ElementType *Element)
Definition IoContainers.h:55
Definition IoContainers.h:267
static void SetNext(ElementType *Element, ElementType *Next)
Definition IoContainers.h:275
Type ElementType
Definition IoContainers.h:268
static void SetPrev(ElementType *Element, ElementType *Prev)
Definition IoContainers.h:285
static Type * GetNext(const ElementType *Element)
Definition IoContainers.h:270
static Type * GetPrev(const ElementType *Element)
Definition IoContainers.h:280