Back To Schedule

When Abstractions Fix Too Much

Towards Flexible Library Design

16:30 - 18:00 Monday 4th May 2026 MT Bethe Hall
Intermediate
Advanced
API Design

Many C++ library implementations of abstractions use fixed strategies for mechanisms like storage and dispatch. These choices, though suitable for general-purpose use, limit flexibility because they aren't exposed as policies that can be adapted to specific needs. In performance-critical contexts, modifying the strategy for these mechanisms requires re-implementing the entire abstraction, even though the change is often conceptually narrow.

By testing a policy-based library design approach on examples like std::vector and std::ranges::any_view, this talk demonstrates how the C++ type system and template metaprogramming facilities can enable mechanisms and even interfaces to be interchangeable, which, in turn, allows the rest of the abstraction to be reusable for specialized requirements, if the user only implements the appropriate policies.

The goal is to show how careful C++ library design can serve as a viable substitute for missing language features, and to draw lessons from other ecosystems about flexibility and reuse.

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.