std::ranges::transform_view<V,F>::iterator<Const>::operator[]

出自cppreference.com
 
 
範圍庫
範圍適配器
 
 
constexpr decltype(auto) operator[]( difference_type n ) const
  requires ranges::random_access_range<Base>;
(C++20 起)

返回位於指定相對位置的變換後的元素。

相當於返回 std::invoke(*parent_->fun_, current_[n]),其中 *parent_->fun_ 是存儲於父 transform_view 中的變換函數,而 current_ 是指向 V 中的底層迭代器。

[編輯] 參數

n - 相對於當前位置的位置。

[編輯] 返回值

變換後的元素

[編輯] 示例