Files
cppdraft_translate/cppdraft/alg/req/ind/copy.md
2025-10-25 03:02:53 +03:00

44 lines
4.3 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.

[alg.req.ind.copy]
# 24 Iterators library [[iterators]](./#iterators)
## 24.3 Iterator requirements [[iterator.requirements]](iterator.requirements#alg.req.ind.copy)
### 24.3.7 Common algorithm requirements [[alg.req]](alg.req#ind.copy)
#### 24.3.7.3 Concept indirectly_copyable [alg.req.ind.copy]
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2613)
The [indirectly_copyable](#concept:indirectly_copyable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]") concept specifies the relationship between
an [indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2Concept indirectly_­readable[iterator.concept.readable]") type and an [indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3Concept indirectly_­writable[iterator.concept.writable]") type
between which values may be copied[.](#1.sentence-1)
template<class In, class Out>concept [indirectly_copyable](#concept:indirectly_copyable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]") =[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2Concept indirectly_­readable[iterator.concept.readable]")<In> &&[indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3Concept indirectly_­writable[iterator.concept.writable]")<Out, iter_reference_t<In>>;
[2](#2)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2625)
The [indirectly_copyable_storable](#concept:indirectly_copyable_storable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]") concept augments[indirectly_copyable](#concept:indirectly_copyable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]") with additional requirements enabling
the transfer to be performed through an intermediate object of the[indirectly_readable](iterator.concept.readable#concept:indirectly_readable "24.3.4.2Concept indirectly_­readable[iterator.concept.readable]") type's value type[.](#2.sentence-1)
It also requires the capability
to make copies of values[.](#2.sentence-2)
template<class In, class Out>concept [indirectly_copyable_storable](#concept:indirectly_copyable_storable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]") =[indirectly_copyable](#concept:indirectly_copyable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]")<In, Out> &&[indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3Concept indirectly_­writable[iterator.concept.writable]")<Out, iter_value_t<In>&> &&[indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3Concept indirectly_­writable[iterator.concept.writable]")<Out, const iter_value_t<In>&> &&[indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3Concept indirectly_­writable[iterator.concept.writable]")<Out, iter_value_t<In>&&> &&[indirectly_writable](iterator.concept.writable#concept:indirectly_writable "24.3.4.3Concept indirectly_­writable[iterator.concept.writable]")<Out, const iter_value_t<In>&&> &&[copyable](concepts.object#concept:copyable "18.6Object concepts[concepts.object]")<iter_value_t<In>> &&[constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<iter_value_t<In>, iter_reference_t<In>> &&[assignable_from](concept.assignable#concept:assignable_from "18.4.8Concept assignable_­from[concept.assignable]")<iter_value_t<In>&, iter_reference_t<In>>;
[3](#3)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/iterators.tex#L2645)
Let i be a dereferenceable value of type In[.](#3.sentence-1)
In and Out model [indirectly_copyable_storable](#concept:indirectly_copyable_storable "24.3.7.3Concept indirectly_­copyable[alg.req.ind.copy]")<In, Out> only if after the initialization of the object obj initer_value_t<In> obj(*i);obj is equal to the value previously denoted by *i[.](#3.sentence-2)
Ifiter_reference_t<In> is an rvalue reference type, the resulting state
of the value denoted by *i is
valid but unspecified ([[lib.types.movedfrom]](lib.types.movedfrom "16.4.6.17Moved-from state of library types"))[.](#3.sentence-3)