80
In C++0x you have
for(string str: strarr) { ... }
But till then use ordinary for loop.
If you have an array you can simply use a for loop. (I'm sorry, but I'm not going to type out the code for a for loop for you.)
Using boost is the best option as it helps you to provide a neat and concise code, but if you want to stick to STL
void listbox_add(const char* item, ListBox &lb)
{
lb.add(item);
}
int foo()
{
const char* starr[] = {"ram", "mohan", "sita"};
ListBox listBox;
std::for_each(starr,
starr + sizeof(starr)/sizeof(char*),
std::bind2nd(std::ptr_fun(&listbox_add), listBox));
}