- Where Developers Learn, Share, & Build Careers
I want to store the indicators in a deck that looks like this:
When I run it, I get it (the function is called on the queset): Because deque.push_back () creates a copy My question is: How can I get reference to 0xbffff240 in this context, in the deck? Edit: Thanks. Sometimes you do not see wood for trees. Your diagnosis is incorrect. This is printing the address of the pointer, not the address that holds the pointer (which you want): Note that there should be present in deck & Lt; OfImage * & gt; Pointer Dick;
Zero testApp :: iTakeAPointer (iGes * and Pointer) {cout & lt; & Lt; "ITAKAPointer" & lt; & Lt; & Amp; Pointer & lt; & Lt; Endl; PointerDeque.push_back (pointer); Cout & lt; & Lt; "Pointerdec.back ()" & lt; & Lt; PointerDeque.back () & lt; & Lt; Endl; }
key pressed 0xbffff240 iTakeAPointer 0xbffff240 pointerdek.back () 0x9f2e08
cout & lt; & Lt; "ITAKAPointer" & lt; & Lt; & Amp; Pointer & lt; & Lt; Endl;
and pointer is the type of
ofImage ** . Just use the
pointer :
cout & lt; & Lt; "ITAKAPointer" & lt; & Lt; Indicator & lt; & Lt; Endl;
ofImage example
PointerDeque exist for your lifetime if the
PointerDec now has
ofImage examples, then consider using
std :: unique_ptr . If it is not self, consider using
std :: shared_ptr (or
boost :: shared_ptr ).
Comments
Post a Comment