Difference between a `vector` created from the std `<vector>` library, and an `STL vector` created from: `<stl_vector.h>`

Viewed 179

Why are there two different vector libraries in the STD library?


  1.   stl_vector.h
  2.   vector.h

What's the difference between the two?

1 Answers

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