Please select what you are reporting on:
Unreal Editor for Fortnite
What Type of Bug are you experiencing?
Verse
Summary
HI all,
I’m trying to write a generic function that finds the indices of duplicate entries in an array. The problem I’m having is with the line Key > MaxElement
. The compiler can’t infer that the type of MaxElement and Key are the same:
Find_Equal_Elements<public>(Array: []t where t:subtype(comparable))<transacts>:[]int=
if (Array.Length <= 1):
return array{0}
var Duplicates: [t][]int = map{}
for (Index->Element : Array):
if (set Duplicates[Element] += array{Index}) {}
var Indices: []int = array{0}
if (var MaxElement: t = Array[0]):
for (Key->Value : Duplicates):
if (Key > MaxElement):
set MaxElement = Key
if (ElementIndices := Duplicates[MaxElement]):
set Indices = ElementIndices
Indices
Steps to Reproduce
Enter the above code in VS Code and you’ll see the compiler error about no overload operator for >
Expected Result
I expect the compiler to infer that both types are the same
Observed Result
Error
Platform(s)
Windows 10