I'm working on a basic DFS algorithm for my oriented graph in c++.
What i got, is a class Vertex which have a char value and a list of adjacence.
Given that, i'm trying to sort a list of object (in my case vertex, but let's say something else) by its value.
My class is something like that:
class Foo {
private:
char x;
list<Foo*> listOfChildrenObject;
};
let's say we got 5 Foo's object.
A,B,C,D,E
now, A is the father of every object in my program.
let's say i've inserted them in this way:
A (the father), D, C, B, E
and then, i want to print them in order:
A,B,C,D,E
and for that, i want to use listOfChildrenObject.sort() to do that.
there's a way to sort my list of object by the char value?