Sorting elements in parent->child order

Ok, so I’m really struggeling to find a good solution to this (presumably) simple problem:

Given a class of objects, where each object can have one parent, and each parent can have multiple childs:

class Object
public: bool IsBaseOf(const Object& child) const noexcept;
private: Object* m_pBase;

How would I sort an array of X “objects” in an order, where the base-classes always come before their respective childs? I tried simply using t

Published by CelleSports

CelleSports is a Game development, News outlet, and Social Cell community. Build your cells or teams for any game and start communicating efficiently. Join us in building the number one eSport and gaming community in the World. Join Cell eSports

Leave a comment