ADD: Functionality to support functors passed as template argument to the segment tree