![]() |
| ||
| Changing elements of lists I am reading lines from a CSV and don't know what size it'll be, so I place read lines into a list of a structure "obs". Then I want to iterate through this list, put it into another list and then modify contents of the original list so that I can print that later. I am, however, not sure if I'm actually modifying the original. using namespace std; In this last line, what am I modifying? Any help would be greatly appreciated. I guess I'm really not sure what is being placed with the line " qtr_ser_obs.push_front(&*it);" |
| ||
| Re: Changing elements of lists Welcome wiczerd, wiczerd said, Quote:
list<obs*> qtr_ser_obs; I think it should be: for (list<obs>::reverse_iterator it=this_series.rbegin() ; it != |
| ||
| Re: Changing elements of lists Thanks very much. The suggestion to print my list was very helpful, and it seems that I am modifying the original objects. My syntax got a bit screwed up because I tried cutting and pasting from a much larger program, but your catch was good. The reason I am moving things from one list to the other is because I need to do calculations on a moving window of the data in the larger list. So I was reading everything into the larger list, and then putting snippets into the smaller one and hoping to modify the initial obs by referencing them through the subset list. |
| All times are GMT -4. The time now is 12:53 pm. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC