Back To Schedule

A View for Any Occasion

Implementing the C++ standard library proposal for any_view

16:30 - 18:00 Wednesday 30th April 2025 MT Bethe Hall
Intermediate
Advanced
API Design

In this talk, we will introduce a reference implementation for a proposed addition to the C++ standard library: std::ranges::any_view. This new type provides a flexible, generalized, type-erased view that can wrap any viewable range object. The any_view abstracts away the specific concrete type of the underlying container, allowing developers to define appropriate API boundaries for range adaptor pipelines. We will explore a design and implementation of std::ranges::any_view added to the Beman project, demonstrate its usage with real-world examples, and discuss how it fits into the broader context of C++'s evolving ranges library. Attendees will learn how this feature can enhance the expressiveness and reusability of their code, while maintaining performance through optimized type erasure. Additionally, we will delve into the trade-offs and challenges faced during its design and implementation, including type safety, efficiency, and compatibility with existing ranges features. This talk will provide insights into the practical applications of type-erased views and offer a glimpse into the future potential of range-based programming in C++.

View Slides

Patrick Roberts

Senior Software EngineerStack AV

Patrick Roberts, PE, is a systems engineer and library developer currently working in the autonomous trucking industry, where he applies modern C++ to safety-critical, real-time vehicle software. His career spans multiple performance-critical roles, from writing firmware and low-latency trading systems to developing open-source device kernels for RISC-V AI accelerators. Patrick is a co-author of the any_view proposal (P3411), a member of the ISO C++ Standards Committee, and a core member of the Beman Project.