STL list C++ pop_back

is there any way I can check to see if num is equal to my last of list? thanks
-----------------
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
void delFlight(list<Flight> &l, list<Flight>::iterator iter){
	int num;
	
	if(l.empty())
		return;

	cout << "Please enter flight number you want to delete: ";
	cin >> num;
	cout << endl;
	if(num == l.begin()->flight_no)
		l.pop_front();
	else if(num == l.end()->flight_no) //no good here
		l.pop_back();
	else
		for(iter = l.begin(); iter != l.end(); iter++){
			if(iter->flight_no == num)	
				iter = l.erase(iter);
	}
			
}
nvm i got it, thanks
Topic archived. No new replies allowed.