Skip to content

Instantly share code, notes, and snippets.

@olostan
Created March 17, 2011 21:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olostan/875134 to your computer and use it in GitHub Desktop.
Save olostan/875134 to your computer and use it in GitHub Desktop.
Sort of strings (tiny benchmark)
#include <string>
#include <stdlib.h>
#include <list>
#include <sstream>
using namespace std;
void main(int argc, char **argv)
{
list<string> l;
srand(43242342);
ostringstream stream;
for(long i = 10000000;i-->0;)
{
stream.seekp(ios_base::beg)<<rand();
l.push_back(stream.str());
}
l.sort();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment