Article

From Token Sequences to operator for

Barry ·Barry's C++ Blog ·Published 2026-11-04 ·5 min read

This article explores the concept of operator overloading in C++ and how token sequences can be utilized to implement custom operators. It provides insights into the syntax and semantics of operator functions.

From the article

Iterating Ranges: Insanely and Then Properly

A year and a half ago now, I wrote a post about using token sequences to iterate ranges . In that post, I talked about the overhead that certain range adaptors fundamentally have because they don’t neatly fit into the regular C++ for loop (particularly views::take_while and views::reverse ), how Tristan Brindle’s Flux library addresses these limitations with its own for_each implementation that uses internal iteration to just do the optimal thing, and then I walked through an insane solution using token sequences with an early implementation of that feature that Daveed Vandevoorde provided in EDG.

That token sequence implementation is old though. Since then, we’ve iterated on the token sequence injection proposal quite a bit. We have a new…


Share this resource


Discovered 2026-11-05 Source Barry's C++ Blog Archive 2026-11 →