pragma solidity ^0.4.8;
library Library {
struct data {
unit val;
}
}
contract Array{
using Library for Library.data;
mapping(address => Library.data) clusterContract;
function addCluster(address id) returns(bool){
if (clusterContract[id] == address(0)) { // error occurs!
clusterContract[id] = list;
return true;
}
return false;
}
}
Following comparission if (clusterContract[id] == address(0)) gives the following error:
Operator == not compatible with types struct Library.data storage ref and address
E if(clusterContract[id] == address(0)) {...
How could I fix this error?
// insert thisI have to putclusterContract[id].isValue=trueso when same id is provided on the next function call, it will enter intothrow; right? And thank you for the the design patterns I will work on them. @RobHitchens. – alper Mar 13 '17 at 16:06creates a namespace in which all possible keys exist, and values are initialized to 0/false. What are the memory implications of this? Does it dynamically instantiate a struct when I try to access it? – Olshansky Jul 31 '17 at 00:30