diff options
Diffstat (limited to 'library/cpp/iterator')
| -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 6a4522e8654..af94efa43fd 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) { |
