title: How find structure index in a structure-TArray?
body: <p>There is a function on BP that looks for an empty slot in the array and fills it. When trying to rewrite it in c++, it throws the error C2678 &quot;binary&quot;==&quot;: an operator accepting a left operand of the type &quot;const FSlotStructure&quot; was not found (or there is no acceptable conversion)&quot;<a href="https://i.stack.imgur.com/GGobe.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GGobe.jpg" alt="enter image description here" /></a>
  The variables in the picture correspond to the variables in the code. The Find() function itself does not search for the FSlotStructure variable in the Array Inventory array. What is the mistake?</p>
  <p>The function below is custom, because &quot;FIND&quot; and &quot;SetArrayElem&quot; functions from UKismetArrayLibrary and could not be used directly.</p>
  <pre><code>void UInventoryComponent::CreateStack(FSlotStructure&amp; ContentToAdd)
  {
      //TArray&lt;FSlotStructure&gt; Inventory;
  
      int32 Index;
  
      for (auto&amp; SlotStructure : Inventory)
      {
          int32 NewIndex = Inventory.Find(SlotStructure, Index);
  
          Inventory.Insert(ContentToAdd, NewIndex);
      }
  }
  </code></pre>