20 Strings library [strings]

20.3 String classes [string.classes]

20.3.2 Class template basic_­string [basic.string] String operations [string.ops] basic_­string​::​find_­first_­of [string.find.first.of]

template<class T> size_type find_first_of(const T& t, size_type pos = 0) const;
Effects: Creates a variable, sv, as if by basic_­string_­view<charT, traits> sv = t; and then determines the lowest position xpos, if possible, such that both of the following conditions hold:
  • pos <= xpos and xpos < size();
  • traits::eq(at(xpos), sv.at(I)) for some element I of the data referenced by sv.
Returns: xpos if the function can determine such a value for xpos.
Otherwise, returns npos.
Remarks: This function shall not participate in overload resolution unless is_­convertible_­v<const T&, basic_­string_­view<charT, traits>> is true and is_­convertible_­v<const T&, const charT*> is false.
Throws: Nothing unless the initialization of sv throws an exception.
size_type find_first_of(const basic_string& str, size_type pos = 0) const noexcept;
Effects: Equivalent to: return find_­first_­of(basic_­string_­view<charT, traits>(str), pos);
size_type find_first_of(const charT* s, size_type pos, size_type n) const;
Returns: find_­first_­of(basic_­string_­view<charT, traits>(s, n), pos).
size_type find_first_of(const charT* s, size_type pos = 0) const;
Requires: s points to an array of at least traits::length(s) + 1 elements of charT.
Returns: find_­first_­of(basic_­string_­view<charT, traits>(s), pos).
size_type find_first_of(charT c, size_type pos = 0) const;
Returns: find_­first_­of(basic_­string(1, c), pos).