Fix string_view not checking for oversized needles during in search function

This commit is contained in:
rexy712 2022-07-16 18:31:13 -07:00
parent 0ac55f3699
commit 13ce1550e2

View File

@ -51,6 +51,9 @@ namespace rexy{
template<class Char>
constexpr auto basic_string_view<Char>::search(basic_string_view s)const -> const_iterator{
if(s.length() > m_length){
return cend();
}
return two_way_search(cbegin(), cend(), s.cbegin(), s.cend());
}
template<class Char>
@ -61,6 +64,9 @@ namespace rexy{
template<class Char>
template<class Searcher>
constexpr auto basic_string_view<Char>::search(basic_string_view s, const Searcher& searcher)const -> const_iterator{
if(s.length() > m_length){
return cend();
}
return searcher(cbegin(), cend(), s.cbegin(), s.cend());
}
template<class Char>