本文整理汇总了C++中TArray::RemoveAt方法的典型用法代码示例。如果您正苦于以下问题:C++ TArray::RemoveAt方法的具体用法?C++ TArray::RemoveAt怎么用?C++ TArray::RemoveAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TArray
的用法示例。
在下文中一共展示了TArray::RemoveAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetTransportSection
/**
* Takes a large transport array and splits it into pieces of a desired size and returns the portion of this which is requested
*
* @param FullTransportArray - The whole series of data
* @param CurrentChunkIndex - The The chunk we are requesting
* @param NumToSend - The maximum number of bytes we should be splitting into.
*
* @return The section of the transport array which matches our index requested
*/
TArray< uint8 > GetTransportSection( const TArray< uint8 >& FullTransportArray, const int32 NumToSend, const int32 RequestedChunkIndex )
{
TArray< uint8 > TransportArray = FullTransportArray;
if( NumToSend > 0 )
{
int32 NumToRemoveFromStart = RequestedChunkIndex * NumToSend;
if( NumToRemoveFromStart > 0 )
{
TransportArray.RemoveAt( 0, NumToRemoveFromStart );
}
int32 NumToRemoveFromEnd = FullTransportArray.Num() - NumToRemoveFromStart - NumToSend;
if( NumToRemoveFromEnd > 0 )
{
TransportArray.RemoveAt( TransportArray.Num()-NumToRemoveFromEnd, NumToRemoveFromEnd );
}
}
else
{
TransportArray.Empty();
}
return TransportArray;
}
示例2: TickQueueTests
bool TickQueueTests(float DeltaTime)
{
check(bTicking);
if (!GIsAutomationTesting && !bTestInPogress && Queue.Num())
{
FJob& CurrentJob = Queue[0];
TArray<FAutomationTestInfo> TestInfo;
FAutomationTestFramework::GetInstance().GetValidTestNames( TestInfo );
bool bRanIt = false;
for ( int TestIndex = 0; TestIndex < TestInfo.Num(); ++TestIndex )
{
FString TestCommand = TestInfo[TestIndex].GetTestName();
if (TestCommand == CurrentJob.Test)
{
CurrentJob.Ar->Logf(TEXT("Running: %s"), *CurrentJob.Test);
IAutomationWorkerModule::FStopTestEvent Event;
Event.BindRaw(this, &FQueueTests::ConsoleCommandTestComplete, CurrentJob.Ar);
if (FModuleManager::Get().IsModuleLoaded(TEXT("AutomationWorker")))
{
FModuleManager::GetModuleChecked<IAutomationWorkerModule>("AutomationWorker").RunTest(CurrentJob.Test, CurrentJob.RoleIndex, Event);
bTestInPogress = true;
bRanIt = true;
}
break;
}
}
if (!bRanIt)
{
CurrentJob.Ar->Logf(TEXT("ERROR: Failed to find test %s"), *CurrentJob.Test);
}
Queue.RemoveAt(0);
}
bTicking = !!Queue.Num();
return bTicking;
}
示例3: createFilter
UAbsFilter* UFuncFactory::createFilter(const FString& _str)
{
FString paramStr = _str.ToLower();
TArray<FString> params;
paramStr.ParseIntoArray(params, Split_Line, true);
if (params.Num() > 0)
{
const FString clsName = params[0];
UAbsFilter** filter = mFilterMap.Find(clsName);
if (filter == nullptr)
{
UE_LOG(SkillLogger, Error, TEXT("--- Error: UFuncFactory::createFilter, return null"));
return nullptr;
}
*filter = (*filter)->Clone();
if (*filter == nullptr)
{
UE_LOG(SkillLogger, Error, TEXT("--- Error: UFuncFactory::createFilter, clone null"));
return nullptr;
}
params.RemoveAt(0); //移除掉类名
(*filter)->Parser(params);
return *filter;
}
return nullptr;
}
示例4: RemoveCollinearPoints
void RemoveCollinearPoints(TArray<FIntPoint>& PointList)
{
if (PointList.Num() < 3)
{
return;
}
for (int32 VertexIndex = 1; VertexIndex < PointList.Num(); )
{
const FVector2D A(PointList[VertexIndex-1]);
const FVector2D B(PointList[VertexIndex]);
const FVector2D C(PointList[(VertexIndex+1) % PointList.Num()]);
// Determine if the area of the triangle ABC is zero (if so, they're collinear)
const float AreaABC = (A.X * (B.Y - C.Y)) + (B.X * (C.Y - A.Y)) + (C.X * (A.Y - B.Y));
if (FMath::Abs(AreaABC) < KINDA_SMALL_NUMBER)
{
// Remove B
PointList.RemoveAt(VertexIndex);
}
else
{
// Continue onwards
++VertexIndex;
}
}
}
示例5: AddQueuedWork
void AddQueuedWork(IQueuedWork* InQueuedWork) override
{
if (TimeToDie)
{
InQueuedWork->Abandon();
return;
}
check(InQueuedWork != nullptr);
FQueuedThread* Thread = nullptr;
// Check to see if a thread is available. Make sure no other threads
// can manipulate the thread pool while we do this.
check(SynchQueue);
FScopeLock sl(SynchQueue);
if (QueuedThreads.Num() > 0)
{
// Figure out which thread is available
int32 Index = QueuedThreads.Num() - 1;
// Grab that thread to use
Thread = QueuedThreads[Index];
// Remove it from the list so no one else grabs it
QueuedThreads.RemoveAt(Index);
}
// Was there a thread ready?
if (Thread != nullptr)
{
// We have a thread, so tell it to do the work
Thread->DoWork(InQueuedWork);
}
else
{
// There were no threads available, queue the work to be done
// as soon as one does become available
QueuedWork.Add(InQueuedWork);
}
}
示例6: FStringToBinaryArray
TArray<uint8> UMasterServerFunctions::CompressBytes(FString UncompressedString)
{
TArray<uint8> UncompressedBinaryArray = FStringToBinaryArray(UncompressedString);
TArray<uint8> CompressedBinaryArray;
CompressedBinaryArray.SetNum(UncompressedBinaryArray.Num() * 1023, true);
//int ret;
z_stream strm;
strm.zalloc = Z_NULL;
strm.zfree = Z_NULL;
strm.opaque = Z_NULL;
strm.avail_in = UncompressedBinaryArray.Num();
strm.next_in = (Bytef *)UncompressedBinaryArray.GetData();
strm.avail_out = CompressedBinaryArray.Num();
strm.next_out = (Bytef *)CompressedBinaryArray.GetData();
// the actual compression work.
deflateInit(&strm, Z_BEST_COMPRESSION);
deflate(&strm, Z_FINISH);
deflateEnd(&strm);
// Shrink the array to minimum size
CompressedBinaryArray.RemoveAt(strm.total_out, CompressedBinaryArray.Num() - strm.total_out, true);
return CompressedBinaryArray;
}
示例7: HasActiveActionOfType
bool UPawnActionsComponent::HasActiveActionOfType(EAIRequestPriority::Type Priority, TSubclassOf<UPawnAction> PawnActionClass) const
{
TArray<UPawnAction*> ActionsToTest;
ActionsToTest.Add(GetActiveAction(Priority));
while (ActionsToTest.Num() > 0)
{
UPawnAction* ActiveActionIter = ActionsToTest[0];
if (ActiveActionIter)
{
if (ActiveActionIter->GetClass()->IsChildOf(*PawnActionClass))
{
return true;
}
else
{
UPawnAction_Sequence* PawnActionSequence = Cast<UPawnAction_Sequence>(ActiveActionIter);
if (PawnActionSequence)
{
for (int32 PawnActionSequenceCount = 0; PawnActionSequenceCount < PawnActionSequence->ActionSequence.Num(); ++PawnActionSequenceCount)
{
ActionsToTest.Add(PawnActionSequence->ActionSequence[PawnActionSequenceCount]);
}
}
}
}
ActionsToTest.RemoveAt(0);
}
// Didn't find one.
return false;
}
示例8: AddChildRecursively
//------------------------------------------------------------------------------
void FGraphActionNode::AddChildRecursively(TArray<FString>& CategoryStack, TSharedPtr<FGraphActionNode> NodeToAdd)
{
if (CategoryStack.Num() > 0)
{
FString CategorySection = CategoryStack[0];
CategoryStack.RemoveAt(0, 1);
// make sure we don't already have a child that this can nest under
TSharedPtr<FGraphActionNode> ExistingNode = FindMatchingParent(CategorySection, NodeToAdd);
if (ExistingNode.IsValid())
{
ExistingNode->AddChildRecursively(CategoryStack, NodeToAdd);
}
else
{
TSharedPtr<FGraphActionNode> CategoryNode = NewCategoryNode(CategorySection, NodeToAdd->Grouping, NodeToAdd->SectionID);
InsertChild(CategoryNode);
CategoryNode->AddChildRecursively(CategoryStack, NodeToAdd);
}
}
else
{
InsertChild(NodeToAdd);
}
}
示例9: CollectQueryParams
void UEnvQuery::CollectQueryParams(TArray<FEnvNamedValue>& NamedValues) const
{
TArray<FName> RequiredParams;
// collect all params
for (int32 OptionIndex = 0; OptionIndex < Options.Num(); OptionIndex++)
{
const UEnvQueryOption* Option = Options[OptionIndex];
AddNamedValuesFromObject(Option->Generator, NamedValues, RequiredParams);
for (int32 TestIndex = 0; TestIndex < Option->Tests.Num(); TestIndex++)
{
const UEnvQueryTest* TestOb = Option->Tests[TestIndex];
AddNamedValuesFromObject(TestOb, NamedValues, RequiredParams);
}
}
// remove unnecessary params
for (int32 ValueIndex = NamedValues.Num() - 1; ValueIndex >= 0; ValueIndex--)
{
if (!RequiredParams.Contains(NamedValues[ValueIndex].ParamName))
{
NamedValues.RemoveAt(ValueIndex);
}
}
}
示例10: PopFrameCounter
void UJavascriptTestLibrary::PopFrameCounter()
{
#if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
GFrameCounter = GFrameCounterStack[GFrameCounterStack.Num() - 1];
GFrameCounterStack.RemoveAt(GFrameCounterStack.Num() - 1, 1);
#endif
}
示例11: LoadSettings
void FSourceControlSettings::LoadSettings()
{
// make sure we load the global ini first
const FString& GlobalIniFile = SourceControlHelpers::GetGlobalSettingsIni();
GConfig->GetBool(*SourceControlSettingsConstants::SettingsSection, TEXT("UseGlobalSettings"), bUseGlobalSettings, GlobalIniFile);
TArray<FString> Tokens;
TArray<FString> Switches;
FCommandLine::Parse( FCommandLine::Get(), Tokens, Switches );
TMap<FString, FString> SwitchPairs;
for (int32 SwitchIdx = Switches.Num() - 1; SwitchIdx >= 0; --SwitchIdx)
{
FString& Switch = Switches[SwitchIdx];
TArray<FString> SplitSwitch;
if (2 == Switch.ParseIntoArray(SplitSwitch, TEXT("="), true))
{
SwitchPairs.Add(SplitSwitch[0], SplitSwitch[1].TrimQuotes());
Switches.RemoveAt(SwitchIdx);
}
}
if( SwitchPairs.Contains( TEXT("SCCProvider") ) )
{
Provider = SwitchPairs[TEXT("SCCProvider")];
}
else
{
const FString& IniFile = SourceControlHelpers::GetSettingsIni();
GConfig->GetString(*SourceControlSettingsConstants::SettingsSection, TEXT("Provider"), Provider, IniFile);
}
}
示例12: GenerateObjectGraph
void FArchiveObjectGraph::GenerateObjectGraph( TArray<UObject*>& Objects )
{
const int32 LastRootObjectIndex = Objects.Num();
for ( int32 ObjIndex = 0; ObjIndex < Objects.Num(); ObjIndex++ )
{
CurrentReferencer = Objects[ObjIndex];
CurrentReferencer->UnMark(OBJECTMARK_TagExp);
// Serialize this object
if ( CurrentReferencer->HasAnyFlags(RF_ClassDefaultObject) )
{
CurrentReferencer->GetClass()->SerializeDefaultObject(CurrentReferencer, *this);
}
else
{
CurrentReferencer->Serialize( *this );
}
// ObjectsToSerialize will contain only those objects which were encountered while serializing CurrentReferencer
// that weren't already in the list of objects to be serialized.
if ( ObjectsToSerialize.Num() > 0 )
{
// add to objects, so that we make sure ObjectToSerialize are serialized
Objects += ObjectsToSerialize;
ObjectsToSerialize.Empty();
}
}
Objects.RemoveAt(LastRootObjectIndex, Objects.Num() - LastRootObjectIndex);
}
示例13: ReturnToPoolOrGetNextJob
virtual IQueuedWork* ReturnToPoolOrGetNextJob(FQueuedThread* InQueuedThread) override
{
check(InQueuedThread != nullptr);
IQueuedWork* Work = nullptr;
// Check to see if there is any work to be done
FScopeLock sl(SynchQueue);
if (TimeToDie)
{
check(!QueuedWork.Num()); // we better not have anything if we are dying
}
if (QueuedWork.Num() > 0)
{
// Grab the oldest work in the queue. This is slower than
// getting the most recent but prevents work from being
// queued and never done
Work = QueuedWork[0];
// Remove it from the list so no one else grabs it
QueuedWork.RemoveAt(0);
}
if (!Work)
{
// There was no work to be done, so add the thread to the pool
QueuedThreads.Add(InQueuedThread);
}
return Work;
}
示例14: GetKeyablePropertyPaths
void GetKeyablePropertyPaths(UClass* Class, UStruct* PropertySource, TArray<UProperty*>& PropertyPath, FSequencer& Sequencer, TArray<TArray<UProperty*>>& KeyablePropertyPaths)
{
//@todo need to resolve this between UMG and the level editor sequencer
const bool bRecurseAllProperties = Sequencer.IsLevelEditorSequencer();
for (TFieldIterator<UProperty> PropertyIterator(PropertySource); PropertyIterator; ++PropertyIterator)
{
UProperty* Property = *PropertyIterator;
if (Property && !Property->HasAnyPropertyFlags(CPF_Deprecated))
{
PropertyPath.Add(Property);
bool bIsPropertyKeyable = Sequencer.CanKeyProperty(FCanKeyPropertyParams(Class, PropertyPath));
if (bIsPropertyKeyable)
{
KeyablePropertyPaths.Add(PropertyPath);
}
if (!bIsPropertyKeyable || bRecurseAllProperties)
{
UStructProperty* StructProperty = Cast<UStructProperty>(Property);
if (StructProperty != nullptr)
{
GetKeyablePropertyPaths(Class, StructProperty->Struct, PropertyPath, Sequencer, KeyablePropertyPaths);
}
}
PropertyPath.RemoveAt(PropertyPath.Num() - 1);
}
}
}
示例15: CleanupUnitTestWorlds
void NUTNet::CleanupUnitTestWorlds()
{
for (auto It=PendingUnitWorldCleanup.CreateIterator(); It; ++It)
{
UWorld* CurWorld = *It;
// Remove the tick-hook, for this world
int32 TickHookIdx = ActiveTickHooks.IndexOfByPredicate(
[&CurWorld](const FWorldTickHook* CurTickHook)
{
return CurTickHook != NULL && CurTickHook->AttachedWorld == CurWorld;
});
if (TickHookIdx != INDEX_NONE)
{
ActiveTickHooks.RemoveAt(TickHookIdx);
}
GEngine->DestroyWorldContext(CurWorld);
CurWorld->DestroyWorld(false);
}
PendingUnitWorldCleanup.Empty();
// Immediately garbage collect remaining objects, to finish net driver cleanup
CollectGarbage(GARBAGE_COLLECTION_KEEPFLAGS, true);
}