diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-06-19 13:01:10 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2022-06-19 13:01:10 +0100 |
commit | 48ce799a7a5cf1bde8440e3e75a677ee3e467c9d (patch) | |
tree | cf4d760701e7f5dbb6177204fe3efa9e04e93867 | |
parent | 2b746e782c48cac5d1d8a54f4c065a4ddeb26cb3 (diff) | |
download | rspamd-48ce799a7a5cf1bde8440e3e75a677ee3e467c9d.tar.gz rspamd-48ce799a7a5cf1bde8440e3e75a677ee3e467c9d.zip |
[Minor] C++20 is here
-rw-r--r-- | src/client/rspamc.cxx | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/src/client/rspamc.cxx b/src/client/rspamc.cxx index 6060b621f..d9a1c2dea 100644 --- a/src/client/rspamc.cxx +++ b/src/client/rspamc.cxx @@ -418,12 +418,6 @@ static const auto sort_map = frozen::make_unordered_map<frozen::string, sort_lam }}, }); -/* TODO: remove once migrate to C++20 standard */ -static constexpr auto -sv_ends_with(std::string_view inp, std::string_view suffix) -> bool { - return inp.size() >= suffix.size() && inp.compare(inp.size() - suffix.size(), std::string_view::npos, suffix) == 0; -} - template<typename T> auto sort_ucl_container_with_default(T &cont, const char *default_sort, typename std::enable_if<std::is_same_v<typename T::value_type, const ucl_object_t *>>::type* = 0) -> void @@ -433,7 +427,7 @@ auto sort_ucl_container_with_default(T &cont, const char *default_sort, auto sort_view = std::string_view{real_sort}; auto inverse = false; - if (sv_ends_with(sort_view, ":asc")) { + if (sort_view.ends_with(":asc")) { inverse = true; sort_view = std::string_view{sort, strlen(sort) - sizeof(":asc") + 1}; } |