Simple implementation of DisjointSets data structure in C++