# Binary ‘==’: no operator found? FTransform == FTransform

**URL:** <https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457>\
**Category:** C++\
**Tags:** UE4-20, unreal-engine, UE4, CPP, question\
**Created:** [August 14, 2022, 11:25pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457 "2022-08-14T23:25:26Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 7:17pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/41 "2022-08-15T19:17:48Z")

</div>

So it’s  
Ftransform Location;  
as var declaration, then that is what you have to convert , or better put the content of Location to an int.

> **[Unreal Engine 4 Scripting with C++ Cookbook](https://books.google.ro/books?id=zZ7cDgAAQBAJ&pg=PA109&lpg=PA109&dq=fvector.add%2Bunreal&source=bl&ots=ZtZ32DK5cU&sig=ACfU3U1KNQPLkksYHOkR5S-RtmAf99k8Cg&hl=en&sa=X&ved=2ahUKEwjO6qqnycn5AhWhgv0HHRm4CKEQ6AF6BAgcEAM#v=onepage&q=fvector.add%20unreal&f=false)**
>
> Get the best out of your games by scripting them using UE4About This BookA straightforward and easy-to-follow formatA selection of the most important tasks and problemsCarefully organized instructions to solve problems efficientlyClear explanations...

So you just add the vector like here but with the name changed.  
Here it shows you the indices representing int indexes made from vectors.  
I don’t know if this method works out of unreal components, then you are going to have to use capture.

Anyway you just need to put the int index that you are trying to create out of your float points.

int yourintindex = Location.Add(xyz);  
This works as long as you have an x,y,z float variables declared and used inside the array, maybe they are called something else so check that what ever they are named.

then do what ever with int yourindex to “==” with it.

Once you do that you are going to get the index out of your float and use that to compare. But I do not know if it works out of unreal components. If not you may want to add or convert in another form with capture or another form.

There are simple forms to convert.  
Like:

> <https://stackoverflow.com/questions/43076535/convert-vectorint-to-integer>

But it may be unfrendly to unreal because unreal uses Fvector and especially Ftrasnform so you may not use raw C++ with these, so you have to use C++ like unreal likes with index points out of floats and captures. for the Fv or Ftr…

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 7:54pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/42 "2022-08-15T19:54:09Z")

</div>

how can I can check the index if it is duplicated using int index?

```auto
TArray<FTransform> Available{};
TArray<FTransform> UsedLocations{};
FTransform Location{};
int Index{};

RandomLocation(Available, Location); 
int Index = UsedLocations.Add(Location) ;

  if (UsedLocations.Find(Location) == -1)
  { 
     //Some code
  }

```

> Already randomizing the locations by -1 formula to avoid duplicates.

```auto
void AMyGM::RandomLocation(TArray<FTransform> A, FTransform& B)
{
	int32 ArrMaxLength{};
	ArrMaxLength = A.Num() - 1;
	FTransform GetByCopy{};
	GetByCopy = A[FMath::RandRange(0, ArrMaxLength)];
	B = GetByCopy;
}

```

The locations in the data table are `vectors`

if (UsedLocations.Find(Location) == -1) // this location variable is FTransform,

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 7:57pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/43 "2022-08-15T19:57:12Z")

</div>

> [@Alexa.Ki](#):
>
> ```auto
> if (UsedLocations.Find(Location) == -1)
> { 
> //Some code
> }
> 
> ```

the == checks if it’s identical.  
So this is what you are trying to do ?

```auto
 if (UsedLocations.Find(Your_int_index_variable) == -1)
  { 
     //Some code
  }

```

But What is used locations, another Ftransform as I see. You have to convert also Ftransform UsedLocations to int indexes.

So …

```auto
 if (Int array data that you converted.Find(Your_int_index_variable) == -1)

```

You may want to get indexes then store them to int type of array and then compare not with int variable but with the int array that you stored the indexes into.

Get indexes out of your Ftransforms both of them  
Crete int arrays and store the indexes inside of them that you got from vectors  
Use the arrays to compare with ==  
As I see you are using the arrays to compare them not some simple index variable that contains one value maybe, so the array has the whole list.

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:00pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/44 "2022-08-15T20:00:14Z")

</div>

> [@GigiK-K-K](#):
>
> the == checks if it’s identical.  
> So this is what you are trying to do ?

yes exactly

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:01pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/45 "2022-08-15T20:01:09Z")

</div>

Good luck and do post back.

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:05pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/46 "2022-08-15T20:05:07Z")

</div>

So

```auto
if (Your_int_array with the values you had from check values.Find(Your_array with _index_variables from locations) == -1)
  { 
     //Some code
  }

```

Compare one array against the other but Int arrays not floats.  
So if it works for you please let me know, I’ll use this too when I use relative possitions to check if the possitions have diffrrences after I switch from relative to world back.

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:06pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/47 "2022-08-15T20:06:26Z")

</div>

if it works I will accept this answer as solution 🙂  
I am currently trying

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:07pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/48 "2022-08-15T20:07:23Z")

</div>

Sweet but I don’t need noble premium hahaha, just a solution to check possitions, I was interestid in this also, why I replied because I’m going to use transforms to transform landscapes that I have.

---

<div class="post-metadata">

**Author:** ![Emaer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/emaer/32/570877_2.png) [@Emaer](https://forums.unrealengine.com/u/Emaer)\
**Post date:** [August 15, 2022, 8:15pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/49 "2022-08-15T20:15:26Z")

</div>

Dont know what you want to achieve, but never use `==` for comparing `float`/`double` variables.  
If you want compare `FTransform` then use `FTransform::Equals` function.

For example:

```cpp
void SomeFunction(FTransform const& MyTransform)
{
  TArray<FTransform> Transforms = GetTransformsFromSomewhere();
  auto IsNearlyIdentical = [MyTransform](FTransform const& Other) noexcept -> bool {
    return Other.Equals(MyTransform);
  };
  if (Transforms.FindByPredicate(IsNearlyIdentical)) {
    // yay!
  }
}

```

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:19pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/50 "2022-08-15T20:19:18Z")

</div>

gives the same error: `[Binary ‘==’: no operator found]`

this `Equals` function also using the == from C++ in the end?

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:22pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/51 "2022-08-15T20:22:36Z")

</div>

Post the modified code.

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:25pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/52 "2022-08-15T20:25:32Z")

</div>

your solution I am still trying, the message was for @Emaer , his solution gives the same error as normal `== `

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:35pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/53 "2022-08-15T20:35:49Z")

</div>

So

You should have two int32 arrays.  
TArray NameUsedLocations2{};  
TArray Locations2{};

Then…

int first = Locations.Add Locations.Add (Fvector(Locations3));  
int second = UsedLocations.Add (Fvector(YourUsedLocations3));

To create an index you have to create another Fvector array I think also for each because when you dump the data in it, it’s when you create an index.

So you may want to use 4 arrays Fvector or in your case Ftransform and 2 int arrays. You have dump data from fvector or in your case ftransform to other two who have the same type otherwise it’s going to give conversion errors.

So when you get the data in the arrays is when you create an index, but you already have an array with data, so you have to dump it in to an identical type and then when you dump it you get index. And with the index you store it into the other two arrays that are int.

4 arrays Locations, UsedLocations, Locations2 , UsedLocations2, then the other two that are int UsedLocations3 and Locations3.

To get the data as index you have to use float x,y,z. But since you alrady have the floats into the arrays you have to dump them in other arrays that are identical as type to get index on them, it’s when you dump data inside the array that you make an int index out of them. Then use the int variables to store to int arrays.

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:42pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/54 "2022-08-15T20:42:23Z")

</div>

it is in compilation progress, my incredibuild has expired and the project is large, it will take some time to compile , I will share the result in any case

---

<div class="post-metadata">

**Author:** ![Emaer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/emaer/32/570877_2.png) [@Emaer](https://forums.unrealengine.com/u/Emaer)\
**Post date:** [August 15, 2022, 8:46pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/55 "2022-08-15T20:46:20Z")

</div>

> gives the same error: `[Binary ‘==’: no operator found]`

Unlikely, because `FindByPredicate` dont use `operator==` at all.

> this `Equals` function also using the == from C++ in the end?

Nope. `Equals` function take second argument to specify tolerance. This argument is optional and is defaulted to `machine epsilon`-like.

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:48pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/56 "2022-08-15T20:48:52Z")

</div>

it is returning a bool and I think this is why it is complaining about the same error

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:52pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/57 "2022-08-15T20:52:40Z")

</div>

Do this

> TArray\< FVector \> Locations = TArray();  
> TArray\< FVector \> Locations 2= TArray();  
> TArray\< FVector \> UsedLocations = TArray();  
> TArray\< FVector \> UsedLocations2 = TArray();

> TArray\< Int32 \>Locations3 = TArray();  
> TArray\< Int32 \>Used Locations3= TArray();

So you need to have these as first step I think.  
After that you need to dump one into another with the int that stores a value.

So use the first array to insert to a second array and when you do you make an index:  
int a1 = Locations.2.Add(Location);  
int a2 = UsedLocations2.Add(UsedLocations);  
Corrected some code.

Now you have some int indexes.

Try placing the int array instead of a local variable a1 for example  
instead of int a1 to capture it directly inside the array maybe.

For Example

Locations3 = Locations.2.Add(Location));  
There is no reason to give conversion error if you do this properly with integer values.

---

<div class="post-metadata">

**Author:** ![Alexa.Ki](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/alexa.ki/32/562753_2.png) [@Alexa.Ki](https://forums.unrealengine.com/u/Alexa.Ki)\
**Post date:** [August 15, 2022, 8:56pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/58 "2022-08-15T20:56:48Z")

</div>

I am waiting for this to get compiled, I think I did the same and hopefully it will not give the error

---

<div class="post-metadata">

**Author:** ![GigiK-K-K](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GigiK-K-K](https://forums.unrealengine.com/u/GigiK-K-K)\
**Post date:** [August 15, 2022, 8:58pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/59 "2022-08-15T20:58:13Z")

</div>

Also if you add individual variables that are int if it does not work directly with the int array to store directly into array rather than storing it first inside an int variable, it’s the same.

Location3.Add…name of the int variable  
UsedLocation3.Add…name of the int variable

and now they are inside the int array and ready to ======. what ever you are trying to compare.

So you just do this.  
int your\_variable = Location2.Add(Location);  
And when you dump one fvector array into another fvector you create an index int.

Or maybe like this  
Your\_location\_int\_array = Location2.Add(Location);

My post was not accepting \<

So…

> TArray\< FVector \> Locations = TArray();  
> TArray\< FVector \> Locations 2= TArray();  
> TArray\< FVector \> UsedLocations = TArray();  
> TArray\< FVector \> UsedLocations2 = TArray();

> TArray\< Int32 \>Locations3 = TArray();  
> TArray\< Int32 \>Used Locations3= TArray();

Make sure the arrays have the type.  
In your case it’s ```  
\< FTransform \> not FVector

```auto

```

---

<div class="post-metadata">

**Author:** ![Roy\_Wierer.Seda145](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/roy_wierer.seda145/32/906551_2.png) [@Roy\_Wierer.Seda145](https://forums.unrealengine.com/u/Roy_Wierer.Seda145)\
**Post date:** [August 15, 2022, 9:01pm UTC](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457/60 "2022-08-15T21:01:49Z")

</div>

> [@Alexa.Ki](#):
>
> cannot access protected member

this or “is inaccessible” means the property or method is not marked public, so you have to get them through a public method on FTransform.

[Previous page](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457.md?page=2)

[Next page](https://forums.unrealengine.com/t/binary-no-operator-found-ftransform-ftransform/628457.md?page=4)
