(C++) std::find\first\of
February 24, 2017 · View on GitHub
(C++) std::find_first_of
std::find_first_of is an STL algorithm similar to std::find, except that it finds a value from a collection of values.
#include <algorithm> #include <cassert> #include <string> int main() { const std::string vowels = "aeiouAEIOU"; const std::string s = "Bilderbikkel"; const std::string::const_iterator i = std::find_first_of(s.begin(),s.end(),vowels.begin(),vowels.end()); assert(*i == 'i' && "The first vowel in \'Bilderbikkel\' is an \'i\'"); }