Mixing up an Array of pointers using Random Shuffle

I have created an array of 9 pointers and each pointer points to a specific object.

I now need to mix up the pointers so they are in a random order. I figured the best way to do this would be to use random_shuffle() from the Algorithm STL however whenever I try to run the program I get an error. This is the code I am trying to use:

random_shuffle(p_symbol.begin(), p_symbol.end());

p_symbol is the name of the array. My compiler is suggesting that p_symbol must have a class type - but I dont know what that means :-)

Can someone tell me what I am doing wrong?
Your array does not have the begin() and end() member functions, try:
copy your array into a std container (e.g vector) and pass the vector's begin() and end() to random_shuffle(), or create a pointer to your array and pass the pointer and pointer+array_size to random_shuffle()
closed account (D80DSL3A)
matsom's 2nd suggestion in code:
random_shuffle(p_symbol, p_symbol+9);
Yes! Its now working! Thanks!
Topic archived. No new replies allowed.