$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-users] [foreach] BOOST_FOREACH question...
From: barcaroller (barcaroller_at_[hidden])
Date: 2010-01-07 18:31:59
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.