Table table;
             table.UpdateSeats(false, false, false, false, false, false);
	     std::list<bool>::iterator Test = table.GetSeats();
			
	     std::cout << "The current status of seats: ";
		for (int i = 0; i < 6; ++i) {
		     std::cout << " " << *Test;
		     ++Test;
		     std::cout << std::endl;
			}

No compiler errors or warnings, just a Debug Assertion Failed!

Expression: list iterator not incrementable. Any ideas?

Edited 5 Years Ago by PhysicsExpert: n/a

It looks like you have a fixed number of elements in the table and they are simple bool type. I would suggest you use either a static array or a class vector instead of list. The error you are reporting is weird... normally, this should execute just fine. The error is either in the definition of Table (and GetSeats()) or that you have some non-standard (and faulty) implementation of the C++ STL. Please provide details on the definition of Table and what platform this is running on. Maybe you could try using "vector" instead of "list", just for a quick-fix of the problem.

Edited 5 Years Ago by mike_2000_17: n/a

class Table {

std::list<bool> Seats;

public:

	void UpdateSeats(bool SB, bool BB, bool EA, bool MP1, bool MP2, bool LA);
	std::list<bool>::iterator GetSeats(void);

};

std::list<bool>::iterator Table::GetSeats(void)
{
	std::list<bool>::iterator Get;
	Get = Seats.begin();
	return Get;
};

Using VS 2010 on Windows.

I just started with learning STL, so the error is most probably a fundemental one.

Did you initialize the list "Seats". If it is empty, then that would explain your error. Make sure it is not empty.

This question has already been answered. Start a new discussion instead.