title: C++ for each, pulling from vector elements
body: <p>I am trying to do a foreach on a vector of attacks, each attack has a <strong>unique ID</strong> say, 1-3.</p>
  
  <p>The class method takes the keyboard input of 1-3.</p>
  
  <p>I am trying to use a foreach to run through my elements in m_attack to see if the number matches, if it does... do something.</p>
  
  <p>The problem I'm seeing is this: </p>
  
  <pre><code>a'for each' statement cannot operate on an expression of type "std::vector&lt;Attack
  </code></pre>
  
  <p>Am I going about this totally wrong, I have C# experience and is kind of what I'm basing this on, any help would be appreciated. </p>
  
  <p>My code is as follows: </p>
  
  <p>In header</p>
  
  <pre><code>vector&lt;Attack&gt; m_attack;
  </code></pre>
  
  <p>In class</p>
  
  <pre><code>int Player::useAttack (int input)
  {
  
      for each (Attack* attack in m_attack) // Problem part
      {  
          //Psuedo for following action
          if (attack-&gt;m_num == input)
          {
              //For the found attack, do it's damage
              attack-&gt;makeDamage();
          }
      }
  }
  </code></pre>