S
Sachin Garg
Hi,
When trying to return objects of type
std::list<MyClass>
from my function, I get a corrupt heap.
(I checked using MSVC++ 7.0 runtime heap check facility)
Basically, I am creating a local object
std::list<MyClass> myObj;
After filling it up with data, at end I do a
return myObj;
And the process halts with a InvalidPointerInHeap runtime exception
(basically a corrupt heap).
I feel that the return statement must be calling the std::list copy
constructor, which must be performing a deep-copy of the container,
and then it must be deleting the local container.
Not to mention, myClass also has as a member, another stl list.
std::list<myOtherClass> myMemberList;
(I got the heap exception error message in the destructor of the inner
std:list)
Has anyone else faced similar issues with STL, or is this expected
behaviour, or is it that I am doing something wrong somewhere else?
Sachin Garg [India]
http://sachingarg.go.to
When trying to return objects of type
std::list<MyClass>
from my function, I get a corrupt heap.
(I checked using MSVC++ 7.0 runtime heap check facility)
Basically, I am creating a local object
std::list<MyClass> myObj;
After filling it up with data, at end I do a
return myObj;
And the process halts with a InvalidPointerInHeap runtime exception
(basically a corrupt heap).
I feel that the return statement must be calling the std::list copy
constructor, which must be performing a deep-copy of the container,
and then it must be deleting the local container.
Not to mention, myClass also has as a member, another stl list.
std::list<myOtherClass> myMemberList;
(I got the heap exception error message in the destructor of the inner
std:list)
Has anyone else faced similar issues with STL, or is this expected
behaviour, or is it that I am doing something wrong somewhere else?
Sachin Garg [India]
http://sachingarg.go.to