Alex Rivera | Logout

Using arrays or std::vectors in C++, what's the performance gap?

Asked 2008-12-19T17:30:26.817
259

In our C++ course they suggest not to use C++ arrays on new projects anymore. As far as I know Stroustrup himself suggests not to use arrays. But are there significant performance differences?

Edit
Report

1 Answer

1

Vectors use a tiny bit more memory than arrays since they contain the size of the array. They also increase the hard disk size of programs and probably the memory footprint of programs. These increases are tiny, but may matter if you're working with an embedded system. Though most places where these differences matter are places where you would use C rather than C++.

answered 2009-05-11T21:37:02.603

Your Answer