Click here to Skip to main content
15,924,507 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionusing STL Vector [modified] Pin
act_x11-Apr-07 9:26
act_x11-Apr-07 9:26 
AnswerRe: using STL Vector Pin
Mark Salsbery11-Apr-07 10:08
Mark Salsbery11-Apr-07 10:08 
GeneralRe: using STL Vector Pin
led mike11-Apr-07 10:10
led mike11-Apr-07 10:10 
GeneralRe: using STL Vector Pin
Mark Salsbery11-Apr-07 10:14
Mark Salsbery11-Apr-07 10:14 
GeneralRe: using STL Vector Pin
act_x11-Apr-07 10:37
act_x11-Apr-07 10:37 
GeneralRe: using STL Vector Pin
Mark Salsbery11-Apr-07 10:45
Mark Salsbery11-Apr-07 10:45 
GeneralRe: using STL Vector Pin
Mark Salsbery11-Apr-07 11:03
Mark Salsbery11-Apr-07 11:03 
GeneralRe: using STL Vector Pin
nde_plume11-Apr-07 14:16
nde_plume11-Apr-07 14:16 
The answer is basically no it is not safe, except in certain very resrictive circumstances. In particular if you add elements to the vector, your pointer could very readily be invalidated. A better way to do it is to use itertors.

However, if your concern is simple block of memory, I'd suggest what you need is a change in perspective. A vector is a block of memory, albeit with a type structure imposed on it. Why pretend it is a BYTE*, why not just use a vector?

AnswerRe: using STL Vector Pin
led mike11-Apr-07 10:11
led mike11-Apr-07 10:11 
AnswerRe: using STL Vector [modified] Pin
Michael Dunn11-Apr-07 11:28
sitebuilderMichael Dunn11-Apr-07 11:28 
AnswerRe: using STL Vector Pin
Stephen Hewitt11-Apr-07 16:01
Stephen Hewitt11-Apr-07 16:01 
QuestionNo Windows XP Style controls !!! Why ? Pin
Avinash Gupta ITER11-Apr-07 8:41
Avinash Gupta ITER11-Apr-07 8:41 
AnswerRe: No Windows XP Style controls !!! Why ? Pin
Dustin Henry11-Apr-07 9:03
Dustin Henry11-Apr-07 9:03 
GeneralRe: No Windows XP Style controls !!! Why ? Pin
sthotakura11-Apr-07 10:41
sthotakura11-Apr-07 10:41 
GeneralThanks !!! Pin
Avinash Gupta ITER12-Apr-07 21:37
Avinash Gupta ITER12-Apr-07 21:37 
Questionsaving and printing Pin
cyn811-Apr-07 8:09
cyn811-Apr-07 8:09 
Questionconverting int to char Pin
cyn811-Apr-07 8:00
cyn811-Apr-07 8:00 
AnswerRe: converting int to char Pin
doctorpi11-Apr-07 8:39
doctorpi11-Apr-07 8:39 
AnswerRe: converting int to char Pin
cp987611-Apr-07 13:46
cp987611-Apr-07 13:46 
QuestionAssigning parent to a Dialog Pin
doctorpi11-Apr-07 7:03
doctorpi11-Apr-07 7:03 
AnswerRe: Assigning parent to a Dialog Pin
led mike11-Apr-07 7:10
led mike11-Apr-07 7:10 
GeneralRe: Assigning parent to a Dialog Pin
doctorpi11-Apr-07 7:41
doctorpi11-Apr-07 7:41 
GeneralRe: Assigning parent to a Dialog [modified] Pin
doctorpi11-Apr-07 8:25
doctorpi11-Apr-07 8:25 
GeneralRe: Assigning parent to a Dialog Pin
led mike11-Apr-07 8:56
led mike11-Apr-07 8:56 
QuestionWriting XML to file Pin
LCI11-Apr-07 6:22
LCI11-Apr-07 6:22 

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.