# Problem translating Blueprint to C++ TMap

**URL:** <https://forums.unrealengine.com/t/problem-translating-blueprint-to-c-tmap/2373135>\
**Category:** Blueprint\
**Tags:** tmap, unreal-engine, CPP, Blueprint, question\
**Created:** [March 3, 2025, 10:21pm UTC](https://forums.unrealengine.com/t/problem-translating-blueprint-to-c-tmap/2373135 "2025-03-03T22:21:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chevidal451](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chevidal451](https://forums.unrealengine.com/u/Chevidal451)\
**Post date:** [March 3, 2025, 10:21pm UTC](https://forums.unrealengine.com/t/problem-translating-blueprint-to-c-tmap/2373135/1 "2025-03-03T22:21:36Z")

</div>

Im trying to translate this blueprint function to code but its not working at all

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/2/6/726d24165105bd53d5241693f1261b855710abf7.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/e/b/4ebace6701395a54724f0f3cd039cda9b42bb122.png)

```auto
void ULyraInventoryManagerComponent::DoesShapeFit(TArray<FVector2D> Shape, bool& bSuccess, FVector2D& ResultVec)
{
	FVector2D EmptySlot = FVector2D::ZeroVector;
	bool bFailed = false;
	
	TArray<FVector2D> Locations;
	InventoryState.GetKeys(Locations);

	for (int j = 0; j < Locations.Num(); j++)
	{
		FVector2D Location = Locations[j];
		bool* bFound = InventoryState.Find(Location - Shape[0]);

		if (bFound)
		{
			if (!(*bFound))
			{
				EmptySlot = Location;

				for (int i = 0; i < Shape.Num(); i++)
				{
					bool* FoundValue = InventoryState.Find(EmptySlot + Shape[i]);

					bool bCondition = (!FoundValue || !(*FoundValue));
				
					if (bCondition)
					{
						bFailed = true;
						break;
					}
				}
				if (bFailed)
				{
					bFailed = false;
				}
				else
				{
					bSuccess = true;
					ResultVec = EmptySlot;
					return;
				}
			}
		}
		
	}
	
	bSuccess = false;
	ResultVec = FVector2D::ZeroVector;
		
}

```
