Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/named req/CopyAssignable"

From cppreference.com
< cpp‎ | named req
(missed t in the legend)
m (fmt, .)
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{cpp/concept/title|CopyAssignable}}
+
{{cpp/named req/title|CopyAssignable}}
{{cpp/concept/navbar}}
+
{{cpp/named req/navbar}}
  
 
Specifies that an instance of the type can be copy-assigned from an [[cpp/language/value_category|lvalue expression]].
 
Specifies that an instance of the type can be copy-assigned from an [[cpp/language/value_category|lvalue expression]].
  
 
===Requirements===
 
===Requirements===
 
+
The type {{tt|T}} satisfies {{named req/core|CopyAssignable}} if
The type {{tt|T}} satisfies {{tt|CopyAssignable}} if
+
* The type {{tt|T}} satisfies {{named req|MoveAssignable}}, and
 
+
* The type {{tt|T}} satisfies {{concept|MoveAssignable}}, and
+
 
+
 
Given
 
Given
* {{tt|t}}, a modifiable [[cpp/language/value_category|lvalue expression]] of type {{tt|T}}
+
* {{tt|t}}, a modifiable [[cpp/language/value_category|lvalue expression]] of type {{tt|T}},
* {{tt|v}}, an [[cpp/language/value_category|lvalue]] expression of type {{tt|T}} or {{tt|const T}} or an [[cpp/language/value_category|rvalue]] expression of type {{tt|const T}}
+
* {{tt|v}}, an [[cpp/language/value_category|lvalue]] expression of type {{tt|T}} or {{tt|const T}} or an [[cpp/language/value_category|rvalue]] expression of type {{tt|const T}}.
  
The following expressions must be valid and have their specified effects
+
The following expressions must be valid and have their specified effects.
  
 
{|table class=wikitable
 
{|table class=wikitable
Line 20: Line 17:
 
!Expression||Return type||Return value||Post-conditions
 
!Expression||Return type||Return value||Post-conditions
 
|-
 
|-
| {{c|1=t = v}}
+
|{{c|1=t = v}}
| {{tt|T&}}
+
|{{tt|T&}}
| {{tt|t}}
+
|{{tt|t}}
| The value of {{tt|t}} is equivalent to the value of {{tt|v}}.
+
|The value of {{tt|t}} is equivalent to the value of {{tt|v}}.
 
The value of {{tt|v}} is unchanged.
 
The value of {{tt|v}} is unchanged.
 
|}
 
|}
Line 29: Line 26:
 
===See also===
 
===See also===
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc inc | cpp/types/dsc is_copy_assignable}}
+
{{dsc inc|cpp/types/dsc is_copy_assignable}}
 +
{{dsc inc|cpp/concepts/dsc assignable_from}}
 
{{dsc end}}
 
{{dsc end}}
  
[[de:cpp/concept/CopyAssignable]]
+
{{langlinks|de|es|fr|it|ja|pt|ru|zh}}
[[es:cpp/concept/CopyAssignable]]
+
[[fr:cpp/concept/CopyAssignable]]
+
[[it:cpp/concept/CopyAssignable]]
+
[[ja:cpp/concept/CopyAssignable]]
+
[[pt:cpp/concept/CopyAssignable]]
+
[[ru:cpp/concept/CopyAssignable]]
+
[[zh:cpp/concept/CopyAssignable]]
+

Latest revision as of 10:36, 8 August 2023

 
 
C++ named requirements
 

Specifies that an instance of the type can be copy-assigned from an lvalue expression.

[edit] Requirements

The type T satisfies CopyAssignable if

Given

The following expressions must be valid and have their specified effects.

Expression Return type Return value Post-conditions
t = v T& t The value of t is equivalent to the value of v.

The value of v is unchanged.

[edit] See also

checks if a type has a copy assignment operator
(class template) [edit]
specifies that a type is assignable from another type
(concept) [edit]