Merge pull request #461 from ethereum/mappingStructDocumentation

Inner struct mapping copy into a mapping question
This commit is contained in:
chriseth 2016-03-31 13:08:51 +02:00
commit 4d200e3ee6

View File

@ -666,6 +666,23 @@ gas and return your 20 Wei).
In the above example, the low-level function `call` is used to invoke another
contract with `p.data` as payload and `p.amount` Wei is sent with that call.
What happens to a struct's mapping when copying over a struct?
==============================================================
This is a very interesting question. Suppose that we have a contract field set up like such::
struct user{
mapping(string => address) usedContracts;
}
function somefunction{
user user1;
user1.usedContracts["Hello"] = "World";
user user2 = user1;
}
In this case, the mapping of the struct being copied over into the userList is ignored as there is no "list of mapped keys".
Therefore it is not possible to find out which values should be copied over.
How do I initialize a contract with only a specific amount of wei?
==================================================================