views::transform
C++23Apply a function to each element lazily.
Section hub
template< ranges::input_range V, ranges::forward_range Pattern >
requires ranges::view<V> &&
ranges::input_range<ranges::range_reference_t<V>> &&
ranges::view<Pattern> &&
/*concatable*/<ranges::range_reference_t<V>, Pattern>
class join_with_view :
ranges::view_interface<join_with_view<V, Pattern>>
(since C++23)
namespace views {
inline constexpr /* unspecified */ join_with = /* unspecified */;
}
(since C++23)
Call signature
template< ranges::viewable_range R, class Pattern >
requires /* see below */
constexpr ranges::view auto join_with( R&& r, Pattern&& pattern );
(since C++23)
template< class Pattern >
constexpr /* range adaptor closure */ join_with( Pattern&& pattern );
(since C++23)
Feature-test macro Value Std Feature __cpp_lib_ranges_join_with 202202L (C++23) std::ranges::join_with_view
#include <iostream>
#include <ranges>
#include <string_view>
#include <vector>
int main()
{
using namespace std::literals;
std::vector v{"This"sv, "is"sv, "a"sv, "test."sv};
auto joined = v | std::views::join_with(' ');
for (auto c : joined)
std::cout << c;
std::cout << '\n';
}
| DR | Applied to | Behavior as published | Correct behavior |
|---|---|---|---|
| LWG 4074 | C++23 | join_with_view was underconstrained | updated the constraints |
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.