#include <memory>

using namespace std;

struct T {};

auto_ptr<T> source()
{
	return auto_ptr<T> (new T);
}

void sink(auto_ptr<T>)
{}

struct use
{
	use(): resource(new T) {}
	auto_ptr<T> resource;
};

int main()
{
	auto_ptr<T> p1(new T);
	sink(p1); // p1 is gone afterwards

	auto_ptr<T> p2(source()); // constructs a new object

	use u;
}

