Home > Blockchain >  Difference between a `vector` created from the std `<vector>` library, and an `STL vector` cre
Difference between a `vector` created from the std `<vector>` library, and an `STL vector` cre

Time:12-08

What I want to know is why there are two vector libraries (stl_vector.h & vector.h), and what the difference is between the two?

CodePudding user response:

If you look into the file itself you will see

/** @file bits/stl_vector.h
 *  This is an internal header file, included by other library headers.
 *  Do not attempt to use it directly. @headername{vector}
 */

Your code should not directly include stl_vector.h. It's an implementation detail of libstdc and could be absent in other standard library implementations.

  • Related