title: C++ upper_bound no matching function call to object of type <lambda
body: <p>I am newbie in C++ and I am trying to use lower_bound and upper_bound for sorting and searching vector. This line of code make strange error for me:</p>
  
  <pre><code>up = upper_bound(low, this-&gt;data.end(), name, [](const human &amp; a, const string &amp; b) {return (a.name &lt; b) ? true : false;});
  </code></pre>
  
  <p>The error is no matching function call to object of type <code>&lt;lambda at ...</code> which is not fired on this line, but in algorithm library on line 4104. I am confused, because I am using <code>upper_bound</code> in another part of code it works fine. Also when I changed the function from <code>upper_bound</code> to <code>lower_bound</code> everything works fine.</p>
  
  <p>Does anyone has idea how to solve that?</p>