Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(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\'");
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict