Use std::is_sorted and std::none_of instead of manual loops. NFC