Boost logo

Boost Users :

Subject: [Boost-users] foreach question
From: Neal Becker (ndbecker2_at_[hidden])
Date: 2010-10-15 14:27:50


The following loop iterates over strings in result (which
comes from boost::split). Is there a way to include the integer
enumerator 'col' into the FOREACH loop?

In python that would be spelled
for col,s in enumerate (result):
 ...

    int col = 0;
    BOOST_FOREACH (std::string s, result) {
      H(row, col) = boost::lexical_cast<int> (s);
      ++col;
    }


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net