Push_back
push_back is an operation that appends an element to the end of a sequence container or returns a sequence containing the appended element.
Object-Oriented Software Design in C++
A standard C++ vector operation that appends an element to the container's end.
- How it is used
- Uses push_back() to append appointments while exposing the performance cost of hidden vector operations.
- How deep it goes
- Explains copying, allocation, relocation, and destruction during growth, but does not develop broader vector-performance techniques.
- Examples
- Demonstrates append operations with Date objects and reports constructor and destructor calls through instrumentation.
- What you can do after
- Diagnose unexpected copying, allocation, and destruction when appending objects to a vector.
Read how Object-Oriented Software Design in C++ explains push_back →
Learn C++ by Example
push_back is a C++ sequence-container member function that appends an element to the container.
- How it is used
- Appends calculated or existing objects to the end of sequence containers such as std::vector.
- How deep it goes
- Explains copying, rvalue overloads, moving temporaries, and the contrast with emplace_back; it defers complete value-category details.
- Examples
- Uses Pascal’s triangle rows, triangle.push_back(data), and push_back(get_next_row(triangle.back())) to demonstrate copying and moving.
- What you can do after
- Apply it via std::vector to append existing objects and recognize when an lvalue is copied or a temporary is moved.
Related concepts
- emplace_backalternative to · emplace_back is a C++ sequence-container member function that constructs and appends an element at the container's end.
- embeddingproduces · An embedding is a numerical vector representation of an item that encodes features or relationships useful for computational tasks.
- rvalue referenceuses · An rvalue reference is a C++ reference type, written with &&, that binds to rvalues, including temporary objects, and supports moving resources from them.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.

