Adding const and mutable to has_task function.