Previously, collecting CFGElements in a set was practially impossible, because both CFGBlock::operator[] and both the iterators returned it by value. One workaround would be to collect the iterators instead, but they don't really capture the concept of an element, and elements from different iterator types are incomparable.
This patch introduces CFGElementRef, a wrapper around a (CFGBlock, Index) pair, and a variety of new iterators and iterator ranges to solve this problem.
I guess you could say that this patch took a couple iterations to get right :^)
Yeah, kinda shocking that you needed to go that far >.<
I suggest CFGElementRefBase or CFGElementRefImpl or something like that, because otherwise it looks to me as if it's some sort of a generic reference to an element of arbitrary collection.