Click here to Skip to main content
16,017,755 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Vector of Pointers Pin
Maximilien4-Jun-07 3:05
Maximilien4-Jun-07 3:05 
AnswerRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 3:41
Rajkumar R4-Jun-07 3:41 
GeneralRe: Vector of Pointers Pin
Kevin Brydon4-Jun-07 5:16
Kevin Brydon4-Jun-07 5:16 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 15:04
Stephen Hewitt4-Jun-07 15:04 
GeneralRe: Vector of Pointers Pin
led mike3-Mar-08 6:32
led mike3-Mar-08 6:32 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 15:01
Stephen Hewitt4-Jun-07 15:01 
AnswerRe: Vector of Pointers [modified] Pin
Rajkumar R4-Jun-07 18:49
Rajkumar R4-Jun-07 18:49 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 19:00
Stephen Hewitt4-Jun-07 19:00 
That's because you're looking at the code in a debug build (which means function inlining is disabled). I can also see you've got iterator debugging and range checking enabled. In short your comparison is flawed. Here's a disassembly for a release build (using MSVC6):
 
For the raw array:
16:       int raw = IntRaw[0];
004010DC   mov         eax,dword ptr [esi]


For the vector:
20:       int vec = IntVec[0];
0040113B   mov         eax,dword ptr [ebp]


Here's the whole program used:
// VectorTest.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <vector>
#include <iostream>
 
int main(int argc, char* argv[])
{
	using namespace std;
 
	int *IntRaw = new int[10];
	vector<int> IntVec(10, 0);
 
	// Raw.
	int raw = IntRaw[0];
	cout << raw << endl;
 
	// Vector.
	int vec = IntVec[0];
	cout << vec << endl;
 
	return 0;
}


Steve

GeneralRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 19:18
Rajkumar R4-Jun-07 19:18 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 19:29
Stephen Hewitt4-Jun-07 19:29 
GeneralRe: Vector of Pointers Pin
Rajkumar R4-Jun-07 19:57
Rajkumar R4-Jun-07 19:57 
GeneralRe: Vector of Pointers Pin
Stephen Hewitt4-Jun-07 20:11
Stephen Hewitt4-Jun-07 20:11 
Questionset 24 hr time format using Date Time Picker Control Pin
abhiakude4-Jun-07 0:28
abhiakude4-Jun-07 0:28 
AnswerRe: set 24 hr time format using Date Time Picker Control Pin
Rajkumar R4-Jun-07 0:40
Rajkumar R4-Jun-07 0:40 
GeneralRe: set 24 hr time format using Date Time Picker Control Pin
abhiakude4-Jun-07 1:31
abhiakude4-Jun-07 1:31 
QuestionChange view into MDIFrame Pin
baerten4-Jun-07 0:08
baerten4-Jun-07 0:08 
JokeRe: Change view into MDIFrame Pin
Jhony george4-Jun-07 1:43
Jhony george4-Jun-07 1:43 
GeneralRe: Change view into MDIFrame Pin
baerten4-Jun-07 2:28
baerten4-Jun-07 2:28 
QuestionHow to check wireless net connection? Pin
oustar3-Jun-07 23:57
oustar3-Jun-07 23:57 
QuestionRe: How to check wireless net connection? Pin
David Crow4-Jun-07 3:38
David Crow4-Jun-07 3:38 
QuestionCannot remove directory Pin
Wim Engberts3-Jun-07 23:54
Wim Engberts3-Jun-07 23:54 
AnswerRe: Cannot remove directory Pin
kakan4-Jun-07 0:13
professionalkakan4-Jun-07 0:13 
GeneralRe: Cannot remove directory Pin
Wim Engberts4-Jun-07 0:36
Wim Engberts4-Jun-07 0:36 
GeneralRe: Cannot remove directory Pin
kakan4-Jun-07 0:38
professionalkakan4-Jun-07 0:38 
QuestionAdd Scroll bar to a Static control-(pls reply) Pin
TobetheWinner3-Jun-07 23:48
TobetheWinner3-Jun-07 23:48 

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.