vector push_back? append?

I want to know the differences between push_back and append func.

I usually use push_back function to add some elements to vector.

and while I am googling i saw the usage of vector "vList.append(sth)".

Let me know the differences!

Thanks. :)
there is no vector::append. Perhaps you saw code that used strings ?
the Vector that i saw was customized thing. :)
There is no such thing as std::vector::append in the standard C++ libraries. Though, I assume you might have thought of std::vector::emplace, which is a more complex way of adding data to the vector, offering the possibility of adding your data at a specific point n in the vector, despitestd::vector::push_back, which is not capable of such things. Also the functions std::vector::emplace and std::vector::emplace_back are able to store data structures. The normal std::vector::push_back is not. In order to do that with the C++ 98 function, you need to create another function which is supposed to assign the data to an object, and only after, assigning your already created object to an std::vector of the same type with the object.

PS: std::vector::emplace and std::vector::emplace_back are only accessible from C++ 11.

Hope I could help,
~Raul~
Last edited on
Topic archived. No new replies allowed.