mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
26 lines
701 B
Solidity
26 lines
701 B
Solidity
contract CopyTest {
|
|
struct Tree {
|
|
Tree[] children;
|
|
}
|
|
|
|
Tree storageTree;
|
|
Tree[] children;
|
|
|
|
constructor() public {
|
|
for (uint i = 0; i < 2; i++)
|
|
storageTree.children.push();
|
|
for (uint i = 0; i < 23; i++)
|
|
storageTree.children[0].children.push();
|
|
for (uint i = 0; i < 42; i++)
|
|
storageTree.children[1].children.push();
|
|
}
|
|
|
|
function run() public returns (uint256, uint256, uint256) {
|
|
Tree memory memoryTree;
|
|
memoryTree = storageTree;
|
|
return (memoryTree.children.length, memoryTree.children[0].children.length, memoryTree.children[1].children.length);
|
|
}
|
|
}
|
|
// ----
|
|
// run() -> 2, 23, 42
|