TBitArray

Forward declaration.

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Containers/BitArray.h

Include

#include "Containers/BitArray.h"

Syntax

template<typename Allocator>
class TBitArray

Remarks

A dynamically sized bit array. An array of Booleans. They stored in one bit/Boolean. There are iterators that efficiently iterate over only set bits.

Constructors

Name Description

Public function

TBitArray()

Public function

TBitArray

(
    TBitArray&& Other
)

Move constructor.

Public function

TBitArray

(
    const TBitArray& Copy
)

Copy constructor.

Public function

TBitArray

(
    const TBitArray< OtherAllocator >&...
)

Public function

TBitArray

(
    bool bValue,
    int32 InNumBits
)

Minimal initialization constructor.

Functions

Name Description

Public function

FBitReferenc...

 

AccessCorrespondingBit

(
    const FRelativeBitReference& Relat...
)

Public function Const

const FConst...

 

AccessCorrespondingBit

(
    const FRelativeBitReference& Relat...
)

Public function

int32

 

Add

(
    const bool Value
)

Adds a bit to the array with the given value.

Public function

int32

 

Add

(
    const bool Value,
    int32 NumBitsToAdd
)

Adds multiple bits to the array with the given value.

Public function

int32

 

AddRange

(
    const InWordType* ReadBits,
    int32 NumBitsToAdd,
    int32 ReadOffsetBits
)

Adds multiple bits read from the given pointer.

Public function

int32

 

AddRange

(
    const TBitArray< OtherAllocator >&...,
    int32 NumBitsToAdd,
    int32 ReadOffsetBits
)

Adds multiple bits read from the given BitArray.

Public function

int32

 

AddUninitialized

(
    int32 NumBitsToAdd
)

Inserts space for multiple bits at the end of the array.

Public function Static

TBitArray

 

BitwiseAND

(
    const TBitArray& A,
    const TBitArray& B,
    EBitwiseOperatorFlags InFlags
)

Return the bitwise AND of two bit arrays.

Public function

void

 

BitwiseNOT()

Perform a bitwise NOT on all the bits in this array

Public function Static

TBitArray

 

BitwiseOR

(
    const TBitArray& A,
    const TBitArray& B,
    EBitwiseOperatorFlags InFlags
)

Return the bitwise OR of two bit arrays.

Public function Static

TBitArray

 

BitwiseXOR

(
    const TBitArray& A,
    const TBitArray& B,
    EBitwiseOperatorFlags InFlags
)

Return the bitwise XOR of two bit arrays.

Public function Const

void

 

CheckInvariants()

Checks the invariants of this class

Public function

TBitArray &

 

CombineWithBitwiseAND

(
    const TBitArray& InOther,
    EBitwiseOperatorFlags InFlags
)

Perform a bitwise AND on this bit array with another.

Public function

TBitArray &

 

CombineWithBitwiseOR

(
    const TBitArray& InOther,
    EBitwiseOperatorFlags InFlags
)

Return the bitwise OR of two bit arrays.

Public function

TBitArray &

 

CombineWithBitwiseXOR

(
    const TBitArray& InOther,
    EBitwiseOperatorFlags InFlags
)

Return the bitwise XOR of two bit arrays.

Public function Const

bool

 

CompareSetBits

(
    const TBitArray& Other,
    const bool bMissingBitValue
)

Returns true if Other contains all the same set bits as this, accounting for differences in length.

Public function Const

bool

 

Contains

(
    bool bValue
)

Public function Const

void

 

CountBytes

(
    FArchive& Ar
)

Tracks the container's memory use through an archive.

Public function Const

int32

 

CountSetBits

(
    int32 FromIndex,
    int32 ToIndex
)

Count the number of set bits in this array FromIndex <= bit < ToIndex

Public function

void

 

Empty

(
    int32 ExpectedNumBits
)

Removes all bits from the array, potentially leaving space allocated for an expected number of bits about to be added.

Public function Const

int32

 

Find

(
    bool bValue
)

Finds the first true/false bit in the array, and returns the bit index.

Public function

int32

 

FindAndSetFirstZeroBit

(
    int32 ConservativeStartIndex
)

Finds the first zero bit in the array, sets it to true, and returns the bit index.

Public function

int32

 

FindAndSetLastZeroBit()

Finds the last zero bit in the array, sets it to true, and returns the bit index.

Public function Const

int32

 

FindLast

(
    bool bValue
)

Finds the last true/false bit in the array, and returns the bit index.

Public function Const

uint32

 

GetAllocatedSize()

Helper function to return the amount of memory allocated by this container

Public function

uint32 *

 

GetData()

Public function Const

const uint32...

 

GetData()

Public function Const

void

 

GetRange

(
    int32 Index,
    int32 NumBitsToGet,
    InWordType* WriteBits,
    int32 WriteOffsetBits
)

Reads a range of bits within the array and writes them to the given pointer.

Public function

void

 

Init

(
    bool bValue,
    int32 InNumBits
)

Resets the array's contents.

Public function

void

 

Insert

(
    bool Value,
    int32 Index,
    int32 NumBitsToAdd
)

Inserts multiple bits with the given value into the array, starting at the given Index.

Public function

void

 

Insert

(
    bool Value,
    int32 Index
)

Adds a bit with the given value at the given index in the array.

Public function

void

 

InsertRange

(
    const TBitArray< OtherAllocator >&...,
    int32 Index,
    int32 NumBitsToAdd,
    int32 ReadOffsetBits
)

Inserts multiple bits read from the given BitArray into the array, starting at the given index.

Public function

void

 

InsertRange

(
    const InWordType* ReadBits,
    int32 Index,
    int32 NumBitsToAdd,
    int32 ReadOffsetBits
)

Inserts multiple bits read from the given pointer, starting at the given index.

Public function

void

 

InsertUninitialized

(
    int32 Index,
    int32 NumBitsToAdd
)

Inserts space for multiple bits into the array, starting at the given index.

Public function Const

bool

 

IsEmpty()

Returns true if the bit array is empty and contains no elements.

Public function Const

bool

 

IsValidIndex

(
    int32 InIndex
)

Accessors.

Public function Const

int32

 

Max()

Public function Const

int32

 

Num()

Public function

int32

 

PadToNum

(
    int32 DesiredNum,
    bool bPadValue
)

Pad this bit array with the specified value to ensure that it is at least the specified length.

Public function

void

 

RemoveAt

(
    int32 BaseIndex,
    int32 NumBitsToRemove
)

Removes bits from the array.

Public function

void

 

RemoveAtSwap

(
    int32 BaseIndex,
    int32 NumBitsToRemove
)

Removes bits from the array by swapping them with bits at the end of the array.

Public function

void

 

Reserve

(
    int32 Number
)

Reserves memory such that the array can contain at least Number bits.

Public function

void

 

Reset()

Removes all bits from the array retaining any space already allocated.

Public function

void

 

SetNumUninitialized

(
    int32 InNumBits
)

Sets number of bits without initializing new bits.

Public function

void

 

SetRange

(
    int32 Index,
    int32 NumBitsToSet,
    bool Value
)

Sets or unsets a range of bits within the array.

Public function

void

 

SetRangeFromRange

(
    int32 Index,
    int32 NumBitsToSet,
    const InWordType* ReadBits,
    int32 ReadOffsetBits
)

Sets range of bits within the TBitArray to the values read out of a pointer.

Public function

void

 

SetRangeFromRange

(
    int32 Index,
    int32 NumBitsToSet,
    const TBitArray< OtherAllocator >&...,
    int32 ReadOffsetBits
)

Sets range of bits within this TBitArray to the values read out another TBitArray.

Public function Const

void

 

WriteMemoryImage

(
    FMemoryImageWriter& Writer
)

Operators

Name Description

Public function Const

bool

 

operator!=

(
    const TBitArray< Allocator >& Othe...
)

Public function Const

const FConst...

 

operator[]

(
    int32 Index
)

Public function

FBitReferenc...

 

operator[]

(
    int32 Index
)

Public function Const

bool

 

operator<

(
    const TBitArray< Allocator >& Othe...
)

Public function

TBitArray &

 

operator=

(
    TBitArray&& Other
)

Move assignment.

Public function

TBitArray &

 

operator=

(
    const TBitArray& Copy
)

Assignment operator.

Public function

TBitArray &

 

operator=

(
    const TBitArray< OtherAllocator >&...
)

Public function Const

bool

 

operator==

(
    const TBitArray< Allocator >& Othe...
)

Classes

Name

Description

Public class

FConstIterator

Const BitArray iterator.

Public class

FConstReverseIterator

Const reverse iterator.

Public struct

FConstWordIterator

Public class

FIterator

BitArray iterator.

Public struct

FWordIterator

Typedefs

Name

Description

AllocatorType

WordType

Constants

Name

Description

FullWordMask