Moved operator== to be hidden friend instead of put directly in global namespace

Moved GetTypeHash function to be hidden friend instead of put directly in global namespace.

Note that the function/operator needs to be fully inlined in the type or placed in the cpp. If the function is added as friend but then implemented outside the type then hidden friend optimization won't work.

This should improve compile time somewhat according to msvc devs.

#rb Steve.Robb
#preflight 6360b7052b5338aceb26471b

[CL 22889837 by henrik karlsson in ue5-main branch]
This commit is contained in:
henrik karlsson
2022-11-01 15:50:27 -04:00
parent 891737c14e
commit 4a36cfe8ff
95 changed files with 2126 additions and 2202 deletions
@@ -43,12 +43,12 @@ namespace Metasound
uint32 FAnalyzerAddress::GetHash() const
{
uint32 AddressHash = HashCombineFast(AnalyzerInstanceID.A, ::GetTypeHash(AnalyzerMemberName));
AddressHash = HashCombineFast(AddressHash, ::GetTypeHash(AnalyzerName));
AddressHash = HashCombineFast(AddressHash, ::GetTypeHash(DataType));
AddressHash = HashCombineFast(AddressHash, ::GetTypeHash(InstanceID));
uint32 AddressHash = HashCombineFast(AnalyzerInstanceID.A, GetTypeHashHelper(AnalyzerMemberName));
AddressHash = HashCombineFast(AddressHash, GetTypeHashHelper(AnalyzerName));
AddressHash = HashCombineFast(AddressHash, GetTypeHashHelper(DataType));
AddressHash = HashCombineFast(AddressHash, GetTypeHashHelper(InstanceID));
AddressHash = HashCombineFast(AddressHash, NodeID.A);
AddressHash = HashCombineFast(AddressHash, ::GetTypeHash(OutputName));
AddressHash = HashCombineFast(AddressHash, GetTypeHashHelper(OutputName));
return AddressHash;
}
@@ -662,13 +662,13 @@ namespace Metasound
FFrontendQueryKey::FFrontendQueryKey(const FString& InKey)
: Key(TInPlaceType<FString>(), InKey)
, Hash(::GetTypeHash(InKey))
, Hash(GetTypeHash(InKey))
{
}
FFrontendQueryKey::FFrontendQueryKey(const FName& InKey)
: Key(TInPlaceType<FName>(), InKey)
, Hash(::GetTypeHash(InKey))
, Hash(GetTypeHash(InKey))
{
}
@@ -68,8 +68,8 @@ namespace Metasound
uint32 FSendAddress::GetHash() const
{
uint32 HashedChannel = HashCombineFast(::GetTypeHash(DataType), ::GetTypeHash(ChannelName));
HashedChannel = HashCombineFast(HashedChannel, ::GetTypeHash(InstanceID));
uint32 HashedChannel = HashCombineFast(GetTypeHashHelper(DataType), GetTypeHashHelper(ChannelName));
HashedChannel = HashCombineFast(HashedChannel, GetTypeHashHelper(InstanceID));
return HashedChannel;
}
@@ -98,7 +98,7 @@ namespace Metasound
FORCEINLINE friend uint32 GetTypeHash(const IMetaSoundAssetManager::FAssetInfo& InInfo)
{
return HashCombineFast(::GetTypeHash(InInfo.RegistryKey), GetTypeHash(InInfo.AssetPath));
return HashCombineFast(GetTypeHash(InInfo.RegistryKey), GetTypeHash(InInfo.AssetPath));
}
};
@@ -236,12 +236,12 @@ struct METASOUNDFRONTEND_API FMetasoundFrontendVersionNumber
{
return FString::Format(TEXT("v{0}.{1}"), { Major, Minor });
}
};
FORCEINLINE uint32 GetTypeHash(const FMetasoundFrontendVersionNumber& InNumber)
{
return HashCombineFast(GetTypeHash(InNumber.Major), GetTypeHash(InNumber.Minor));
}
friend FORCEINLINE uint32 GetTypeHash(const FMetasoundFrontendVersionNumber& InNumber)
{
return HashCombineFast(GetTypeHash(InNumber.Major), GetTypeHash(InNumber.Minor));
}
};
// General purpose version info for Metasound Frontend objects.
USTRUCT()
@@ -312,12 +312,12 @@ struct METASOUNDFRONTEND_API FMetasoundFrontendVersion
{
return InLHS == InRHS || InLHS < InRHS;
}
};
FORCEINLINE uint32 GetTypeHash(const FMetasoundFrontendVersion& InVersion)
{
return HashCombineFast(GetTypeHash(InVersion.Name), GetTypeHash(InVersion.Number));
}
friend FORCEINLINE uint32 GetTypeHash(const FMetasoundFrontendVersion& InVersion)
{
return HashCombineFast(GetTypeHash(InVersion.Name), GetTypeHash(InVersion.Number));
}
};
// An FMetasoundFrontendVertex provides a named connection point of a node.
USTRUCT()