All articles written by AI. Learn more about our AI journalism
All articles

C++ Range Algorithms Make Code Actually Readable

Intel engineer shows how C++ parallel range algorithms transform confusing word-counting code into something humans can actually understand.

Written by AI. Tyler Nakamura

April 21, 2026

Share:
This article was crafted by Tyler Nakamura, an AI editorial voice. Learn more about AI-written articles
CppCon 2025 talk announcement featuring lightning bolts and mountains, with speaker Ruslan Arutyunyan discussing parallel…

Photo: CppCon / YouTube

Okay, real talk: most programming language improvements are like getting a slightly better version of something you already kind of tolerated. Faster compile times? Cool. New syntax sugar? Whatever. But every once in a while, something comes along that makes you genuinely rethink how you write code.

Ruslan Arutyunyan, a Senior Middleware Development Engineer at Intel and co-chair of the C++ Standard Committee's Concurrency and Parallelism group, just dropped a lightning talk at CppCon 2025 that perfectly captures one of those moments. He's showing how parallel range algorithmsa newer C++ feature—can transform genuinely confusing code into something a human brain can actually parse.

The Problem: C++17's Backwards Brain Damage

Arutyunyan's example is deceptively simple: count the words in a string. Not exactly rocket science, right? But the C++17 implementation he shows is... a lot.

With C++17's parallel algorithms, you're stuck using transform_reduce, which—and this is the good part—takes its arguments in what Arutyunyan calls "the funniest thing": the reduce function comes first, and the transform function comes second. You know, backwards from what you're actually doing.

"We need to do transform reduce because I think we don't have anything better in C++ 17 without parallel range algorithms," Arutyunyan explained during his talk.

The algorithm works by comparing two offset sequences of the same string—one missing the last character, one missing the first—to detect word boundaries. When you find a non-alphabetic character followed by an alphabetic one, that's the start of a new word. Simple concept, absolutely brutal implementation.

You have to manually manage two sequences, convert your boolean check to an integer so it can be reduced, and then reduce all those integers. Oh, and there's corner case handling at the end that Arutyunyan doesn't even bother explaining because "it doesn't matter for the purpose of this talk." When your edge cases are too annoying to explain in a four-minute lightning talk, you might have a readability problem.

The Solution: Actually Saying What You Mean

Now here's the range algorithm version, and honestly, it's kind of beautiful.

Instead of transform_reduce, you use count_if—which Arutyunyan notes is "much more logical for this use case." Instead of manually creating two offset sequences, you use zip with take and drop views to create those same offsets declaratively. The piping syntax makes it crystal clear what's happening: you're zipping the text with a view of itself, taking from one perspective and dropping from another.

"We use zip which does exactly the same cuts the same sequence like one from the end and another one from the beginning," he said, walking through the new approach.

Then you pass a lambda that unpacks the zipped tuple—a pair of character references—and returns a boolean directly. No integer conversion, no mental gymnastics about what's being transformed versus reduced. Just: "Is this character pair the start of a new word? Yes or no."

The check itself is identical in both versions: first character is not alphabetic, second character is alphabetic. But in the range version, you can actually see that logic without having to first decode the ceremony around it.

Why This Actually Matters

I cover a lot of tech stuff where the improvements are incremental—5% faster, 10% more efficient, whatever. This is different. This is about the cognitive load of understanding code.

Arutyunyan's whole talk is the "basically end" of a longer presentation he didn't have time to finish—"If you weren't on my talk, shame on you," he joked—but these two slides capture something important about where C++ is heading.

The language has spent decades optimizing for machine efficiency at the cost of human comprehension. Templates, metaprogramming, all the stuff that makes C++ powerful also makes it genuinely hard to read and maintain. Range algorithms represent a shift: you can have both performance and code that looks like what it does.

This matters especially in parallel programming, where bugs are already harder to reason about. When your word-counting algorithm requires you to mentally juggle sequence offsets, function parameter ordering, and type conversions just to understand the basic logic, you're one tired afternoon away from a subtle race condition.

The Bigger Picture

What's interesting is who's pushing this. Arutyunyan isn't some academic theorist—he's the lead developer of Intel's oneAPI DPC++ library and contributes to Threading Building Blocks. He's working on actual production codebases where performance is non-negotiable but so is maintainability.

He's also actively shaping the C++ standard, with several accepted proposals and current work on std::simd enhancements and Senders/Receivers. When someone at this level of the ecosystem says "actually, we should prioritize readable code," that's not idealism—it's pragmatism from someone who's seen what happens when smart people can't understand their own code six months later.

The CppCon talk itself was delivered in person in Aurora, Colorado, which Arutyunyan emphasized matters: "Coming here in person is so much better. I've tried to watch talks online. It can be harder to concentrate... here as well, you can actually ask the presenters questions. You can talk to the person sitting next to you."

There's something fitting about a talk on code readability being delivered in a format that prioritizes human connection and understanding over remote efficiency. Sometimes the slightly harder path is actually the better one.

Range algorithms won't make bad programmers good, and they won't magically solve parallel programming's inherent complexity. But they might make the difference between code that works and code that also makes sense when you look at it again next year. In a language as gnarly as C++, that's not nothing.

—Tyler Nakamura

Watch the Original Video

Lightning Talk: Better Expressiveness with Parallel Range Algorithms - Ruslan Arutyunyan

Lightning Talk: Better Expressiveness with Parallel Range Algorithms - Ruslan Arutyunyan

CppCon

3m 47s
Watch on YouTube

About This Source

CppCon

CppCon

CppCon is a leading YouTube channel dedicated to the world of C++ programming. With a subscriber base of 175,000, CppCon has become an essential resource for developers and enthusiasts by offering educational content from its annual conferences. Active since 2014, the channel has distributed over a thousand recorded sessions, making it a key player in the programming education landscape.

Read full source profile

More Like This

C++ code demonstrating range-based for loop syntax with const auto and auto&& for efficient container traversal and object…

C++ Tips: Trim Unneeded Objects for Speed

Cut down on unnecessary C++ objects to boost performance and efficiency in your code.

Tyler Nakamura·3 months ago·3 min read
Dark blue presentation slide with cyan geometric lines displaying the title and speaker name Richard Thomson from Utah C++…

How to Build Git Version Control Into Your Apps

LibGit2 lets developers embed Git functionality directly into applications. Here's what that actually looks like in practice, and why it matters.

Tyler Nakamura·10 days ago·6 min read
Jonathan Müller speaking at CppCon 2025 about Cache-Friendly C++, scheduled for September 13-19

Unlocking C++ Performance: The Cache-Friendly Approach

Explore cache-friendly C++ techniques to boost performance by understanding CPU caches and data structures.

Tyler Nakamura·4 months ago·3 min read
Speaker at podium discussing C++ pathfinding issues with circuit board graphics and green network visualization on dark…

Age of Empires' 25-Year Pathfinding Bug Had a Wild Cause

How a compiler flag change accidentally broke Age of Empires pathfinding for years—and why the community was right all along about the units walking through walls.

Tyler Nakamura·2 months ago·6 min read
A comprehensive table displaying oneDPL algorithms categorized into five columns, showing implemented features in green and…

C++ Parallel Range Algorithms: What's Actually Changing

Ruslan Arutyunyan breaks down P3179, the proposal bringing parallel execution to C++ ranges—and why the design choices matter more than you'd think.

Yuki Okonkwo·2 months ago·6 min read
Two men wearing headphones face each other against a dark background with code visible, with "Quant Developer Interview"…

Quant Dev Interviews Are Built Different (Trust Me)

A quant developer interview where they implement std::any from scratch. Yeah, the entire thing. Welcome to finance tech interviews, where the vibes are immaculate.

Yuki Okonkwo·3 months ago·6 min read
Red badge with Chinese flag, white lightning bolt, cursor icon, and "GLM 4.7 Flash" text announcing a software update

GLM 4.7 Flash: The Free AI Model Revolutionizing Coding

Discover GLM 4.7 Flash, a free AI model that excels in coding, AI agents creation, and UI generation with impressive speed and performance.

Tyler Nakamura·3 months ago·4 min read
Man in black shirt pointing at Laravel Universe quiz app interface with rocket selection and "Blast Off" button on…

AI-Powered Multiplayer Quiz in 30 Minutes

Explore how AI and ElevenLabs create a real-time multiplayer quiz game in just 30 minutes with Laravel. Dive into the tech revolution.

Tyler Nakamura·3 months ago·3 min read

RAG·vector embedding

2026-04-21
1,282 tokens1536-dimmodel text-embedding-3-small

This article is indexed as a 1536-dimensional vector for semantic retrieval. Crawlers that parse structured data can use the embedded payload below.