7 Jan
2010
7 Jan
'10
11:31 p.m.
Does the BOOST_FOREACH macro work for empty sequences or must a size check be done explicitly? list<int> mylist; if (!mylist.empty()) // <--- necessary? { foreach(int& i, mylist) { // take action } } The reason I ask is that neither begin() nor end() return valid iterators for empty sequences, but it is my understanding that BOOST_FOREACH needs iterators to work properly.