(When I say STL, I'm talking about the template library that revolves around containers, iterators, algorithms and functors.)
This question came to mind after thinking that a std::string
mostly behaves like a normal container, with begin
and end
functions (including iterator), a size
function and the possibility to use all of those for normal STL algorithms that work on containers / ranges through their iterators (e.g. transform
, sort
, find
, etc.).
At the same time, however, it is not a container itself, as it doesn't fit in picture of containers that store arbitary data. Also, it operates on the contained data mostly through member functions, like substr
, find_first_of
, etc., while true container don't do that and let the algorithms handle that.
Additionally, the cplusplus reference site and the C++ standard don't list std::string
together with the real containers, but in a distinct category.
However, on SGI's STL site, basic_string
(and consequently the string
typedef) are mentioned with the other container and the basic_string
reference site states that it belongs to the "containers" category.
Now my question is, is string
actually part of the STL or is it a distinct library itself?
And if it belongs to the STL now, did it differ in the original STL developed by Stepanov?