views::transform
C++23Apply a function to each element lazily.
Section hub
template< ranges::input_range V >
requires ranges::view<V> and
ranges::input_range<ranges::range_reference_t<V>>
class join_view
: public ranges::view_interface<join_view<V>>
(since C++20)
namespace views {
inline constexpr /* unspecified */ join = /* unspecified */;
}
(since C++20)
Call signature
template< ranges::viewable_range R >
requires /* see below */
constexpr ranges::view auto join( R&& r );
(since C++20)
Before P2328R1 was adopted, the inner range type (ranges::range_reference_t
#include <iostream>
#include <ranges>
#include <string_view>
#include <vector>
int main()
{
using namespace std::literals;
const auto bits = {"https:"sv, "//"sv, "cppreference"sv, "."sv, "com"sv};
for (char const c : bits | std::views::join)
std::cout << c;
std::cout << '\n';
const std::vector<std::vector<int>> v{{1, 2}, {3, 4, 5}, {6}, {7, 8, 9}};
auto jv = std::ranges::join_view(v);
for (int const e : jv)
std::cout << e << ' ';
std::cout << '\n';
}
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 3474 | C++20 | views::join(e) returned a copy of e when e is a join_view | returns a nested join_view |
| P2328R1 | C++20 | non-view range prvalues could not be joined by join_view | made joinable |
This hub groups the ranges library by user task rather than by raw reference tree shape. View types and adaptor objects are presented as the same conceptual item.
Start here for the adapters most people reach for first when building pipelines.
Apply a function to each element lazily.
Keep only elements that satisfy a predicate.
Keep the first N elements from a source range.
Skip the first N elements and expose the rest.
Split a range into non-overlapping fixed-size subranges.
Flatten a range of ranges into a single lazy sequence.
These adapt shape, ownership, or projection rather than representing the “headline” pipeline steps.
Normalize a range into a view-compatible form.
Adapt iterator/sentinel pairs into a common-range shape.
Wrap an existing range by reference.
Store and expose a range with unique ownership.
Package iterator + sentinel as a view-like object.
Project tuple-like elements to their key component.
Project tuple-like elements to their value component.
Newer adapters, kept as a compact scan list with only standard badges.
A lighter-weight index of the full ranges surface, grouped by conceptual task instead of raw page-tree names.