#include <iostream> // std::cout #include <algorithm> // std::find_first_of #include <vector> // std::vector #include <cctype> // std::tolower using namespace std; bool comp_case_insensitive (char c1, char c2) { return (tolower(c1)==tolower(c2)); } int main () { int mychars[] = {'a','b','c','A','B','C'}; vector<char> haystack (mychars,mychars+6); vector<char>::iterator it; int needle[] = {'C'}; // using default comparison: it = find_first_of (haystack.begin(), haystack.end(), needle, needle+3); cout << "The first match is: " << *it << ' '; if (it!=haystack.end()) cout << "The first match is: " << *it << ' '; // using predicate comparison: it = find_first_of (haystack.begin(), haystack.end(),needle, needle+3, comp_case_insensitive); cout << "The first match is: " << *it << ' '; if (it!=haystack.end()) cout << "The first match is: " << *it << ' '; return 0; }