Skip to main content
gamedev.net
🔒 Locked

vector Res@iz

Started by hihiandbyebye 1 reply 650+ views
Original Post
hihiandbyebye
hihiandbyebye
does vector.resize(size+1) preserve the elements it have and add just 1 uninitialized slot or it reallocates everything so the 'so-far-stored-data` is lost? TH@Nks AlOTs yuoRs FaiThFuLLy hi Hi and bye ByE
SiCrane
SiCrane
It adds one initialized element to the end of the vector, though it may force a reallocation which causes iterators, pointers and references to be invalidated. However, the value of those elements are preserved.
ToohrVyk
ToohrVyk
Quote:
From sgi:
void resize(n, t = T())
Inserts or erases elements at the end such that the size becomes n.


Also, '@' and 'a' are not interchangeable.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.