It’s not a function created by you that you are returning, so that is like one problem with the types, second problem is it you are overloading it ? as I can see that parameter is only one inside the function and you got two params on the function call.
It only has one parameter in the form of a pointer with it’s type named item
SizeType Find(const ElementType& Item) const
So maybe when you call array find you are calling more than one function and this is just one of them ? otherwise you can’t fit two parameters on a call to a function that only has to offer one.
Is this created by you ?
SizeType Find(const ElementType& Item) const
{
const ElementType* RESTRICT Start = GetData();
for (const ElementType* RESTRICT Data = Start, *RESTRICT DataEnd = Data + ArrayNum; Data != DataEnd; ++Data)
{
if (*Data == Item)
{
return static_cast<SizeType>(Data - Start);
}
}
return INDEX_NONE;
}```
It has two parameters so array find calls on multiple locations one the find function then a Template array, okay, template meaning for template, it can be any kind ?
So that is the first parameter and it’s calling not on the find function as I see, Location is calling on it. You gave wrong function.
First parameter is
TransformArray
Second is Location
The Array_find calls on multiple locations not just in one place
You made a Ftransfrom parameter for:
TArray<T>& TargetArray
and another parameter named Location for the function you posted.
const U& ItemToFind
So you induced us in error
Actuall the last parameter is for the function
const U& ItemToFind
const TArray<T>& TargetArray,
This has nothing to do with the function posted by you, it may be valid for your Ftransform because it’s a Template array I take it the stands for any type of template and since FTransfrom is a template part of the Tarray is aceptable.
So most probally it’s the INT.
You are tryig to say that the template array parameter that now is of Ftransform is to be stored inside an INT variable called index.
So things have cleared up regarding your Ftransfrom, it was a parameter for < T > type “teplate type” and it is the first parameter as I see the function is detailed in the unreal docs now. The second parameter “Location” is for that function, only the second one.
It can also be that the universal < T > array teplate is not accepting your Ftransform for some reason and it says that it’s a conversion error. Maybe you should check how to set types on the array, or what types does < T > accept
I am bent using transform becasue vector will not help me in case I am spawning the actors in the world space transforms of the level using GetComponentTransforms
I’m not sure how this works < T > , I’m not familiar with it, I never used it.
But that might be the problem also, as it is not recondising your Ftransform and thinks you want to convert from it to < T > and it may not find the type of Ftransform compatible with it.
I am bent using transform becasue vector will not help me in case I am spawning the actors in the world space transforms of the level using GetComponentTransforms
Solved your problem ?
Now that I’m rested I can see that var location is also a Ftransfrom.
So as I said no Ftransform in that function, Location parameter is suppose to input a value for the function return that you have there that returns parameter “Item” I believe that is not of Ftransform Type.
ElementType is the type being return there with the name "Item:
Maybe element type accepts all things maybe not Ftransform, or maybe also Ftransform.
( TArrayView< ElementType, SizeType >, TArrayView< OtherElementType, Other…
)
So if you are trying to match things this should be a good resource.
Why is it giving “==” error , I don’t see this operator in your code now posted by you
I understand the conversion error tho on the Ftransform where you are trying to fit Ftranssform into universal types and maybe they don’t like Ftransform.
yes this is confusing, we see the code without == but internally I am sure some comparison is happening because this is returning the index of the FTransform in the Ftransform Array
Index = FCustomThunkTemplates::Array_Find(TransformArray, Location);
UKismetMathLibrary converts things, I use this lib often.
I don’t see UKismetMathLibrary in your code.
It’s obvious, at the end it has " FindIndex So the error is there when it’s trying to compare FindIndex with this library.
So it’s obvious that your Ftransform is not being converted to “int” as stated by me it’s the INT not converted. So Find Index is not an int, tho you made it an INT.
The error happens at the library level where it’s trying to equal int to int, it finds that Ftransform is not an INT and gives you the error
no operator found which takes a left-hand operand of type ‘const FTransform’