Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > loop -> for_each

Thread Tools

loop -> for_each

Posts: n/a
i can't get the clue:
I have had a loop in my code like this:


class Foo {
accept(Visitor& v) {

class Visitor {
visit (Foo& f) {
} main...

Visitor v(arugments, ...);
for (std::deque<Foo*>::iterator iter = list_.begin();
iter != m_list.end();
++iter) {


by means of the boost::bind i could express the loop with

std::for_each(list_.begin(), list_.end(),
bind(mem_fun(&Foo::accept), _1, v));

But now things changed to something like

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
Replacing for loop with for_each or accumulate Skirmish C++ 9 07-24-2007 08:59 AM
What's the advantage of using for_each loop? Sarath C++ 13 06-05-2007 03:44 AM
loop -> for_each advanced ibe C++ 5 01-20-2006 05:55 PM
loop -> for_each ibe C++ 1 01-13-2006 02:24 PM