add some performance optimizations by utilizing MoveTemp in return statements

This commit is contained in:
Mamadou Babaei
2024-03-12 20:31:32 +01:00
parent 6a5f200ee8
commit 6eaac124ce
5 changed files with 38 additions and 38 deletions
@@ -84,8 +84,8 @@ void FSGDeviceImpl::ParseFirmware(const FString& RawFirmware, int32& OutMainVers
FString FSGDeviceImpl::ToString(ESGDeviceType DeviceType)
{
const FString String{UTF8_TO_TCHAR(FSGDeviceType::ToString(FSGCoreEnumCast::ToEDeviceType(DeviceType)).c_str())};
return String;
FString String{UTF8_TO_TCHAR(FSGDeviceType::ToString(FSGCoreEnumCast::ToEDeviceType(DeviceType)).c_str())};
return MoveTemp(String);
}
FSGDeviceImpl::FSGDeviceImpl()
@@ -192,14 +192,14 @@ int32 FSGDeviceImpl::GetSubFirmwareVersion() const
FString FSGDeviceImpl::GetFirmwareString() const
{
const FString String{UTF8_TO_TCHAR(ToSGDevicePtrChecked()->GetFirmwareString().c_str())};
return String;
FString String{UTF8_TO_TCHAR(ToSGDevicePtrChecked()->GetFirmwareString().c_str())};
return MoveTemp(String);
}
FString FSGDeviceImpl::GetAddress() const
{
const FString String(UTF8_TO_TCHAR(ToSGDevicePtrChecked()->GetAddress().c_str()));
return String;
FString String(UTF8_TO_TCHAR(ToSGDevicePtrChecked()->GetAddress().c_str()));
return MoveTemp(String);
}
bool FSGDeviceImpl::IsConnected() const
@@ -254,8 +254,8 @@ bool FSGDeviceImpl::GetBatteryLevel(float& OutLevel)
FString FSGDeviceImpl::ToString() const
{
const FString String(UTF8_TO_TCHAR(ToSGDevicePtrChecked()->ToString().c_str()));
return String;
FString String(UTF8_TO_TCHAR(ToSGDevicePtrChecked()->ToString().c_str()));
return MoveTemp(String);
}
FSGDeviceImpl::FImpl::FImpl(FSGDeviceImpl* InOwner)