mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-20 19:12:24 +00:00
change is_pod tp is_trivial (#21071)
### Description change is_pod tp is_trivial ### Motivation and Context This is commonnly needed for both linux and win c++20 upgrade. is_trivial was introduced backed in C++11
This commit is contained in:
parent
be423747b1
commit
8448f31d90
3 changed files with 14 additions and 14 deletions
|
|
@ -33,10 +33,10 @@ struct CufftPlanInfo {
|
|||
// see https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
|
||||
template <typename T>
|
||||
struct ParamsHash {
|
||||
// Params must be a POD because we read out its memory
|
||||
// contenst as char* when hashing
|
||||
// Params must be a trivial type because we read out its memory
|
||||
// contents as char* when hashing
|
||||
|
||||
static_assert(std::is_pod<T>::value, "Params is not POD");
|
||||
static_assert(std::is_trivial<T>::value, "Params is not a trivial type");
|
||||
size_t operator()(const T& params) const {
|
||||
auto ptr = reinterpret_cast<const uint8_t*>(¶ms);
|
||||
uint32_t value = 0x811C9DC5;
|
||||
|
|
@ -50,10 +50,10 @@ struct ParamsHash {
|
|||
|
||||
template <typename T>
|
||||
struct ParamsEqual {
|
||||
// Params must be a POD because we read out its memory
|
||||
// contenst as char* when comparing
|
||||
// Params must be a trivial type because we read out its memory
|
||||
// contents as char* when comparing
|
||||
|
||||
static_assert(std::is_pod<T>::value, "Params is not POD");
|
||||
static_assert(std::is_trivial<T>::value, "Params is not a trivial type");
|
||||
|
||||
bool operator()(const T& a, const T& b) const {
|
||||
auto ptr1 = reinterpret_cast<const uint8_t*>(&a);
|
||||
|
|
|
|||
|
|
@ -54,15 +54,15 @@ struct ConvArgs {
|
|||
};
|
||||
|
||||
struct ConvParamsHash {
|
||||
// ConvParams must be a POD because we read out its memory constant as char* when hashing.
|
||||
static_assert(std::is_pod<ConvParams>::value, "ConvParams is not POD");
|
||||
// ConvParams must be a trivial type because we read out its memory contents as char* when hashing.
|
||||
static_assert(std::is_trivial<ConvParams>::value, "ConvParams is not a trivial type");
|
||||
|
||||
size_t operator()(const ConvParams& conv_params) const;
|
||||
};
|
||||
|
||||
struct ConvParamsEqual {
|
||||
// ConvParams must be a POD because we read out its memory constant as char* when hashing.
|
||||
static_assert(std::is_pod<ConvParams>::value, "ConvParams is not POD");
|
||||
// ConvParams must be a trivial type because we read out its memory contents as char* when hashing.
|
||||
static_assert(std::is_trivial<ConvParams>::value, "ConvParams is not a trivial type");
|
||||
|
||||
bool operator()(const ConvParams& a, const ConvParams& b) const;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ std::vector<T_Perf> GetValidAlgorithms(const T_Perf* perf_results, int n_algo) {
|
|||
}
|
||||
|
||||
struct ConvParamsHash {
|
||||
// ConvParams must be a POD because we read out its memory constant as char* when hashing.
|
||||
static_assert(std::is_pod<ConvParams>::value, "ConvParams is not POD");
|
||||
// ConvParams must be a trivial type because we read out its memory contents as char* when hashing.
|
||||
static_assert(std::is_trivial<ConvParams>::value, "ConvParams is not a trivial type");
|
||||
size_t operator()(const ConvParams& conv_params) const {
|
||||
auto ptr = reinterpret_cast<const uint8_t*>(&conv_params);
|
||||
uint32_t value = 0x811C9DC5;
|
||||
|
|
@ -85,8 +85,8 @@ struct ConvParamsHash {
|
|||
};
|
||||
|
||||
struct ConvParamsEqual {
|
||||
// ConvParams must be a POD because we read out its memory constant as char* when hashing.
|
||||
static_assert(std::is_pod<ConvParams>::value, "ConvParams is not POD");
|
||||
// ConvParams must be a trivial type because we read out its memory contents as char* when hashing.
|
||||
static_assert(std::is_trivial<ConvParams>::value, "ConvParams is not a trivial type");
|
||||
bool operator()(const ConvParams& a, const ConvParams& b) const {
|
||||
auto ptr1 = reinterpret_cast<const uint8_t*>(&a);
|
||||
auto ptr2 = reinterpret_cast<const uint8_t*>(&b);
|
||||
|
|
|
|||
Loading…
Reference in a new issue