Skip to content

Instantly share code, notes, and snippets.

@ityuhui
Created February 3, 2016 04:25
Show Gist options
  • Save ityuhui/c7dc7f914b78cf750e88 to your computer and use it in GitHub Desktop.
Save ityuhui/c7dc7f914b78cf750e88 to your computer and use it in GitHub Desktop.
C++ STL Vector 排序
#include <algorithm>
int main()
{
int initv[] = {4,2,78,12,3,2,77,34};
std::vector<int> a(initv,initv+sizeof(initv)/sizeof(int));
sort(a.begin(), a.end());
for (auto it = a.begin(); it != a.end(); ++it) {
std::cout << *it << std::endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment