1、测试代码如下:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
contract Test {
struct Test {
uint256 a;
mapping(uint256 => uint256) b;
}
Test public test; //slot 0
constructor() {
test.a = 3;
test.b[1] = 0x1111111;
}
function delTest() external {
delete test;
//test.a = 4;
//test.b[1] = 0x55555;
}
}
结论:mappping 中的value 还存在
有兴趣的可以在尝试下,如果继续 之前已经删除的位置,添加值会是什么情况?