B
Barry
struct A
{
void Print() const {
cout << "Print" << endl;
}
};
auto_ptr<A> Get()
{
new A; // (1)
// auto_ptr<A>(new A); // (2) works fine
}
int main()
{
auto_ptr<A> p = Get();
p->Print();
}
if use MSVC8.0 it crash, turns out what p contains is a null pointer
if use STLPort, it works fine,
So is there something wrong with the code, or with MSVC8.0
implementation of auto_ptr ?
{
void Print() const {
cout << "Print" << endl;
}
};
auto_ptr<A> Get()
{
new A; // (1)
// auto_ptr<A>(new A); // (2) works fine
}
int main()
{
auto_ptr<A> p = Get();
p->Print();
}
if use MSVC8.0 it crash, turns out what p contains is a null pointer
if use STLPort, it works fine,
So is there something wrong with the code, or with MSVC8.0
implementation of auto_ptr ?