TCircularBuffer

Template for circular buffers.

Windows
MacOS
Linux

References

Module

Core

Header

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

Include

#include "Containers/CircularBuffer.h"

Syntax

template<typename ElementType>
class TCircularBuffer

Remarks

Template for circular buffers.

The size of the buffer is rounded up to the next power of two in order speed up indexing operations using a simple bit mask instead of the commonly used modulus operator that may be slow on some platforms.

Constructors

Name Description

Public function

TCircularBuffer

(
    uint32 Capacity
)

Creates and initializes a new instance of the TCircularBuffer class.

Public function

TCircularBuffer

(
    uint32 Capacity,
    const ElementType& InitialValue
)

Creates and initializes a new instance of the TCircularBuffer class.

Functions

Name Description

Public function Const

uint32

 

Capacity()

Returns the number of elements that the buffer can hold.

Public function Const

uint32

 

GetNextIndex

(
    uint32 CurrentIndex
)

Calculates the index that follows the given index.

Public function Const

uint32

 

GetPreviousIndex

(
    uint32 CurrentIndex
)

Calculates the index previous to the given index.

Operators

Name Description

Public function

ElementType ...

 

operator[]

(
    uint32 Index
)

Returns the mutable element at the specified index.

Public function Const

const Elemen...

 

operator[]

(
    uint32 Index
)

Returns the immutable element at the specified index.

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss