C++ Logo


Advanced search

Subject: Re: [std-proposals] std::any_of, std::all_of and std::none_of without predicate
From: Jake Arkinstall (jake.arkinstall_at_[hidden])
Date: 2019-12-15 09:55:04

I'll be all for this idea iff the value_type of the iterator passed to
these functions is verified to be precisely of type bool, rather than the
looser "convertible to bool" requirement of the predicate return type in
the current function definitions, following the principle of least

Consider a container holding elements of type T, where T is convertible to
bool. I use std::any_of over that container and accidently miss out the
predicate, which is intended as, say, a bounds check. Without warning or
error, my code compiles and I get unwanted results.

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups