I had a certain class in my program, which I used to attract different shapes and also add shapes to events . Note that in the above code (method I checked the memory address of the You are returning the address of the local object (which will be destroyed at the end of the function call) so that You will end up with undefined behavior. vector & lt; XQuad * & gt; _inputMappedShape; Zero addRegularShape (container inputpoints, container output points) {XQuad Quad; SetInputPoints (tractors, some point); SetInputPoints (tractors, some point); SetArrowHandles (tractors, some point); _inputmappedShape [current index ++] = & amp; Tractor; } XQuad * getMappedShape (int index) {return_inputmap shap [index]; } Zero set input points (Exquired and quad, point * some point); Zero setopaptu point (exquired and quad, point * few points); Zero set arrowhorals (exquired and quad, point * few points);
addRegularshape ), before I add it, by passing the
quad to the reference of other methods In my main program, I was trying to retrieve the figure using the
getMappedShape method, which is my purpose. An indicator will return to the quad for.
XQuad * returnShape = getMappedShape (0)
tractor allocated
addRegularShape method and the address The indicator (method returned by
getMappedShape ) and the memory address were the same.
However, somehow my data returned within the XQuad class when returned from
getMappedShape was not true (i.e. that is not what is modified in the XQuad context in the other three Had been the member's work) and in return were some garbage values. I was not getting such a reason why this was happening and with the doubt of having corrupted or something else, I referred the reference object to
addRegularShape Changed the indicator as follows.
No comments:
Post a Comment