The above code gives the above output. Using various methods of testing (valgrind, gdb, and good old diagnostic cout), I have determined that the segmentation fault occurs after the completion of --s_list; but before the modified list has completed printing. I believe I may have messed up the operator overload functions, but I don't see how I did it. If anybody has any insight into what's going on here, I would love to hear it.
In Status_List& Status_List::operator--() you get the size of the vector only once (line 4). If you delete an entry, the size of the vector decreases by one, but you're still using the original size of the vector as the upper limit.
1) Since I'm using that as the test, wouldn't that mean it retrieves that information every time it is tested?
2) How would that cause a segmentation fault in the case (as this case is) when no elements have been removed?
Looks to me like rem_status will remove more than just one item. it erases from the beginning to the index which could be multiple things. That could result in a memory leak. Overall, this design is horrendous. First of all, an operator-- should not be destroying memory. Although you can overload operators to do whatever you want, it is not advisable to design them to do nonsensical, or unintuitive things. (e.g., operator+ should add, operator- should substract, operator* should multiply or dereference). Of course, you could write your operator+ to do all kinds of crazy and unintuitive things. The compiler won't stop you from doing dumb things.
You have no posted the code in a way that would allow others to easily compile and run. I recommend that you stop into this with the debugger and monitor the variables. The debugger should easily be able to tell you the root cause.
The first line of http://www.cplusplus.com/reference/vector/vector/erase/ makes your entire post nonsensical. The rem_status function specifically tracks memory like an iterator does, removes that ONE element from the vector, and then uses the temporary pointer to deallocate the memory properly. The purpose of the operator-- is to reduce the value of duration in every element. Removing an element when the lifetime of that element has expired is one of the crucial elements of the program, and I'm not bout to leave it up to the user to clean up. That type of design is uh...what was the word? Oh, "horrendous.'