C++ Actor class array search

I’m wondering how I might go about scanning an array for a specific class. Here’s the code I want to do in BP:

(Basically the “Contains” node just searches an array for a given input which is the bottom)
I’ve tried this:

//.H file
	UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Element)
		TArray<TSubclassOf<AActor>> ClassArray;
		
//.CPP file
bool AMyClass::SearchArray(TSubclassOf<AActor> ActorIn)
{
	bool bArrayContains = ClassArray.Contains(ActorIn);
	return bArrayContains;
}

//It's the "ClassArray.Contains" that seems to be messing up.

I’m not sure what to do here. The rest of my project kinda rides on this and I don’t want to use BP because it’s easier (for me) to use C++ as a main parent class. Any help is greatly appreciated!

I don’t understand whats the problem? How “ClassArray.Contains” messing up?

I think you have to use an actor pointer to check

Hey catellus-

Can you explain how line 8 above is messing up? If it is not compiling, can you provide the compile error you’re getting? If it is causing issues in the editor, please explain what the behavior is.

Also, was Zarkopafilis’ suggestion of using an Actor pointer instead of TSubclassOf helpful? Let us know what you’re experiencing and we can investigate further.

After messing with this for a while, I’ve managed to fix it. It seems that the ActorIn was not putting through a class properly. Unfortunately I did not put the code for the ActorIn variable so I do apologize for that. Thanks to you all for trying to help me. Can’t cure stupidity, unfortunately.