Вам нужно явно определить operator ==
для MyStruct1
.
struct MyStruct1 {
bool operator == (const MyStruct1 &rhs) const
{ /* your logic for comparision between "*this" and "rhs" */ }
};
Теперь сравнение == законно для 2 таких объектов.
Это сделало задание для меня:
import numpy as np
import h5py
def conv(obj):
ret = {}
for k, v in obj.items():
if hasattr(v, "items"):
# Nested dicts
ret[k] = conv(v)
elif hasattr(v, "shape"):
# Arrays a Numpy arrays
ret[k] = np.array(v)
else:
# I haven't seen other types, but just in case:
ret[k] = v
return ret
with h5py.File('e1_eegmodel.mat', 'r') as f:
eegmodel = conv(f)