Fix build error caused by nonconst reference in comparison lambda