c++std-ranges

What is the replacement for range-v3 views::cache1 in std::ranges?


Is there any replacement for range-v3 views::cache1 in std::ranges?

Caching the most recent element could be quite helpful when it comes to heavy calculation for it.


Solution

  • Nope in C++20/23.

    However, P2760: A Plan for C++26 Ranges sets it to Tier 1 priority, which was eventually renamed to cache_latest and made it into C++26.