Browse Source

Revert "[Minor] C++20 is here"

This change is not so useful to break compatibility with Clang 7. Maybe later...

This reverts commit 48ce799a7a.
tags/3.3
Vsevolod Stakhov 1 year ago
parent
commit
508f8da2f6
No account linked to committer's email address
1 changed files with 7 additions and 1 deletions
  1. 7
    1
      src/client/rspamc.cxx

+ 7
- 1
src/client/rspamc.cxx View File

@@ -427,6 +427,12 @@ 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
@@ -436,7 +442,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 (sort_view.ends_with(":asc")) {
if (sv_ends_with(sort_view, ":asc")) {
inverse = true;
sort_view = std::string_view{sort, strlen(sort) - sizeof(":asc") + 1};
}

Loading…
Cancel
Save