title: Sorting a list with objects by property
body: <p>I'm completely stumped, looking around at examples hasn't helped me getting this sort function to work:</p>
  
  <pre><code>void sortRegistryByName(std::list&lt;Transcript&gt;&amp; registry) {
     std::sort(registry.begin(), registry.end(), [](const Transcript &amp;f, const Transcript &amp;s) { return f.name &lt; s.name; }); 
  }
  </code></pre>
  
  <p>The code above should sort the list of Transcripts by their name property.</p>
  
  <p>And the Transcript is as follows:</p>
  
  <pre><code>typedef struct Transcript_t {
      std::string name; // Name of the transcript
      std::string student_id;
      std::list&lt;std::pair&lt;std::string, size_t&gt;&gt; grades; // List of (course, grade) pairs
  } Transcript;
  </code></pre>
  
  <p>When I try to compile this the sort function causes one huge wall of errors with something related to safe_iterators and operators.</p>
  
  <p>Anyone see any really really silly mistake here? I'm blind to it.</p>