Vector

Description

Vector syntax, functions, and access members
Ariel Sanchez
Flashcards by Ariel Sanchez, updated more than 1 year ago
Ariel Sanchez
Created by Ariel Sanchez about 8 years ago
35
0

Resource summary

Question Answer
**VECTOR**.begin() return an iterator to the beginning of vector list
**VECTOR**.end() return an iterator to the end of vector list
std::vector<void>::iterator sample = **VECTOR**.begin() create iterator variable and set value for vector list position
**VECTOR**[i] Access Element at (i) the unsafe method
**VECTOR**.at(i) Access Element of Vector with bounds checking
**VECTOR**.front() access first element of vector list
**VECTOR**.back() access last item of list
**VECTOR**.data() access data **incomplete definition**
**VECTOR**.assign() (elements, value) (adjVectorPosi1,adjVectorPos2) *iterators lets you assign without pushback as if when first declaring the vector
**VECTOR**.push_back() adds element to end of vector construct temp obj(copy) then moved to end of vector
**VECTOR**.pop_back() deletes element at the end of vector list
**VECTOR**.insert() (**VECTOR**.begin()) (**VECTOR**.begin(), pos1, pos2) insert element before position defined with optional param. overloading copy between to positions in different vector
**VECTOR**.erase() (nthElement) (nth, mthElement) delete an item from vector at specified or range of nth -> m'th Elements
**VECTOR**.swap(**VECTOR2**) swap entire vector contents
**VECTOR**.clear() resets to an empty vector
**VECTOR**.emplace(iterator, value) forward the value and construct in place no copies no moves
**VECTOR**.emplace_back() forward and construct in place at end of vector no copy or moving
**VECTOR**.size() returns integer with number of elements
**VECTOR**.max_size() returns integer with max memory allocation possible *not max element size
vector<class || varTYPE> **VECTOR** () (**VECTOR2**) (#, value) (iteraStart,iteraEnd) {1,2,3,4} vector declaration with parameter overload syntax
**VECTOR**.resize(intValue) size the container manually
**VECTOR**.capacity() returns max amount of potential element storage without resizing
**VECTOR**.empty() bool function checking for empty vector
Show full summary Hide full summary

Similar

HTTPS explained with Carrier Pigeons
Shannon Anderson-Rush
Historical Development of Computer Languages
Shannon Anderson-Rush
Useful String Methods
Shannon Anderson-Rush
Flvs foundations of programming dba 2
mariaha vassar
Mapa Conceptual - Arreglos
ciroivan94
OOP Phase Test (Summer)
b3014292
C++ Syntax Keyword
Ariel Sanchez
CSC160 Final Project - Mastermind in C++
jsmith303
Data Types
Jacob Sedore
Python Quiz
karljmurphy