Utilities
Concepts
Assignable
Category: utilities
Component type: concept
A type is Assignable if it is possible to copy objects of that type and to assign values to variables.
X A type that is a model of Assignable
x, y Object of type
| Name | Expression | Return type |
|---|---|---|
| Copy constructor | X(x) | X |
| Copy constructor | X x(y); X x = y; | |
| Assignment | x = y [1] | X& |
| Swap | swap(x,y) | void |
| Name | Expression | Semantics | Postcondition |
|---|---|---|---|
| Copy constructor | X(x) | ||
| Copy constructor | X(x) | ||
| Copy constructor | X x(y); X x = y; | ||
| Assignment | x = y [1] | ||
| Swap | swap (x,y) | Equivalent to{ X tmp = x; x = y; y = tmp; } |
• int
[1] One implication of this requirement is that a
Вы читаете Standard Template Library Programmer's Guide
