Last active
August 7, 2019 08:40
-
-
Save kangzhiheng/e27b1e672a4074492cd67edae0b91669 to your computer and use it in GitHub Desktop.
删除容器里的重复元素
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 删除容器里的重复元素 | |
// 1. 排序; | |
sort(pStr.begin(), pStr.end()); | |
// unique()返回的是容器里的重复元素的起始位置 | |
pStr.erase(unique(pStr.begin(), pStr.end()), pStr.end()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment