Click here to Skip to main content
15,910,303 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: msdn 2003 download Pin
Toni785-Aug-03 22:26
Toni785-Aug-03 22:26 
GeneralRe: msdn 2003 download Pin
Bob Stanneveld5-Aug-03 8:26
Bob Stanneveld5-Aug-03 8:26 
GeneralTool bar buttons Pin
Marissa1824-Aug-03 22:29
Marissa1824-Aug-03 22:29 
GeneralRe: Tool bar buttons Pin
Fredrik Skog5-Aug-03 0:36
Fredrik Skog5-Aug-03 0:36 
GeneralSystem Menu Pin
vikramlinux4-Aug-03 22:12
vikramlinux4-Aug-03 22:12 
GeneralRe: System Menu Pin
algol5-Aug-03 0:56
algol5-Aug-03 0:56 
Generalbyte [] to bitmap in MFC Pin
peenu4-Aug-03 22:03
peenu4-Aug-03 22:03 
GeneralSTL vector element removal Pin
Ryan Binns4-Aug-03 21:20
Ryan Binns4-Aug-03 21:20 
[rant]
OK, this is really bugging me Mad | :mad: . Why doesn't the vector class have a remove(int) method? Why does it insist on doing everything with these damn "iterators"? No wonder I hate STL!! Mad | :mad:
[/rant]

What is the best way to remove an element by index from the middle of a vector? At the moment I'm doing this:
int nElementToRemove = 5;
vector<type>::iterator it = myvector.begin();
while(nElementToRemove--)
    it++;
myvector.erase(it);
But surely there must be a better way. Does anyone know of the best way to do this?

Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"

GeneralRe: STL vector element removal Pin
PJ Arends4-Aug-03 21:28
professionalPJ Arends4-Aug-03 21:28 
GeneralRe: STL vector element removal Pin
Ryan Binns4-Aug-03 21:35
Ryan Binns4-Aug-03 21:35 
GeneralRe: STL vector element removal Pin
Arjan Schouten4-Aug-03 21:39
Arjan Schouten4-Aug-03 21:39 
GeneralRe: STL vector element removal Pin
PJ Arends4-Aug-03 21:54
professionalPJ Arends4-Aug-03 21:54 
GeneralRe: STL vector element removal Pin
Arjan Schouten4-Aug-03 22:22
Arjan Schouten4-Aug-03 22:22 
GeneralRe: STL vector element removal Pin
jhwurmbach4-Aug-03 22:32
jhwurmbach4-Aug-03 22:32 
GeneralRe: STL vector element removal Pin
Ryan Binns5-Aug-03 0:50
Ryan Binns5-Aug-03 0:50 
GeneralRe: STL vector element removal Pin
jhwurmbach5-Aug-03 1:28
jhwurmbach5-Aug-03 1:28 
GeneralRe: STL vector element removal Pin
Ryan Binns5-Aug-03 1:32
Ryan Binns5-Aug-03 1:32 
QuestionCreate NT user? Pin
Nick Seng4-Aug-03 20:24
Nick Seng4-Aug-03 20:24 
AnswerRe: Create NT user? Pin
Steve Hopkins4-Aug-03 21:13
Steve Hopkins4-Aug-03 21:13 
GeneralRe: Create NT user? Pin
Nick Seng4-Aug-03 21:42
Nick Seng4-Aug-03 21:42 
Generalperformance disaster after removing myhook.dll Pin
suninwater4-Aug-03 17:14
suninwater4-Aug-03 17:14 
GeneralRe: performance disaster after cutting off myhook.dll Pin
John M. Drescher4-Aug-03 17:48
John M. Drescher4-Aug-03 17:48 
GeneralRe: performance disaster after cutting off myhook.dll Pin
suninwater4-Aug-03 17:56
suninwater4-Aug-03 17:56 
GeneralAbout Convert MS Word doc to EMF File Pin
黑发4-Aug-03 17:02
黑发4-Aug-03 17:02 
GeneralRe: About Convert MS Word doc to EMF File Pin
Kannan Kalyanaraman4-Aug-03 18:41
Kannan Kalyanaraman4-Aug-03 18:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.