Home
Sign Up
Sign In
V2EX
›
问与答
std::multiset 如何删除多个相同元素中的某一个?
stupidcat
·
Dec 10, 2014
· 5929 views
This topic created in 4348 days ago, the information mentioned may be changed or developed.
比如现在multiset里是{10 20 30 40 40 40 50 60},如果使用erase(40)的话,会把所有的40都删除了,得到{10 20 30 50 60}
但是我现在只想删除一个40,应该怎么搞。。。?是不是只有“先erase(40),然后再insert回去,直到比原来少一个”这种傻方法了。。。?
erase
删除
multiset
1 replies
stupidcat
OP
Dec 10, 2014
1
。。。。。。我太naive了 可以沉了
medianSet.erase(medianSet.find(40));
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
3224 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 18ms ·
UTC 10:29
·
PVG 18:29
·
LAX 02:29
·
JFK 05:29
♥ Do have faith in what you're doing.
❯