Implemented TBB function for sort_by_key