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

34 lines
2.0 KiB
Markdown
Raw Permalink 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.

[concept.copyconstructible]
# 18 Concepts library [[concepts]](./#concepts)
## 18.4 Language-related concepts [[concepts.lang]](concepts.lang#concept.copyconstructible)
### 18.4.14 Concept copy_constructible [concept.copyconstructible]
[🔗](#concept:copy_constructible)
`template<class T>
concept [copy_constructible](#concept:copy_constructible "18.4.14Concept copy_­constructible[concept.copyconstructible]") =
[move_constructible](concept.moveconstructible#concept:move_constructible "18.4.13Concept move_­constructible[concept.moveconstructible]")<T> &&
[constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<T, T&> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<T&, T> &&
[constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<T, const T&> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<const T&, T> &&
[constructible_from](concept.constructible#concept:constructible_from "18.4.11Concept constructible_­from[concept.constructible]")<T, const T> && [convertible_to](concept.convertible#concept:convertible_to "18.4.4Concept convertible_­to[concept.convertible]")<const T, T>;
`
[1](#1)
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/concepts.tex#L826)
If T is an object type, then let v be an lvalue of typeT or const T or an rvalue of type const T[.](#1.sentence-1)
T models [copy_constructible](#concept:copy_constructible "18.4.14Concept copy_­constructible[concept.copyconstructible]") only if
- [(1.1)](#1.1)
After the definition T u = v;,u is equal to v ([[concepts.equality]](concepts.equality "18.2Equality preservation")) andv is not modified[.](#1.1.sentence-1)
- [(1.2)](#1.2)
T(v) is equal to v and does not modify v[.](#1.2.sentence-1)