C++ Syntax for GameplayTag Queries

Thanks for this, it works and I just want to add a little tidbit here for any lost souls like I was :joy:

The official documentation has an example that does not work (FGameplayTagQuery)

// DOESNT WORK
FGameplayTagQuery Q; 
Q.BuildQuery( ... ); //  static function, returns a *new* query which is being assigned to nothing

Instead you either want to use BuildQuery to create a new one, or call Build on an existing query.

// Option 1. Build a new query
FGameplayTagQuery query = FGameplayTagQuery::BuildQuery(yourExpression);

// Option 2. Build the existing query 
FGameplayTagQuery q;
q.Build(yourExpression);

For posterity, anyone looking for a minimal example of how to use FGameplayTagQuery

FGameplayTagQuery query = FGameplayTagQuery::BuildQuery(
	FGameplayTagQueryExpression()
	.AllTagsMatch()
	.AddTag(FGameplayTag::RequestGameplayTag("Your.Tag"))
);

TArray<AActor*> results;
UBlueprintGameplayTagLibrary::GetAllActorsOfClassMatchingTagQuery(
	this,
	AActor::StaticClass(),
	query,
	results
);