Skip to content

Commit ab9231e

Browse files
committed
Merge 2020-11 LWG Motion 4
2 parents ee5b56a + 4a8bb0f commit ab9231e

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

source/strings.tex

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,6 +1046,10 @@
10461046
constexpr bool ends_with(basic_string_view<charT, traits> x) const noexcept;
10471047
constexpr bool ends_with(charT x) const noexcept;
10481048
constexpr bool ends_with(const charT* x) const;
1049+
1050+
constexpr bool contains(basic_string_view<charT, traits> x) const noexcept;
1051+
constexpr bool contains(charT x) const noexcept;
1052+
constexpr bool contains(const charT* x) const;
10491053
};
10501054

10511055
template<class InputIterator,
@@ -3222,6 +3226,24 @@
32223226
\end{codeblock}
32233227
\end{itemdescr}
32243228

3229+
\rSec4[string.contains]{\tcode{basic_string::contains}}
3230+
3231+
\indexlibrarymember{contains}{basic_string}%
3232+
\begin{itemdecl}
3233+
constexpr bool contains(basic_string_view<charT, traits> x) const noexcept;
3234+
constexpr bool contains(charT x) const noexcept;
3235+
constexpr bool contains(const charT* x) const;
3236+
\end{itemdecl}
3237+
3238+
\begin{itemdescr}
3239+
\pnum
3240+
\effects
3241+
Equivalent to:
3242+
\begin{codeblock}
3243+
return basic_string_view<charT, traits>(data(), size()).contains(x);
3244+
\end{codeblock}
3245+
\end{itemdescr}
3246+
32253247
\rSec2[string.nonmembers]{Non-member functions}
32263248

32273249
\indexlibraryglobal{basic_string}
@@ -4117,6 +4139,10 @@
41174139
constexpr bool ends_with(charT x) const noexcept;
41184140
constexpr bool ends_with(const charT* x) const;
41194141

4142+
constexpr bool contains(basic_string_view x) const noexcept;
4143+
constexpr bool contains(charT x) const noexcept;
4144+
constexpr bool contains(const charT* x) const;
4145+
41204146
// \ref{string.view.find}, searching
41214147
constexpr size_type find(basic_string_view s, size_type pos = 0) const noexcept;
41224148
constexpr size_type find(charT c, size_type pos = 0) const noexcept;
@@ -4717,6 +4743,19 @@
47174743
Equivalent to: \tcode{return ends_with(basic_string_view(x));}
47184744
\end{itemdescr}
47194745

4746+
\indexlibrarymember{contains}{basic_string_view}%
4747+
\begin{itemdecl}
4748+
constexpr bool contains(basic_string_view x) const noexcept;
4749+
constexpr bool contains(charT x) const noexcept;
4750+
constexpr bool contains(const charT* x) const;
4751+
\end{itemdecl}
4752+
4753+
\begin{itemdescr}
4754+
\pnum
4755+
\effects
4756+
Equivalent to: \tcode{return find(x) != npos;}
4757+
\end{itemdescr}
4758+
47204759
\rSec3[string.view.find]{Searching}
47214760

47224761
\pnum

source/support.tex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -673,6 +673,7 @@
673673
#define @\defnlibxname{cpp_lib_span}@ 202002L // also in \libheader{span}
674674
#define @\defnlibxname{cpp_lib_ssize}@ 201902L // also in \libheader{iterator}
675675
#define @\defnlibxname{cpp_lib_starts_ends_with}@ 201711L // also in \libheader{string}, \libheader{string_view}
676+
#define @\defnlibxname{cpp_lib_string_contains}@ 202011L // also in \libheader{string}, \libheader{string_view}
676677
#define @\defnlibxname{cpp_lib_string_udls}@ 201304L // also in \libheader{string}
677678
#define @\defnlibxname{cpp_lib_string_view}@ 201803L // also in \libheader{string}, \libheader{string_view}
678679
#define @\defnlibxname{cpp_lib_syncbuf}@ 201803L // also in \libheader{syncstream}

0 commit comments

Comments
 (0)