'remix failed to create a library
i tried to test how to make a library and how to use it for a contract,but the remix-ide told me
creation of Set errored: Error: invalid type (arg="type", value="Set.Data storage", version=4.0.47)
My code is here
pragma solidity ^0.4.18;
library Set {
struct Data {
mapping (uint=>bool) flags;
}
function insert(Data storage self, uint value) returns(bool) {
if(self.flags[value]){
return false;
}else{
self.flags[value] = true;
return true;
}
}
function remove(Data storage self, uint value) returns(bool){
if(!self.flags[value]){
return true;
}else{
self.flags[value] = false;
}
}
function contains(Data storage self, uint value) returns(bool) {
return self.flags[value];
}
}
contract useSet {
using Set for Set.Data;
Set.Data data;
function insert(uint value) public returns(bool){
return data.insert(value);
}
}
How to solve this problem? Thanks for your answer.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
