3#include <userver/utils/void_t.hpp>
7namespace utils::statistics::detail {
10template <
typename Result,
typename Counter,
typename Duration,
typename = void_t<>>
11struct ResultWantsAddFunction : std::false_type {};
13template <
typename Result,
typename Counter,
typename Duration>
14struct ResultWantsAddFunction<
18 void_t<
decltype(std::declval<Result>()
19 .Add(std::declval<Counter>(), std::declval<Duration>(), std::declval<Duration>()))>>
22template <
typename Result,
typename Counter,
typename Duration>
23inline constexpr bool kResultWantsAddFunction = 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<
33 void_t<
decltype(std::declval<Result&>() += std::declval<
const Counter&>())>> : std::true_type {};
35template <
typename Result,
typename Counter>
36inline constexpr bool kResultCanUseAddAssign = ResultCanUseAddAssign<Result, Counter>::value;
39template <
typename Counter,
typename = void_t<>>
40struct CanReset : std::false_type {};
42template <
typename Counter>
43struct CanReset<Counter, void_t<
decltype(std::declval<Counter&>().Reset())>> : std::true_type {};
45template <
typename Counter>
46inline constexpr bool kCanReset = CanReset<Counter>::value;