MCRO
C++23 utilities for Unreal Engine.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages Concepts
Mcro::Range::RenderAsMap Class Reference

Render a range of tuples or range of ranges with at least 2 elements as a TMap. More...

#include <Conversion.h>

Public Member Functions

 RenderAsMap ()
 
template<CRangeMember From>
auto Render (From &&range) const
 

Friends

template<CIsTemplate< TMap > Target>
class OutputToMap
 
template<CRangeMember From>
auto operator| (From &&range, RenderAsMap &&functor)
 

Detailed Description

Render a range of tuples or range of ranges with at least 2 elements as a TMap.

This functor will iterate over the entire input range and copy its values to the newly created container one-by-one with its Add function.

When working with range-of-ranges then ranges which doesn't have at least two elements will be silently ignored.

usage (from tuples):

using namespace ranges;
TArray<int32> MyKeyArray {1, 2, 3, 4, 5};
TArray<FString> MyValueArray {TEXT_"foo", TEXT_"bar"};
auto result = views::zip(MyKeyArray, views::cycle(MyValueArray))
// -> TMap<int32, FString> {{1, "foo"}, {2, "bar"}, {3, "foo"}, {4, "bar"}, {5, "foo"}}
#define TEXT_
A convenience alternative to Unreal's own TEXT macro but this one doesn't require parenthesis around ...
Definition TextMacros.h:51

usage (from inner-ranges):

using namespace ranges;
auto result = views::ints(0, 9)
| views::chunk(2)
// -> TMap<int32, int32> {{0, 1}, {2, 3}, {4, 5}, {6, 7}}
// notice how 8 is discarded from the end, as that range didn't have 2 items

Definition at line 391 of file Conversion.h.

Constructor & Destructor Documentation

◆ RenderAsMap()

Mcro::Range::RenderAsMap::RenderAsMap ( )
inline

Definition at line 456 of file Conversion.h.

Member Function Documentation

◆ Render()

template<CRangeMember From>
auto Mcro::Range::RenderAsMap::Render ( From && range) const
inline

Definition at line 465 of file Conversion.h.

Friends And Related Symbol Documentation

◆ operator|

template<CRangeMember From>
auto operator| ( From && range,
RenderAsMap && functor )
friend

Definition at line 459 of file Conversion.h.

◆ OutputToMap

template<CIsTemplate< TMap > Target>
friend class OutputToMap
friend

Definition at line 454 of file Conversion.h.


The documentation for this class was generated from the following file: