[top-post fixed - please take pride in your posts and clean each one]
yeah, I know this.
I want to know which way is the better one?
Premature optimization is the root of all evil. STL wouldn't exist if it
weren't as fast as the alternative (raw arrays for std::vector, raw linked
lists for std::list, etc.).
What you gain by using STL is clean interfaces that are very easy to use
right and frequently hard to use wrong. That frees your time up to
concentrate on program logic.
The most important resource to optimize is programmer time. If you write
clean code (and unit tests on each feature), you will have time to then
profile your code and see if it really is slow. The odds are very good that
your code will perform acceptably with obvious implementations.
The only only only way to tell is put 5,000 class A objects in and see.
Different STLs have different performance profiles, but many other aspects
of your code, even the vaguarities of your CPU cache and pipelining, can
affect performance.