title: lower_bound to perform binary search
body: <p>Here I have created a binary search function by using <code>std::lower_bound()</code>. Like below. This works fine if I pass a <code>std::pair</code>, however I want to just perform the binary search on the first value of the <code>pair</code>. I'm thinking that in the <code>Comp</code> parameter of the <code>lower_bound()</code> this can be done but not entirely sure how.</p>
  
  <p>i.e my vector looks like the following.</p>
  
  <pre><code>std::vector&lt;std::pair&lt;int,double&gt;&gt; v;
  </code></pre>
  
  <p>and I just want to compare the first value i.e the <code>int</code>.</p>
  
  <pre><code>template&lt;class ForwardIt, class T&gt;
  ForwardIt binary_searcht(ForwardIt first, ForwardIt last, const T&amp; value)
  {
      ForwardIt i = std::lower_bound(first, last, value);
      if (i != last &amp;&amp; !(value &lt; *i))
          return i;
      else
          return last;
  
  }
  </code></pre>