How can I apply the std::random_shuffle
algorithm with a std::queue
? I tried this:
std::random_shuffle(myQueue.front(), myQueue.back());
And gives errors:
- No match for 'operator-' in '__i- __first'
- No match for 'operator!=' in '__first != __last'
- No match for 'operator+' in '__first + 1'
- No match for 'operator++' in '++ __i'
My queue is holding Card
classes, which represent poker cards. I can understand that the error comes from the operations which std::random_shuffle
is doing with the queue elements So, even when I don't need a != operator
for my Card
class, i wrote one and that error is gone.
But what should I do with the rest of the errors? It makes no sense to write operators +, - and ++
for a Card
class.