Looping through a <vector>

From: Some Clown (noone_at_nowhere.net)
Date: 04/23/04


Date: Thu, 22 Apr 2004 20:29:04 -0700

Greetings,

I'm trying to figure out how to loop through a vector of strings, searching
each item as I go for either a boolean condition or a "contains" test. So
if my vector is called 'v' I need to test v.0 for a boolean condition, then
test v.1 and put the results in a new string, etc.

I've tried several methods, none of which have worked. I've also been
looking through my shiny "The C++ Programming Language" guide, but that's
not so much of a "how-to" as a reference for those who already know. Kinda
like looking in the dictionary to learn how to spell a word that you can't
find because you don't know how to spell it.

Here's the snippet I most recently tried, which obviously doesn't work:

------------------- snip ---------------------------
 for(i = 0; i < wholeCmdLine.size(); i++)
 {
  if(wholeCmdLine[i].find(".m3u"))
  {
   std::string playListFileName = wholeCmdLine[i];
   std::cout << playListFileName;
  }
  //else usage();
 }
------------------- snip ---------------------------