title: How to check if vector has element that starts with specific string
body: <p>I want to know how to check if vector has element that starts with specific string.</p>
  
  <p>I did that with code below in C#.
  But how can I do this in C++.</p>
  
  <pre><code>if (Array.Exists(words, word =&gt; word.StartsWith("abc")))
  {
      Console.WriteLine("Exists");
  }
  </code></pre>
  
  <p>[Edit]
  I tried with code below but I think this is dirty solution when vector is huge.
  (My vector has elements over 400000)
  Is there a better solution for this?</p>
  
  <pre><code>vector&lt;string&gt; words;
  bool hasValue = false;
  
  words.push_back("abcdef");
  words.push_back("bcdef");
  words.push_back("fffewdd");
  
  for (string&amp; word : words)
  {
      if (word.find("abc") == 0)
      {
          hasValue = true;
  
          break;
      }
  }
  
  cout &lt;&lt; hasValue &lt;&lt; endl;
  </code></pre>