title: How can I build a std::vector<std::string> and then sort them?
body: <p>I have a bunch of strings that I need to sort. I think a std::vector would be the easiest way to do this. However, I've never used vectors before and so would like some help.</p>
  
  <p>I just need to sort them alphanumerically, nothing special. Indeed, the string::compare function would work.</p>
  
  <p>After that, how can I iterate through them to verify that they're sorted?</p>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>std::sort(data.begin(), data.end(), std::string::compare);
  
  for(std::vector&lt;std::string&gt;::iterator i = data.begin(); i != data.end(); ++i)
  {
      printf("%s\n", i.c_str);
  }
  </code></pre>