B
Bill Burris
How do I use auto_ptr in managed C++?
Here is my existing code:
namespace Alta
{
public __gc class CMDAQ
{
public:
CMDAQ();
~CMDAQ();
private:
CDAQControl* itsDAQControl;
};
}
namespace Alta
{
CMDAQ::CMDAQ( )
{
itsDAQControl = new CDAQControl();
}
CMDAQ::~CMDAQ()
{
delete itsDAQControl;
}
}
If I change this code to the following, I get "error C3633: cannot define
itsDAQControl as a member of managed Alta::CMDAQ"
namespace Alta
{
public __gc class CMDAQ
{
public:
CMDAQ();
~CMDAQ();
private:
std::auto_ptr< CDAQControl > itsDAQControl;
};
}
namespace Alta
{
CMDAQ::CMDAQ( )
{
std::auto_ptr< CDAQControl > dc( new CDAQControl() );
itsDAQControl = dc;
}
CMDAQ::~CMDAQ()
{
}
}
thanks
Bill
Here is my existing code:
namespace Alta
{
public __gc class CMDAQ
{
public:
CMDAQ();
~CMDAQ();
private:
CDAQControl* itsDAQControl;
};
}
namespace Alta
{
CMDAQ::CMDAQ( )
{
itsDAQControl = new CDAQControl();
}
CMDAQ::~CMDAQ()
{
delete itsDAQControl;
}
}
If I change this code to the following, I get "error C3633: cannot define
itsDAQControl as a member of managed Alta::CMDAQ"
namespace Alta
{
public __gc class CMDAQ
{
public:
CMDAQ();
~CMDAQ();
private:
std::auto_ptr< CDAQControl > itsDAQControl;
};
}
namespace Alta
{
CMDAQ::CMDAQ( )
{
std::auto_ptr< CDAQControl > dc( new CDAQControl() );
itsDAQControl = dc;
}
CMDAQ::~CMDAQ()
{
}
}
thanks
Bill