Sorry for so many questions. If you feel that I'm abusing this board, please say so, and I'll go elsewhere... I typically consult google, cplusplus.com, codeguru, my books, search the forum here, and then fiddle with code before posting. I'm just a bit slow going with learning some of these features :P
In any event, is it possible to return a user-defined object from a list?
This is my dilemma:
I have a list of custom objects. I need to be able to copy one object from the list into another object not in a list.
Ex (assuming the assignment operator for myobject is overloaded):
Unfortunately, this doesn't work because the compiler states that it can't copy from an iterator object to a myobject type.... I've tried using *myiter to get the object, but evidently that is illegal as well. So, is there any way to get at the object that's stored in the list?Code:list<myobject> mylist; list<myobject>::iterator myiter; myiter = mylist.begin(); myobject standAloneObject; standAloneObject = myiter; //?? Needs to copy the object where myiter points to into standAloneObject
Thanks again for all of your help!