## find_first_of
## Prototype
template <class InputIterator, class ForwardIterator> InputIterator find_first_of(InputIterator first1, InputIterator last1, ForwardIterator first2, ForwardIterator last2); template <class InputIterator, class ForwardIterator, class BinaryPredicate> InputIterator find_first_of(InputIterator first1, InputIterator last1, ForwardIterator first2, ForwardIterator last2, BinaryPredicate comp); ## Description
The two versions of ## DefinitionDefined in the standard header algorithm, and in the nonstandard backward-compatibility header algo.h. ## Requirements on typesFor the first version: -
`InputIterator` is a model of InputIterator. -
`ForwardIterator` is a model of ForwardIterator. -
`InputIterator` 's value type is EqualityComparable, and can be compared for equality with ForwardIterator's value type.
For the second version: -
`InputIterator` is a model of InputIterator. -
`ForwardIterator` is a model of ForwardIterator. -
`BinaryPredicate` is a model of BinaryPredicate. -
`InputIterator` 's value type is convertible to`BinaryPredicate` 's first argument type. -
`ForwardIterator` 's value type is convertible to`BinaryPredicate` 's second argument type.
## Preconditions-
`[first1, last1)` is a valid range. -
`[first2, last2)` is a valid range.
## ComplexityAt most ## ExampleLike int main() { const char* WS = "\t\n "; const int n_WS = strlen(WS); char* s1 = "This sentence contains five words."; char* s2 = "OneWord"; char* end1 = find_first_of(s1, s1 + strlen(s1), WS, WS + n_WS); char* end2 = find_first_of(s2, s2 + strlen(s2), WS, WS + n_WS); printf("First word of s1: %.*s\n", end1 - s1, s1); printf("First word of s2: %.*s\n", end2 - s2, s2); } ## Notes## See also |