auto_ptr array

Joined
Feb 12, 2008
Messages
108
Reaction score
0
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?

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,237
Latest member
AvivMNS

Latest Threads

Top