title: Java8 lambda type of comparisons in c++
body: <p>I have the following codes, which sort a list of <code>Info</code> instances by multiple fields of the Info class. The lambda expression in Java8 makes things easy and clean. Therefore, I am wondering is there a similar way of doing so in C++? If not, what would be the closest (or most elegant way) to approach such multiple-field sorting? Thanks!</p>
  
  <pre><code>    public class Info {
          Info(int wi, int bi, int di) {
              w = wi;
              b = bi;
              d = di;
          }
  
          int w = -1;
          int b = -1;
          int d = -1;
      }
  
      List&lt;Info&gt; results = new ArrayList&lt;Info&gt;();
  
      Collections.sort(results, (a,b) -&gt; { 
              if (a.d == b.d) {
                  if(a.w == b.w) {
                      return a.b-b.b;
                  } else {
                      return a.w - b.w;
                  }
              } else {
                  return a.d - b.d;
              }
      });
  </code></pre>