RE: [gtkmm] deleting last childrow of a row



> 	I've used the end() call and the -- operator with success.

But you need to test if the list is not empty, so I think you can make
someting like:

// get iterator of last element
list<foo>::iterator it = list.end()--;

// check that list is not empty
if (it != list.end()) {
    // get last element
    foo = *it;

    // if you want to delete it
    it = list.erase(it);
}

Regards,
Christian Van Brussel



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]