I face this problem:
No source available.
Call stack location: lab5.exe! Counter:: 'scalar deleting destructor'() + 0x2b bytes.
I construct a single linked list.
counter.h
class Counter{
private:
char* m_pStr;
unsigned int m_nOwners;
Counter* pNext;
static unsigned int m_curCounters;
static Counter* Head;
...
counter.cpp
Counter* Counter:: Head = new Counter();
unsigned int Counter:: m_curCounters = 0;
Counter:: ~Counter(){
if (this == Head){
Head = Head->pNext;
}
else{
Counter* current = Head->pNext;
for (int i = 0; i < m_curCounters; i++){
if (current->pNext == this){
// Searching for counter, with next one equal this.
current->pNext = this->pNext;
break;
}
current = current ->pNext;
}
}
m_curCounters--;
delete[] this->m_pStr;
}
The closing brace leads to the error. In the pictures: one step separates me from the error screen and the error itself.
P.S. Vectors are forbidden.