|
|
|
|
|
by ambrop7
4199 days ago
|
|
Well I don't want to get into a flame-war regarding intrusive/containing or C/C++, but I will say that type safety and intrusive/container are orthogonal things. One can have a type-unsafe container as well as a type-safe (generic!) intrusive structure. See my code for proof :) I think we'll agree that it's not too complicated and easy to use. Implementation: https://github.com/ambrop72/aprinter/blob/master/aprinter/st... Usage: https://github.com/ambrop72/aprinter/blob/master/aprinter/sy... (the BusyEventLoop keep track of QueuedEvent objects). If you wonder what's the purpose of the Accessor, it's for when you can't use the simple member-pointer based interface due to C++'s eager evaluation, and can hack around it with forward declaration of a custom Accessor class, followed by the complete definition later. I think Boost intrusive structures are type safe too, but I'm not 100% sure. But Boost is another matter altogether. |
|