Hello.
I tried to declare list in header file:
private list<MyClass*> _objects;
In .cpp file I implemented method for appending object:
1 2 3 4
|
void Document::append(MyCLass *o)
{
_objects.push_back(o);
}
|
It chrashes when I try to push_back an object.
The message I got is "Access violation".
If I put some other function, for example
_objects.size()
, it chrashes, too.
So I realized that list is not accessible.
If I declare list in that method (not in header file), then it is ok:
1 2 3 4 5
|
void Document::append(MyCLass *object)
{
list<MyCLass*> _objects;
_objects.push_back(object);
}
|
It's interesting that if I use VECTOR, I don't have such problems..
But I need to work with LIST, not VECTOR.
If anybody can help me...
Thank You !