Hello everyone,
I have tried to initialize an auto_ptr array, but failed. My C++ Programming Language book does not contain a sample about how to initialize an auto_ptr array.
(not an auto_ptr pointing to an array, which is not legal)
Any solutions?
thanks in advance,
George
I have tried to initialize an auto_ptr array, but failed. My C++ Programming Language book does not contain a sample about how to initialize an auto_ptr array.
(not an auto_ptr pointing to an array, which is not legal)
Any solutions?
Code:
#include <memory>
using namespace std;
int main()
{
auto_ptr<int[]> pi (new int[10]); // compile error
auto_ptr<int> pi (new int[10]); // compile error
return 0;
}
thanks in advance,
George