Updated OperatorUtility to avoid C2672 and C2783 (#9651)

Updated OperatorUtility to avoid compiler error errors C2672 and C2783.

- Error C2672: 'TryMapStringToIndex': no matching overloaded function found
- Error C2783: 'std::optional<_Ty> Dml::TryMapStringToIndex(std::string_view,gsl::span<const Dml::NameAndIndex>)': could not deduce template argument for 'T'. note: see declaration of 'Dml::TryMapStringToIndex'. 'TryMapStringToIndex': function declaration must be available as none of the arguments depend on a template parameter
This commit is contained in:
Ginés Hidalgo 2021-11-04 17:04:32 -04:00 committed by GitHub
parent 1128bf282d
commit 2fb03769bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,6 +70,8 @@ namespace Dml
uint32_t index;
};
std::optional<uint32_t> TryMapStringToIndex(std::string_view mode, gsl::span<const NameAndIndex> nameAndIndexList);
template<typename T>
std::optional<T> TryMapStringToIndex(std::string_view mode, gsl::span<const NameAndIndex> nameAndIndexList)
{
@ -78,10 +80,8 @@ namespace Dml
return *reinterpret_cast<std::optional<T>*>(std::addressof(result));
}
std::optional<uint32_t> TryMapStringToIndex(std::string_view mode, gsl::span<const NameAndIndex> nameAndIndexList);
DML_INTERPOLATION_MODE MapStringToInteropolationMode(std::string_view mode);
DML_DEPTH_SPACE_ORDER MapStringToDepthSpaceMode(std::string_view mode);
} // namespace Dml
} // namespace Dml