@@ -19,8 +19,8 @@ namespace framework {
19
19
20
20
struct DataTypeMap {
21
21
std::unordered_map<std::type_index, proto::VarType::Type> cpp_to_proto_;
22
- std::unordered_map<proto::VarType::Type , std::type_index> proto_to_cpp_;
23
- std::unordered_map<proto::VarType::Type , std::string> proto_to_str_;
22
+ std::unordered_map<int , std::type_index> proto_to_cpp_;
23
+ std::unordered_map<int , std::string> proto_to_str_;
24
24
std::unordered_map<std::type_index, size_t > cpp_to_size_;
25
25
};
26
26
@@ -29,9 +29,10 @@ static DataTypeMap g_data_type_map_;
29
29
template <typename T>
30
30
static inline void RegisterType (proto::VarType::Type proto_type,
31
31
const std::string &name) {
32
- g_data_type_map_.proto_to_cpp_ .emplace (proto_type, typeid (T));
32
+ g_data_type_map_.proto_to_cpp_ .emplace (static_cast <int >(proto_type),
33
+ typeid (T));
33
34
g_data_type_map_.cpp_to_proto_ .emplace (typeid (T), proto_type);
34
- g_data_type_map_.proto_to_str_ .emplace (proto_type, name);
35
+ g_data_type_map_.proto_to_str_ .emplace (static_cast < int >( proto_type) , name);
35
36
g_data_type_map_.cpp_to_size_ .emplace (typeid (T), sizeof (T));
36
37
}
37
38
@@ -63,7 +64,7 @@ proto::VarType::Type ToDataType(std::type_index type) {
63
64
64
65
std::type_index ToTypeIndex (proto::VarType::Type type) {
65
66
std::call_once (register_once_flag_, RegisterAllTypes);
66
- auto it = g_data_type_map_.proto_to_cpp_ .find (type);
67
+ auto it = g_data_type_map_.proto_to_cpp_ .find (static_cast < int >( type) );
67
68
if (it != g_data_type_map_.proto_to_cpp_ .end ()) {
68
69
return it->second ;
69
70
}
@@ -73,7 +74,7 @@ std::type_index ToTypeIndex(proto::VarType::Type type) {
73
74
74
75
std::string DataTypeToString (const proto::VarType::Type type) {
75
76
std::call_once (register_once_flag_, RegisterAllTypes);
76
- auto it = g_data_type_map_.proto_to_str_ .find (type);
77
+ auto it = g_data_type_map_.proto_to_str_ .find (static_cast < int >( type) );
77
78
if (it != g_data_type_map_.proto_to_str_ .end ()) {
78
79
return it->second ;
79
80
}
0 commit comments