diff options
| author | levlam <levlam@telegram.org> | 2020-06-26 02:24:13 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2020-06-26 02:24:13 +0300 |
| commit | 8872fbf6aca12242ee8ab945bb3822f790cbb478 (patch) | |
| tree | cdbeecbe6d1f4f3ec6199544a93faca718dbcf37 /tdutils/td/utils/TimedStat.h | |
| parent | a9e95b7f4b4f00de0dec13d47ff25b723e7f4626 (diff) | |
Fix tdutils after merge.
GitOrigin-RevId: 5b9a863e405a9e3782157570156fda71bf2bb589
Diffstat (limited to 'tdutils/td/utils/TimedStat.h')
| -rw-r--r-- | tdutils/td/utils/TimedStat.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/tdutils/td/utils/TimedStat.h b/tdutils/td/utils/TimedStat.h index bbd4f16b2..6969f50e3 100644 --- a/tdutils/td/utils/TimedStat.h +++ b/tdutils/td/utils/TimedStat.h @@ -9,6 +9,7 @@ #include "td/utils/common.h" #include "td/utils/optional.h" +#include <functional> #include <utility> namespace td { @@ -69,27 +70,28 @@ class TimedStat { } }; +namespace detail { template <class T, class Cmp> struct MinMaxStat { - public: using Event = T; void on_event(Event event) { if (!best_ || Cmp()(event, best_.value())) { best_ = event; } } - td::optional<T> get_stat() const { + optional<T> get_stat() const { return best_.copy(); } private: - td::optional<T> best_; + optional<T> best_; }; +} // namespace detail template <class T> -using MinStat = MinMaxStat<T, std::less<>>; +using MinStat = detail::MinMaxStat<T, std::less<>>; template <class T> -using MaxStat = MinMaxStat<T, std::greater<>>; +using MaxStat = detail::MinMaxStat<T, std::greater<>>; } // namespace td |
