3#include <userver/utils/void_t.hpp>
7namespace utils::statistics::detail {
10template <
typename Result,
typename Counter,
typename Duration,
12struct ResultWantsAddFunction : std::false_type {};
14template <
typename Result,
typename Counter,
typename Duration>
15struct ResultWantsAddFunction<
16 Result, Counter, Duration,
17 void_t<
decltype(std::declval<Result>().Add(
18 std::declval<Counter>(), std::declval<Duration>(),
19 std::declval<Duration>()))>> : std::true_type {};
21template <
typename Result,
typename Counter,
typename Duration>
22inline constexpr bool kResultWantsAddFunction =
23 ResultWantsAddFunction<Result, Counter, Duration>::value;
26template <
typename Result,
typename Counter,
typename = void_t<>>
27struct ResultCanUseAddAssign : std::false_type {};
29template <
typename Result,
typename Counter>
30struct ResultCanUseAddAssign<
32 void_t<
decltype(std::declval<Result&>() += std::declval<
const Counter&>())>>
35template <
typename Result,
typename Counter>
36inline constexpr bool kResultCanUseAddAssign =
37 ResultCanUseAddAssign<Result, Counter>::value;
40template <
typename Counter,
typename = void_t<>>
41struct CanReset : std::false_type {};
43template <
typename Counter>
44struct CanReset<Counter, void_t<
decltype(std::declval<Counter&>().Reset())>>
47template <
typename Counter>
48inline constexpr bool kCanReset = CanReset<Counter>::value;