|
Adobe Source Libraries 2.0.0
A collection of C++ libraries.
|
X | A type that is a model of Assignable |
x, y | Object of type X |
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
| Copy constructor | X(x) | X | |
| Copy constructor | X x(y); X x = y; | ||
| Assignment | x = y [1] | X& | |
| Swap | adobe::swap(x,y) | void |
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Copy constructor | X(x) | X(x) is a copy of x [2] | ||
| Copy constructor | X(x) | X(x) is a copy of x [2] | ||
| Copy constructor | X x(y); X x = y; | x is a copy of y [2] | ||
| Assignment | x = y [1] | x is a copy of y [2] | ||
| Swap | adobe::swap(x,y)[3] | Equivalent to {
X tmp = x;
x = y;
y = tmp;
}
|
const type is not Assignable. For example, const int is not Assignable: if x is declared to be of type const int, then x = 7 is illegal. Similarly, the type pair<const int, int> is not Assignable. x is a copy of y", rather than "x == y", is that operator== is not necessarily defined: equality is not a requirement of Assignable. If the type X is EqualityComparable as well as Assignable, then a copy of x should compare equal to x.