Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

WDYM? Vector is an abstraction over dynamically sized arrays so sure it does use heap to store its elements.




I think usefulcat interpreted "std::vector<int> allocated and freed on the stack" as creating a default std::vector<int> and then destroying it without pushing elements to it. That's what their godbolt link shows, at least, though to be fair MSVC seems to match the described GCC/Clang behavior these days.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: