any_of() Function in C++ STL Last Updated : 24 Aug, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report any_of() is the C++ function defined in <algorithm> library in STL. This function determines whether even one element in a given range satisfies a specified criterion. If at least one element meets the property, then it returns true; otherwise, it returns false. Also if the range is empty then this function returns false. any_of() function takes 3 arguments, the first element, the last element, and a function condition_function. Function Template: template <class InputIterator, class UnaryPredicate> bool any_of (InputIterator start_limit, InputIterator end_limit, UnaryPredicate condition_function); Parameters: start_limit - It is the first element in the range specified. end_limit - It is the last element in the range. condition_function - It is a function which accepts the argument from the range. Time Complexity: O(n)Auxiliary Space: O(1) Example: C++ // C++ Program to demonstrate // working of any_of() #include <algorithm> #include <iostream> using namespace std; int main() { // Initializing the array int ar[6] = { 2, 6, 7, 10, 8, 4 }; // Checking if any odd number is // present or not in the array if (any_of(ar, ar + 6, [](int x) { return x % 2 != 0; })) { cout << "There exists odd number in the array"; } else { cout << "No odd number found in the array"; } return 0; } OutputThere exists odd number in the array Comment More infoAdvertise with us Next Article strol() function in C++ P pushpeshrajdx01 Follow Improve Article Tags : Technical Scripter C++ Technical Scripter 2022 STL cpp-algorithm-library +1 More Practice Tags : CPPSTL Similar Reads array at() function in C++ STL The array::at() is a built-in function in C++ STL which returns a reference to the element present at location i in given array. Syntax: array_name.at(i) Parameters: The function accepts a single mandatory parameter i which specifies the location. Return value: The function returns an element presen 2 min read strol() function in C++ The strtol() function in C++ interprets the contents of a string as an integral number of the specified base and return its value as a long int.This function also sets an end pointer that points to the first character after the last valid numeric character of the string, if there is no such characte 3 min read array get() function in C++ STL The array::get() is a built-in function in C++ STL which returns a reference to the i-th element of the array container. Syntax: get(array_name) Parameters: The function accepts two mandatory parameters which are described below. i - position of an element in the array, with 0 as the position of the 2 min read std::function in C++ The std::function() in C++ is a function wrapper class which can store and call any function or a callable object. In this article, we will learn about std::function in C++ and how to use it in different cases.Table of ContentWhat is std::function in C++?Example of std::functionMember Functions of s 5 min read strtol() function in C++ STL The strtol() function is a builtin function in C++ STL which converts the contents of a string as an integral number of the specified base and return its value as a long int. Syntax: strtol(s, &end, b) Parameters: The function accepts three mandatory parameters which are described as below: s: s 4 min read set::count() Function in C++ STL The std::set::count() is a built-in function in C++ STL which is used to count the number of times an element occurs in the set container. std::set container stores unique elements, so it can only return 1 or 0. Therefore, it is only used for checking if the element exists in the set or not.ExampleC 3 min read Like