STL Algorithms are agnostic about containers. STL algorithms also support arrays, string, and input/output streams.
STL Algorithms are very particular about …. iterators! Some demand specific iterator features. As P30[[ObjectSpace manual]] puts it, some algorithms require more powerful iterators than others. For example, sort() expects random-access iterators.
Some algorithms' declarations mention the expected type of iterators.
Many expect input iterators, so an output-only iterator won't do.
Some need output iterators , so an input-only iterator won't do.
I believe some expect RW iterators.
I believe some expect const iterators, i.e. read-only
I believe some expect bidirectional iterators.