參考這個頁面
https://www.jianshu.com/p/0e7939d792d1
在一個結構體內寫了構造函數後
從:
struct aa
{
int a;
int b;
}
修改爲:
struct aa
{
int a;
int b;
aa()
{
a = 0;
b = 0;
}
}
後
再用
struct aa test1;
memset(&test1,0,sizeof(struct aa));
kw就會報錯,在一個non-pod對象上使用了memset