Both code examples compile and run without problems. Using the second variant results in a memory leak. Any ideas why? Thanks in advance for any help.
Variant 1:
typedef boost::shared_ptr<ParameterTabelle> SpParameterTabelle;
struct ParTabSpalteData
{
ParTabSpalteData(const SpParameterTabelle& tabelle, const string& id)
:Tabelle(tabelle), Id(id)
{
}
const SpParameterTabelle& Tabelle;
string Id;
};
Variant 2:
struct ParTabSpalteData
{
ParTabSpalteData(const SpParameterTabelle& tabelle, const string& id)
:Id(id)
{
// causes memory leak
Tabelle2 = tabelle;
}
SpParameterTabelle Tabelle2;
string Id;
};