SHARE
TWEET

Untitled

a guest Jun 19th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mapping(address => MyStruct[]) public structs;
  2.      
  3. structs[_user].length = 0; // will trigger an error !
  4.      
  5. function _burn(uint index) internal {
  6.  
  7.   require(index < array.length);
  8.  
  9.   array[index] = array[array.length-1];
  10.   delete array[array.length-1];
  11.  
  12.   // when array.length is set to 0 it doesn't work:
  13.  
  14.   array.length = array.length - 1; // doesn't work if array.length = 1
  15.  
  16.   array.length = 0;  // doesn't work
  17.  
  18.   // when array.length is set to a value > 0 it works:
  19.  
  20.   array.length = 1;  // works
  21.  
  22.   array.length = 2; //  works
  23.  
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top