title: Find if vector contains pair with second element equal to X
body: <p>I have this vector:</p>
  
  <pre><code>using namespace std;
  
  vector&lt; pair&lt;short, string&gt; &gt; vec = {};
  </code></pre>
  
  <p>And I want to find out if exists a pair <code>&lt;a, b&gt;</code> with <code>b == X</code>.</p>
  
  <p>I know about <code>std::find</code> from <code>&lt;algorithm&gt;</code> but don't know how to apply it here.</p>
  
  <p>Should I write my own function to do that?</p>
  
  <pre><code>bool is_in_vec(X)
  {
      for (auto&amp; e : vec)
          if (e.second == X)
              return true;
      return false;
  }
  </code></pre>
  
  <p>Is that efficient?</p>