I have a piece of code to perform a bubble sort on an array of objects based on the object's name property. Unfortunaltely, the pointer swap in my bubble sort gives be error messages.
The code below does the swapping inside my bubble sort:
Here is the code for my pickLayer function:
//swap the layer pointers
//create a temporary layer pointer
Layer * tempPtr = MunicArg->pickLayer(p);
MunicArg->pickLayer(p) = MunicArg->pickLayer(p+1);
MunicArg->pickLayer(p+1) = tempPtr;
The array layers is an array of type Layer *.
Layer * Munic::pickLayer(int i)
//return the munic based on the index
} //end County::pickLayers
Here are the error messages:
Why can't I assign the return of pickLayer a value of another pointer?
c:\temp\c++\pec\pec\digObj.cpp(565): error C2106: '=' : left operand must be l-value
c:\temp\c++\pec\pec\digObj.cpp(566): error C2106: '=' : left operand must be l-value