Использование битовых массивов в UE
using Allocator = TInlineAllocator<8>;
TBitArray<Allocator> Changed, Active; - массивы для храниения битов (аналог bool) да или нет
const auto active = Active.GetData();
for (TConstSetBitIterator<Allocator> bit{ Changed }; bit; ++bit)
{
const auto i = bit.GetIndex();
Operation(i, FBit{ active, i });
}int32 size = 0;
int32 partitions = 0;
auto remove = [&, start = 0](const int32 Begin, const int32 End) mutable {
const auto partition = Partition.GetData();
const auto actors = Enemies.GetData();
const auto spawners = Spawners.GetData();
const auto activation = Activation.GetData();
const auto change = Change.Changed.GetData();
const auto active = Change.Active.GetData();
for (int32 i = Begin; i < End; ++i)
{
const auto end = partition[i];
const auto previous = size;
for (auto j = start; j < end; ++j)
{
if (actors[j] != nullptr)
{
ForEach([&](auto& Container) { Container[size] = Container[j]; }, actors, activation);
ForEach([&](auto& Container) { WZF::Culling::FBit{ Container, size } = WZF::Culling::FBit{ Container, j }; }, active);
++size;
}
}
start = end;
const auto spawner = spawners[i] - 1;
if (size > previous)
{
if (partitions < i)
{
Parent->Spawners.Activation[spawner].Zombies = partitions + 1;
}
spawners[partitions] = spawner + 1;
partition[partitions] = size;
++partitions;
}
else if (spawner > 0)
{
Parent->Spawners.Activation[spawner].Zombies = 0;
}
}
};
remove(0, Retained);
const int retained = size;
remove(Retained, Partition.Num());
const auto added = size - retained;Last updated