GCC Code Coverage Report


Directory: src/
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 20.0% 2 / 0 / 10
Functions: -% 0 / 0 / 0
Branches: -% 0 / 0 / 0

reverse_comparator.hpp
Line Branch Exec Source
1 #pragma once
2
3 #include <functional>
4 #include <utility>
5
6 template <typename F> struct reverse_comparator_t {
7 F f;
8 42 template <typename Arg1, typename Arg2> constexpr bool operator() (Arg1&& arg1, Arg2&& arg2) & {
9 42 return f(std::forward<Arg2>(arg2), std::forward<Arg1>(arg1));
10 }
11 template <typename Arg1, typename Arg2> constexpr bool operator() (Arg1&& arg1, Arg2&& arg2) const& {
12 return f(std::forward<Arg2>(arg2), std::forward<Arg1>(arg1));
13 }
14 template <typename Arg1, typename Arg2> constexpr bool operator() (Arg1&& arg1, Arg2&& arg2) && {
15 return std::move(f)(std::forward<Arg2>(arg2), std::forward<Arg1>(arg1));
16 }
17 template <typename Arg1, typename Arg2> constexpr bool operator() (Arg1&& arg1, Arg2&& arg2) const&& {
18 return std::move(f)(std::forward<Arg2>(arg2), std::forward<Arg1>(arg1));
19 }
20 };
21
22 template <typename F> constexpr reverse_comparator_t<std::decay_t<F>> reverse_comparator(F&& f) {
23 return { std::forward<F>(f) };
24 }
25