Skip to content

Commit c4a5c01

Browse files
committed
[libc++][NFC] Forward string observer functions when appropriate
1 parent 6049289 commit c4a5c01

File tree

1 file changed

+18
-33
lines changed

1 file changed

+18
-33
lines changed

libcxx/include/string

Lines changed: 18 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,14 +1815,14 @@ public:
18151815

18161816
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18171817
find(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
1818-
return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __str.data(), __pos, __str.size());
1818+
return find(__str.data(), __str.size(), __pos);
18191819
}
18201820

18211821
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
18221822
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18231823
find(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
18241824
__self_view __sv = __t;
1825-
return std::__str_find<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
1825+
return find(__sv.data(), __sv.size(), __pos);
18261826
}
18271827

18281828
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1835,8 +1835,7 @@ public:
18351835
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18361836
find(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
18371837
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find(): received nullptr");
1838-
return std::__str_find<value_type, size_type, traits_type, npos>(
1839-
data(), size(), __s, __pos, traits_type::length(__s));
1838+
return find(__s, traits_type::length(__s), __pos);
18401839
}
18411840

18421841
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type find(value_type __c, size_type __pos = 0) const _NOEXCEPT {
@@ -1847,15 +1846,14 @@ public:
18471846

18481847
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18491848
rfind(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
1850-
return std::__str_rfind<value_type, size_type, traits_type, npos>(
1851-
data(), size(), __str.data(), __pos, __str.size());
1849+
return rfind(__str.data(), __str.size(), __pos);
18521850
}
18531851

18541852
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
18551853
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18561854
rfind(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
18571855
__self_view __sv = __t;
1858-
return std::__str_rfind<value_type, size_type, traits_type, npos>(data(), size(), __sv.data(), __pos, __sv.size());
1856+
return rfind(__sv.data(), __sv.size(), __pos);
18591857
}
18601858

18611859
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1868,8 +1866,7 @@ public:
18681866
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18691867
rfind(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
18701868
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::rfind(): received nullptr");
1871-
return std::__str_rfind<value_type, size_type, traits_type, npos>(
1872-
data(), size(), __s, __pos, traits_type::length(__s));
1869+
return rfind(__s, traits_type::length(__s), __pos);
18731870
}
18741871

18751872
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1881,16 +1878,14 @@ public:
18811878

18821879
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18831880
find_first_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
1884-
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
1885-
data(), size(), __str.data(), __pos, __str.size());
1881+
return find_first_of(__str.data(), __str.size(), __pos);
18861882
}
18871883

18881884
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
18891885
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
18901886
find_first_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
18911887
__self_view __sv = __t;
1892-
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
1893-
data(), size(), __sv.data(), __pos, __sv.size());
1888+
return find_first_of(__sv.data(), __sv.size(), __pos);
18941889
}
18951890

18961891
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1903,8 +1898,7 @@ public:
19031898
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19041899
find_first_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
19051900
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_of(): received nullptr");
1906-
return std::__str_find_first_of<value_type, size_type, traits_type, npos>(
1907-
data(), size(), __s, __pos, traits_type::length(__s));
1901+
return find_first_of(__s, traits_type::length(__s), __pos);
19081902
}
19091903

19101904
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1916,16 +1910,14 @@ public:
19161910

19171911
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19181912
find_last_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
1919-
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
1920-
data(), size(), __str.data(), __pos, __str.size());
1913+
return find_last_of(__str.data(), __str.size(), __pos);
19211914
}
19221915

19231916
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
19241917
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19251918
find_last_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
19261919
__self_view __sv = __t;
1927-
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
1928-
data(), size(), __sv.data(), __pos, __sv.size());
1920+
return find_last_of(__sv.data(), __sv.size(), __pos);
19291921
}
19301922

19311923
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1938,8 +1930,7 @@ public:
19381930
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19391931
find_last_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
19401932
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_of(): received nullptr");
1941-
return std::__str_find_last_of<value_type, size_type, traits_type, npos>(
1942-
data(), size(), __s, __pos, traits_type::length(__s));
1933+
return find_last_of(__s, traits_type::length(__s), __pos);
19431934
}
19441935

19451936
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1951,16 +1942,14 @@ public:
19511942

19521943
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19531944
find_first_not_of(const basic_string& __str, size_type __pos = 0) const _NOEXCEPT {
1954-
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
1955-
data(), size(), __str.data(), __pos, __str.size());
1945+
return find_first_not_of(__str.data(), __str.size(), __pos);
19561946
}
19571947

19581948
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
19591949
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19601950
find_first_not_of(const _Tp& __t, size_type __pos = 0) const _NOEXCEPT {
19611951
__self_view __sv = __t;
1962-
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
1963-
data(), size(), __sv.data(), __pos, __sv.size());
1952+
return find_first_not_of(__sv.data(), __sv.size(), __pos);
19641953
}
19651954

19661955
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1973,8 +1962,7 @@ public:
19731962
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19741963
find_first_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = 0) const _NOEXCEPT {
19751964
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_first_not_of(): received nullptr");
1976-
return std::__str_find_first_not_of<value_type, size_type, traits_type, npos>(
1977-
data(), size(), __s, __pos, traits_type::length(__s));
1965+
return find_first_not_of(__s, traits_type::length(__s), __pos);
19781966
}
19791967

19801968
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1986,16 +1974,14 @@ public:
19861974

19871975
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19881976
find_last_not_of(const basic_string& __str, size_type __pos = npos) const _NOEXCEPT {
1989-
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
1990-
data(), size(), __str.data(), __pos, __str.size());
1977+
return find_last_not_of(__str.data(), __str.size(), __pos);
19911978
}
19921979

19931980
template <class _Tp, __enable_if_t<__can_be_converted_to_string_view_v<_CharT, _Traits, _Tp>, int> = 0>
19941981
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
19951982
find_last_not_of(const _Tp& __t, size_type __pos = npos) const _NOEXCEPT {
19961983
__self_view __sv = __t;
1997-
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
1998-
data(), size(), __sv.data(), __pos, __sv.size());
1984+
return find_last_not_of(__sv.data(), __sv.size(), __pos);
19991985
}
20001986

20011987
[[__nodiscard__]] _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -2008,8 +1994,7 @@ public:
20081994
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
20091995
find_last_not_of(const value_type* _LIBCPP_DIAGNOSE_NULLPTR __s, size_type __pos = npos) const _NOEXCEPT {
20101996
_LIBCPP_ASSERT_NON_NULL(__s != nullptr, "string::find_last_not_of(): received nullptr");
2011-
return std::__str_find_last_not_of<value_type, size_type, traits_type, npos>(
2012-
data(), size(), __s, __pos, traits_type::length(__s));
1997+
return find_last_not_of(__s, traits_type::length(__s), __pos);
20131998
}
20141999

20152000
[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type

0 commit comments

Comments
 (0)