From Jason Turner

[string.find]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmph8q6hk8j/{from.md → to.md} +46 -23
tmp/tmph8q6hk8j/{from.md → to.md} RENAMED
@@ -1,44 +1,67 @@
1
- ##### `basic_string::find` <a id="string.find">[[string.find]]</a>
2
 
 
 
 
 
3
  ``` cpp
4
- size_type find(basic_string_view<charT, traits> sv, size_type pos = 0) const noexcept;
5
  ```
6
 
7
- *Effects:* Determines the lowest position `xpos`, if possible, such that
8
- both of the following conditions hold:
9
-
10
- - `pos <= xpos` and `xpos + sv.size() <= size()`;
11
- - `traits::eq(at(xpos + I), sv.at(I))` for all elements `I` of the data
12
- referenced by `sv`.
13
-
14
- *Returns:* `xpos` if the function can determine such a value for `xpos`.
15
- Otherwise, returns `npos`.
16
-
17
  ``` cpp
18
- size_type find(const basic_string& str, size_type pos = 0) const noexcept;
19
  ```
20
 
21
- *Effects:* Equivalent to:
22
- `return find(basic_string_view<charT, traits>(str), pos);`
 
 
 
 
23
 
 
 
 
24
  ``` cpp
25
- size_type find(const charT* s, size_type pos, size_type n) const;
26
  ```
27
 
28
- *Returns:* `find(basic_string_view<charT, traits>(s, n), pos)`.
 
 
 
29
 
30
  ``` cpp
31
- size_type find(const charT* s, size_type pos = 0) const;
 
 
 
 
 
 
 
 
 
 
 
32
  ```
33
 
34
- *Requires:* `s` points to an array of at least `traits::length(s) + 1`
35
- elements of `charT`.
 
 
 
36
 
37
- *Returns:* `find(basic_string_view<charT, traits>(s), pos)`.
38
 
39
  ``` cpp
40
- size_type find(charT c, size_type pos = 0) const;
 
41
  ```
42
 
43
- *Returns:* `find(basic_string(1, c), pos)`.
 
44
 
 
1
+ ##### Searching <a id="string.find">[[string.find]]</a>
2
 
3
+ Let *F* be one of `find`, `rfind`, `find_first_of`, `find_last_of`,
4
+ `find_first_not_of`, and `find_last_not_of`.
5
+
6
+ - Each member function of the form
7
  ``` cpp
8
+ constexpr size_type F(const basic_string& str, size_type pos) const noexcept;
9
  ```
10
 
11
+ has effects equivalent to:
12
+ `return F(basic_string_view<charT, traits>(str), pos);`
13
+ - Each member function of the form
 
 
 
 
 
 
 
14
  ``` cpp
15
+ constexpr size_type F(const charT* s, size_type pos) const;
16
  ```
17
 
18
+ has effects equivalent to:
19
+ `return F(basic_string_view<charT, traits>(s), pos);`
20
+ - Each member function of the form
21
+ ``` cpp
22
+ constexpr size_type F(const charT* s, size_type pos, size_type n) const;
23
+ ```
24
 
25
+ has effects equivalent to:
26
+ `return F(basic_string_view<charT, traits>(s, n), pos);`
27
+ - Each member function of the form
28
  ``` cpp
29
+ constexpr size_type F(charT c, size_type pos) const noexcept;
30
  ```
31
 
32
+ has effects equivalent to:
33
+ ``` cpp
34
+ return F(basic_string_view<charT, traits>(addressof(c), 1), pos);
35
+ ```
36
 
37
  ``` cpp
38
+ template<class T>
39
+ constexpr size_type find(const T& t, size_type pos = 0) const noexcept(see below);
40
+ template<class T>
41
+ constexpr size_type rfind(const T& t, size_type pos = npos) const noexcept(see below);
42
+ template<class T>
43
+ constexpr size_type find_first_of(const T& t, size_type pos = 0) const noexcept(see below);
44
+ template<class T>
45
+ constexpr size_type find_last_of(const T& t, size_type pos = npos) const noexcept(see below);
46
+ template<class T>
47
+ constexpr size_type find_first_not_of(const T& t, size_type pos = 0) const noexcept(see below);
48
+ template<class T>
49
+ constexpr size_type find_last_not_of(const T& t, size_type pos = npos) const noexcept(see below);
50
  ```
51
 
52
+ *Constraints:*
53
+
54
+ - `is_convertible_v<const T&, basic_string_view<charT, traits>>` is
55
+ `true` and
56
+ - `is_convertible_v<const T&, const charT*>` is `false`.
57
 
58
+ *Effects:* Let *G* be the name of the function. Equivalent to:
59
 
60
  ``` cpp
61
+ basic_string_view<charT, traits> s = *this, sv = t;
62
+ return s.G(sv, pos);
63
  ```
64
 
65
+ *Remarks:* The expression inside `noexcept` is equivalent to
66
+ `is_nothrow_convertible_v<const T&, basic_string_view<charT, traits>>`.
67