News for hackers. Stuff that matters.
Re:Why should I have written ZeroMQ in C, not C++ (2012) by cesarb on Thursday May 21, 2015 @09:49AM (#9582704)
> The primary technique is to embed the type that is iterated over in a larger struct which contains the links. This way I can give out references to the inner type without fear of invalidating the iterator.

I see. I was too fixated in embedding a small struct with the links within the larger struct (in the style of the Linux kernel "struct list_head"), and didn't think of doing the opposite.

It probably makes being in several intrusive structs at the same time much more complicated, but I think it's possible to do without breaking anything.

There are no comments on this comment yet.