vector assignment operator

Hi
I am trying to use the vector of objects and assign a value to the vector using '=' operator as follows

vector<Panel> panelArray;
panelArray[panelCount] = Panel(x,y);

I am getting the following error.
error C2582: 'operator =' function is unavailable in 'Panel'

but the '='operator is overloaded in the vector class.So why can't I use it.

Please Help.
Yes. It's overloaded for std::vector. You're not trying to assign an std::vector, there. You're trying to assign a Panel.
Hi helios
Thanks for the reply,
But can u tell me how can i assign values to the panelArray using [] = operators.
thanks
Please some one help
Give us time plzkthx. This is a messageboard where people pop in and post when they have time available. There aren't people sitting around here 24/7 waiting to answer your questions.

Your problem has nothing to do with vectors. You can take vectors completely out of the equation:

1
2
3
4
Panel a; // make 2 panels, one 'a' and one 'b'
Panel b;

a = b;  // then assign one to the other 


If you try that code, you'll get the same error. This is because 'Panel' does not have a usable assignment operator. To be able to do this, you'll need to modify 'Panel' and give it an overloaded assignment operator.
Topic archived. No new replies allowed.