IRIX 6.5 » Books » Developer »
Standard Template Library Programmer's Guide
(document number: 007-3426-004 / published: 1999-05-21)
table of contents | additional info | download
find in page
| Category: containers | Component type: concept |
| X | A type that is a model of Back Insertion Sequence |
| a | Object of type X |
| T | The value type of X |
| t | Object of type T |
| Name | Expression | Type requirements | Return type |
|---|---|---|---|
| Back | a.back() | reference if a is mutable, otherwise const_reference. | |
| Push back | a.push_back(t) | a is mutable. | void |
| Pop back | a.pop_back() | a is mutable. | void |
| Name | Expression | Precondition | Semantics | Postcondition |
|---|---|---|---|---|
| Back | a.back() | !a.empty() | Equivalent to *(--a.end()). | |
| Push back | a.push_back(t) | Equivalent to a.insert(a.end(), t) | a.size is incremented by 1. a.back() is a copy of t. | |
| Pop back | a.pop_back() | !a.empty() | Equivalent to a.erase(--a.end()) | a.size() is decremented by 1. |
| Symmetry of push and pop | push_back() followed by pop_back() is a null operation. |
[1] This complexity guarantee is the only reason that back(), push_back(), and pop_back() are defined: they provide no additional functionality. Not every sequence must define these operations, but it is guaranteed that they are efficient if they exist at all.
Standard Template Library Programmer's Guide
(document number: 007-3426-004 / published: 1999-05-21)
table of contents | additional info | download
Copyright © 1993-2007 SGI, Inc. All rights reserved.