Click here to Skip to main content
15,923,168 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Structures and Member Variables Question Pin
#realJSOP14-Jan-07 23:28
professional#realJSOP14-Jan-07 23:28 
GeneralRe: Structures and Member Variables Question Pin
Andy20215-Jan-07 0:38
Andy20215-Jan-07 0:38 
GeneralRe: Structures and Member Variables Question Pin
#realJSOP15-Jan-07 3:19
professional#realJSOP15-Jan-07 3:19 
Questioncreate thread in asm block Pin
zon_cpp14-Jan-07 20:06
zon_cpp14-Jan-07 20:06 
AnswerRe: create thread in asm block Pin
yeti1114-Jan-07 20:13
yeti1114-Jan-07 20:13 
GeneralRe: create thread in asm block Pin
zon_cpp15-Jan-07 18:27
zon_cpp15-Jan-07 18:27 
GeneralRe: create thread in asm block Pin
yeti1115-Jan-07 21:48
yeti1115-Jan-07 21:48 
Questioncasting stl::vector confusion... Pin
yeti1114-Jan-07 19:59
yeti1114-Jan-07 19:59 
In a vector are stored class pointers;

<br />
class sample1 : public mybase<br />
{<br />
}<br />
<br />
vector<sample1*> vec;<br />


I would like to cast it;

<br />
vector<mybase*> *result = (vector<mybase*>*)&vec;<br />


I got a response previously that it is not possible, but i dont understand why.

Actually i am not sure this is a problem for my core dump.

I have been thinking about; if i have pointer stored inside vector, at the end it
is stored as address to something and the address is the same size in any case. So
if i cast it, there should be no changes, but i still got a core dump (it works for
instance in 20 cases, but then one crashes).

Can someone enlighten me what is wrong (or it is correct and i have problem somewhere else?)?

Thank you...
AnswerRe: casting stl::vector confusion... Pin
Stephen Hewitt14-Jan-07 20:24
Stephen Hewitt14-Jan-07 20:24 
GeneralRe: casting stl::vector confusion... [modified] Pin
yeti1114-Jan-07 21:03
yeti1114-Jan-07 21:03 
AnswerRe: casting stl::vector confusion... Pin
El Corazon14-Jan-07 20:46
El Corazon14-Jan-07 20:46 
GeneralRe: casting stl::vector confusion... [modified] Pin
yeti1114-Jan-07 21:05
yeti1114-Jan-07 21:05 
AnswerRe: casting stl::vector confusion... Pin
Michael Dunn14-Jan-07 22:17
sitebuilderMichael Dunn14-Jan-07 22:17 
GeneralRe: casting stl::vector confusion... [modified] Pin
yeti1114-Jan-07 22:59
yeti1114-Jan-07 22:59 
GeneralRe: casting stl::vector confusion... Pin
El Corazon15-Jan-07 4:59
El Corazon15-Jan-07 4:59 
GeneralRe: casting stl::vector confusion... Pin
yeti1115-Jan-07 11:57
yeti1115-Jan-07 11:57 
GeneralRe: casting stl::vector confusion... Pin
El Corazon15-Jan-07 15:00
El Corazon15-Jan-07 15:00 
GeneralRe: casting stl::vector confusion... Pin
Stephen Hewitt15-Jan-07 12:37
Stephen Hewitt15-Jan-07 12:37 
GeneralRe: casting stl::vector confusion... Pin
Stephen Hewitt15-Jan-07 12:02
Stephen Hewitt15-Jan-07 12:02 
GeneralRe: casting stl::vector confusion... Pin
yeti1115-Jan-07 12:16
yeti1115-Jan-07 12:16 
GeneralRe: casting stl::vector confusion... Pin
Stephen Hewitt15-Jan-07 16:00
Stephen Hewitt15-Jan-07 16:00 
GeneralRe: casting stl::vector confusion... [modified] Pin
yeti1115-Jan-07 18:21
yeti1115-Jan-07 18:21 
GeneralRe: casting stl::vector confusion... Pin
Stephen Hewitt15-Jan-07 18:27
Stephen Hewitt15-Jan-07 18:27 
GeneralRe: casting stl::vector confusion... Pin
yeti1115-Jan-07 18:39
yeti1115-Jan-07 18:39 
GeneralRe: casting stl::vector confusion... Pin
Stephen Hewitt15-Jan-07 18:43
Stephen Hewitt15-Jan-07 18:43 

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.