UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
Rotate.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "uLang/Common/Templates/Storage.h" // for Swap()
7
8// nb: this was copied over from Core until uLang can properly depend on Core.
9
10namespace uLang
11{
12namespace AlgoImpl
13{
14 template <typename T>
15 size_t RotateInternal(T* First, size_t Num, size_t Count)
16 {
17 if (Count == 0)
18 {
19 return Num;
20 }
21
22 if (Count >= Num)
23 {
24 return 0;
25 }
26
27 T* Iter = First;
28 T* Mid = First + Count;
29 T* End = First + Num;
30
31 T* OldMid = Mid;
32 for (;;)
33 {
34 Swap(*Iter++, *Mid++);
35 if (Mid == End)
36 {
37 if (Iter == OldMid)
38 {
39 return Num - Count;
40 }
41
42 Mid = OldMid;
43 }
44 else if (Iter == OldMid)
45 {
46 OldMid = Mid;
47 }
48 }
49 }
50}
51
52namespace Algo
53{
62 template <typename RangeType>
63 ULANG_FORCEINLINE size_t Rotate(RangeType&& Range, size_t Count)
64 {
66 }
67}
68}
UE_FORCEINLINE_HINT TSharedRef< CastToType, Mode > StaticCastSharedRef(TSharedRef< CastFromType, Mode > const &InSharedRef)
Definition SharedPointer.h:127
@ Num
Definition MetalRHIPrivate.h:234
#define ULANG_FORCEINLINE
Definition Common.h:188
Definition BinarySearch.h:10
Definition ParallelSort.h:13
size_t RotateInternal(T *First, size_t Num, size_t Count)
Definition Rotate.h:15
Definition VVMEngineEnvironment.h:23
auto ULangGetData(T &&Container) -> decltype(Container.GetData())
Definition Storage.h:30
size_t ULangGetNum(T &&Container)
Definition Storage.h:58