solidity/test/libsolidity/syntaxTests/types/mapping/library_argument_storage.sol
2020-06-30 16:53:41 +05:30

14 lines
296 B
Solidity

library Set {
struct Data { mapping(uint => bool) flags; }
function insert(Data storage self, uint value)
public
returns (bool)
{
if (self.flags[value])
return false; // already there
self.flags[value] = true;
return true;
}
}