Damus
Andrew Zonenberg profile picture
Andrew Zonenberg
@Andrew Zonenberg
Is there a name for a design paradigm where a class has a static "list of all objects of my own type" member, inserted by the constructor and removed by the destructor, and you can iterate over them for $REASONS?
4
Graham Sutherland / Polynomial · 7w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqqv5atqz9k9c54q8c28kra6sfata0wk7w7x5gkrnde8vmxe5gt00q8mmv7s self-registering inventory?
Marcus Müller · 7w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqqv5atqz9k9c54q8c28kra6sfata0wk7w7x5gkrnde8vmxe5gt00q8mmv7s that's a registry, and be careful of the *static initialization order fiasco* if this is C++
Ken Milmore · 7w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqqv5atqz9k9c54q8c28kra6sfata0wk7w7x5gkrnde8vmxe5gt00q8mmv7s If it's C++ then a member can't be both static and set up by the constructor of the class it's in. I'm sure you know this but I'm just being pedantic. We use that pattern a lot though, s...
Ignas Kiela · 7w
nostr:nprofile1qy2hwumn8ghj7un9d3shjtnyd968gmewwp6kyqpqqv5atqz9k9c54q8c28kra6sfata0wk7w7x5gkrnde8vmxe5gt00q8mmv7s I know Factorio uses this a bunch and calls them implicit linked lists (because each object has a next/prev pointers to each other)