class TRTTIIterator

template<class DataType, bool IsContainer>
Inherits: IRTTIIterator

Wraps a container that can be used for sequentially reading container contents, inserting new elements in the container, and retrieving container element count.

Template parameters

DataType

Data type to iterate over.

IsContainer

Set to true if you wish to iterate over DataType as a container with multiple elements. If false, the iterator acts as a faux iterator with a single entry, directly referencing the provided data type.

Public

Constructors

TRTTIIterator<DataType, IsContainer>

TRTTIIterator<DataType, IsContainer>(DataType &value)

TRTTIIterator<DataType, IsContainer>

TRTTIIterator<DataType, IsContainer>(DataType &value, IteratorType iterator)

Methods

IsValid

bool IsValid() const override

Returns true if the iterator points to a valid value.

SeekToBeginning

void SeekToBeginning() override

Resets the iterator to the beginning of the container.

SeekToEnd

void SeekToEnd() override

Resets the iterator to the end of the container.

GetElementCount

u64 GetElementCount() const override

Returns the number of elements in the container.

GetValue

const void *GetValue() const override

Returns the current value of the iterator.

Increment

void Increment() override

Increment operator.

Clone

SPtr<IRTTIIterator> Clone(FrameAllocator &allocator) const override

Makes a copy of this iterator at its current location.

Clear

void Clear() override

Clears all the entries from the underlying container.

Erase

void Erase() override

Removes the current iterator element.

SeekToIndex

bool SeekToIndex(u64 index) override

Seeks the iterator to a particular index.

If the index is out of range, or seeking to index is not supported, the iterator is marked as invalid and false is returned.

SeekToKey

bool SeekToKey(const void *value) override

Seeks the iterator to a particular key.

The provided value should be a pointer to the key value, or to a tuple. In case the value is a tuple, the first element is considered to be the key. If the kye is not found, or seeking to key is not supported, the iterator is marked as invalid and false is returned.

staticSupportsSeekToIndex

static constexpr bool SupportsSeekToIndex()

Returns true if SeekToIndex() may be called on the iterator.

Generally true for array containers.

staticSupportsSeekToKey

static constexpr bool SupportsSeekToKey()

Returns true if SeekToKey() may be called on the iterator.

Generally true for set/map containers.

Operators

operator=

TRTTIIterator<DataType, IsContainer> &operator=(const ElementType &value)

Assigns (copies) the value at the current iterator location, or if the iterator is not valid inserts the value at the end of the container.

operator=

TRTTIIterator<DataType, IsContainer> &operator=(ElementType &&value)

Assigns (moves) the value at the current iterator location, or if the iterator is not valid inserts the value at the end of the container.

operator*

ElementType &operator*()

Returns the current value of the iterator.

operator++

TRTTIIterator<DataType, IsContainer> &operator++()

Pre-increment operator.

Protected

Fields

mValue

DataType * mValue

mIterator

IteratorType mIterator