Namespaces
Variants
Actions

std::ranges::zip_transform_view<F,Views...>::iterator<Const>::operator[]

From cppreference.com
 
C++
 
Ranges library
Range adaptors
 
std::ranges::zip_transform_view
constexpr decltype(auto) operator[]( difference_type n ) const
    requires ranges::random_access_range<Base>;
(since C++23)

Returns the element at specified relative location, after transformation.

Equivalent to

return
    std::apply
    (
        [&]<class... Is>(const Is&... iters) -> decltype(auto)
        {
            return std::invoke(*parent_->fun_, iters[std::iter_difference_t<Is>(n)]...);
        },
        inner_.current_
    );

where *parent_->fun_ is the transformation function of type F stored in the parent ranges::zip_transform_view, and current_ is the underlying tuple of iterators into Views....

Contents

[edit] Parameters

n - position relative to current location.

[edit] Return value

The element which is the result of transformation (mapping).

[edit] Notes

The behavior is undefined if the parent_ pointer to parent ranges::zip_transform_view is null (e.g. if *this is default constructed).

[edit] Example

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant