# How to join or concat ranges, C++26

DevFeed: [How to join or concat ranges, C++26](<https://devfeed.tech/articles/how-to-join-or-concat-ranges-c-26-53313.md>)

Original publisher: [Read original article](<https://www.cppstories.com/2025/join_concat_ranges/>)

Published: 2026-05-16T00:00:00Z

Content type: tutorial

Language: en

Sources: [C++ Stories](<https://devfeed.tech/sources/c-stories.md>)

Topics: [C++](<https://devfeed.tech/topics/c-plus-plus.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Collections](<https://devfeed.tech/topics/collections.md>)

Tags: [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-plus-plus-23](<https://devfeed.tech/tags/c-plus-plus-23.md>), [collections](<https://devfeed.tech/tags/collections.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [how-to](<https://devfeed.tech/tags/how-to.md>), [lazy](<https://devfeed.tech/tags/lazy.md>)

## AI overview

A tutorial comparing C++ range adaptors for concatenating and flattening collections: concat_view from C++26, join_view from C++20, and join_with_view from C++23. It explains their behavior, supported operations, lazy evaluation, and practical examples.

## Source excerpt

Modern C++ continuously improves its range library to provide more expressive, flexible, and efficient ways to manipulate collections. Usually, when you wanted to concatenate or flatten ranges, you'd use raw loops or custom algorithms. With C++'s range adaptors, we now have an elegant and efficient way to process collections lazily without unnecessary allocations. In this post, we will explore three powerful range adaptors introduced in different C++ standards: std::ranges::concat_view (C++26) std::ranges::join_view (C++20) std::ranges::join_with_view (C++23) Let's break down their differences, use cases, and examples. Updated in May 2026: added from_range construction options. std::ranges::concat_view (C++26) The concat_view allows you to concatenate multiple independent ranges into a single sequence. Unlike join_view, it does not require a range of ranges-it simply merges the given ranges sequentially while preserving their structure. In short: Takes multiple independent ranges as arguments. Supports random access if all underlying ranges support it. Allows modification if underlying ranges are writable. Lazy evaluation: No additional memory allocations. See the example: #include <print> #include <ranges> #include <vector> #include <array> int main() { std::vector<std::string> v1{"world", "hi"}; std::vector<std::string> v2 { "abc", "xyz" }; std::string arr[]{"one", "two", "three"}; auto v1_rev = v1 | std::views::reverse; auto concat = std::views::concat(v1_rev, v2, arr); concat[0] = "hello"; // access and write for (auto& elem : concat) std::print("{} ", elem); } See at @Compiler Explorer The output: hello world abc xyz one two three The example below shows how to concatenate three ranges, v1 is reversed and then combined with v2 and arr. Notice that we can also access the value at position 0 and update it. And a bit more complex example: #include <print> #include <ranges> #include <vector> #include <list> #include <string> struct Transaction { std::string type; d