h_323 (h_323) wrote,
h_323
h_323

всякие контейнерные фор-ичи

пусть будет здесь тоже
std::for_each + lambda
// C++0x only.
std::for_each(theContainer.begin(), theContainer.end(), [](someType x) {
    // do stuff with x.
});

range-based for loop
// C++0x only
for (auto x : theContainer) {
   // do stuff with x.
}

MS-specific "for each"
// MSVC only
for each (auto x in theContainer) {
  // do stuff with x.
}

Boost.Foreach
// Requires Boost
BOOST_FOREACH(someType x, theContainer) {
  // do stuff with x.
}

link
Tags: cpp
  • Post a new comment

    Error

    default userpic
  • 6 comments