Since memory is already allocated on (array[0] = value;
), I just want to change its pointing key value. Such as array[1]
will allow me to access value
now.
Is it possible to change the key of already mapped memory?
mapping(uint => uint) array;
uint value = 10;
array[0] = value; //memory is allocated, pointed by [0].
array[1] = array[0]'s_address; //I do want [1] to point same memory location as [0] without creating new memory space.
//or
uint value_addr;
assembly { value_addr := value }
array[1] -> value_addr; //if possible, at this stage array[1] should also point to the value's memory space.
array[0] -> NULL; //`array[0]` should point empty memory space.
As a result, when I make a change on array[1]
it should also make change on the array[0]
.
Thank you for your valuable time and help.