Skip to content

Commit 26169cb

Browse files
committed
Document requirements on transform that are stricter than those on transform_non_idempotent
1 parent 0eae22f commit 26169cb

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

source/containers/algorithms/transform.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ concept element_invocable = std::invocable<Function, range_reference_t<Range>>;
110110
template<typename Function, typename Range>
111111
concept iterator_invocable = std::invocable<Function, iterator_t<Range>>;
112112

113+
// Requires that the function has the same effects if called multiple times. A
114+
// transformed random access range remains random access, but if the function
115+
// cannot be called multiple times the resulting range must be an input range
116+
// instead.
113117
export template<range Range, element_invocable<Range> UnaryFunction>
114118
constexpr auto transform(Range && source, UnaryFunction dereference) -> range auto {
115119
return adapt(
@@ -118,6 +122,10 @@ constexpr auto transform(Range && source, UnaryFunction dereference) -> range au
118122
);
119123
}
120124

125+
// Requires that the function has the same effects if called multiple times. A
126+
// transformed random access range remains random access, but if the function
127+
// cannot be called multiple times the resulting range must be an input range
128+
// instead.
121129
export template<range Range, iterator_invocable<Range> UnaryFunction>
122130
constexpr auto transform_dereference(Range && source, UnaryFunction dereference) -> range auto {
123131
return adapt(

0 commit comments

Comments
 (0)