I see that TCollection has an AssertClass member function to assert that all objects derive from some specific class. Good!
From looking at the implementation, it iterates over all elements. For the generic case, this is fine!
If I have a TClonesArray, then it should be possible to do this more efficient, right?
Purpose: Basically to assert (as in: check for programming error) in a library that a passed in TCloneArray actually has a class derived from some expected one. Especially to later on perform an efficient static_cast.
If it is an assert that is run in debug mode then I would still do the full check. If it is an on-all-the-time check then indeed the simpler check should be enough.