Hi all,
what i have is a class like this:
namespace srv
{
class section
{
public:
void AddSubSection(section* newSection);
private:
vector<section*> mSubSections;
};
}
void section::AddSubSection(section* newSection)
{
mSubSections.push_back(newSection); // crash
}
When i call the AddSubSection method i get a crash when the push_back function is called.
section mySection;
section* newSection;
newSection = new(section);
mySection.AddSubSection(newSection);
The program crashes in the push_back function
void push_back(const _Ty& _Val)
{
if (size()<capacity())
....
where it steps into the size function
size_type size() const
{
return (_Mylast-Myfirst); // here the crash happens.
}
The error message states:
Unhandled exception at 0x.... in test.exe: 0xC000000005
I am sitting here since ages and i am getting out of ideas. I found some solutions here in the forum but none of them really helped. If anybody here has a solution i would really appreciate it.
Thanks in advance
Kande