Sure they can, but if you define an interface that allows this, every container type implementing it must support it, and it is probably gonna be rather slow operation for the effort. That's why the question is not "can you do this?" but "why would you want to do this?". I can't think of a good reason for generic containers, if you need something like that, it should be a purpose-built data structure that efficiently supports it.
The STL containers are full of "features" that containers in other languages just do not support, yet it's worse to use in my opinion.
The STL containers are full of "features" that containers in other languages just do not support, yet it's worse to use in my opinion.