C++ Algorithm Functions none_of()Last Updated : 17 Mar 2025 C++ Algorithm none_of() function returns a true value if the value of 'pred' argument is false. The value should be false for all elements in the range [first, last). SyntaxParameterfirst : It specifies the first element in the list. last: It specifies the last element in the list. pred: It is an unary function which accepts the argument from the range. Return valueThe function has one return type, 'true'. If the value of argument 'pred' is false for all the elements of the range then the value 'true' is returned, else false. Example 1Output: None of the elements is divisible by 2 Example 2Output: Array 2 4 6 8 12None of the elements in the range are negative ComplexityThe function moves in a linear way, starting from the first element going towards the last one. For each element of the list value of 'pred' is checked. The search goes on until a mismatch for the 'pred' value is encountered. Data racesEither all the objects in the specified range or some of them are accessed by the function. ExceptionsThe function throws an exception if any of the argument throws one. Next TopicC++ Algorithm search_n Function |
We request you to subscribe our newsletter for upcoming updates.

We deliver comprehensive tutorials, interview question-answers, MCQs, study materials on leading programming languages and web technologies like Data Science, MEAN/MERN full stack development, Python, Java, C++, C, HTML, React, Angular, PHP and much more to support your learning and career growth.
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India