UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
ReverseIterate.h File Reference
#include "HAL/Platform.h"
#include <iterator>

Go to the source code of this file.

Classes

struct  TReversePointerIterator< T >
 

Namespaces

namespace  UE
 
namespace  UE::Core
 
namespace  UE::Core::Private
 implementation
 

Functions

template<typename RangeType >
constexpr UE::Core::Private::TReverseIterationAdapter< RangeType > ReverseIterate (RangeType &&Range UE_LIFETIMEBOUND)
 

Function Documentation

◆ ReverseIterate()

template<typename RangeType >
constexpr UE::Core::Private::TReverseIterationAdapter< RangeType > ReverseIterate ( RangeType &&Range  UE_LIFETIMEBOUND)
inlineconstexpr

Allows a range to be iterated backwards. The container must not be modified during iteration, but elements may be. The container must outlive the adapter.

Parameters
RangeThe range to iterate over backwards.
Returns
An adapter which allows reverse iteration over the range. The adapter is not intended to be handled directly, but rather as a parameter to an algorithm or ranged-for loop.

Example:

TArray<int> Array = { 1, 2, 3, 4, 5 };

for (int& Element : ReverseIterate(Array)) { UE_LOG(LogTemp, Log, TEXT("%d"), Element); } // Logs: 5 4 3 2 1

TArray<FString> Output; Algo::Transform(ReverseIterate(Array), Output, UE_PROJECTION(LexToString)); // Output: [ "5", "4", "3", "2", "1" ]