Boost logo

Boost Users :

Subject: Re: [Boost-users] [smart_ptr] Multiple inheritance problem with smart pointer
From: José Augusto Jr. (jamajbr_at_[hidden])
Date: 2010-11-20 21:50:26


Hi All,

I'm trying to begin using smart pointers, and when I changed my
typedefs like:

typedef TimeSeriesClass* pTimeSeries;
to
typedef boost::shared_ptr<TimeSeriesClass> pTimeSeries;

where:

class TimeSeriesClass : public wxGridTableBase, public tsObject
{
(...)
}

I get an error in this situation:

myDataAnalyserFrame::myDataAnalyserFrame( wxWindow* parent ,
pTimeSeries myTimeSeries)
:
DataAnalyserFrame( parent )
{
   m_myTimeSeries = myTimeSeries;
   m_tsOld = new wxGridStringTable( 1, 1 );

   DataGrid->SetTable(m_myTimeSeries ,false); => the m_myTimeSeries,
whis is a smart pointer to the TimeSeriesClass, doesn't know that
TimeSeriesClass is also wxGridTableBase child?

   m_myTimeSeries->AutoSizeColsLabels();
   DataGrid->Refresh();
}

 bool SetTable( wxGridTableBase *table, bool takeOwnership = false,
                  wxGrid::wxGridSelectionModes selmode =
                  wxGrid::wxGridSelectCells );

The problem occurs because the smart_pointer to the TimeSeriesClass
seems to ignore that TimeSeriesClass is also a wxGridTableBase. With
normal pointers it functions.

Why it does not work? What i'm doing wrong?

Thanks in advance.

Best Regards.

José Augusto



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net