Files
cppdraft_translate/cppdraft/projected.md
2025-10-25 03:02:53 +03:00

25 lines
1.9 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[projected]
# 24 Iterators library [[iterators]](./#iterators)
## 24.3 Iterator requirements [[iterator.requirements]](iterator.requirements#projected)
### 24.3.6 Indirect callable requirements [[indirectcallable]](indirectcallable#projected)
#### 24.3.6.4 Alias template projected [projected]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2515)
Alias template projected is used to constrain algorithms
that accept callable objects and projections ([[defns.projection]](defns.projection "3.44projection"))[.](#1.sentence-1)
It combines an [indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2Concept indirectly_­readable[iterator.concept.readable]") type I and
a callable object type Proj into a new [indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2Concept indirectly_­readable[iterator.concept.readable]") type
whose reference type is the result of applyingProj to the iter_reference_t of I[.](#1.sentence-2)
[🔗](#lib:projected)
namespace std {template<class I, class Proj>struct *projected-impl* { // *exposition only*struct *type* { // *exposition only*using value_type = remove_cvref_t<indirect_result_t<Proj&, I>>; using difference_type = iter_difference_t<I>; // present only if I// models [weakly_incrementable](iterator.concept.winc#concept:weakly_incrementable "24.3.4.4Concept weakly_­incrementable[iterator.concept.winc]") indirect_result_t<Proj&, I> operator*() const; // *not defined*}; }; template<[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2Concept indirectly_­readable[iterator.concept.readable]") I, [indirectly_regular_unary_invocable](indirectcallable.indirectinvocable#concept:indirectly_regular_unary_invocable "24.3.6.3Indirect callables[indirectcallable.indirectinvocable]")<I> Proj>using projected = *projected-impl*<I, Proj>::*type*;}