как избавится от этого:
..\common/testparamtree.h: In destructor 'virtual TMapParameters::~TMapParameters()':
..\common/testparamtree.h:38: warning: possible problem detected in invocation of delete operator:
..\common/testparamtree.h:34: warning: 'ptr' has incomplete type
..\common/testparamtree.h:26: warning: forward declaration of 'struct TestParamTree'
..\common/testparamtree.h:38: note: neither the destructor nor the class-specific operator delete will be called, even if they are declared when the class is defined.
вот код на который ругается
#ifndef TESTPARAMTREE_H
#define TESTPARAMTREE_H
#include <map>
#include <string>
#include <iostream>
using namespace std;
class TestParamTree;
class TMapParameters :public std::map< std::string, TestParamTree*>
{
public:
virtual ~TMapParameters()
{
TMapParameters::iterator it = begin();
TestParamTree* ptr;
for(; it != end(); it++)
{
ptr = it->second;
delete ptr;
}
}
};
class TestParamTree
{
public:
std::string type;
std::string value;
TMapParameters items;
TestParamTree()
{
items.clear();
}
virtual ~TestParamTree()
{
}
};
#endif // TESTPARAMTREE_H