A generic bisection class for any function