Starting testing DisjointSets:

- Fix a couple compiler errors (private base class; missing consts)
- Fix a problem where the cache was being replaced when it shouldn't
  have been, which meant that 'sets.begin() != sets.begin()' was
  true (as the first one was into one backing set, and then the second
  call replaced that cache with a new one and returned an iterator
  into it)
Oh drat. This should have been committed rather a while ago.

Oh well, since the intermediate states are lost anyway, I'm not going to
go retrofit it into the Git history.
Add more tests

Along with this came a couple more fixes (const, basically) to DisjointSets.hpp,
but because I just added that a second ago anyway you don't really see those changes.
Sorry.