首页 > 代码库 > MSDN?中?对vector::erase()的解释.xml
MSDN?中?对vector::erase()的解释.xml
<style
type="text/css">
pre{
line-height:1;
color:#f0caa6;
background-color:#2d161d;
font-size:16px;}.sysFunc{color:#e54ae9;font-style:italic;font-weight:bold;}
.selfFuc{color:#f1f9be;}
.bool{color:#69305e;}
.condition{color:#628698;font-weight:bold;}
.key{color:#e336b6;}
.var{color:#008080;font-style:italic;}
.Digit{color:#808080;font-weight:bold;}
.includePre{color:#a6caf0;}
.operator?{color:#ce0c40;font-weight:bold;}
</style>
vector::erase Removes?an?element?or?a?range?of?elements?in?a?vector?from?specified?positions. iterator?erase( ???iterator?_Where ); iterator?erase( ???iterator?_First, ???iterator?_Last ); ?Return?Value An?iterator?that?designates?the?first?element?remaining?beyond?any?elements?removed,?or?a?pointer?to?the?end?of?the?vector?if?no?such?element?exists. ? ? ? ? ?Example //?vector_erase.cpp //?compile?with:?/EHsc #include?<vector> #include?<iostream> int?main(?) { ???using?namespace?std;??? ???vector?<int>?v1; ???vector?<int>::iterator?Iter; ??? ???v1.push_back(?10?); ???v1.push_back(?20?); ???v1.push_back(?30?); ???v1.push_back(?40?); ???v1.push_back(?50?); ???cout?<<?"v1?="?; ???for?(?Iter?=?v1.begin(?)?;?Iter?!=?v1.end(?)?;?Iter++?) ??????cout?<<?"?"?<<?*Iter; ???cout?<<?endl; ???v1.erase(?v1.begin(?)?); ???cout?<<?"v1?="; ???for?(?Iter?=?v1.begin(?)?;?Iter?!=?v1.end(?)?;?Iter++?) ??????cout?<<?"?"?<<?*Iter; ???cout?<<?endl; ???v1.erase(?v1.begin(?)?+?1,?v1.begin(?)?+?3?); ???cout?<<?"v1?="; ???for?(?Iter?=?v1.begin(?)?;?Iter?!=?v1.end(?)?;?Iter++?) ??????cout?<<?"?"?<<?*Iter; ???cout?<<?endl; } v1?=?10?20?30?40?50 v1?=?20?30?40?50 v1?=?20?50 ?Requirements Header:?<vector> Namespace:?std ? ? ?
本文使用?书画小说软件?发布,内容与软件无关,书画小说软件?更惬意的读、更舒心的写、更轻松的发布。
MSDN?中?对vector::erase()的解释.xml
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。