diff options
author | richard <richard@yandex-team.ru> | 2022-02-10 16:52:06 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:52:06 +0300 |
commit | dd0a071a4202feb26c92240b37ecb9b884ca3849 (patch) | |
tree | ab7fbbf3253d4c0e2793218f09378908beb025fb /util/generic/algorithm.h | |
parent | 3d614c8de544db53c298060cd32d4119154be35a (diff) | |
download | ydb-dd0a071a4202feb26c92240b37ecb9b884ca3849.tar.gz |
Restoring authorship annotation for <richard@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/generic/algorithm.h')
-rw-r--r-- | util/generic/algorithm.h | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/util/generic/algorithm.h b/util/generic/algorithm.h index 34b58dba1c..badfb88993 100644 --- a/util/generic/algorithm.h +++ b/util/generic/algorithm.h @@ -126,20 +126,20 @@ static inline auto Find(C&& c, const T& v) { return std::find(begin(c), end(c), v); } -// FindPtr - return NULL if not found. Works for arrays, containers, iterators -template <class I, class T> -static inline auto FindPtr(I f, I l, const T& v) -> decltype(&*f) { - I found = Find(f, l, v); - return (found != l) ? &*found : nullptr; -} - -template <class C, class T> -static inline auto FindPtr(C&& c, const T& v) { +// FindPtr - return NULL if not found. Works for arrays, containers, iterators +template <class I, class T> +static inline auto FindPtr(I f, I l, const T& v) -> decltype(&*f) { + I found = Find(f, l, v); + return (found != l) ? &*found : nullptr; +} + +template <class C, class T> +static inline auto FindPtr(C&& c, const T& v) { using std::begin; using std::end; return FindPtr(begin(c), end(c), v); -} - +} + template <class I, class P> static inline I FindIf(I f, I l, P p) { return std::find_if(f, l, p); |