In any language, I would write following:
struct Node {
void* data;
Node* next;
}
...
head.next = new Node(data, null)
But it seems that solidity doesn't have a concept of pointers.
How could it be done here?
EDIT The answer at the end of Are there well-solved and simple storage patterns for Solidity? is not enough for me as I also need to insert nodes to the middle.
1>Dynamic exception type: class boost::exception_detail::clone_impl<struct dev::solidity::UnimplementedFeatureError> 1>std::exception::what: Copying of type struct Season.StatusUpdate memory[] memory to storage not yet supported– Alex Zhukovskiy Jun 13 '18 at 18:31nodes.length++and then writing directly into new storage. It seems that it's a common way to do such a thing in Solidity. Thank you for your post, it was really priceless. – Alex Zhukovskiy Jun 13 '18 at 19:12