The Vector concept is intended to define a vector that can be used in linear-algebra operations.
Note that both Collection and SizeConstructible define a size() member and thus the Vector concept need to comply with both definitions.
X | Type that is a model of the Vector concept |
a | object of type X::value_type |
Name | Expression | Type requirements | Return type | |
---|---|---|---|---|
Destructor | a.~X() | Although the destructor is already defined in Collection, an extra semantic is required here: all elements in the vector will be destroyed. |
Name | Expression | Preconditions | Semantics | Postconditions |
Destructor | a.~X() | Destroys the vector and all its elements |
[1] Being DefaultConstructible makes it possible for instance to create an std::vector of vectors. The initial size of these vectors will be zero and thus are not very usable. Therefore vector's are also resizeable.