Generally the idea in these cases is to have a data structure which is a tree consisting of trees and leaf nodes. Something like
struct TreeType
{
std::vector<TreeType> subtrees;
std::vector<LeafNodes> leafs;
}
This allows one to define a ==
operator along the lines of
bool TreeType::operator==(const TreeType& rhs) const
{
if each subtree == subtree && each leaf == leaf
then true
else false
}
Here the subtree
comparison will call the ==
operator recursively on the children trees.
EDIT: It would be handy if you provided the exact organization of your TreeType data structure to allow for a better/specific answer.