diff options
author | mikhnenko <mikhnenko@yandex-team.com> | 2023-10-05 21:37:40 +0300 |
---|---|---|
committer | mikhnenko <mikhnenko@yandex-team.com> | 2023-10-05 21:54:02 +0300 |
commit | 3129b20e900736c3db0cf7498e1a36dc754a5b07 (patch) | |
tree | 2d3a5a96993b5c6a8e80d6f078f317310dfaf8d1 /library/cpp/iterator/mapped.h | |
parent | a286f9189df8d0b024fd58a68234aaa20f0a03d0 (diff) | |
download | ydb-3129b20e900736c3db0cf7498e1a36dc754a5b07.tar.gz |
Cleared the iterator value type from references and modifiers
Diffstat (limited to 'library/cpp/iterator/mapped.h')
-rw-r--r-- | library/cpp/iterator/mapped.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/library/cpp/iterator/mapped.h b/library/cpp/iterator/mapped.h index 6a4522e865..af94efa43f 100644 --- a/library/cpp/iterator/mapped.h +++ b/library/cpp/iterator/mapped.h @@ -20,7 +20,8 @@ class TMappedIterator { protected: using TSelf = TMappedIterator<TIterator, TMapper>; using TSrcPointerType = typename std::iterator_traits<TIterator>::reference; - using TValue = typename std::invoke_result_t<TMapper, TSrcPointerType>; + using TInvokeResult = std::invoke_result_t<TMapper, TSrcPointerType>; + using TValue = std::remove_reference_t<TInvokeResult>; public: using difference_type = std::ptrdiff_t; using value_type = TValue; @@ -43,10 +44,10 @@ public: --Iter; return *this; } - TValue operator*() { + TInvokeResult operator*() { return Mapper((*Iter)); } - TValue operator*() const { + TInvokeResult operator*() const { return Mapper((*Iter)); } @@ -54,7 +55,7 @@ public: return &(Mapper((*Iter))); } - TValue operator[](difference_type n) const { + TInvokeResult operator[](difference_type n) const { return Mapper(*(Iter + n)); } TSelf& operator+=(difference_type n) { |