STL container for a deck of cards

Hi, I'm currently writing a class Deck which contains objects (or probably pointers to objects) of another class, Card.

I'm wondering if std::list is better than std::vector?
With std::list, I can sort the cards easier using sort(), and move "piles" of Cards from Deck to Deck using splice().
But std::list doesn't have an operator[], do I have to access the elements using pointers/iterators?
But an iterator like someList.begin() doesn't have an operator+, and assigning the someList.begin() to a Card* is not wise (and we cannot), right?

I can't find the right way to go on =\

Many thanks =)

[EDITED]
Ah, I can use the STL algorithm sort() for std::vector too. Still, referring to the other issues, which one is the better container?
Last edited on
Correct, std::list doesn't have an operator[].

An iterator doesn't have operator+, but there's std::advance.

You wouldn't assign a list to a Card*, you'd add a Card* to a list.

There have been previous posts about storing cards. Maybe you could search this forum for some advice posted previously.
Topic archived. No new replies allowed.