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.

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback