To me, the proposed version(PhobosUnitTests) hack looks good for the particular case. But I don't see whether such trick scales well for the whole ecosystem of libraries.
Another approach that might work specifically for containers is to pass as an additional template parameter whether the particular RedBlackTree must continuously check its integrity or not. That way, the parameter can be explicitly set to "doCheck" from the unittest instantiations, default to "doNotCheck" for other code, and be enabled on a case-by-case basis when debugging.
Again, I don't see whether it fits the larger picture, but still think it's worth to consider.
Ivan Kazmenko.
