How to Rangify Your Code
summary
Shows how to refactor real C++ loops into concrete range pipelines using range-v3, the standard library ranges and helpers like ranges::to; demonstrates adapters: sliding, cycle, zip, enumerate, iota, span, transform, accumulate and cartesian_product to implement sliding means, flatten-and-transform matrix ops, indexed range generation, filtered accumulations and a full Jefferson (Huntington) seat-allocation pipeline. Benchmarks use google::benchmark on 3 inputs (3 parties/7 seats, 15/700, 60/7000) and show C++20-style code wins on medium+ inputs but ranges-v3 is the library used so results compare that implementation not the final standard.
AI-written summary · about
chapters (19)
- 0:00Start
- 0:24What Qualifies Me To Give this Talk
- 2:09Overview of Standard Ranges
- 2:39Write Your Own Range Adapter
- 2:49Range Adapter
- 3:53Rangev3 Library
- 4:12Nanorange
- 4:58Ranges
- 14:18Sliding Mean
- 18:25Subtract a Mean from Matrix Elements
- 44:12The Enumerate View
- 46:22Disclaimer
- 47:59Complex Example
- 48:26Method of the Greatest Divisors
- 56:39For Loop
- 57:30Cartesian Product
- 1:01:36Sorting
- 1:06:58Calculate the Number of Seats
- 1:12:38Summary
related talks
01h 04mHow to Rangify Your Code
01h 02mC++20 Ranges in Practice
57mRange Algorithms, Views and Actions: A Comprehensive Guide
54mThrowing Tools at C++ Ranges
01h 01mFrom STL to Ranges: Using Ranges Effectively
01h 06mC++20 Ranges in Practice
01h 34mAn Overview of Standard Ranges
01h 01mAn Overview of Standard Ranges
