stl - Using C++ vector::insert() to add to end of vector -


i'm writing little piece of code i'll have insert values c++ stl vector @ place depending on values in vector elements. i'm using insert() function accomplish this. realize when want add new element end of vector, use push_back(). keep code looking nice, i'd exclusively use insert(), takes input iterator pointing element after desired insertion point , value inserted. if value of iterator passed in argument v.end(), v vector, work same push_back()?

thanks lot!

a.push_back(x) defined have identical semantics (void)a.insert(a.end(),x) sequence containers support it.

see table 68 in iso/iec 14882:2003 23.1.1/12 [lib.sequence.reqmts].


Comments

Popular posts from this blog

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -