Skip to content

avoid childBegin()/childEnd()

Gerhard Raven requested to merge cleanup-olddet into master

avoid jumping through two layers of virtual functions twice, i.e. childBegin, which just calls childIDetectorElements().begin() -- so just cut out the middle layer, and get the range of children with one call, i.e. reduce the number of virtual function calls by a factor of 4, and as a bonus, make obvious that 'begin' and 'end' are guaranteed to point into the same range, i.e. that end is reachable from begin (which is not guaranteed if it takes two separate function calls to get them, as the range could have been modified in between the calls to childBegin() and childEnd() (yes, unlikely, but it is good to be paranoid in a multithreaded program, so prefer interfaces which return 'all' the information one needs with a single call as opposed to multiple independent calls)

Edited by Gerhard Raven

Merge request reports