TMemoryView

A non-owning view of a contiguous region of memory.

Choose your operating system:

Windows

macOS

Linux

References

Module

Core

Header

/Engine/Source/Runtime/Core/Public/Memory/MemoryFwd.h

Include

#include "Memory/MemoryFwd.h"

Syntax

template<typename DataType>
class TMemoryView

Remarks

A non-owning view of a contiguous region of memory.

Prefer to use the aliases FMemoryView or FMutableMemoryView over this type.

Functions that modify a view clamp sizes and offsets to always return a sub-view of the input.

Constructors

Name Description

Public function

TMemoryView()

Construct an empty view.

Public function

TMemoryView

(
    const TMemoryView< OtherDataType > ...
)

Construct a view of by copying a view with compatible const/volatile qualifiers.

Public function

TMemoryView

(
    DataType* InData,
    uint64 InSize
)

Construct a view of InSize bytes starting at InData.

Public function

TMemoryView

(
    DataType* InData,
    DataEndType* InDataEnd
)

Construct a view starting at InData and ending at InDataEnd.

Functions

Name Description

Public function Const

int32

 

CompareBytes

(
    const TMemoryView< OtherDataType > ...
)

Returns whether the bytes of this view are equal or less/greater than the bytes of the other view.

Public function Const

bool

 

Contains

(
    const TMemoryView< OtherDataType > ...
)

Returns whether this view fully contains the other view.

Public function Const

TMemoryView

 

CopyFrom

(
    FMemoryView InView
)

Copies bytes from the input view into this view, and returns the remainder of this view.

Public function Const

bool

 

EqualBytes

(
    const TMemoryView< OtherDataType > ...
)

Returns whether the bytes of this views are equal to the bytes of the other view.

Public function Const

constexpr bo...

 

Equals

(
    const TMemoryView< OtherDataType > ...
)

Returns whether the data pointers and sizes of this view and the other view are equal.

Public function Const

constexpr Da...

 

GetData()

Returns a pointer to the start of the view.

Public function Const

DataType ...

 

GetDataEnd()

Returns a pointer to the end of the view.

Public function Const

constexpr ui...

 

GetSize()

Returns the number of bytes in the view.

Public function Const

bool

 

Intersects

(
    const TMemoryView< OtherDataType > ...
)

Returns whether this view intersects the other view.

Public function Const

constexpr bo...

 

IsEmpty()

Returns whether the view has a size of 0 regardless of its data pointer.

Public function Const

constexpr TM...

 

Left

(
    uint64 InSize
)

Returns the left-most part of the view by taking the given number of bytes from the left.

Public function Const

constexpr TM...

 

LeftChop

(
    uint64 InSize
)

Returns the left-most part of the view by chopping the given number of bytes from the right.

Public function

constexpr vo...

 

LeftChopInline

(
    uint64 InSize
)

Modifies the view by chopping the given number of bytes from the right.

Public function

constexpr vo...

 

LeftInline

(
    uint64 InSize
)

Modifies the view to be the given number of bytes from the left.

Public function Const

TMemoryView

 

Mid

(
    uint64 InOffset,
    uint64 InSize
)

Returns the middle part of the view by taking up to the given number of bytes from the given position.

Public function

void

 

MidInline

(
    uint64 InOffset,
    uint64 InSize
)

Modifies the view to be the middle part by taking up to the given number of bytes from the given offset.

Public function

constexpr vo...

 

Reset()

Resets to an empty view.

Public function Const

TMemoryView

 

Right

(
    uint64 InSize
)

Returns the right-most part of the view by taking the given number of bytes from the right.

Public function Const

TMemoryView

 

RightChop

(
    uint64 InSize
)

Returns the right-most part of the view by chopping the given number of bytes from the left.

Public function

void

 

RightChopInline

(
    uint64 InSize
)

Modifies the view by chopping the given number of bytes from the left.

Public function

void

 

RightInline

(
    uint64 InSize
)

Modifies the view to be the given number of bytes from the right.

Operators

Name Description

Public function Const

constexpr bo...

 

operator!=

(
    const TMemoryView< OtherDataType > ...
)

Returns whether the data pointers and sizes of this view and the other view are not equal.

Public function

constexpr TM...

 

operator+=

(
    uint64 InOffset
)

Advances the start of the view by an offset, which is clamped to stay within the view.

Public function Const

constexpr bo...

 

operator==

(
    const TMemoryView< OtherDataType > ...
)

Returns whether the data pointers and sizes of this view and the other view are equal.

Typedefs

Name

Description

ByteType